Crombie Tools
RatioComparison.cc
Go to the documentation of this file.
1 #include "RatioComparison.h"
2 
4 
5 //--------------------------------------------------------------------
7 { }
8 
9 //--------------------------------------------------------------------
11 { }
12 
13 //--------------------------------------------------------------------
14 void
15 RatioComparison::MakeCompare(TString FileBase, Int_t NumXBins, Double_t *XBins,
16  TString XLabel, TString YLabel)
17 {
18  DisplayFunc(__func__);
19 
20  std::vector<TH1D*> hists;
21 
22  for (UInt_t iLine = 0; iLine != fTypes.size(); ++iLine) {
23  SetDefaultWeight(fNumeratorCuts[iLine].Data());
24  TH1D *tempHist = GetHist(NumXBins, XBins, fTypes[iLine]);
25  SetDefaultWeight(fDenominatorCuts[iLine].Data());
26  tempHist->Divide(GetHist(NumXBins, XBins, fTypes[iLine]));
27 
28  /// @todo Add an option for background subraction for the ratios
29 
30  hists.push_back(tempHist);
31  }
32 
33  BaseCanvas(FileBase, hists, XLabel, YLabel);
34 
35  for (UInt_t i0 = 0; i0 != hists.size(); ++i0)
36  delete hists[i0];
37 
38  CloseFiles();
39 }
40 
41 //--------------------------------------------------------------------
42 void
43 RatioComparison::MakeCompare(TString FileBase, Int_t NumXBins, Double_t MinX, Double_t MaxX,
44  TString XLabel, TString YLabel)
45 {
46  Double_t XBins[NumXBins+1];
47  ConvertToArray(NumXBins, MinX, MaxX, XBins);
48  MakeCompare(FileBase, NumXBins, XBins, XLabel, YLabel);
49 }
50 
51 //--------------------------------------------------------------------
52 void
53 RatioComparison::AddRatioCuts(TString num_cut, TString denom_cut, FileType type, TString entry, Int_t color)
54 {
55  fNumeratorCuts.push_back(num_cut);
56  fDenominatorCuts.push_back(denom_cut);
57  fTypes.push_back(type);
58  AddLegendEntry(entry, color);
59 }
60 
61 //--------------------------------------------------------------------
62 void
64 {
65  ResetLegend();
66  fNumeratorCuts.resize(0);
67  fDenominatorCuts.resize(0);
68  fTypes.resize(0);
69 }