Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
garana::Backtracker Class Reference

#include <Backtracker.h>

Public Member Functions

 Backtracker ()
 
 Backtracker (const TreeManager *tm)
 
void FillMaps ()
 
const vector< UInt_t > * GTruthToG4Particles (const UInt_t &itruth) const
 
const vector< UInt_t > * GTruthToTracks (const UInt_t &itruth) const
 
UInt_t const G4ParticleToGTruth (const UInt_t &ig4p) const
 
const vector< UInt_t > * G4ParticleToTracks (const UInt_t &ig4p) const
 
UInt_t const TrackToGTruth (const UInt_t &itrk) const
 
const vector< UInt_t > * TrackToG4Particles (const UInt_t &itrk) const
 
const vector< pair< UInt_t, float > > TrackToG4ParticlesDeposits (const UInt_t &itrk) const
 
UInt_t const TrackToG4Particle (const UInt_t &itrk) const
 
const pair< UInt_t, float > TrackToG4ParticleDeposit (const UInt_t &itrk) const
 
UInt_t const VertexToGTruth (const UInt_t &ivtx) const
 
UInt_t const GTruthToVertex (const UInt_t &ivtx) const
 
const vector< UInt_t > * VertexToG4Particles (const UInt_t &ivtx) const
 
const vector< UInt_t > * G4ParticleToVertices (const UInt_t &ig4p) const
 
UInt_t const VeeToGTruth (const UInt_t &ivee) const
 
UInt_t const GTruthToVee (const UInt_t &ivee) const
 
const vector< UInt_t > * VeeToG4Particles (const UInt_t &ivee) const
 
UInt_t const G4ParticleToVee (const UInt_t &ig4p) const
 
const vector< UInt_t > * TrackToVertices (const UInt_t &itrk) const
 
const vector< UInt_t > * VertexToTracks (const UInt_t &ivtx) const
 
const vector< UInt_t > * TrackToVees (const UInt_t &itrk) const
 
const vector< UInt_t > * VeeToTracks (const UInt_t &ivee) const
 
const vector< UInt_t > * TrackToCalClusters (const UInt_t &itrk) const
 
const vector< UInt_t > * CalClusterToTracks (const UInt_t &itrk) const
 
const vector< UInt_t > * G4PToCalClusters (const UInt_t &itrk) const
 
const vector< UInt_t > * CalClusterToG4Ps (const UInt_t &itrk) const
 

Public Attributes

float ASSN_THRESHOLD = 0.5
 fraction of total associated energy contributed to reco object a particle must constitute to be considered associated More...
 

Private Member Functions

template<class T >
bool CheckRange (const map< UInt_t, T > &m, const UInt_t &i) const
 
void Clear ()
 

Private Attributes

const TreeManagerfTM = nullptr
 
G4Treeg4 = nullptr
 
RecoTreerec = nullptr
 
map< UInt_t, vector< UInt_t > > fGTruthToG4Particles
 
map< UInt_t, UInt_t > fG4ParticleToGTruth
 
map< UInt_t, vector< UInt_t > > fGTruthToTracks
 
map< UInt_t, UInt_t > fTrackToGTruth
 
map< UInt_t, vector< UInt_t > > fTrackToG4Particles
 
map< UInt_t, UInt_t > fTrackToG4Particle
 
map< UInt_t, vector< UInt_t > > fG4ParticleToTracks
 
map< UInt_t, vector< UInt_t > > fG4ParticleToVertices
 
map< UInt_t, vector< UInt_t > > fVertexToG4Particles
 
map< UInt_t, UInt_t > fVertexToGTruth
 
map< UInt_t, UInt_t > fGTruthToVertex
 
map< UInt_t, vector< UInt_t > > fVeeToG4Particles
 
map< UInt_t, UInt_t > fG4ParticleToVee
 
map< UInt_t, UInt_t > fVeeToGTruth
 
map< UInt_t, UInt_t > fGTruthToVee
 
map< UInt_t, vector< UInt_t > > fTrackToVertices
 
map< UInt_t, vector< UInt_t > > fVertexToTracks
 
map< UInt_t, vector< UInt_t > > fVeeToTracks
 
map< UInt_t, vector< UInt_t > > fTrackToVees
 
map< UInt_t, vector< UInt_t > > fCaloClusterToTracks
 
map< UInt_t, vector< UInt_t > > fTrackToCaloClusters
 
map< UInt_t, vector< UInt_t > > fCaloClusterToG4Ps
 
map< UInt_t, vector< UInt_t > > fG4PToCaloClusters
 

Detailed Description

Definition at line 30 of file Backtracker.h.

Constructor & Destructor Documentation

garana::Backtracker::Backtracker ( )
inline

Definition at line 33 of file Backtracker.h.

33 {}
garana::Backtracker::Backtracker ( const TreeManager tm)
inline

