#include "DCanvasInstructions.h" ClassImp(DCanvasInstructions) DCanvasInstructions::DCanvasInstructions(string locStyleName) { // dTargetPadAspectRatio = 1.5; // dTargetCanvasAspectRatio = 1.5; dTargetPadAspectRatio = 16.0/9.0; dTargetCanvasAspectRatio = 16.0/9.0; dTargetCanvasHeight = 800; dMinPadWidth = 300; //this causes a memory leak ... because of how ROOT handles it (this is the default constructor) dPadInstructions.push_back(new DPadInstructions()); //Must be a unique name! if(locStyleName == "") locStyleName = "NewStyle"; string locBaseStyleName = locStyleName; int locStyleNumber = 1; while(gROOT->GetStyle(locStyleName.c_str()) != NULL) { ++locStyleNumber; ostringstream locStyleStream; locStyleStream << locBaseStyleName << "_" << locStyleNumber; locStyleName = locStyleStream.str(); } dStyle = new TStyle(locStyleName.c_str(), locStyleName.c_str()); dStyle->Reset("Modern"); //Size dStyle->SetCanvasDefH(dTargetCanvasHeight); dStyle->SetCanvasDefW(Get_TargetCanvasWidth()); //Basic object fill colors dStyle->SetCanvasBorderMode(0); dStyle->SetLegendFillColor(0); dStyle->SetCanvasColor(0); //Stat box // dStyle->SetOptFit(112); // dStyle->SetOptStat(10); dStyle->SetOptFit(0); dStyle->SetOptStat(0); //Titles and Labels dStyle->SetLabelSize(0.05, "xyz"); dStyle->SetTitleSize(0.055, "xyz"); dStyle->SetTitleOffset(1.1, "x"); dStyle->SetTitleOffset(0.8, "y"); //Margins (correlated with title/label size) dStyle->SetPadBottomMargin(0.15); dStyle->SetPadLeftMargin(0.15); dStyle->SetPadRightMargin(0.05); dStyle->SetPadTopMargin(0.1); dPadLargeRightMargin = 0.15; //For TH2* or right-side scaling axis dAdjacentPadTopMargin = 0.05; //For adjacent plots in more than one row (title in hist) //Default Histogram Style Settings dStyle->SetHistFillColor(kTeal - 4); dStyle->SetHistFillStyle(1001); //solid fill (0 for hollow) //see http://root.cern.ch/root/html/TAttFill.html dStyle->SetHistLineColor(kBlack); dStyle->SetHistLineWidth(1); dStyle->SetHistMinimumZero(kTRUE); //Default Function Style Settings dStyle->SetFuncColor(kBlack); dStyle->SetFuncStyle(1); //see http://root.cern.ch/root/html/TAttLine.html dStyle->SetFuncWidth(3); //Default Line Style Settings dStyle->SetLineColor(kBlack); //black because is border of TLegend dStyle->SetLineStyle(1); //see http://root.cern.ch/root/html/TAttLine.html dStyle->SetLineWidth(1); //is border of TLegend //Default Graph Style Settings dStyle->SetMarkerColor(kBlack); dStyle->SetMarkerSize(1.5); //see http://root.cern.ch/root/html/TAttMarker.html dStyle->SetMarkerStyle(22); //see http://root.cern.ch/root/html/TAttMarker.html //adjacent dAdjacentPlotsFlag = false; //if true then draw plots directly adjacent to each other on a canvas //common range //if true, all plots on canvas have the same y-range (or z-range if 2D) //if false: if adjacent plots: all plots in ROW (instead of canvas) //if false: if NOT adjacent plots: All are different dCommonRangeFlag = false; //common height for all plots in a canvas //if false & adjacent, then all plots in a row //else not used dCommonGraphRange_OnlyErrorsFlag = false; //if true: when determining the common range for graphs, ignore data with no/0 errors //Grid // dStyle->SetPadGridX(kTRUE); // dStyle->SetPadGridY(kTRUE); //Histogram/Graph Title Size dStyle->SetTitleSize(0.075, "t"); //"t": could be anything that is not "x" "y" or "z" //Palette dStyle->SetNumberContours(50); #if ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0) dStyle->SetPalette(kBird); //57 #else dStyle->SetPalette(55); //rainbow #endif }