Crombie Tools
PlotTriggerEfficiency.h
Go to the documentation of this file.
1 /**
2  @file PlotTriggerEfficiency.h
3  Definition of PlotTriggerEfficiency class.
4  @author Daniel Abercrombie <dabercro@mit.edu>
5 */
6 
7 
8 #ifndef CROMBIETOOLS_PLOTTOOLS_PLOTTRIGGEREFFICIENCY_H
9 #define CROMBIETOOLS_PLOTTOOLS_PLOTTRIGGEREFFICIENCY_H
10 
11 #include "TString.h"
12 #include "TChain.h"
13 
14 #include "InDirectoryHolder.h"
15 #include "PlotBase.h"
16 
17 /**
18  @ingroup plotgroup
19  @class PlotTriggerEfficiency
20  A class that creates trigger efficiency plots using a base cut, a variable to plot, and a trigger.
21  This class is accessed through CrombieTools.PlotTools.PlotTriggerEfficiency.
22 */
23 
25 {
26  public:
27  PlotTriggerEfficiency () { fChain = new TChain("TriggerChain", "TriggerChain"); }
28  virtual ~PlotTriggerEfficiency () { delete fChain; }
29 
30  /// Only takes data files, so this function is named appropriately
31  void AddDataFile ( TString name ) { fChain->Add(AddInDir(name) + "/events"); }
32 
33  /// Reset the data files
34  void ResetDataFiles () { delete fChain; fChain = new TChain(); }
35 
36  /**
37  Sets the cut for the trigger, which must evaluate to 1 or 0.
38  The other cut should be set using PlotBase::SetDefaultCut
39  */
40  void SetTriggerCut ( char* cut ) { fTrigger = cut; }
41 
42  /// Plot the trigger efficiencies
43  void MakeCanvas ( TString FileBase, Int_t NumXBins, Double_t *XBins,
44  TString XLabel, TString = "", Bool_t logY = false );
45  /// Plot the trigger efficiencies
46  void MakeCanvas ( TString FileBase, Int_t NumXBins, Double_t MinX, Double_t MaxX,
47  TString XLabel, TString = "", Bool_t logY = false);
48 
49  private:
50 
51  TChain *fChain; ///< The TChain that holds all the files in the plot
52  TString fTrigger = ""; ///< Cut for the trigger
53 
54  ClassDef(PlotTriggerEfficiency, 1)
55 };
56 
57 #endif