Backtracker.h
Go to the documentation of this file.
1 /*
2  * Backtracker.h
3  *
4  * Created on: Mar 15, 2021
5  * Author: chilgenb
6  */
7 
8 #ifndef GARANA_BACKTRACKER_H_
9 #define GARANA_BACKTRACKER_H_
10 
18 
20 
21 #include <map>
22 #include <climits>
23 
24 //using std::vector;
25 //using std::map;
26 using namespace std;
27 
28 namespace garana {
29 
30  class Backtracker {
31 
32  public:
34  Backtracker(const TreeManager* tm) : fTM(tm) {}
35  void FillMaps();
36 
37  const vector<UInt_t>* GTruthToG4Particles(const UInt_t& itruth) const;
38  const vector<UInt_t>* GTruthToTracks(const UInt_t& itruth) const;
39  UInt_t const G4ParticleToGTruth(const UInt_t& ig4p) const;
40  const vector<UInt_t>* G4ParticleToTracks(const UInt_t& ig4p) const;
41  UInt_t const TrackToGTruth(const UInt_t& itrk) const;
42  const vector<UInt_t>* TrackToG4Particles(const UInt_t& itrk) const;
43  const vector<pair<UInt_t,float>> TrackToG4ParticlesDeposits(const UInt_t& itrk) const;
44  UInt_t const TrackToG4Particle(const UInt_t& itrk) const;
45  const pair<UInt_t,float> TrackToG4ParticleDeposit(const UInt_t& itrk) const;
46  //const vector<UInt_t>* FSParticleToG4Particles(const UInt_t& ifsp) const;
47  //UInt_t G4ParticleToFSParticle(const UInt_t& ig4p) const;
48 
49  UInt_t const VertexToGTruth(const UInt_t& ivtx) const;
50  UInt_t const GTruthToVertex(const UInt_t& ivtx) const;
51  const vector<UInt_t>* VertexToG4Particles(const UInt_t& ivtx) const;
52  const vector<UInt_t>* G4ParticleToVertices(const UInt_t& ig4p) const;
53 
54  UInt_t const VeeToGTruth(const UInt_t& ivee) const;
55  UInt_t const GTruthToVee(const UInt_t& ivee) const;
56  const vector<UInt_t>* VeeToG4Particles(const UInt_t& ivee) const;
57  UInt_t const G4ParticleToVee(const UInt_t& ig4p) const;
58 
59  const vector<UInt_t>* TrackToVertices(const UInt_t& itrk) const;
60  const vector<UInt_t>* VertexToTracks(const UInt_t& ivtx) const;
61  const vector<UInt_t>* TrackToVees(const UInt_t& itrk) const;
62  const vector<UInt_t>* VeeToTracks(const UInt_t& ivee) const;
63 
64  const vector<UInt_t>* TrackToCalClusters(const UInt_t& itrk) const;
65  const vector<UInt_t>* CalClusterToTracks(const UInt_t& itrk) const;
66 
67  const vector<UInt_t>* G4PToCalClusters(const UInt_t& itrk) const;
68  const vector<UInt_t>* CalClusterToG4Ps(const UInt_t& itrk) const;
69 
70  float ASSN_THRESHOLD = 0.5; ///< fraction of total associated energy contributed to reco object a particle must constitute to be considered associated
71 
72  private:
73 
74  const TreeManager* fTM = nullptr;
75  //GenTree* gen = nullptr;
76  G4Tree* g4 = nullptr;
77  //DetTree* det = nullptr;
78  RecoTree* rec = nullptr;
79  template <class T>
80  bool CheckRange(const map<UInt_t,T>& m, const UInt_t& i) const;
81  void Clear();
82 
83  map< UInt_t, vector<UInt_t> > fGTruthToG4Particles; // gen -> g4
84  map< UInt_t, UInt_t > fG4ParticleToGTruth; // g4 -> gen
85  map< UInt_t, vector<UInt_t> > fGTruthToTracks; // gen -> reco
86  map< UInt_t, UInt_t > fTrackToGTruth; // reco -> gen
87  map< UInt_t, vector<UInt_t> > fTrackToG4Particles; // reco -> g4
88  map< UInt_t, UInt_t > fTrackToG4Particle; // reco -> g4
89  map< UInt_t, vector<UInt_t> > fG4ParticleToTracks; // g4 -> reco
90  //map< UInt_t, vector<UInt_t> > fFSParticleToG4Particles;
91  //map< UInt_t, UInt_t > fG4ParticleToFSParticle; //TODO are these really necessary?
92 
93  map< UInt_t, vector<UInt_t> > fG4ParticleToVertices;// g4 -> reco
94  map< UInt_t, vector<UInt_t> > fVertexToG4Particles; // reco -> g4
95  map< UInt_t, UInt_t > fVertexToGTruth; // reco -> gen
96  map< UInt_t, UInt_t > fGTruthToVertex; // gen -> reco
97  map< UInt_t, vector<UInt_t> > fVeeToG4Particles; // reco -> g4
98  map< UInt_t, UInt_t > fG4ParticleToVee; // g4 -> reco
99  map< UInt_t, UInt_t> fVeeToGTruth; // reco -> gen
100  map< UInt_t, UInt_t > fGTruthToVee; // gen -> reco
101 
102  map< UInt_t, vector<UInt_t> > fTrackToVertices; // reco -> reco
103  map< UInt_t, vector<UInt_t> > fVertexToTracks; // reco -> reco
104  map< UInt_t, vector<UInt_t> > fVeeToTracks; // reco -> reco
105  map< UInt_t, vector<UInt_t> > fTrackToVees; // reco -> reco
106  map< UInt_t, vector<UInt_t> > fCaloClusterToTracks; // reco -> reco
107  map< UInt_t, vector<UInt_t> > fTrackToCaloClusters; // reco -> reco
108  map< UInt_t, vector<UInt_t> > fCaloClusterToG4Ps; // reco -> reco
109  map< UInt_t, vector<UInt_t> > fG4PToCaloClusters; // reco -> reco
110 
111  }; //class
112 }//namespace
113 
114 #endif /* GARANA_BACKTRACKER_H_ */
map< UInt_t, vector< UInt_t > > fVertexToTracks
Definition: Backtracker.h:103
Backtracker(const TreeManager *tm)
Definition: Backtracker.h:34
rec
Definition: tracks.py:88
map< UInt_t, vector< UInt_t > > fG4PToCaloClusters
Definition: Backtracker.h:109
map< UInt_t, vector< UInt_t > > fG4ParticleToTracks
Definition: Backtracker.h:89
map< UInt_t, vector< UInt_t > > fCaloClusterToTracks
Definition: Backtracker.h:106
map< UInt_t, vector< UInt_t > > fTrackToG4Particles
Definition: Backtracker.h:87
STL namespace.
map< UInt_t, vector< UInt_t > > fVertexToG4Particles
Definition: Backtracker.h:94
tm
Definition: demo.py:21
map< UInt_t, vector< UInt_t > > fTrackToVees
Definition: Backtracker.h:105
map< UInt_t, UInt_t > fGTruthToVee
Definition: Backtracker.h:100
map< UInt_t, vector< UInt_t > > fVeeToTracks
Definition: Backtracker.h:104
map< UInt_t, UInt_t > fTrackToG4Particle
Definition: Backtracker.h:88
map< UInt_t, UInt_t > fVertexToGTruth
Definition: Backtracker.h:95
map< UInt_t, vector< UInt_t > > fGTruthToG4Particles
Definition: Backtracker.h:83
map< UInt_t, UInt_t > fGTruthToVertex
Definition: Backtracker.h:96
map< UInt_t, vector< UInt_t > > fG4ParticleToVertices
Definition: Backtracker.h:93
map< UInt_t, UInt_t > fVeeToGTruth
Definition: Backtracker.h:99
map< UInt_t, UInt_t > fG4ParticleToGTruth
Definition: Backtracker.h:84
map< UInt_t, vector< UInt_t > > fVeeToG4Particles
Definition: Backtracker.h:97
map< UInt_t, vector< UInt_t > > fTrackToVertices
Definition: Backtracker.h:102
map< UInt_t, UInt_t > fG4ParticleToVee
Definition: Backtracker.h:98
map< UInt_t, vector< UInt_t > > fTrackToCaloClusters
Definition: Backtracker.h:107
map< UInt_t, vector< UInt_t > > fGTruthToTracks
Definition: Backtracker.h:85
map< UInt_t, UInt_t > fTrackToGTruth
Definition: Backtracker.h:86
g4
Definition: tracks.py:87
map< UInt_t, vector< UInt_t > > fCaloClusterToG4Ps
Definition: Backtracker.h:108