Definition at line 34 of file Backtracker.h.

34 : fTM(tm) {}
tm
Definition: demo.py:21
const TreeManager * fTM
Definition: Backtracker.h:74

Member Function Documentation

const vector< UInt_t > * Backtracker::CalClusterToG4Ps ( const UInt_t &  itrk) const

Definition at line 232 of file Backtracker.cxx.

232  {
233  if(CheckRange(fCaloClusterToG4Ps, icluster)) {
234  return &fCaloClusterToG4Ps.at(icluster);
235  }
236  else {
237  return new vector<UInt_t>();
238  }
239 }//
bool CheckRange(const map< UInt_t, T > &m, const UInt_t &i) const
map< UInt_t, vector< UInt_t > > fCaloClusterToG4Ps
Definition: Backtracker.h:108
const vector< UInt_t > * Backtracker::CalClusterToTracks ( const UInt_t &  itrk) const

Definition at line 214 of file Backtracker.cxx.

214  {
215  if(CheckRange(fCaloClusterToTracks, icluster)) {
216  return &fCaloClusterToTracks.at(icluster);
217  }
218  else {
219  return new vector<UInt_t>();
220  }
221 }//
map< UInt_t, vector< UInt_t > > fCaloClusterToTracks
Definition: Backtracker.h:106
bool CheckRange(const map< UInt_t, T > &m, const UInt_t &i) const
template<class T >
bool Backtracker::CheckRange ( const map< UInt_t, T > &  m,
const UInt_t &  i 
) const
private

Definition at line 415 of file Backtracker.cxx.

415  {
416 
417  try {
418  if(m.find(i)==m.end())
419  throw(i);
420  return true;
421  }
422  catch(UInt_t i){
423  //cerr << "ERROR Backtracker: map index not found" << endl;
424  return false;
425  }
426 }
void Backtracker::Clear ( )
private

Definition at line 428 of file Backtracker.cxx.

428  {
429 
430  //gen = nullptr;
431  g4 = nullptr;
432  //det = nullptr;
433  rec = nullptr;
434 
435  fGTruthToG4Particles.clear();
436  fG4ParticleToGTruth.clear();
437  fGTruthToTracks.clear();
438  fTrackToGTruth.clear();
439  fTrackToG4Particles.clear();
440  fTrackToG4Particle.clear();
441  fG4ParticleToTracks.clear();
442  //fFSParticleToG4Particles.clear();
443  //fG4ParticleToFSParticle.clear();
444  fVertexToGTruth.clear();
445  fGTruthToVertex.clear();
446  fG4ParticleToVertices.clear();
447  fVertexToG4Particles.clear();
448  fVertexToGTruth.clear();
449  fGTruthToVertex.clear();
450  fVeeToG4Particles.clear();
451  fG4ParticleToVee.clear();
452  fVeeToGTruth.clear();
453  fGTruthToVee.clear();
454  fTrackToVertices.clear();
455  fVertexToTracks.clear();
456  fVeeToTracks.clear();
457  fTrackToVees.clear();
458  fCaloClusterToTracks.clear();
459  fTrackToCaloClusters.clear();
460  fCaloClusterToG4Ps.clear();
461  fG4PToCaloClusters.clear();
462 }
map< UInt_t, vector< UInt_t > > fVertexToTracks
Definition: Backtracker.h:103
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
map< UInt_t, vector< UInt_t > > fVertexToG4Particles
Definition: Backtracker.h:94
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
map< UInt_t, vector< UInt_t > > fCaloClusterToG4Ps
Definition: Backtracker.h:108
void Backtracker::FillMaps ( )

Definition at line 242 of file Backtracker.cxx.

