//TO CUSTOMIZE THE STYLE/LAYOUT OF ANY OF THE BELOW: //DCanvasInstructions* locCanvasInstructions = new DCanvasInstructions("MyStyle"); //locCanvasInstructions->Set...(); //locCanvasInstructions->dPadInstructions[0]->Set...(); //if only one DPadInstructions, applies to all. If multiple, one for each pad. //Call DPlotDrawer::Draw...(MyHist/Array, locCanvasInstructions); //Supported object types: TH1, TH2, TH3, TGraph, TGraphErrors void Example_Draw(void) { //INPUT HISTOGRAM/GRAPH: TFile* locFile = new TFile("MyFile.root", "READ"); TObject* locHist = gDirectory->Get("MyHist"); //SETUP PLOTTER: gSystem->Load("$(ROOT_ANALYSIS_HOME)/$(OS_NAME)/lib/libPlotDrawer.so"); //for drawing plots DPlotDrawer locPlotDrawer; //PLOT HISTOGRAM: TCanvas* locCanvas = locPlotDrawer.Draw_Object(locHist); } void Example_Draw_Superimpose(void) { //INPUT HISTOGRAMS/GRAPHS: TFile* locFile = new TFile("MyFile.root", "READ"); TObject* locHist = gDirectory->Get("MyHist"); TObject* locHist2 = gDirectory->Get("MyHist2"); //SETUP PLOTTER: gSystem->Load("$(ROOT_ANALYSIS_HOME)/$(OS_NAME)/lib/libPlotDrawer.so"); //for drawing plots DPlotDrawer locPlotDrawer; //SET LEGEND NAMES, SCALE FLAG (optional) DCanvasInstructions* locCanvasInstructions = new DCanvasInstructions("MyStyle"); locCanvasInstructions->dPadInstructions[0]->dScaleFlag = true; //scale so avg-y same (default = false) locCanvasInstructions->dPadInstructions[0]->dLegendNames.push_back("MyLegendName"); locCanvasInstructions->dPadInstructions[0]->dLegendNames.push_back("MyLegendName2"); //SUPERIMPOSE HISTOGRAMS: TObjArray* locPadObjectsArray = new TObjArray(); locPadObjectsArray->AddLast(locHist); locPadObjectsArray->AddLast(locHist2); TCanvas* locCanvas = locPlotDrawer.Draw_Superimpose(locPadObjectsArray, locCanvasInstructions); } void Draw_MultiplePads(void) { //INPUT HISTOGRAMS/GRAPHS: TFile* locFile = new TFile("MyFile.root", "READ"); TObject* locHist = gDirectory->Get("MyHist"); TObject* locHist2 = gDirectory->Get("MyHist2"); //SETUP PLOTTER: gSystem->Load("$(ROOT_ANALYSIS_HOME)/$(OS_NAME)/lib/libPlotDrawer.so"); //for drawing plots DPlotDrawer locPlotDrawer; //DRAW SEPARATE HISTOGRAMS/GRAPHS: TObjArray* locCanvasObjectsArray = new TObjArray(); locCanvasObjectsArray->AddLast(locHist); locCanvasObjectsArray->AddLast(locHist2); TObjArray* locCanvasArray = locPlotDrawer.Draw_Array(locCanvasObjectsArray); } void Example_Draw_SuperimposeMultiplePads(void) { //INPUT HISTOGRAMS/GRAPHS: TFile* locFile = new TFile("MyFile.root", "READ"); TObject* locHist = gDirectory->Get("MyHist"); TObject* locHist2 = gDirectory->Get("MyHist2"); TObject* locHist3 = gDirectory->Get("MyHist3"); TObject* locHist4 = gDirectory->Get("MyHist4"); //SETUP PLOTTER: gSystem->Load("$(ROOT_ANALYSIS_HOME)/$(OS_NAME)/lib/libPlotDrawer.so"); //for drawing plots DPlotDrawer locPlotDrawer; //DRAW SEPARATE SUPERIMPOSITIONS OF HISTOGRAMS/GRAPHS: TObjArray* locCanvasObjectsArray = new TObjArray(); TObjArray* locPadObjectsArray = new TObjArray(); locPadObjectsArray->AddLast(locHist); locPadObjectsArray->AddLast(locHist2); locCanvasObjectsArray->AddLast(locPadObjectsArray); locPadObjectsArray = new TObjArray(); locPadObjectsArray->AddLast(locHist3); locPadObjectsArray->AddLast(locHist4); locCanvasObjectsArray->AddLast(locPadObjectsArray); TObjArray* locCanvasArray = locPlotDrawer.Draw_2DArray(locCanvasObjectsArray); } void Example_Fit(void) { //INPUT HISTOGRAM/GRAPH: TFile* locFile = new TFile("MyFile.root", "READ"); TObject* locHist = gDirectory->Get("MyHist"); //SETUP FITTER: gSystem->Load("$(ROOT_ANALYSIS_HOME)/$(OS_NAME)/lib/libPlotFitter.so"); //for fitting plots DPlotFitter locPlotFitter; //FIT CONTROL: double locFitRangeMin = 0.07, locFitRangeMax = 0.19; DFitControl* locFitControl = new DFitControl(locFitRangeMin, locFitRangeMax, locSignalFitFunctor, locBackgroundFitFunctor, true); //FIT int locFitStatus = locPlotFitter.Fit_Hist(locHist, locFitControl); //PLOT HISTOGRAM: TCanvas* locCanvas = locPlotDrawer.Draw_Object(locHist); }