FlashMatchAnalysis.h
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////
2 // This class has been automatically generated on
3 // Sat Feb 3 09:43:47 2018 by ROOT version 6.10/04
4 // from TTree FlashMatchTree/FlashMatchTree
5 // found on file: dune1x2x6_optical_tutorial_flashmatch_hist.root
6 //////////////////////////////////////////////////////////
7 
8 #ifndef FlashMatchAnalysis_h
9 #define FlashMatchAnalysis_h
10 
11 #include <TROOT.h>
12 #include <TChain.h>
13 #include <TFile.h>
14 
15 // Header file for the classes stored in the TTree if any.
16 #include "vector"
17 #include "vector"
18 #include "vector"
19 
21 public :
22  TTree *fChain; //!pointer to the analyzed TTree or TChain
23  Int_t fCurrent; //!current Tree number in a TChain
24 
25 // Fixed size dimensions of array or collections stored in the TTree if any.
26 
27  // Declaration of leaf types
28  Int_t EventID;
29  Float_t TrueX;
30  Float_t TrueY;
31  Float_t TrueZ;
32  Float_t TrueT;
33  Float_t DetectedT;
34  Float_t TrueE;
35  Int_t TruePDG;
36  Int_t NFlashes;
46  Int_t NOpDets;
50 
51  // List of branches
52  TBranch *b_EventID; //!
53  TBranch *b_TrueX; //!
54  TBranch *b_TrueY; //!
55  TBranch *b_TrueZ; //!
56  TBranch *b_TrueT; //!
57  TBranch *b_DetectedT; //!
58  TBranch *b_TrueE; //!
59  TBranch *b_TruePDG; //!
60  TBranch *b_NFlashes; //!
61  TBranch *b_FlashIDVector; //!
62  TBranch *b_YCenterVector; //!
63  TBranch *b_ZCenterVector; //!
64  TBranch *b_YWidthVector; //!
65  TBranch *b_ZWidthVector; //!
66  TBranch *b_TimeVector; //!
67  TBranch *b_TimeWidthVector; //!
68  TBranch *b_TimeDiffVector; //!
69  TBranch *b_TotalPEVector; //!
70  TBranch *b_NOpDets; //!
71  TBranch *b_NHitOpDetVector; //!
72  TBranch *b_Signal; //!
73  TBranch *b_Purity; //!
74 
75  FlashMatchAnalysis(TTree *tree=0);
76  virtual ~FlashMatchAnalysis();
77  virtual Int_t Cut(Long64_t entry);
78  virtual Int_t GetEntry(Long64_t entry);
79  virtual Long64_t LoadTree(Long64_t entry);
80  virtual void Init(TTree *tree);
81  virtual void Loop();
82  virtual Bool_t Notify();
83  virtual void Show(Long64_t entry = -1);
84 };
85 
86 #endif
87 
88 #ifdef FlashMatchAnalysis_cxx
90 {
91 // if parameter tree is not specified (or zero), connect the file
92 // used to generate this class and read the Tree.
93  if (tree == 0) {
94  TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("dune1x2x6_optical_tutorial_flashmatch_hist.root");
95  if (!f || !f->IsOpen()) {
96  f = new TFile("dune1x2x6_optical_tutorial_flashmatch_hist.root");
97  }
98  TDirectory * dir = (TDirectory*)f->Get("dune1x2x6_optical_tutorial_flashmatch_hist.root:/flashmatch");
99  dir->GetObject("FlashMatchTree",tree);
100 
101  }
102  Init(tree);
103 }
104 
106 {
107  if (!fChain) return;
108  delete fChain->GetCurrentFile();
109 }
110 
111 Int_t FlashMatchAnalysis::GetEntry(Long64_t entry)
112 {
113 // Read contents of entry.
114  if (!fChain) return 0;
115  return fChain->GetEntry(entry);
116 }
117 Long64_t FlashMatchAnalysis::LoadTree(Long64_t entry)
118 {
119 // Set the environment to read one entry
120  if (!fChain) return -5;
121  Long64_t centry = fChain->LoadTree(entry);
122  if (centry < 0) return centry;
123  if (fChain->GetTreeNumber() != fCurrent) {
124  fCurrent = fChain->GetTreeNumber();
125  Notify();
126  }
127  return centry;
128 }
129 
130 void FlashMatchAnalysis::Init(TTree *tree)
131 {
132  // The Init() function is called when the selector needs to initialize
133  // a new tree or chain. Typically here the branch addresses and branch
134  // pointers of the tree will be set.
135  // It is normally not necessary to make changes to the generated
136  // code, but the routine can be extended by the user if needed.
137  // Init() will be called many times when running on PROOF
138  // (once per file to be processed).
139 
140  // Set object pointer
141  FlashIDVector = 0;
142  YCenterVector = 0;
143  ZCenterVector = 0;
144  YWidthVector = 0;
145  ZWidthVector = 0;
146  TimeVector = 0;
147  TimeWidthVector = 0;
148  TimeDiffVector = 0;
149  TotalPEVector = 0;
150  NHitOpDetVector = 0;
151  Signal = 0;
152  Purity = 0;
153  // Set branch addresses and branch pointers
154  if (!tree) return;
155  fChain = tree;
156  fCurrent = -1;
157  fChain->SetMakeClass(1);
158 
159  fChain->SetBranchAddress("EventID", &EventID, &b_EventID);
160  fChain->SetBranchAddress("TrueX", &TrueX, &b_TrueX);
161  fChain->SetBranchAddress("TrueY", &TrueY, &b_TrueY);
162  fChain->SetBranchAddress("TrueZ", &TrueZ, &b_TrueZ);
163  fChain->SetBranchAddress("TrueT", &TrueT, &b_TrueT);
164  fChain->SetBranchAddress("DetectedT", &DetectedT, &b_DetectedT);
165  fChain->SetBranchAddress("TrueE", &TrueE, &b_TrueE);
166  fChain->SetBranchAddress("TruePDG", &TruePDG, &b_TruePDG);
167  fChain->SetBranchAddress("NFlashes", &NFlashes, &b_NFlashes);
168  fChain->SetBranchAddress("FlashIDVector", &FlashIDVector, &b_FlashIDVector);
169  fChain->SetBranchAddress("YCenterVector", &YCenterVector, &b_YCenterVector);
170  fChain->SetBranchAddress("ZCenterVector", &ZCenterVector, &b_ZCenterVector);
171  fChain->SetBranchAddress("YWidthVector", &YWidthVector, &b_YWidthVector);
172  fChain->SetBranchAddress("ZWidthVector", &ZWidthVector, &b_ZWidthVector);
173  fChain->SetBranchAddress("TimeVector", &TimeVector, &b_TimeVector);
174  fChain->SetBranchAddress("TimeWidthVector", &TimeWidthVector, &b_TimeWidthVector);
175  fChain->SetBranchAddress("TimeDiffVector", &TimeDiffVector, &b_TimeDiffVector);
176  fChain->SetBranchAddress("TotalPEVector", &TotalPEVector, &b_TotalPEVector);
177  fChain->SetBranchAddress("NOpDets", &NOpDets, &b_NOpDets);
178  fChain->SetBranchAddress("NHitOpDetVector", &NHitOpDetVector, &b_NHitOpDetVector);
179  fChain->SetBranchAddress("Signal", &Signal, &b_Signal);
180  fChain->SetBranchAddress("Purity", &Purity, &b_Purity);
181  Notify();
182 }
183 
185 {
186  // The Notify() function is called when a new file is opened. This
187  // can be either for a new TTree in a TChain or when when a new TTree
188  // is started when using PROOF. It is normally not necessary to make changes
189  // to the generated code, but the routine can be extended by the
190  // user if needed. The return value is currently not used.
191 
192  return kTRUE;
193 }
194 
195 void FlashMatchAnalysis::Show(Long64_t entry)
196 {
197 // Print contents of entry.
198 // If entry is not specified, print current entry
199  if (!fChain) return;
200  fChain->Show(entry);
201 }
202 Int_t FlashMatchAnalysis::Cut(Long64_t entry)
203 {
204 // This function may be called from Loop.
205 // returns 1 if entry is accepted.
206 // returns -1 otherwise.
207  return 1;
208 }
209 #endif // #ifdef FlashMatchAnalysis_cxx
virtual Int_t Cut(Long64_t entry)
QList< Entry > entry
virtual void Loop()
vector< float > * TimeWidthVector
Int_t EventID
current Tree number in a TChain
vector< int > * FlashIDVector
virtual ~FlashMatchAnalysis()
vector< float > * Purity
vector< float > * YCenterVector
string dir
Int_t fCurrent
pointer to the analyzed TTree or TChain
vector< float > * TimeDiffVector
vector< float > * ZCenterVector
vector< float > * TotalPEVector
vector< float > * YWidthVector
vector< int > * NHitOpDetVector
vector< float > * TimeVector
FlashMatchAnalysis(TTree *tree=0)
virtual void Init(TTree *tree)
virtual Long64_t LoadTree(Long64_t entry)
vector< bool > * Signal
virtual void Show(Long64_t entry=-1)
virtual Int_t GetEntry(Long64_t entry)
vector< float > * ZWidthVector
virtual Bool_t Notify()