SummarySelector.h
1 #ifndef SummarySelector_h
2 #define SummarySelector_h
3 
4 #include <TSelector.h>
5 #include <TROOT.h>
6 #include <TChain.h>
7 #include <TFile.h>
8 #include "AnitaEventSummary.h"
9 
10 // Use the TTree reader?
11 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0)
12 #define USE_TTREE_READER
13 #include <TTreeReader.h>
14 #include <TTreeReaderValue.h>
15 #include <TTreeReaderArray.h>
16 #endif
17 
18 class TH1D;
19 class TBranch;
20 class TCut;
21 
22 namespace Acclaim {
23 
48  class SummarySelector : public TSelector {
49  public :
50 
51  TTree* fChain;
53  TList* fCuts;
54  TList* fCutFormulas;
55 
56  // TString fAnalysisCutTreeName; /// Name of optional tree
57  // TTree* fAnalysisCutTree; /// Optional tree to store the results of all the analysis cuts, default is on
58  Int_t fMaxNdata;
59  std::vector<std::vector<Int_t> > fCutReturns;
60  std::vector<Int_t> fCumulativeCutReturns;
61  // bool fDoAnalysisCutTree; /// Switches on/sult tree
62 
63 
64 
66  TTreeFormula* fDemoForm;
67  TH1D* fDemoHist;
68  bool fDoDemoHist;
69 
70  SummarySelector(const char* sumBranchName = "sum");
71  virtual ~SummarySelector();
72 
73  void addCut(const TCut* analysisCut);
74 
75  virtual void Begin(TTree *tree);
76  virtual void SlaveBegin(TTree *tree);
77  virtual void Init(TTree *tree);
78  virtual Bool_t Notify();
79  virtual Bool_t Process(Long64_t entry);
80  virtual void SlaveTerminate();
81  virtual void Terminate();
82 
83  virtual Int_t Version() const
84  {
85  return 2;
86  }
87  virtual Int_t GetEntry(Long64_t entry, Int_t getall = 0)
88  {
89  return fChain ? fChain->GetTree()->GetEntry(entry, getall) : 0;
90  }
91  virtual void SetOption(const char *option)
92  {
93  fOption = option;
94  }
95  virtual void SetObject(TObject *obj)
96  {
97  fObject = obj;
98  }
99  virtual void SetInputList(TList *input)
100  {
101  fInput = input;
102  }
103  virtual TList* GetOutputList() const
104  {
105  return fOutput;
106  }
107 
108 
109  private:
110  // UInt_t fEventNumber;
111  // Int_t fRun;
112  // Double_t fWeight;
113  TTree* fTree;
114 
115  ClassDef(SummarySelector,0);
116 
117  };
118 
119 }
120 
121 #endif
virtual void SetInputList(TList *input)
Set the input list, not sure what this does.
virtual Bool_t Process(Long64_t entry)
Reads the AnitaEventSummary TTree entry and sets the fSum pointer. Cycles through the fCuts...
SummarySelector(const char *sumBranchName="sum")
Set this to true to generate and fill fDemoHist.
virtual void SetOption(const char *option)
From ROOT, set the option.
TTreeFormula * fDemoForm
Stores the AND of cut results per iteration processed in sequence.
virtual void Begin(TTree *tree)
TList * fCuts
Which TTree formula determines the peak direction?
Int_t fMaxNdata
A list of TTreeFormula objects, derived from the TCut objects.
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
From ROOT, Gets the local tree entry.
Namespace which wraps everything in the library.
TList * fCutFormulas
A list of TCut objects, for event selection (none means selecting all)
std::vector< Int_t > fCumulativeCutReturns
Stores the results as the cuts are processed in sequence.
Template TSelector to be inherited from, designed for use with SummarySet.
virtual void Init(TTree *tree)
std::vector< std::vector< Int_t > > fCutReturns
Maximum size of the cut.
virtual Int_t Version() const
From ROOT.
void addCut(const TCut *analysisCut)
virtual void SetObject(TObject *obj)
Set the current object, not sure what this does.
Int_t fDirectionFormulaIndex
The analyzed TTree or TChain.
TH1D * fDemoHist
TTree formula produced if making the demonstration histogram.
bool fDoDemoHist
A histogram of peak[1][0].value.
virtual TList * GetOutputList() const
Used to combine the objects.
virtual void SlaveBegin(TTree *tree)