242  {
243 
244  //cout << "In FillMaps..." << endl;
245  Clear();
246  //GenTree* gen = nullptr;
247  //g4 = nullptr;
248  //DetTree* det = nullptr;
249  //rec = nullptr;
250 
251  //cout << "get trees" << endl;
252  //if(fTM->IsActiveGenTree()) gen = fTM->GetGenTree();
253  if(fTM->IsActiveG4Tree()) g4 = fTM->GetG4Tree();
254  //if(fTM->IsActiveDetTree()) det = fTM->GetDetTree();
255  if(fTM->IsActiveRecTree()) rec = fTM->GetRecoTree();
256 
257  //cout << "checking which are active..." << endl;
258  if(fTM->IsActiveG4Tree()){
259  //cout << "g4Tree is active" << endl;
260 
261  for(UInt_t ig4p=0; ig4p<g4->NSim(); ig4p++) {
262  fG4ParticleToTracks[ig4p] = {};
263  }
264 
265  if(fTM->IsActiveRecTree()){
266  //cout << "recoTree is active" << endl;
267  for(UInt_t itrk = 0; itrk<rec->NTrack(); itrk++ ) {
268 
269  //if(rec->TrackMaxDepositFrac(itrk)<ASSN_THRESHOLD) continue;
270 
271  //vector<UInt_t> tmpindices;
272  //cout << "call GetTrackG4PIndices" << endl;
274  //cout << "get match ID" << endl;
275  int matchid = rec->TrackTrkIdMaxDeposit(itrk);
276  //cout << "track matched to " << fTrackToG4Particles[itrk].size() << " G4 particle(s)" << endl;
277 
278  //cout << "point i" << endl;
280  //cout << "track deposit fraction too low (" << rec->TrackMaxDepositFrac(itrk)
281  // << ")...skipping to next track" << endl;
282  continue;
283  }//should this be considered an association?
284 
285  //cout << "point ii" << endl;
286  for(UInt_t ig4p=0; ig4p<fTrackToG4Particles[itrk].size(); ig4p++){
287  //for(UInt_t ig4p=0; ig4p<tmpindices.size(); ig4p++){
288 
289  if(fG4ParticleToTracks.find(fTrackToG4Particles[itrk][ig4p]) != fG4ParticleToTracks.end()) {
290 
291  //fTrackToG4Particles[itrk][ig4p] = tmpindices[ig4p];
292  //if(fG4ParticleToTracks.find(tmpindices[ig4p]) != fG4ParticleToTracks.end() && //){
293  //if(g4->TrackID(tmpindices[ig4p]) == matchid ) {
294  if(g4->TrackID(fTrackToG4Particles[itrk][ig4p]) == matchid ) {
295  //cout << "found match id" << endl;
296  fTrackToG4Particle[itrk] = ig4p;
297  fG4ParticleToTracks[ig4p].push_back(itrk);
298  break;
299  } //if match id matches g4particle ID
300  }//if G4Particle index is in map
301  }//for all matched particles to this track
302 
303  //cout << "point iii" << endl;
304  // for(UInt_t ig4p=0; ig4p<g4->NSim(); ig4p++) {
305  // if(fG4ParticleToTracks[ig4p].size() == 0) continue;
306  // cout << "G4particle " << ig4p << " matched to " << fG4ParticleToTracks[ig4p].size()
307  // << " reco track(s)" << endl;
308  // }//for all g4Particles
309  }//for tracks
310  }//if recoTree active
311  }//if g4Tree active
312 
313  //cout << "point 1" << endl;
314 
315  if(fTM->IsActiveGenTree()){
316 
317  // cout << "genTree is active" << endl;
318 
319  if(fTM->IsActiveG4Tree()){
320 
321  //G4 particles
322  for(UInt_t ig4 = 0; ig4<g4->NSim(); ig4++ ) {
323  fG4ParticleToGTruth[ig4] = g4->GetTruthIndex(ig4);
324  fGTruthToG4Particles[ fG4ParticleToGTruth[ig4] ].push_back(ig4);
325 
326  //fG4ParticleToFSParticle[ig4] //map< UInt_t, UInt_t >
327  //fFSParticleToG4Particles //map< UInt_t, vector<UInt_t> >
328 
329  }//endfor g4 particles
330  }//endif g4tree
331 
332  // cout << "point 2" << endl;
333 
334  if(fTM->IsActiveRecTree()){
335 
336  //tracks
337  for(UInt_t itrk=0; itrk<rec->NTrack(); itrk++ ) {
338  // cout << "point 2i" << endl;
339  //cout << "fTrackToG4Particles[itrk][0] = " << fTrackToG4Particles[itrk][0] << endl;
340  //cout << "fG4ParticleToGTruth[ fTrackToG4Particles[itrk][0] ] = " << fG4ParticleToGTruth[ fTrackToG4Particles[itrk][0] ] << endl;
341  if(fTrackToG4Particles[itrk].size()==0) continue;
342  fTrackToGTruth[itrk] = fG4ParticleToGTruth[ fTrackToG4Particles[itrk][0] ]; //TODO select truth with most associated energy
343  // cout << "point 2ii" << endl;
344  fGTruthToTracks[ fTrackToGTruth[itrk] ].push_back(itrk);
345  // cout << "point 2iii" << endl;
346  }//endfor tracks
347 
348  // cout << "point 2a" << endl;
349 
350  //vertices
351  for(UInt_t ivtx=0; ivtx<rec->NVertex(); ivtx++ ) {
353  for(UInt_t itrk=0; itrk<fVertexToTracks[ivtx].size(); itrk++) {
354  fTrackToVertices[ fVertexToTracks[ivtx][itrk] ].push_back(ivtx);
355 
356  for(UInt_t ig4p=0; ig4p<fTrackToG4Particles[fVertexToTracks[ivtx][itrk]].size(); ig4p++) {
357  fVertexToG4Particles[ivtx].push_back( fTrackToG4Particles[ fVertexToTracks[ivtx][itrk] ][ig4p] );
358  fG4ParticleToVertices[ fVertexToG4Particles[ivtx].back() ].push_back(ivtx);
359  }// for g4Particles
360  }// for tracks
361  // cout << "point 2b" << endl;
362  fVertexToGTruth[ivtx] = fTrackToGTruth[ fVertexToTracks[ivtx][0] ];//TODO you sure all tracks associated with vertex associated with same GTruth?
363  fGTruthToVertex[ fVertexToGTruth[ivtx] ] = ivtx;
364  }//endfor vertices
365 
366  // cout << "point 3" << endl;
367 
368  //vees
369  for(UInt_t ivee=0; ivee<rec->NVee(); ivee++){
370 
371  rec->GetVeeTrackIndices(ivee, fVeeToTracks[ivee]);
372 
373  for(UInt_t itrk=0; itrk<fVeeToTracks[ivee].size(); itrk++){
374 
375  fTrackToVees[ fVeeToTracks[ivee][itrk] ].push_back(ivee);
376 
377  for(UInt_t ig4p=0; ig4p<fTrackToG4Particles[ fVeeToTracks[ivee][itrk] ].size(); ig4p++) {
378  fVeeToG4Particles[ivee].push_back(fTrackToG4Particles[ fVeeToTracks[ivee][itrk] ][ig4p]);
379  fG4ParticleToVee[fVeeToG4Particles[ivee].back()] = ivee;
380  }
381  }// for tracks
382 
383  fVeeToGTruth[ivee] = fTrackToGTruth[ fVeeToTracks[ivee][0] ];//TODO you sure all tracks associated with vee associated with same GTruth?
384  fGTruthToVee[ fVeeToGTruth[ivee] ] = ivee;
385  }//endfor vees
386 
387  // cout << "point 4" << endl;
388 
389  //ECal clusters
390  for(UInt_t iclust=0; iclust<rec->NCalCluster(); iclust++){
391 
393 
394  for(UInt_t itrk=0; itrk<fCaloClusterToTracks[iclust].size(); itrk++){
395  fTrackToCaloClusters[ fCaloClusterToTracks[iclust][itrk] ].push_back(iclust);
396  }
397 
399 
400  for(UInt_t ig4p=0; ig4p<fCaloClusterToG4Ps[iclust].size(); ig4p++){
401  fG4PToCaloClusters[ fCaloClusterToG4Ps[iclust][ig4p] ].push_back(iclust);
402  }
403  }//for clusters
404 
405  // cout << "point 5" << endl;
406 
407  }//endif recotree
408  }//if gentree
409 
410  //cout << "at end of FillMaps()" << endl;
411 
412 }//end FillMaps()
map< UInt_t, vector< UInt_t > > fVertexToTracks
Definition: Backtracker.h:103
virtual const int TrackID(const UInt_t &iparticle) const =0
G4 track ID (can be <0 if it fell below trking threshold)
virtual const UInt_t NSim() const =0
number of particles
map< UInt_t, vector< UInt_t > > fG4PToCaloClusters
Definition: Backtracker.h:109
void GetTrackG4PIndices(const size_t &itrk, vector< UInt_t > &ig4ps) const
given a track index, fill a given vector with matched G4 particle indices
Definition: RecoTree.cxx:22
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
map< UInt_t, vector< UInt_t > > fVertexToG4Particles
Definition: Backtracker.h:94
virtual const size_t NVertex() const =0
number of vertices in this event
void GetCalClusterTrackIndices(const size_t &iclust, vector< UInt_t > &itracks) const
given a calocluster index, fill a given vector with matched track indices
Definition: RecoTree.cxx:35
void GetVertexTrackIndices(const size_t &ivtx, vector< UInt_t > &itracks) const
given a vertex index, fill a given vector with matched track indices
Definition: RecoTree.cxx:27
map< UInt_t, vector< UInt_t > > fTrackToVees
Definition: Backtracker.h:105
virtual const int TrackTrkIdMaxDeposit(const size_t &itrack) const =0
trackID of the MCParticle depositing the most energy in ith cluster
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
map< UInt_t, UInt_t > fGTruthToVee
Definition: Backtracker.h:100
map< UInt_t, vector< UInt_t > > fVeeToTracks
Definition: Backtracker.h:104
bool IsActiveG4Tree() const
Definition: TreeManager.h:62
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
void GetVeeTrackIndices(const size_t &ivee, vector< UInt_t > &itracks) const
given a vee index, fill a given vector with matched G4 particle indices
Definition: RecoTree.cxx:31
const TreeManager * fTM
Definition: Backtracker.h:74
map< UInt_t, UInt_t > fGTruthToVertex
Definition: Backtracker.h:96
map< UInt_t, vector< UInt_t > > fG4ParticleToVertices
Definition: Backtracker.h:93
virtual const size_t NTrack() const =0
number of tracks in this event
map< UInt_t, UInt_t > fVeeToGTruth
Definition: Backtracker.h:99
bool IsActiveGenTree() const
Definition: TreeManager.h:61
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
void GetCalClusterG4Indices(const size_t &iclust, vector< UInt_t > &ig4ps) const
given a calocluster index, fill a given vector with matched G4Particle indices
Definition: RecoTree.cxx:39
map< UInt_t, UInt_t > fG4ParticleToVee
Definition: Backtracker.h:98
G4Tree * GetG4Tree() const
virtual const size_t NCalCluster() const =0
number of ECal clusters in this event
map< UInt_t, vector< UInt_t > > fTrackToCaloClusters
Definition: Backtracker.h:107
RecoTree * GetRecoTree() const
UInt_t const GetTruthIndex(UInt_t iparticle) const
index in gen tree subentry to truth match to this
Definition: G4Tree.cxx:12
map< UInt_t, vector< UInt_t > > fGTruthToTracks
Definition: Backtracker.h:85
virtual const size_t NVee() const =0
number of vees in this event
bool IsActiveRecTree() const
Definition: TreeManager.h:64
map< UInt_t, UInt_t > fTrackToGTruth
Definition: Backtracker.h:86
const float TrackMaxDepositFrac(const size_t &itrack) const
largest fraction of total energy contributed by single MCParticle
Definition: RecoTree.cxx:17
float ASSN_THRESHOLD
fraction of total associated energy contributed to reco object a particle must constitute to be consi...
Definition: Backtracker.h:70
map< UInt_t, vector< UInt_t > > fCaloClusterToG4Ps
Definition: Backtracker.h:108
UInt_t const Backtracker::G4ParticleToGTruth ( const UInt_t &  ig4p) const

