Public Member Functions | Private Member Functions | List of all members
sim::EmEveIdCalculator Class Reference

#include <EmEveIdCalculator.h>

Inheritance diagram for sim::EmEveIdCalculator:
sim::EveIdCalculator

Public Member Functions

 EmEveIdCalculator ()
 
virtual ~EmEveIdCalculator ()
 
- Public Member Functions inherited from sim::EveIdCalculator
 EveIdCalculator ()
 Constructor and destructor. More...
 
virtual ~EveIdCalculator ()
 
void Init (const sim::ParticleList *list)
 Initialize this calculator for a particular ParticleList. More...
 
const sim::ParticleListParticleList () const
 
int CalculateEveId (const int trackID)
 

Private Member Functions

virtual int DoCalculateEveId (const int trackID)
 

Additional Inherited Members

- Protected Attributes inherited from sim::EveIdCalculator
const sim::ParticleListm_particleList
 

Detailed Description

Definition at line 63 of file EmEveIdCalculator.h.

Constructor & Destructor Documentation

sim::EmEveIdCalculator::EmEveIdCalculator ( )
inline

Definition at line 67 of file EmEveIdCalculator.h.

68  : EveIdCalculator() // Make sure the parent class constructor is called
69  {}
EveIdCalculator()
Constructor and destructor.
virtual sim::EmEveIdCalculator::~EmEveIdCalculator ( )
inlinevirtual

Definition at line 70 of file EmEveIdCalculator.h.

70 {}

Member Function Documentation

int sim::EmEveIdCalculator::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 sim::EveIdCalculator.

Definition at line 22 of file EmEveIdCalculator.cxx.

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

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