FlatRecoTree.h
Go to the documentation of this file.
1 /*
2  * FlatRecoTree.h
3  *
4  * Created on: Feb 9, 2021
5  * Author: chilgenb
6  */
7 
8 #ifndef GARANA_FLATRECOTREE_H_
9 #define GARANA_FLATRECOTREE_H_
10 
11 #include "garana/Base/RecoTree.h"
12 
13 //using std::vector;
14 using namespace std;
15 
16 namespace garana {
17 
18  class FlatRecoTree : public RecoTree {
19 
20  public:
21 
23  FlatRecoTree(TTree* tree);
24  FlatRecoTree(TTree* tree, char opt);
25 
26  //accessors inherited from RecoTree
27  //virtual void GetEntry(UInt_t entry) override;
28 
29  // sizes
30  const size_t NTrack() const override;
31  const size_t NVertex() const override;
32  const size_t NVee() const override;
33  const size_t NCalCluster() const override;
34 
35  // track
36  const TLorentzVector* TrackVertex(const size_t& itrack) const override;
37  const TLorentzVector* TrackEnd(const size_t& itrack) const override;
38  const size_t NTrackHit(const size_t& itrack) const override;
39  const TVector3* TrackMomBeg(const size_t& itrack) const override;
40  const TVector3* TrackMomEnd(const size_t& itrack) const override;
41  const float TrackVtxDirectionX(const size_t& itrack) const override;
42  const float TrackVtxDirectionY(const size_t& itrack) const override;
43  const float TrackVtxDirectionZ(const size_t& itrack) const override;
44  const float TrackEndDirectionX(const size_t& itrack) const override;
45  const float TrackEndDirectionY(const size_t& itrack) const override;
46  const float TrackEndDirectionZ(const size_t& itrack) const override;
47  const float TrackLenFwd(const size_t& itrack) const override;
48  const float TrackLenBkd(const size_t& itrack) const override;
49  const float TrackIonizFwd(const size_t& itrack) const override;
50  const float TrackIonizBkd(const size_t& itrack) const override;
51  const int TrackChiSqrFwd(const size_t& itrack) const override;
52  const int TrackChiSqrBkd(const size_t& itrack) const override;
53  const int TrackChgFwd(const size_t& itrack) const override;
54  const int TrackChgBkd(const size_t& itrack) const override;
55  void TrackParBeg(const size_t& itrack, float pars[5]) const override;
56  void TrackParEnd(const size_t& itrack, float pars[5]) const override;
57  void TrackCovarBeg(const size_t& itrack, float pars[15]) const override;
58  void TrackCovarEnd(const size_t& itrack, float pars[15]) const override;
59  const TLorentzVector* TrackTruePosBeg(const size_t& itrack) const override;
60  const TLorentzVector* TrackTruePosEnd(const size_t& itrack) const override;
61  const TLorentzVector* TrackTrueMomBeg(const size_t& itrack) const override;
62  const TLorentzVector* TrackTrueMomEnd(const size_t& itrack) const override;
63  const float TrackTrueEnergy(const size_t& icluster) const override;
64  const size_t TrackNTrueTrack(const size_t& icluster) const override;
65  const int TrackTrkIdMaxDeposit(const size_t& icluster)const override;
66  const float TrackMaxDeposit(const size_t& icluster) const override;
67  const pair<int,float>* TrackTrueDeposit(const size_t& itrack, size_t& itrue) const override;
68  const vector<pair<int,float>>* TrackTrueDeposits(const size_t& itrack) const override;
69 
70  //vertex
71  const TLorentzVector* GetVertex(const size_t& ivertex) const override;
72  void VertexCovariance(const size_t& ivertex, float covar[][3]) const override;
73 
74  //vee
75  const TLorentzVector* VeeVertex(const size_t& ivee) const override;
76  void VeeCovariance(const size_t& ivee, float covar[][3]) const override;
77  const vector<TLorentzVector>* VeeMomentumPerHypothesis(const size_t& ivee) const override;
78  const float VeeChiSquared(const size_t& ivee) const override;
79 
80  //ECal cluster
81  const TLorentzVector* CalClustPosition(const size_t& icluster) const override;
82  const float CalClustEnergy(const size_t& icluster) const override;
83  const float CalClustEnergyError(const size_t& icluster) const override;
84  const float CalClustTrueEnergy(const size_t& icluster) const override;
85  const size_t CalClustNTrueTrack(const size_t& icluster) const override;
86  const int CalClustTrkIdMaxDeposit(const size_t& icluster)const override;
87  const float CalClustMaxDeposit(const size_t& icluster) const override;
88  const std::pair<int,float>* CalClustTrueDeposit(const size_t& icluster, const size_t& itrack) const override;
89  const float CalClustTimeDifference(const size_t& icluster) const override;
90  const float* CalClustShape(const size_t& icluster) const override;
91  const float CalClustTheta(const size_t& icluster) const override;
92  const float CalClustPhi(const size_t& icluster) const override;
93  const vector<TVector3>* CalClustEigenVecs(const size_t& icluster) const override;
94 
95  //private:
96  protected:
97 
98  bool SetBranchAddresses() override;
99  void SetVecs();
100  void ClearVecs();
101 
102  //leaves and branches //FIXME: redundant info for track positions?
103  //track info
104  vector<float>* fTrkLenFwd = nullptr; ///< length of the track in cm from forwards fit
105  vector<float>* fTrkLenBac = nullptr; ///< length of the track in cm from backwards fit
106  vector<float>* fTrkMomBeg = nullptr; ///< momentum of the track at the vertex in GeV/c
107  vector<float>* fTrkMomEnd = nullptr; ///< momentum of the track at the end in GeV/c
108  vector<float>* fTrkVtxX = nullptr; ///< track vertex position 4-vector [cm,ns] (vtx vs. end arbitrary)
109  vector<float>* fTrkVtxY = nullptr;
110  vector<float>* fTrkVtxZ = nullptr;
111  vector<float>* fTrkVtxT = nullptr;
112  vector<float>* fTrkEndX = nullptr; ///< track end position 4-vector [cm,ns] (vtx vs. end arbitrary)
113  vector<float>* fTrkEndY = nullptr;
114  vector<float>* fTrkEndZ = nullptr;
115  vector<float>* fTrkEndT = nullptr;
116 
117  vector<float>* fTrkVtxDirX = nullptr; ///< track vertex direction
118  vector<float>* fTrkVtxDirY = nullptr;
119  vector<float>* fTrkVtxDirZ = nullptr;
120  vector<float>* fTrkEndDirX = nullptr; ///< track end direction
121  vector<float>* fTrkEndDirY = nullptr;
122  vector<float>* fTrkEndDirZ = nullptr;
123  vector<float>* fTrkChiFwd = nullptr; ///< chisquared forward fit
124  vector<float>* fTrkChiBac = nullptr; ///< chisquared backward fit
125  vector<size_t>* fTrkNHits = nullptr; ///< number of hits
126 
127  vector<float>* fTrackXBeg = nullptr; ///< Track x-coord at beginning of track [cm]
128  vector<float>* fTrackYBeg = nullptr; ///< Track y-coord (par[0]) at beginning of track [cm]
129  vector<float>* fTrackZBeg = nullptr; ///< Track z-coord (par[1]) at beginning of track [cm]
130  vector<float>* fTrackCurvBeg = nullptr; ///< Track curvature (par[2]) at beginning of track [cm^-1]
131  vector<float>* fTrackPhiBeg = nullptr; ///< Track phi (par[3]) at beginning of track [rad]
132  vector<float>* fTrackLambBeg = nullptr; ///< Track lambda (par[4]) at beginning of track [rad]
133  vector<float>* fTrackXEnd = nullptr; ///< Track x-coord at end of track [cm]
134  vector<float>* fTrackYEnd = nullptr; ///< Track y-coord (par[0]) at end of track [cm]
135  vector<float>* fTrackZEnd = nullptr; ///< Track z-coord (par[1]) at end of track [cm]
136  vector<float>* fTrackCurvEnd = nullptr; ///< Track curvature (par[2]) at end of track [cm^-1]
137  vector<float>* fTrackPhiEnd = nullptr; ///< Track phi (par[3]) at end of track [rad]
138  vector<float>* fTrackLambEnd = nullptr; ///< Track lambda (par[4]) at end of track [rad]
139  vector<float>* fTrkCovMat1Beg = nullptr; ///< covariance matrix at beginning of track -- assuming symmetry
140  vector<float>* fTrkCovMat2Beg = nullptr;
141  vector<float>* fTrkCovMat3Beg = nullptr;
142  vector<float>* fTrkCovMat4Beg = nullptr;
143  vector<float>* fTrkCovMat5Beg = nullptr;
144  vector<float>* fTrkCovMat6Beg = nullptr;
145  vector<float>* fTrkCovMat7Beg = nullptr;
146  vector<float>* fTrkCovMat8Beg = nullptr;
147  vector<float>* fTrkCovMat9Beg = nullptr;
148  vector<float>* fTrkCovMat10Beg = nullptr;
149  vector<float>* fTrkCovMat11Beg = nullptr;
150  vector<float>* fTrkCovMat12Beg = nullptr;
151  vector<float>* fTrkCovMat13Beg = nullptr;
152  vector<float>* fTrkCovMat14Beg = nullptr;
153  vector<float>* fTrkCovMat15Beg = nullptr;
154  vector<float>* fTrkCovMat1End = nullptr; ///< covariance matrix at end of track -- assuming symmetry
155  vector<float>* fTrkCovMat2End = nullptr;
156  vector<float>* fTrkCovMat3End = nullptr;
157  vector<float>* fTrkCovMat4End = nullptr;
158  vector<float>* fTrkCovMat5End = nullptr;
159  vector<float>* fTrkCovMat6End = nullptr;
160  vector<float>* fTrkCovMat7End = nullptr;
161  vector<float>* fTrkCovMat8End = nullptr;
162  vector<float>* fTrkCovMat9End = nullptr;
163  vector<float>* fTrkCovMat10End = nullptr;
164  vector<float>* fTrkCovMat11End = nullptr;
165  vector<float>* fTrkCovMat12End = nullptr;
166  vector<float>* fTrkCovMat13End = nullptr;
167  vector<float>* fTrkCovMat14End = nullptr;
168  vector<float>* fTrkCovMat15End = nullptr;
169 
170  vector<float>* fTrkIonizFwd = nullptr;
171  vector<float>* fTrkIonizBac = nullptr;
172  vector<int>* fTrkChgFwd = nullptr;
173  vector<int>* fTrkChgBac = nullptr;
174 
175 
176  // Vee info
177  vector<float>* fVeeVtxX = nullptr; ///< x-position of vertex [cm]
178  vector<float>* fVeeVtxY = nullptr; ///< y-position of vertex [cm]
179  vector<float>* fVeeVtxZ = nullptr; ///< z-position of vertex [cm]
180  vector<float>* fVeeVtxT = nullptr; ///< time of vertex [ns]
181  vector<float>* fVeeVtxCovar11 = nullptr; ///< uncertainties in vertex position [cm]
182  vector<float>* fVeeVtxCovar12 = nullptr;
183  vector<float>* fVeeVtxCovar13 = nullptr;
184  vector<float>* fVeeVtxCovar21 = nullptr;
185  vector<float>* fVeeVtxCovar22 = nullptr;
186  vector<float>* fVeeVtxCovar23 = nullptr;
187  vector<float>* fVeeVtxCovar31 = nullptr;
188  vector<float>* fVeeVtxCovar32 = nullptr;
189  vector<float>* fVeeVtxCovar33 = nullptr;
190 
191  vector<float>* fVeePxKshort = nullptr; ///< four-momentum of vee, for Kshort hypothesis [GeV]
192  vector<float>* fVeePyKshort = nullptr;
193  vector<float>* fVeePzKshort = nullptr;
194  vector<float>* fVeeEKshort = nullptr;
195  vector<float>* fVeePxLamb1 = nullptr; ///< four-momentum of vee, for Kshort hypothesis [GeV]
196  vector<float>* fVeePyLamb1 = nullptr;
197  vector<float>* fVeePzLamb1 = nullptr;
198  vector<float>* fVeeELamb1 = nullptr;
199  vector<float>* fVeePxLamb2 = nullptr; ///< four-momentum of vee, for Kshort hypothesis [GeV]
200  vector<float>* fVeePyLamb2 = nullptr;
201  vector<float>* fVeePzLamb2 = nullptr;
202  vector<float>* fVeeELamb2 = nullptr;
203  vector<float>* fVeeChisqr = nullptr; ///< chi-squared
204 
205  // Vertex info
206  vector<float>* fVtxX = nullptr; ///< x-position of vertex [cm]
207  vector<float>* fVtxY = nullptr; ///< y-position of vertex [cm]
208  vector<float>* fVtxZ = nullptr; ///< z-position of vertex [cm]
209  vector<float>* fVtxT = nullptr; ///< time of vertex [ns]
210  vector<float>* fVtxCovar11 = nullptr; ///< uncertainties in vertex position [cm]
211  vector<float>* fVtxCovar12 = nullptr;
212  vector<float>* fVtxCovar13 = nullptr;
213  vector<float>* fVtxCovar21 = nullptr;
214  vector<float>* fVtxCovar22 = nullptr;
215  vector<float>* fVtxCovar23 = nullptr;
216  vector<float>* fVtxCovar31 = nullptr;
217  vector<float>* fVtxCovar32 = nullptr;
218  vector<float>* fVtxCovar33 = nullptr;
219 
220  // CalCluster info
221  vector<float>* fCalClustX = nullptr; ///< x-position of the cluster [cm]
222  vector<float>* fCalClustY = nullptr; ///< y-position of the cluster [cm]
223  vector<float>* fCalClustZ = nullptr; ///< z-position of the cluster [cm]
224  vector<float>* fCalClustT = nullptr; ///< time of the cluster [ns]
225  vector<float>* fCalClustEnergy = nullptr; ///< energy of the ECal cluster [GeV]
226  vector<float>* fCalClustEnergyError = nullptr; ///< uncertainty of the cluster energy [GeV]
227  vector<float>* fCalClustTdiff = nullptr; ///< time difference between the first and last layer of the cluster [ns]
228  vector<float>* fCalClustEllip = nullptr; ///< cluster shape parameter ellipsoid
229  vector<float>* fCalClustR1 = nullptr; ///< cluster shape parameter r1
230  vector<float>* fCalClustR2 = nullptr; ///< cluster shape parameter r2
231  vector<float>* fCalClustR3 = nullptr; ///< cluster shape parameter r3
232  vector<float>* fCalClustVol = nullptr; ///< cluster shape parameter volume
233  vector<float>* fCalClustWidth = nullptr; ///< cluster shape parameter width
234  vector<float>* fCalClustTheta = nullptr; ///< intrasic direction of the cluster theta
235  vector<float>* fCalClustPhi = nullptr; ///< intrasic direction of the cluster phi
236  vector<float>* fCalClustEigen1X = nullptr; ///< Eigenvectors of the cluster in ascending order (principal axis with smallest inertial mass) normalised to 1
237  vector<float>* fCalClustEigen1Y = nullptr;
238  vector<float>* fCalClustEigen1Z = nullptr;
239  vector<float>* fCalClustEigen2X = nullptr; ///< Eigenvectors of the cluster in ascending order (principal axis with smallest inertial mass) normalised to 1
240  vector<float>* fCalClustEigen2Y = nullptr;
241  vector<float>* fCalClustEigen2Z = nullptr;
242  vector<float>* fCalClustEigen3X = nullptr; ///< Eigenvectors of the cluster in ascending order (principal axis with smallest inertial mass) normalised to 1
243  vector<float>* fCalClustEigen3Y = nullptr;
244  vector<float>* fCalClustEigen3Z = nullptr;
245 
246  // associations
247  vector<vector<UInt_t>>* fTrackG4PIndices = nullptr;
248  vector<vector<UInt_t>>* fVertTrackIndices = nullptr;
249  vector<vector<UInt_t>>* fVeeTrackIndices = nullptr;
250  vector<vector<UInt_t>>* fCalTrackIndices = nullptr;
251 
252  vector<vector<Int_t>>* fVertTrackEnds = nullptr;
253  vector<vector<Int_t>>* fVeeTrackEnds = nullptr;
254 
255  // branches
256  TBranch* b_TrkLenFwd = nullptr;
257  TBranch* b_TrkLenBac = nullptr;
258  TBranch* b_TrkMomBeg = nullptr;
259  TBranch* b_TrkMomEnd = nullptr;
260  TBranch* b_TrkVtxX = nullptr;
261  TBranch* b_TrkVtxY = nullptr;
262  TBranch* b_TrkVtxZ = nullptr;
263  TBranch* b_TrkVtxT = nullptr;
264  TBranch* b_TrkEndX = nullptr;
265  TBranch* b_TrkEndY = nullptr;
266  TBranch* b_TrkEndZ = nullptr;
267  TBranch* b_TrkEndT = nullptr;
268 
269  TBranch* b_TrkVtxDirX = nullptr;
270  TBranch* b_TrkVtxDirY = nullptr;
271  TBranch* b_TrkVtxDirZ = nullptr;
272  TBranch* b_TrkEndDirX = nullptr;
273  TBranch* b_TrkEndDirY = nullptr;
274  TBranch* b_TrkEndDirZ = nullptr;
275  TBranch* b_TrkChiFwd = nullptr;
276  TBranch* b_TrkChiBac = nullptr;
277  TBranch* b_TrkNHits = nullptr;
278 
279  TBranch* b_TrackXBeg = nullptr;
280  TBranch* b_TrackYBeg = nullptr;
281  TBranch* b_TrackZBeg = nullptr;
282  TBranch* b_TrackCurvBeg = nullptr;
283  TBranch* b_TrackPhiBeg = nullptr;
284  TBranch* b_TrackLambBeg = nullptr;
285  TBranch* b_TrackParEnd = nullptr;
286  TBranch* b_TrackXEnd = nullptr;
287  TBranch* b_TrackYEnd = nullptr;
288  TBranch* b_TrackZEnd = nullptr;
289  TBranch* b_TrackCurvEnd = nullptr;
290  TBranch* b_TrackPhiEnd = nullptr;
291  TBranch* b_TrackLambEnd = nullptr;
292  TBranch* b_TrkCovMat1Beg = nullptr;
293  TBranch* b_TrkCovMat2Beg = nullptr;
294  TBranch* b_TrkCovMat3Beg = nullptr;
295  TBranch* b_TrkCovMat4Beg = nullptr;
296  TBranch* b_TrkCovMat5Beg = nullptr;
297  TBranch* b_TrkCovMat6Beg = nullptr;
298  TBranch* b_TrkCovMat7Beg = nullptr;
299  TBranch* b_TrkCovMat8Beg = nullptr;
300  TBranch* b_TrkCovMat9Beg = nullptr;
301  TBranch* b_TrkCovMat10Beg = nullptr;
302  TBranch* b_TrkCovMat11Beg = nullptr;
303  TBranch* b_TrkCovMat12Beg = nullptr;
304  TBranch* b_TrkCovMat13Beg = nullptr;
305  TBranch* b_TrkCovMat14Beg = nullptr;
306  TBranch* b_TrkCovMat15Beg = nullptr;
307  TBranch* b_TrkCovMat1End = nullptr;
308  TBranch* b_TrkCovMat2End = nullptr;
309  TBranch* b_TrkCovMat3End = nullptr;
310  TBranch* b_TrkCovMat4End = nullptr;
311  TBranch* b_TrkCovMat5End = nullptr;
312  TBranch* b_TrkCovMat6End = nullptr;
313  TBranch* b_TrkCovMat7End = nullptr;
314  TBranch* b_TrkCovMat8End = nullptr;
315  TBranch* b_TrkCovMat9End = nullptr;
316  TBranch* b_TrkCovMat10End = nullptr;
317  TBranch* b_TrkCovMat11End = nullptr;
318  TBranch* b_TrkCovMat12End = nullptr;
319  TBranch* b_TrkCovMat13End = nullptr;
320  TBranch* b_TrkCovMat14End = nullptr;
321  TBranch* b_TrkCovMat15End = nullptr;
322 
323  TBranch* b_VeeVtxX = nullptr;
324  TBranch* b_VeeVtxY = nullptr;
325  TBranch* b_VeeVtxZ = nullptr;
326  TBranch* b_VeeVtxT = nullptr;
327  TBranch* b_VeeVtxCovar11 = nullptr;
328  TBranch* b_VeeVtxCovar12 = nullptr;
329  TBranch* b_VeeVtxCovar13 = nullptr;
330  TBranch* b_VeeVtxCovar21 = nullptr;
331  TBranch* b_VeeVtxCovar22 = nullptr;
332  TBranch* b_VeeVtxCovar23 = nullptr;
333  TBranch* b_VeeVtxCovar31 = nullptr;
334  TBranch* b_VeeVtxCovar32 = nullptr;
335  TBranch* b_VeeVtxCovar33 = nullptr;
336 
337  TBranch* b_VeePxKshort = nullptr;
338  TBranch* b_VeePyKshort = nullptr;
339  TBranch* b_VeePzKshort = nullptr;
340  TBranch* b_VeeEKshort = nullptr;
341  TBranch* b_VeePxLamb1 = nullptr;
342  TBranch* b_VeePyLamb1 = nullptr;
343  TBranch* b_VeePzLamb1 = nullptr;
344  TBranch* b_VeeELamb1 = nullptr;
345  TBranch* b_VeePxLamb2 = nullptr;
346  TBranch* b_VeePyLamb2 = nullptr;
347  TBranch* b_VeePzLamb2 = nullptr;
348  TBranch* b_VeeELamb2 = nullptr;
349  TBranch* b_VeeChisqr = nullptr;
350 
351  TBranch* b_VtxX = nullptr;
352  TBranch* b_VtxY = nullptr;
353  TBranch* b_VtxZ = nullptr;
354  TBranch* b_VtxT = nullptr;
355  TBranch* b_VtxCovar11 = nullptr;
356  TBranch* b_VtxCovar12 = nullptr;
357  TBranch* b_VtxCovar13 = nullptr;
358  TBranch* b_VtxCovar21 = nullptr;
359  TBranch* b_VtxCovar22 = nullptr;
360  TBranch* b_VtxCovar23 = nullptr;
361  TBranch* b_VtxCovar31 = nullptr;
362  TBranch* b_VtxCovar32 = nullptr;
363  TBranch* b_VtxCovar33 = nullptr;
364 
365  TBranch* b_CalClustX = nullptr;
366  TBranch* b_CalClustY = nullptr;
367  TBranch* b_CalClustZ = nullptr;
368  TBranch* b_CalClustT = nullptr;
369  TBranch* b_CalClustEnergy = nullptr;
370  TBranch* b_CalClustEnergyError = nullptr;
371  TBranch* b_CalClustTdiff = nullptr;
372  TBranch* b_CalClustEllip = nullptr;
373  TBranch* b_CalClustR1 = nullptr;
374  TBranch* b_CalClustR2 = nullptr;
375  TBranch* b_CalClustR3 = nullptr;
376  TBranch* b_CalClustVol = nullptr;
377  TBranch* b_CalClustWidth = nullptr;
378  TBranch* b_CalClustTheta = nullptr;
379  TBranch* b_CalClustPhi = nullptr;
380  TBranch* b_CalClustEigen1X = nullptr;
381  TBranch* b_CalClustEigen1Y = nullptr;
382  TBranch* b_CalClustEigen1Z = nullptr;
383  TBranch* b_CalClustEigen2X = nullptr;
384  TBranch* b_CalClustEigen2Y = nullptr;
385  TBranch* b_CalClustEigen2Z = nullptr;
386  TBranch* b_CalClustEigen3X = nullptr;
387  TBranch* b_CalClustEigen3Y = nullptr;
388  TBranch* b_CalClustEigen3Z = nullptr;
389 
390  TBranch* b_TrackG4PIndices = nullptr;
391  TBranch* b_VertTrackIndices = nullptr;
392  TBranch* b_VeeTrackIndices = nullptr;
393  TBranch* b_CalTrackIndices = nullptr;
394 
395  TBranch* b_VertTrackEnds = nullptr;
396  TBranch* b_VeeTrackEnds = nullptr;
397 
398  TBranch* b_TrkIonizFwd = nullptr;
399  TBranch* b_TrkIonizBac = nullptr;
400  TBranch* b_TrkChgFwd = nullptr;
401  TBranch* b_TrkChgBac = nullptr;
402 
403  };//class
404 }//namespace
405 
406 #endif /* GARANA_FLATRECOTREE_H_ */
int TrackEnd
Definition: Track.h:32
opt
Definition: train.py:196
STL namespace.