Definition at line 32 of file Backtracker.cxx.

32  {
33 
34  if(CheckRange(fG4ParticleToGTruth, ig4p)) {
35  return fG4ParticleToGTruth.at(ig4p);
36  }
37  else {
38  return UINT_MAX;
39  }
40 }
map< UInt_t, UInt_t > fG4ParticleToGTruth
Definition: Backtracker.h:84
bool CheckRange(const map< UInt_t, T > &m, const UInt_t &i) const
const vector< UInt_t > * Backtracker::G4ParticleToTracks ( const UInt_t &  ig4p) const

Definition at line 42 of file Backtracker.cxx.

42  {
43 
44  if(CheckRange(fG4ParticleToTracks, ig4p)) {
45  return &fG4ParticleToTracks.at(ig4p);
46  }
47  else {
48  return new vector<UInt_t>();
49  }
50 }
map< UInt_t, vector< UInt_t > > fG4ParticleToTracks
Definition: Backtracker.h:89
bool CheckRange(const map< UInt_t, T > &m, const UInt_t &i) const
UInt_t const Backtracker::G4ParticleToVee ( const UInt_t &  ig4p) const

Definition at line 168 of file Backtracker.cxx.

168  {
169  return fG4ParticleToVee.at(ig4p);
170 }
map< UInt_t, UInt_t > fG4ParticleToVee
Definition: Backtracker.h:98
const vector< UInt_t > * Backtracker::G4ParticleToVertices ( const UInt_t &  ig4p) const

