RecoTree.h
Go to the documentation of this file.
1 /*
2  * G4Tree.h
3  *
4  * Created on: Feb 18, 2021
5  * Author: chilgenb
6  */
7 
8 #ifndef GARANA_RECOTREE_H_
9 #define GARANA_RECOTREE_H_
10 
11 #include "garana/Base/TreeReader.h"
16 
17 using namespace std;
18 
19 namespace garana {
20 
21  class RecoTree : public TreeReader {
22 
23  public:
24 
25  virtual ~RecoTree() {};
26 
27 
28  // pure virtual methods
29  // sizes
30  virtual const size_t NTrack() const = 0; ///< number of tracks in this event
31  virtual const size_t NVertex() const = 0; ///< number of vertices in this event
32  virtual const size_t NVee() const = 0; ///< number of vees in this event
33  virtual const size_t NCalCluster() const = 0; ///< number of ECal clusters in this event
34 
35  // track
36  virtual const TLorentzVector* TrackVertex(const size_t& itrack) const = 0; ///< 4-position of track's assumed start point
37  virtual const TLorentzVector* TrackEnd(const size_t& itrack) const = 0; ///< 4-position of track's assumed end point
38  virtual const size_t NTrackHit(const size_t& itrack) const = 0; ///< number of reconstructed hits used in track fit
39  virtual const TVector3* TrackMomBeg(const size_t& itrack) const = 0; ///< momentum 3-vector as track's assumed start point
40  virtual const TVector3* TrackMomEnd(const size_t& itrack) const = 0; ///< momentum 3-vector as track's assumed end point
41  virtual const float TrackVtxDirectionX(const size_t& itrack) const = 0; ///< x-direction cosine at track vertex
42  virtual const float TrackVtxDirectionY(const size_t& itrack) const = 0; ///< y-direction cosine at track vertex
43  virtual const float TrackVtxDirectionZ(const size_t& itrack) const = 0; ///< z-direction cosine at track vertex
44  virtual const float TrackEndDirectionX(const size_t& itrack) const = 0; ///< x-direction cosine at track end
45  virtual const float TrackEndDirectionY(const size_t& itrack) const = 0; ///< y-direction cosine at track end
46  virtual const float TrackEndDirectionZ(const size_t& itrack) const = 0; ///< z-direction cosine at track end
47  virtual const float TrackLenFwd(const size_t& itrack) const = 0; ///< track length from forward fit
48  virtual const float TrackLenBkd(const size_t& itrack) const = 0; ///< track length from backward fit
49  virtual const float TrackIonizFwd(const size_t& itrack) const = 0; ///< track average ionization rate from forward fit
50  virtual const float TrackIonizBkd(const size_t& itrack) const = 0; ///< track average ionization rate from backward fit
51  virtual const int TrackChiSqrFwd(const size_t& itrack) const = 0; ///< chi-squared of track fit in forward direction
52  virtual const int TrackChiSqrBkd(const size_t& itrack) const = 0; ///< chi-squared of track fit in backward direction
53  virtual const int TrackChgFwd(const size_t& itrack) const = 0; ///< charge sign of track if current hypothesis correct
54  virtual const int TrackChgBkd(const size_t& itrack) const = 0; ///< charge sign of track if current hypothesis wrong
55  virtual void TrackParBeg(const size_t& itrack, float pars[5]) const = 0; ///< track fit parameters at the track's assumed start
56  virtual void TrackParEnd(const size_t& itrack, float pars[5]) const = 0; ///< track fit parameters at the track's assumed end
57  virtual void TrackCovarBeg(const size_t& itrack, float pars[15]) const = 0; ///< track fit covariance matrix (assume symmetry) at track's assumed start
58  virtual void TrackCovarEnd(const size_t& itrack, float pars[15]) const = 0; ///< track fit covariance matrix (assume symmetry) at track's assumed end
59 
60  virtual const TLorentzVector* TrackTruePosBeg(const size_t& itrack) const = 0; ///< true 4-position at track vertex [cm,ns]
61  virtual const TLorentzVector* TrackTruePosEnd(const size_t& itrack) const = 0; ///< true 4-position at track end [cm,ns]
62  virtual const TLorentzVector* TrackTrueMomBeg(const size_t& itrack) const = 0; ///< true 4-momentum at track vertex [GeV/c,GeV]
63  virtual const TLorentzVector* TrackTrueMomEnd(const size_t& itrack) const = 0; ///< true 4-momentum at track end [GeV/c,GeV]
64  virtual const float TrackTrueEnergy(const size_t& itrack) const = 0; ///< total associated true energy deposited with ith cluster
65  virtual const size_t TrackNTrueTrack(const size_t& itrack) const = 0; ///< number of MCParticles associated with ith cluster
66  virtual const int TrackTrkIdMaxDeposit(const size_t& itrack)const = 0; ///< trackID of the MCParticle depositing the most energy in ith cluster
67  virtual const float TrackMaxDeposit(const size_t& itrack) const = 0; ///< maximum true deposited energy from a single MCParticle
68  const float TrackMaxDepositFrac(const size_t& itrack) const; ///< largest fraction of total energy contributed by single MCParticle
69  virtual const pair<int,float>* TrackTrueDeposit(const size_t& itrack, size_t& itrue) const = 0; ///<
70  virtual const vector<pair<int,float>>* TrackTrueDeposits(const size_t& itrack) const = 0;
71 
72  //vertex
73  virtual const TLorentzVector* GetVertex(const size_t& ivertex) const = 0; ///< vertex 4-position for vertex with index ivertex
74  virtual void VertexCovariance(const size_t& ivertex, float covar[][3]) const = 0; ///< given a vertex index, fill given position covariance matrix
75 
76  //vee
77  virtual const TLorentzVector* VeeVertex(const size_t& ivee) const = 0; ///< vertex 4-position for vee with index ivee
78  virtual void VeeCovariance(const size_t& ivee, float covar[][3]) const = 0; ///< given a vee index, fill given position covariance matrix
79  virtual const vector<TLorentzVector>* VeeMomentumPerHypothesis(const size_t& ivee) const = 0; ///< 4-momentum for vee if it matches {Kshort, Lambda1, Lambda2}
80  virtual const float VeeChiSquared(const size_t& ivee) const = 0;
81 
82  //calo cluster
83  virtual const TLorentzVector* CalClustPosition(const size_t& icluster) const = 0;
84  virtual const float CalClustEnergy(const size_t& icluster) const = 0; ///< reconstructed ECal cluster energy
85  virtual const float CalClustEnergyError(const size_t& icluster) const = 0;
86  virtual const float CalClustTrueEnergy(const size_t& icluster) const = 0; ///< total associated true energy deposited with ith cluster
87  virtual const size_t CalClustNTrueTrack(const size_t& icluster) const = 0; ///< number of MCParticles associated with ith cluster
88  virtual const int CalClustTrkIdMaxDeposit(const size_t& icluster)const = 0; ///< trackID of the MCParticle depositing the most energy in ith cluster
89  virtual const float CalClustMaxDeposit(const size_t& icluster) const = 0; ///< maximum true deposited energy from a single MCParticle
90  const float CalClustMaxDepositFrac(const size_t& icluster) const; ///< largest fraction of total energy contributed by single MCParticle
91  virtual const std::pair<int,float>* CalClustTrueDeposit(const size_t& icluster, const size_t& itrack) const = 0; ///<
92  virtual const float CalClustTimeDifference(const size_t& icluster) const = 0;
93  virtual const float* CalClustShape(const size_t& icluster) const = 0;
94  virtual const float CalClustTheta(const size_t& icluster) const = 0;
95  virtual const float CalClustPhi(const size_t& icluster) const = 0;
96  virtual const vector<TVector3>* CalClustEigenVecs(const size_t& icluster) const = 0;
97 
98  // truth matching
99  void GetTrackG4PIndices (const size_t& itrk, vector<UInt_t>& ig4ps ) const; ///< given a track index, fill a given vector with matched G4 particle indices
100  void GetVertexTrackIndices (const size_t& ivtx, vector<UInt_t>& itracks) const; ///< given a vertex index, fill a given vector with matched track indices
101  void GetVeeTrackIndices (const size_t& ivee, vector<UInt_t>& itracks) const; ///< given a vee index, fill a given vector with matched G4 particle indices
102  void GetCalClusterTrackIndices(const size_t& iclust, vector<UInt_t>& itracks) const; ///< given a calocluster index, fill a given vector with matched track indices
103  void GetCalClusterG4Indices (const size_t& iclust, vector<UInt_t>& ig4ps) const; ///< given a calocluster index, fill a given vector with matched G4Particle indices
104 
105  protected:
106 
107  //associations
108  vector<vector<UInt_t>>* fTrackG4PIndices = nullptr;
109  vector<vector<UInt_t>>* fVertTrackIndices = nullptr;
110  vector<vector<UInt_t>>* fVeeTrackIndices = nullptr;
111  vector<vector<UInt_t>>* fCalClusterTrackIndices = nullptr;
112  vector<vector<UInt_t>>* fCalClusterG4Indices = nullptr;
113 
114  TBranch* b_TrackG4PIndices = nullptr;
115  TBranch* b_VertTrackIndices = nullptr;
116  TBranch* b_VeeTrackIndices = nullptr;
117  TBranch* b_CalClusterTrackIndices = nullptr;
118  TBranch* b_CalClusterG4Indices = nullptr;
119 
120  };//class
121 }//namespace
122 
123 #endif /* GARANA_RECOTREE_H_ */
int TrackEnd
Definition: Track.h:32
STL namespace.
ig4ps
Definition: tracks.py:192
virtual ~RecoTree()
Definition: RecoTree.h:25