Crombie Tools
QuickPlot.cc
Go to the documentation of this file.
1 #include "QuickPlot.h"
2 
4 
5 //--------------------------------------------------------------------
7 { }
8 
9 //--------------------------------------------------------------------
11 { }
12 
13 //--------------------------------------------------------------------
14 void
15 QuickPlot::AddBackground(TString entry, Color_t color, FileType type)
16 {
17  AddLegendEntry(entry, color);
18  fBackgroundType.push_back(type);
19 }
20 
21 //--------------------------------------------------------------------
22 void
23 QuickPlot::MakeCanvas(TString FileBase, Int_t NumXBins, Double_t *XBins,
24  TString XLabel, TString, Bool_t logY)
25 {
26  std::vector<TH1D*> hists;
27 
28  for (UInt_t iBackground = 0; iBackground != fBackgroundType.size(); ++iBackground) {
29  TH1D *tempHist = GetHist(NumXBins, XBins, fBackgroundType[iBackground],
30  fLegendEntries[iBackground], kLegendEntry);
31 
32  if (bCompareShapes)
33  tempHist->Scale(1.0/tempHist->Integral("width"));
34 
35  hists.push_back(tempHist);
36  }
37 
38  for (auto* hist: hists)
39  Message(eInfo, "Mean: %f, StdDev: %f", hist->GetMean(), hist->GetStdDev());
40 
41  BaseCanvas(FileBase, hists, XLabel, "A.U.", logY);
42 
43  for (UInt_t i0 = 0; i0 != hists.size(); ++i0)
44  delete hists[i0];
45 }
46 
47 //--------------------------------------------------------------------
48 void
49 QuickPlot::MakeCanvas(TString FileBase, Int_t NumXBins, Double_t MinX, Double_t MaxX,
50  TString XLabel, TString, Bool_t logY)
51 {
52  Double_t XBins[NumXBins+1];
53  ConvertToArray(NumXBins, MinX, MaxX, XBins);
54  MakeCanvas(FileBase, NumXBins, XBins, XLabel, "", logY);
55 }