Definition at line 145 of file Backtracker.cxx.

145  {
146  if(CheckRange(fG4ParticleToVertices, ig4p)) {
147  return &fG4ParticleToVertices.at(ig4p);
148  }
149  else {
150  return new vector<UInt_t>();
151  }
152 }
map< UInt_t, vector< UInt_t > > fG4ParticleToVertices
Definition: Backtracker.h:93
bool CheckRange(const map< UInt_t, T > &m, const UInt_t &i) const
const vector< UInt_t > * Backtracker::G4PToCalClusters ( const UInt_t &  itrk) const

Definition at line 223 of file Backtracker.cxx.

223  {
224  if(CheckRange(fG4PToCaloClusters, ig4p)) {
225  return &fG4PToCaloClusters.at(ig4p);
226  }
227  else {
228  return new vector<UInt_t>();
229  }
230 }//
map< UInt_t, vector< UInt_t > > fG4PToCaloClusters
Definition: Backtracker.h:109
bool CheckRange(const map< UInt_t, T > &m, const UInt_t &i) const
const vector< UInt_t > * Backtracker::GTruthToG4Particles ( const UInt_t &  itruth) const

Definition at line 13 of file Backtracker.cxx.

13  {
14  if(CheckRange(fGTruthToG4Particles, itruth)) {
15  return &fGTruthToG4Particles.at(itruth);
16  }
17  else {
18  return new vector<UInt_t>();
19  }
20 }
map< UInt_t, vector< UInt_t > > fGTruthToG4Particles
Definition: Backtracker.h:83
bool CheckRange(const map< UInt_t, T > &m, const UInt_t &i) const
const vector< UInt_t > * Backtracker::GTruthToTracks ( const UInt_t &  itruth) const

