All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | List of all members
truth::MCTruthEmEveIdCalculator Class Reference

#include <MCTruthEmEveIdCalculator.h>

Inheritance diagram for truth::MCTruthEmEveIdCalculator:
truth::MCTruthEveIdCalculator

Public Member Functions

 MCTruthEmEveIdCalculator ()
 
virtual ~MCTruthEmEveIdCalculator ()
 
- Public Member Functions inherited from truth::MCTruthEveIdCalculator
 MCTruthEveIdCalculator ()
 Constructor and destructor. More...
 
virtual ~MCTruthEveIdCalculator ()
 
void Init (const MCTruthParticleList *list)
 Initialize this calculator for a particular ParticleList. More...
 
const MCTruthParticleListParticleList () const
 
int CalculateEveId (const int trackID)
 

Private Member Functions

virtual int DoCalculateEveId (const int trackID)
 

Additional Inherited Members

- Protected Attributes inherited from truth::MCTruthEveIdCalculator
const MCTruthParticleListm_particleList
 

Detailed Description

Definition at line 69 of file MCTruthEmEveIdCalculator.h.

Constructor & Destructor Documentation

truth::MCTruthEmEveIdCalculator::MCTruthEmEveIdCalculator ( )
inline

Definition at line 73 of file MCTruthEmEveIdCalculator.h.

74  : MCTruthEveIdCalculator() // Make sure the parent class constructor is called
75  {}
MCTruthEveIdCalculator()
Constructor and destructor.
virtual truth::MCTruthEmEveIdCalculator::~MCTruthEmEveIdCalculator ( )
inlinevirtual

Definition at line 76 of file MCTruthEmEveIdCalculator.h.

76 {}

Member Function Documentation

int truth::MCTruthEmEveIdCalculator::DoCalculateEveId ( const int  trackID)
privatevirtual

This is the core method to calculate the eve ID. If another class is going to override the default calculation, this the method that must be implemented.

Reimplemented from truth::MCTruthEveIdCalculator.

Definition at line 29 of file MCTruthEmEveIdCalculator.cxx.

30  {
31  // Almost any eve ID calculation will use this: Get the entire
32  // history of the particle and its ancestors in the simulated
33  // event. (m_particleList is defined in EveIdCalculator.h)
34  const MCTruthParticleHistory particleHistory( m_particleList, trackID );
35 
36  // You can treat particleHistory like an array, and do something
37  // like:
38 
39  // for ( int i = particleHistory.size(); i >= 0; --i )
40  // { const simb::MCParticle* particle = particleHistory[i]; ... }
41 
42  // But we know how to use the Standard Template Library (Yes, you
43  // do! Don't doubt yourself!) so let's treat particleHistory in
44  // the most efficient manner, as an STL container. We want to scan
45  // the container from its last element to its first, from the base
46  // of the particle production chain towards the primary particle.
47 
48  for(auto i = particleHistory.rbegin(); i != particleHistory.rend(); ++i){
49  // Get the text string that describes the process that created
50  // the particle.
51  std::string process = (*i)->Process();
52 
53  // Skip it if it was created by pair production, compton
54  // scattering, photoelectric effect, bremstrahlung,
55  // annihilation, or any ionization. (The ultimate source of
56  // the process names are the physics lists used in Geant4.)
57 
58  if ( process.find("conv") != std::string::npos ||
59  process.find("LowEnConversion") != std::string::npos ||
60  process.find("Pair") != std::string::npos ||
61  process.find("compt") != std::string::npos ||
62  process.find("Compt") != std::string::npos ||
63  process.find("Brem") != std::string::npos ||
64  process.find("phot") != std::string::npos ||
65  process.find("Photo") != std::string::npos ||
66  process.find("Ion") != std::string::npos ||
67  process.find("annihil") != std::string::npos) continue;
68 
69  // If we get here, the particle wasn't created by any of the
70  // above processes. Return its ID.
71  return (*i)->TrackId();
72  }
73 
74  // If we get here, we've skipped every particle in the
75  // chain. Perhaps it was empty.
76  return 0;
77  }
const MCTruthParticleList * m_particleList

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