LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
sim::ParticleHistory Class Reference

#include "ParticleHistory.h"

Inheritance diagram for sim::ParticleHistory:

Public Member Functions

 ParticleHistory (const sim::ParticleList *list, const int trackID)
 
virtual ~ParticleHistory ()
 
int EndParticleID () const
 
const sim::ParticleListParticleList () const
 

Public Attributes

elements
 STL member. More...
 

Private Attributes

const sim::ParticleListm_particleList
 
int m_trackID
 

The ParticleList associated with this chain.

More...
 

Friends

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

Detailed Description

Definition at line 98 of file ParticleHistory.h.

Constructor & Destructor Documentation

sim::ParticleHistory::ParticleHistory ( const sim::ParticleList list,
const int  trackID 
)

Definition at line 18 of file ParticleHistory.cxx.

References sim::ParticleList::end(), sim::ParticleList::find(), sim::ParticleList::IsPrimary(), m_particleList, m_trackID, simb::MCParticle::Mother(), and simb::MCParticle::TrackId().

19  : m_particleList(list)
20  , m_trackID(trackID)
21  {
22  // Look for the track in the particle list.
24 
25  // While we're still finding particles in the chain...
26  while ( search != m_particleList->end() ){
27  const simb::MCParticle* 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_particleList->IsPrimary( trackID ) ) break;
33 
34  // Now look for the parent of this particle.
35  int parentID = particle->Mother();
36  search = m_particleList->find( parentID );
37 
38  } // while we're finding particles in the chain
39  }
const sim::ParticleList * m_particleList
int Mother() const
Definition: MCParticle.h:217
list_type::const_iterator const_iterator
Definition: ParticleList.h:132
int TrackId() const
Definition: MCParticle.h:214
iterator find(const key_type &key)
Definition: ParticleList.h:318
int m_trackID
The ParticleList associated with this chain.
bool IsPrimary(int trackID) const
sim::ParticleHistory::~ParticleHistory ( )
virtual

Definition at line 43 of file ParticleHistory.cxx.

44  {}

Member Function Documentation

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

Definition at line 107 of file ParticleHistory.h.

References m_trackID.

107 { return m_trackID; }
int m_trackID
The ParticleList associated with this chain.
const sim::ParticleList* sim::ParticleHistory::ParticleList ( ) const
inline

Definition at line 110 of file ParticleHistory.h.

References m_particleList, and operator<<.

110 { return m_particleList; }
const sim::ParticleList * m_particleList

Friends And Related Function Documentation

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

Definition at line 47 of file ParticleHistory.cxx.

Referenced by ParticleList().

48  {
49  // Determine a field width for the particle number.
50  ParticleHistory::size_type numberOfParticles = list.size();
51  int numberOfDigits = (int) std::log10( (double) numberOfParticles ) + 1;
52 
53  // A simple header.
54  output.width( numberOfDigits );
55  output << "#" << ": < ID, particle >" << "\n";
56 
57  // Write each particle on a separate line.
58  ParticleHistory::size_type nParticle = 0;
59  for ( ParticleHistory::const_iterator particle = list.begin();
60  particle != list.end(); ++particle, ++nParticle ){
61  output.width( numberOfDigits );
62  output << nParticle << ": "
63  << (*particle)
64  << "\n";
65  }
66 
67  return output;
68  }
intermediate_table::const_iterator const_iterator

Member Data Documentation

T std::deque< T >::elements
inherited

STL member.

const sim::ParticleList* sim::ParticleHistory::m_particleList
private

Definition at line 115 of file ParticleHistory.h.

Referenced by ParticleHistory(), and ParticleList().

int sim::ParticleHistory::m_trackID
private

The ParticleList associated with this chain.

Definition at line 116 of file ParticleHistory.h.

Referenced by EndParticleID(), and ParticleHistory().


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