Definition at line 21 of file Backtracker.cxx.

21  {
22  if(CheckRange(fGTruthToTracks, itruth)) {
23  return &fGTruthToTracks.at(itruth);
24  }
25  else {
26  return new vector<UInt_t>();
27  }
28 }
map< UInt_t, vector< UInt_t > > fGTruthToTracks
Definition: Backtracker.h:85
bool CheckRange(const map< UInt_t, T > &m, const UInt_t &i) const
UInt_t const Backtracker::GTruthToVee ( const UInt_t &  ivee) const

Definition at line 157 of file Backtracker.cxx.

157  {
158  return fGTruthToVee.at(itruth);
159 }
map< UInt_t, UInt_t > fGTruthToVee
Definition: Backtracker.h:100
UInt_t const Backtracker::GTruthToVertex ( const UInt_t &  ivtx) const

Definition at line 127 of file Backtracker.cxx.

127  {
128  if(CheckRange(fGTruthToVertex, itruth)) {
129  return fGTruthToVertex.at(itruth);
130  }
131  else {
132  return UINT_MAX;
133  }
134 }
map< UInt_t, UInt_t > fGTruthToVertex
Definition: Backtracker.h:96
bool CheckRange(const map< UInt_t, T > &m, const UInt_t &i) const
const vector< UInt_t > * Backtracker::TrackToCalClusters ( const UInt_t &  itrk) const

Definition at line 205 of file Backtracker.cxx.

205  {
206  if(CheckRange(fTrackToCaloClusters, itrk)) {
207  return &fTrackToCaloClusters.at(itrk);
208  }
209  else {
210  return new vector<UInt_t>();
211  }
212 }
map< UInt_t, vector< UInt_t > > fTrackToCaloClusters
Definition: Backtracker.h:107
bool CheckRange(const map< UInt_t, T > &m, const UInt_t &i) const
UInt_t const Backtracker::TrackToG4Particle ( const UInt_t &  itrk) const

Definition at line 94 of file Backtracker.cxx.

94  {
95  if(CheckRange(fTrackToG4Particle, itrk)) {
96  return fTrackToG4Particle.at(itrk);
97  }
98  else {
99  return UINT_MAX;
100  }
101 }
map< UInt_t, UInt_t > fTrackToG4Particle
Definition: Backtracker.h:88
bool CheckRange(const map< UInt_t, T > &m, const UInt_t &i) const
const pair< UInt_t, float > Backtracker::TrackToG4ParticleDeposit ( const UInt_t &  itrk) const

Definition at line 103 of file Backtracker.cxx.

103  {
104 
105  int trkidMax = rec->TrackTrkIdMaxDeposit(itrk);
106  auto ig4ps = TrackToG4Particles(itrk);
107  map<int,UInt_t> trackIdToig4; // Geant4 trackID to G4Particle index
108 
109  for(auto const& ig4p : *ig4ps){
110  trackIdToig4[g4->TrackID(ig4p)] = ig4p;
111  }
112 
113  const pair<UInt_t,float> outpair(trackIdToig4[trkidMax],rec->TrackMaxDeposit(itrk));
114  return outpair;
115 
116 }
virtual const int TrackID(const UInt_t &iparticle) const =0
G4 track ID (can be <0 if it fell below trking threshold)
const vector< UInt_t > * TrackToG4Particles(const UInt_t &itrk) const
Definition: Backtracker.cxx:65
virtual const int TrackTrkIdMaxDeposit(const size_t &itrack) const =0
trackID of the MCParticle depositing the most energy in ith cluster
ig4ps
Definition: tracks.py:192
virtual const float TrackMaxDeposit(const size_t &itrack) const =0
maximum true deposited energy from a single MCParticle
const vector< UInt_t > * Backtracker::TrackToG4Particles ( const UInt_t &  itrk) const

Definition at line 65 of file Backtracker.cxx.

65  {
66  if(CheckRange(fTrackToG4Particles, itrk)) {
67  return &fTrackToG4Particles.at(itrk);
68  }
69  else {
70  return new vector<UInt_t>();
71  }
72 }
map< UInt_t, vector< UInt_t > > fTrackToG4Particles
Definition: Backtracker.h:87
bool CheckRange(const map< UInt_t, T > &m, const UInt_t &i) const
const vector< pair< UInt_t, float > > Backtracker::TrackToG4ParticlesDeposits ( const UInt_t &  itrk) const

Definition at line 74 of file Backtracker.cxx.

