Public Member Functions | Private Attributes | Friends | List of all members
sim::ParticleHistory Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N21-01-23/Simulation/ParticleHistory.h"

Inheritance diagram for sim::ParticleHistory:

Public Member Functions

 ParticleHistory (const sim::ParticleNavigator *nav, const int trackID)
 
virtual ~ParticleHistory ()
 
int EndParticleID () const
 
const sim::ParticleNavigatorParticleNavigator () const
 
virtual void Print () const
 

Private Attributes

const sim::ParticleNavigatorm_particleNav
 The ParticleNavigator associated with this chain. More...
 
int m_trackID
 The particle for which a history was created. More...
 

Friends

std::ostream & operator<< (std::ostream &output, const ParticleHistory &)
 

Detailed Description

Definition at line 96 of file ParticleHistory.h.

Constructor & Destructor Documentation

sim::ParticleHistory::ParticleHistory ( const sim::ParticleNavigator nav,
const int  trackID 
)

Definition at line 17 of file ParticleHistory.cxx.

References sim::ParticleNavigator::end(), sim::ParticleNavigator::find(), sim::ParticleNavigator::IsPrimary(), m_particleNav, m_trackID, simb::MCParticle::Mother(), parentID, and simb::MCParticle::TrackId().

18  : m_particleNav(nav)
20  {
21  // Look for the track in the particle list.
23 
24  // While we're still finding particles in the chain...
25  while ( search != m_particleNav->end() )
26  {
27  const sim::Particle* particle = (*search).second;
28  push_front( particle );
29 
30  // If this is a primary particle, we're done.
31  int trackID = particle->TrackId();
32  if ( m_particleNav->IsPrimary( trackID ) ) break;
33 
34  // Now look for the parent of this particle.
35  int parentID = particle->Mother();
36  search = m_particleNav->find( parentID );
37 
38  } // while we're finding particles in the chain
39  }
int Mother() const
Definition: MCParticle.h:212
list_type::const_iterator const_iterator
int TrackId() const
Definition: MCParticle.h:209
int m_trackID
The particle for which a history was created.
bool IsPrimary(int trackID) const
Int_t parentID
Definition: plot.C:85
const sim::ParticleNavigator * m_particleNav
The ParticleNavigator associated with this chain.
Int_t trackID
Definition: plot.C:84
iterator find(const key_type &key)
sim::ParticleHistory::~ParticleHistory ( )
virtual

Definition at line 42 of file ParticleHistory.cxx.

43  {
44  }

Member Function Documentation

int sim::ParticleHistory::EndParticleID ( ) const
inline

Definition at line 105 of file ParticleHistory.h.

References m_trackID.

105 { return m_trackID; }
int m_trackID
The particle for which a history was created.
const sim::ParticleNavigator* sim::ParticleHistory::ParticleNavigator ( ) const
inline

Definition at line 108 of file ParticleHistory.h.

References m_particleNav, operator<<, output, and Print().

108 { return m_particleNav; }
const sim::ParticleNavigator * m_particleNav
The ParticleNavigator associated with this chain.
void sim::ParticleHistory::Print ( ) const
virtual

Definition at line 47 of file ParticleHistory.cxx.

References om::cout.

Referenced by ParticleNavigator().

48  {
49  std::cout << (*this);
50  }
OStream cout
Definition: OStream.cxx:6

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  output,
const ParticleHistory list 
)
friend

Definition at line 53 of file ParticleHistory.cxx.

Referenced by ParticleNavigator().

54  {
55  // Determine a field width for the particle number.
56  ParticleHistory::size_type numberOfParticles = list.size();
57  int numberOfDigits = (int) std::log10( (double) numberOfParticles ) + 1;
58 
59  // A simple header.
60  output.width( numberOfDigits );
61  output << "#" << ": < ID, particle >" << std::endl;
62 
63  // Write each particle on a separate line.
64  ParticleHistory::size_type nParticle = 0;
65  for ( ParticleHistory::const_iterator particle = list.begin(); particle != list.end(); ++particle, ++nParticle ){
66  output.width( numberOfDigits );
67  output << nParticle << ": "
68  << *(*particle)
69  << std::endl;
70  }
71 
72  return output;
73  }
ofstream output
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic >::Index size_type
Definition: typedefs.hpp:11
T log10(T number)
Definition: d0nt_math.hpp:120

Member Data Documentation

const sim::ParticleNavigator* sim::ParticleHistory::m_particleNav
private

The ParticleNavigator associated with this chain.

Definition at line 117 of file ParticleHistory.h.

Referenced by ParticleHistory(), and ParticleNavigator().

int sim::ParticleHistory::m_trackID
private

The particle for which a history was created.

Definition at line 118 of file ParticleHistory.h.

Referenced by EndParticleID(), and ParticleHistory().


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