74  {
75 
76  vector<pair<UInt_t,float>> outvec;
77  auto ig4ps = TrackToG4Particles(itrk);
78  auto iddeps = rec->TrackTrueDeposits(itrk);
79 
80  map<int,UInt_t> trackIdToig4; // Geant4 trackID to G4Particle index
81  for(auto const& ig4p : *ig4ps){
82  trackIdToig4[g4->TrackID(ig4p)] = ig4p;
83  }
84 
85 
86  for( auto const& iddep : *iddeps) {
87  outvec.push_back(make_pair(trackIdToig4[iddep.first],iddep.second));
88  }
89 
90  return outvec;
91 
92 }
virtual const vector< pair< int, float > > * TrackTrueDeposits(const size_t &itrack) const =0
virtual const int TrackID(const UInt_t &iparticle) const =0
G4 track ID (can be <0 if it fell below trking threshold)
const vector< UInt_t > * TrackToG4Particles(const UInt_t &itrk) const
Definition: Backtracker.cxx:65
ig4ps
Definition: tracks.py:192
UInt_t const Backtracker::TrackToGTruth ( const UInt_t &  itrk) const

Definition at line 55 of file Backtracker.cxx.

55  {
56 
57  if(CheckRange(fTrackToGTruth, itrk)) {
58  return fTrackToGTruth.at(itrk);
59  }
60  else {
61  return UINT_MAX;
62  }
63 }
map< UInt_t, UInt_t > fTrackToGTruth
Definition: Backtracker.h:86
bool CheckRange(const map< UInt_t, T > &m, const UInt_t &i) const
const vector< UInt_t > * Backtracker::TrackToVees ( const UInt_t &  itrk) const

Definition at line 188 of file Backtracker.cxx.

188  {
189  if(CheckRange(fTrackToVees, itrk)) {
190  return &fTrackToVees.at(itrk);
191  }
192  else {
193  return new vector<UInt_t>();
194  }
195 }
map< UInt_t, vector< UInt_t > > fTrackToVees
Definition: Backtracker.h:105
bool CheckRange(const map< UInt_t, T > &m, const UInt_t &i) const
const vector< UInt_t > * Backtracker::TrackToVertices ( const UInt_t &  itrk) const

Definition at line 172 of file Backtracker.cxx.

172  {
173  if(CheckRange(fTrackToVertices, itrk)) {
174  return &fTrackToVertices.at(itrk);
175  }
176  else {
177  return new vector<UInt_t>();
178  }
179 }
map< UInt_t, vector< UInt_t > > fTrackToVertices
Definition: Backtracker.h:102
bool CheckRange(const map< UInt_t, T > &m, const UInt_t &i) const
const vector< UInt_t > * Backtracker::VeeToG4Particles ( const UInt_t &  ivee) const

Definition at line 160 of file Backtracker.cxx.

160  {
161  if(CheckRange(fVeeToG4Particles, ivee)) {
162  return &fVeeToG4Particles.at(ivee);
163  }
164  else {
165  return new vector<UInt_t>();
166  }
167 }
map< UInt_t, vector< UInt_t > > fVeeToG4Particles
Definition: Backtracker.h:97
bool CheckRange(const map< UInt_t, T > &m, const UInt_t &i) const
UInt_t const Backtracker::VeeToGTruth ( const UInt_t &  ivee) const

Definition at line 154 of file Backtracker.cxx.

154  {
155  return fVeeToGTruth.at(ivee);
156 }
map< UInt_t, UInt_t > fVeeToGTruth
Definition: Backtracker.h:99
const vector< UInt_t > * Backtracker::VeeToTracks ( const UInt_t &  ivee) const

Definition at line 196 of file Backtracker.cxx.

196  {
197  if(CheckRange(fVeeToTracks, ivee)) {
198  return &fVeeToTracks.at(ivee);
199  }
200  else {
201  return new vector<UInt_t>();
202  }
203 }
map< UInt_t, vector< UInt_t > > fVeeToTracks
Definition: Backtracker.h:104
bool CheckRange(const map< UInt_t, T > &m, const UInt_t &i) const
const vector< UInt_t > * Backtracker::VertexToG4Particles ( const UInt_t &  ivtx) const

Definition at line 136 of file Backtracker.cxx.

136  {
137  if(CheckRange(fVertexToG4Particles, ivtx)) {
138  return &fVertexToG4Particles.at(ivtx);
139  }
140  else {
141  return new vector<UInt_t>();
142  }
143 }
map< UInt_t, vector< UInt_t > > fVertexToG4Particles
Definition: Backtracker.h:94
bool CheckRange(const map< UInt_t, T > &m, const UInt_t &i) const
UInt_t const Backtracker::VertexToGTruth ( const UInt_t &  ivtx) const

Definition at line 118 of file Backtracker.cxx.

118  {
119  if(CheckRange(fVertexToGTruth, ivtx)) {
120  return fVertexToGTruth.at(ivtx);
121  }
122  else {
123  return UINT_MAX;
124  }
125 }
map< UInt_t, UInt_t > fVertexToGTruth
Definition: Backtracker.h:95
bool CheckRange(const map< UInt_t, T > &m, const UInt_t &i) const
const vector< UInt_t > * Backtracker::VertexToTracks ( const UInt_t &  ivtx) const

Definition at line 180 of file Backtracker.cxx.

180  {
181  if(CheckRange(fVertexToTracks, ivtx)) {
182  return &fVertexToTracks.at(ivtx);
183  }
184  else {
185  return new vector<UInt_t>();
186  }
187 }
map< UInt_t, vector< UInt_t > > fVertexToTracks
Definition: Backtracker.h:103
bool CheckRange(const map< UInt_t, T > &m, const UInt_t &i) const

Member Data Documentation

float garana::Backtracker::ASSN_THRESHOLD = 0.5

fraction of total associated energy contributed to reco object a particle must constitute to be considered associated

Definition at line 70 of file Backtracker.h.

map< UInt_t, vector<UInt_t> > garana::Backtracker::fCaloClusterToG4Ps
private

Definition at line 108 of file Backtracker.h.

map< UInt_t, vector<UInt_t> > garana::Backtracker::fCaloClusterToTracks
private

Definition at line 106 of file Backtracker.h.

map< UInt_t, UInt_t > garana::Backtracker::fG4ParticleToGTruth
private

Definition at line 84 of file Backtracker.h.

map< UInt_t, vector<UInt_t> > garana::Backtracker::fG4ParticleToTracks
private

Definition at line 89 of file Backtracker.h.

map< UInt_t, UInt_t > garana::Backtracker::fG4ParticleToVee
private

Definition at line 98 of file Backtracker.h.

map< UInt_t, vector<UInt_t> > garana::Backtracker::fG4ParticleToVertices
private

Definition at line 93 of file Backtracker.h.

map< UInt_t, vector<UInt_t> > garana::Backtracker::fG4PToCaloClusters
private

Definition at line 109 of file Backtracker.h.

map< UInt_t, vector<UInt_t> > garana::Backtracker::fGTruthToG4Particles
private

Definition at line 83 of file Backtracker.h.

map< UInt_t, vector<UInt_t> > garana::Backtracker::fGTruthToTracks
private

Definition at line 85 of file Backtracker.h.

map< UInt_t, UInt_t > garana::Backtracker::fGTruthToVee
private

Definition at line 100 of file Backtracker.h.

map< UInt_t, UInt_t > garana::Backtracker::fGTruthToVertex
private

Definition at line 96 of file Backtracker.h.

const TreeManager* garana::Backtracker::fTM = nullptr
private

Definition at line 74 of file Backtracker.h.

map< UInt_t, vector<UInt_t> > garana::Backtracker::fTrackToCaloClusters
private

Definition at line 107 of file Backtracker.h.

map< UInt_t, UInt_t > garana::Backtracker::fTrackToG4Particle
private

Definition at line 88 of file Backtracker.h.

map< UInt_t, vector<UInt_t> > garana::Backtracker::fTrackToG4Particles
private

Definition at line 87 of file Backtracker.h.

map< UInt_t, UInt_t > garana::Backtracker::fTrackToGTruth
private

Definition at line 86 of file Backtracker.h.

map< UInt_t, vector<UInt_t> > garana::Backtracker::fTrackToVees
private

Definition at line 105 of file Backtracker.h.

map< UInt_t, vector<UInt_t> > garana::Backtracker::fTrackToVertices
private

Definition at line 102 of file Backtracker.h.

map< UInt_t, vector<UInt_t> > garana::Backtracker::fVeeToG4Particles
private

Definition at line 97 of file Backtracker.h.

map< UInt_t, UInt_t> garana::Backtracker::fVeeToGTruth
private

Definition at line 99 of file Backtracker.h.

map< UInt_t, vector<UInt_t> > garana::Backtracker::fVeeToTracks
private

Definition at line 104 of file Backtracker.h.

map< UInt_t, vector<UInt_t> > garana::Backtracker::fVertexToG4Particles
private

Definition at line 94 of file Backtracker.h.

map< UInt_t, UInt_t > garana::Backtracker::fVertexToGTruth
private

Definition at line 95 of file Backtracker.h.

map< UInt_t, vector<UInt_t> > garana::Backtracker::fVertexToTracks
private

Definition at line 103 of file Backtracker.h.

G4Tree* garana::Backtracker::g4 = nullptr
private

Definition at line 76 of file Backtracker.h.

RecoTree* garana::Backtracker::rec = nullptr
private

Definition at line 78 of file Backtracker.h.


The documentation for this class was generated from the following files: