Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Attributes | Friends | List of all members
sim::ParticleNavigator Class Reference

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

Public Types

typedef std::map< int, sim::Particle * > list_type
 
typedef list_type::key_type key_type
 
typedef list_type::mapped_type mapped_type
 
typedef list_type::value_type value_type
 
typedef list_type::iterator iterator
 
typedef list_type::const_iterator const_iterator
 
typedef list_type::reverse_iterator reverse_iterator
 
typedef list_type::const_reverse_iterator const_reverse_iterator
 
typedef list_type::size_type size_type
 
typedef list_type::difference_type difference_type
 
typedef list_type::key_compare key_compare
 
typedef list_type::allocator_type allocator_type
 

Public Member Functions

 ParticleNavigator ()
 
 ParticleNavigator (const std::vector< sim::Particle > &parts)
 
virtual ~ParticleNavigator ()
 
 ParticleNavigator (const ParticleNavigator &rhs)
 
ParticleNavigatoroperator= (const ParticleNavigator &rhs)
 
void Cut (const double &)
 
const key_typeTrackId (const size_type) const
 
mapped_type Particle (const size_type) const
 
mapped_type Particle (const size_type)
 
bool IsPrimary (int trackID) const
 
int NumberOfPrimaries () const
 
const sim::ParticlePrimary (const int) const
 
sim::ParticlePrimary (const int)
 
ParticleNavigator Add (const int &offset) const
 
ParticleNavigator operator+ (const int &value) const
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
size_type size () const
 
bool empty () const
 
void swap (ParticleNavigator &other)
 
iterator find (const key_type &key)
 
const_iterator find (const key_type &key) const
 
iterator upper_bound (const key_type &key)
 
const_iterator upper_bound (const key_type &key) const
 
iterator lower_bound (const key_type &key)
 
const_iterator lower_bound (const key_type &key) const
 
mapped_type operator[] (const key_type &key) const
 
mapped_type operator[] (const key_type &key)
 
mapped_type at (const key_type &key)
 
mapped_type at (const key_type &key) const
 
void insert (sim::Particle *value)
 
void Add (sim::Particle *value)
 
void clear ()
 
size_type erase (const key_type &key)
 
int EveId (const int trackID) const
 

Static Public Member Functions

static void AdoptEveIdCalculator (EveIdCalculator *)
 

Private Types

typedef std::set< intprimaries_type
 
typedef primaries_type::iterator primaries_iterator
 
typedef primaries_type::const_iterator primaries_const_iterator
 

Private Attributes

list_type fParticleList
 Sorted list of particles in the event. More...
 
primaries_type fPrimaries
 Sorted list of the track IDs of primary particles. More...
 

Friends

ParticleNavigator operator+ (const int &value, const ParticleNavigator &list)
 
std::ostream & operator<< (std::ostream &output, const ParticleNavigator &)
 

Detailed Description

A container for particles generated during an event simulation. It acts like a map<int,Particle*> but with additional features:

Definition at line 76 of file ParticleNavigator.h.

Member Typedef Documentation

typedef list_type::allocator_type sim::ParticleNavigator::allocator_type

Definition at line 92 of file ParticleNavigator.h.

typedef list_type::const_iterator sim::ParticleNavigator::const_iterator

Definition at line 86 of file ParticleNavigator.h.

typedef list_type::const_reverse_iterator sim::ParticleNavigator::const_reverse_iterator

Definition at line 88 of file ParticleNavigator.h.

typedef list_type::difference_type sim::ParticleNavigator::difference_type

Definition at line 90 of file ParticleNavigator.h.

typedef list_type::iterator sim::ParticleNavigator::iterator

Definition at line 85 of file ParticleNavigator.h.

typedef list_type::key_compare sim::ParticleNavigator::key_compare

Definition at line 91 of file ParticleNavigator.h.

typedef list_type::key_type sim::ParticleNavigator::key_type

Definition at line 82 of file ParticleNavigator.h.

Definition at line 81 of file ParticleNavigator.h.

typedef list_type::mapped_type sim::ParticleNavigator::mapped_type

Definition at line 83 of file ParticleNavigator.h.

typedef primaries_type::const_iterator sim::ParticleNavigator::primaries_const_iterator
private

Definition at line 197 of file ParticleNavigator.h.

typedef primaries_type::iterator sim::ParticleNavigator::primaries_iterator
private

Definition at line 196 of file ParticleNavigator.h.

typedef std::set< int > sim::ParticleNavigator::primaries_type
private

Definition at line 195 of file ParticleNavigator.h.

typedef list_type::reverse_iterator sim::ParticleNavigator::reverse_iterator

Definition at line 87 of file ParticleNavigator.h.

typedef list_type::size_type sim::ParticleNavigator::size_type

Definition at line 89 of file ParticleNavigator.h.

typedef list_type::value_type sim::ParticleNavigator::value_type

Definition at line 84 of file ParticleNavigator.h.

Constructor & Destructor Documentation

sim::ParticleNavigator::ParticleNavigator ( )

Definition at line 37 of file ParticleNavigator.cxx.

38  {
39  }
sim::ParticleNavigator::ParticleNavigator ( const std::vector< sim::Particle > &  parts)
explicit

Definition at line 42 of file ParticleNavigator.cxx.

References Add().

43  {
44  for(size_t p = 0; p < parts.size(); ++p) Add(new sim::Particle(parts[p]));
45  }
const char * p
Definition: xmltok.h:285
ParticleNavigator Add(const int &offset) const
sim::ParticleNavigator::~ParticleNavigator ( )
virtual

Definition at line 49 of file ParticleNavigator.cxx.

References clear().

50  {
51  this->clear();
52  }
sim::ParticleNavigator::ParticleNavigator ( const ParticleNavigator rhs)

Definition at line 57 of file ParticleNavigator.cxx.

References clear(), HTMLTools::entry(), fParticleList, and insert().

58  {
59  // Clear any contents that we already possess.
60  this->clear();
61 
62  // Copy each entry in the other ParticleNavigator.
63  for ( const_iterator entry = rhs.fParticleList.begin();
64  entry != rhs.fParticleList.end(); ++entry ){
65  const sim::Particle* original = (*entry).second;
66  sim::Particle* copy = new sim::Particle( *original );
67  this->insert( copy );
68  }
69  }
list_type::const_iterator const_iterator
void insert(sim::Particle *value)
def entry(str)
Definition: HTMLTools.py:26

Member Function Documentation

ParticleNavigator sim::ParticleNavigator::Add ( const int offset) const

Definition at line 189 of file ParticleNavigator.cxx.

References simb::MCParticle::AddDaughter(), simb::MCParticle::AddTrajectoryPoint(), d, simb::MCParticle::Daughter(), fParticleList, MECModelEnuComparisons::i, insert(), simb::MCParticle::Mass(), simb::MCParticle::Momentum(), simb::MCParticle::Mother(), simb::MCParticle::NumberDaughters(), simb::MCParticle::NumberTrajectoryPoints(), PandAna.reco_validation.add_data::offset, simb::MCParticle::PdgCode(), simb::MCParticle::Polarization(), simb::MCParticle::Position(), simb::MCParticle::Process(), fillBadChanDBTables::result, simb::MCParticle::SetPolarization(), confusionMatrixTree::t, and simb::MCParticle::TrackId().

Referenced by nuesand::FillNueSandbox::GetECF(), operator+(), ParticleNavigator(), g4n::ParticleListAction::PreTrackingAction(), and cheat::BackTracker::Rebuild().

190  {
191  // Start with a fresh ParticleNavigator, the destination of the
192  // particles with adjusted track numbers.
194 
195  // For each particle in our list:
196  for ( const_iterator i = fParticleList.begin(); i != fParticleList.end(); ++i ){
197  const sim::Particle* particle = (*i).second;
198 
199  // Create a new particle with an adjusted track ID.
200  sim::Particle* adjusted = new sim::Particle( particle->TrackId() + offset,
201  particle->PdgCode(),
202  particle->Process(),
203  particle->Mother(),
204  particle->Mass() );
205 
206  adjusted->SetPolarization( particle->Polarization() );
207 
208  // Copy all the daughters, adjusting the track ID.
209  for ( int d = 0; d < particle->NumberDaughters(); ++d ){
210  int daughterID = particle->Daughter(d);
211  adjusted->AddDaughter( daughterID + offset );
212  }
213 
214  // Copy the trajectory points.
215  for ( size_t t = 0; t < particle->NumberTrajectoryPoints(); ++t ){
216  adjusted->AddTrajectoryPoint( particle->Position(t), particle->Momentum(t) );
217  }
218 
219  // Add the adjusted particle to the destination particle list.
220  // This will also adjust the destination's list of primary
221  // particles, if needed.
222  result.insert( adjusted );
223  }
224 
225  return result;
226  }
unsigned int NumberTrajectoryPoints() const
Definition: MCParticle.h:217
const TVector3 & Polarization() const
Definition: MCParticle.h:213
const TLorentzVector & Position(const int i=0) const
Definition: MCParticle.h:218
list_type fParticleList
Sorted list of particles in the event.
void AddDaughter(const int trackID)
Definition: MCParticle.h:264
int PdgCode() const
Definition: MCParticle.h:211
void AddTrajectoryPoint(TLorentzVector const &position, TLorentzVector const &momentum)
Definition: MCParticle.h:256
int Mother() const
Definition: MCParticle.h:212
double Mass() const
Definition: MCParticle.h:238
list_type::const_iterator const_iterator
std::string Process() const
Definition: MCParticle.h:214
int NumberDaughters() const
Definition: MCParticle.h:216
int TrackId() const
Definition: MCParticle.h:209
int Daughter(const int i) const
Definition: MCParticle.cxx:112
void SetPolarization(const TVector3 &p)
Definition: MCParticle.h:265
Float_t d
Definition: plot.C:236
const TLorentzVector & Momentum(const int i=0) const
Definition: MCParticle.h:219
void sim::ParticleNavigator::Add ( sim::Particle value)
inline

Definition at line 177 of file ParticleNavigator.h.

References AdoptEveIdCalculator(), clear(), erase(), EveId(), insert(), operator<<, output, and trackID.

177 { insert(value); }
void insert(sim::Particle *value)
void sim::ParticleNavigator::AdoptEveIdCalculator ( EveIdCalculator calc)
static

Set a pointer to a different eve ID calculation. The name begins with "Adopt" because it accepts control of the ponters; do NOT delete the pointer yourself if you use this method.

Definition at line 367 of file ParticleNavigator.cxx.

Referenced by Add(), and EveId().

368  {
369  eveIdCalculator.reset(calc);
370  }
osc::OscCalcDumb calc
static std::unique_ptr< EveIdCalculator > eveIdCalculator
mapped_type sim::ParticleNavigator::at ( const key_type key)
inline

Definition at line 168 of file ParticleNavigator.h.

References operator[]().

168 { return operator[](key); }
mapped_type operator[](const key_type &key) const
mapped_type sim::ParticleNavigator::at ( const key_type key) const
inline

Definition at line 169 of file ParticleNavigator.h.

References insert(), and operator[]().

169 { return operator[](key); }
mapped_type operator[](const key_type &key) const
iterator sim::ParticleNavigator::begin ( )
inline
const_iterator sim::ParticleNavigator::begin ( ) const
inline

Definition at line 137 of file ParticleNavigator.h.

References fParticleList.

137 { return fParticleList.begin(); }
list_type fParticleList
Sorted list of particles in the event.
void sim::ParticleNavigator::clear ( )

Definition at line 270 of file ParticleNavigator.cxx.

References fParticleList, fPrimaries, and MECModelEnuComparisons::i.

Referenced by Add(), ncs::NCAna::analyze(), g4n::ParticleListAction::BeginOfEventAction(), operator=(), ParticleNavigator(), cheat::BackTracker::Rebuild(), and ~ParticleNavigator().

271  {
272  for ( iterator i = fParticleList.begin(); i != fParticleList.end(); ++i ){
273  delete (*i).second;
274  }
275 
276  fParticleList.clear();
277  fPrimaries.clear();
278 
279  eveIdCalculator.reset();
280 
281  return;
282  }
list_type fParticleList
Sorted list of particles in the event.
list_type::iterator iterator
static std::unique_ptr< EveIdCalculator > eveIdCalculator
primaries_type fPrimaries
Sorted list of the track IDs of primary particles.
void sim::ParticleNavigator::Cut ( const double &  cut)

Apply an energy threshold cut to the particles in the list, removing all those that fall below the cut.

Definition at line 94 of file ParticleNavigator.cxx.

References simb::MCParticle::E(), erase(), fParticleList, and MECModelEnuComparisons::i.

95  {
96  // The safest way to do this is to create a list of track IDs that
97  // fail the cut, then delete those IDs.
98 
99  // Define a list of IDs.
100  typedef std::set< key_type > keyList_type;
101  keyList_type keyList;
102 
103  // Add each ID that fails the cut to the list.
104  for ( const_iterator i = fParticleList.begin(); i != fParticleList.end(); ++i ){
105  const sim::Particle* particle = (*i).second;
106  Double_t totalInitialEnergy = particle->E();
107  if ( totalInitialEnergy < cut ) {
108  keyList.insert( (*i).first );
109  }
110  }
111 
112  // Go through the list, deleting the particles that are on the list.
113  for ( keyList_type::const_iterator i = keyList.begin(); i != keyList.end(); ++i ){
114  this->erase( *i );
115  }
116  }
double E(const int i=0) const
Definition: MCParticle.h:232
list_type fParticleList
Sorted list of particles in the event.
list_type::const_iterator const_iterator
size_type erase(const key_type &key)
const Cut cut
Definition: exporter_fd.C:30
bool sim::ParticleNavigator::empty ( ) const
inline

Definition at line 146 of file ParticleNavigator.h.

References fParticleList.

Referenced by mono::Monopole::analyze().

146 { return fParticleList.empty(); }
list_type fParticleList
Sorted list of particles in the event.
iterator sim::ParticleNavigator::end ( )
inline
const_iterator sim::ParticleNavigator::end ( ) const
inline

Definition at line 139 of file ParticleNavigator.h.

References fParticleList.

139 { return fParticleList.end(); }
list_type fParticleList
Sorted list of particles in the event.
ParticleNavigator::size_type sim::ParticleNavigator::erase ( const key_type key)

Definition at line 286 of file ParticleNavigator.cxx.

References HTMLTools::entry(), and fParticleList.

Referenced by Add(), and Cut().

287  {
288  iterator entry = fParticleList.find( key );
289  delete (*entry).second;
290  return fParticleList.erase( key );
291  }
list_type fParticleList
Sorted list of particles in the event.
list_type::iterator iterator
def entry(str)
Definition: HTMLTools.py:26
int sim::ParticleNavigator::EveId ( const int  trackID) const

Definition at line 341 of file ParticleNavigator.cxx.

References AdoptEveIdCalculator(), and sim::EveIdCalculator::Init().

Referenced by Add(), calib::ParticleCorrections::analyze(), showere::ShowerEnergyAna::analyze(), slid::LIDTraining::analyze(), showere::ShowerEnergyFilterMC::filter(), filter::TruthFilter::produce(), cheat::MCCheater::produce(), and cheat::BackTracker::TrackIDToMotherParticle().

342  {
343  // If the eve ID calculator has never been initialized, use the
344  // default method.
345  if ( eveIdCalculator.get() == 0 ){
346  AdoptEveIdCalculator( new EveIdCalculator );
347  }
348 
349  // If the eve ID calculator has changed, or we're looking at a
350  // different ParticleNavigator, initialize the calculator.
351  static EveIdCalculator* saveEveIdCalculator = 0;
352  if ( saveEveIdCalculator != eveIdCalculator.get() ) {
353  saveEveIdCalculator = eveIdCalculator.get();
354  eveIdCalculator->Init( this );
355  }
356  if ( eveIdCalculator->ParticleNavigator() != this ){
357  eveIdCalculator->Init( this );
358  }
359 
360  // After the "bookkeeping" tests, here's where we actually do the
361  // calculation.
362  return eveIdCalculator->CalculateEveId( trackID );
363  }
static void AdoptEveIdCalculator(EveIdCalculator *)
static std::unique_ptr< EveIdCalculator > eveIdCalculator
Int_t trackID
Definition: plot.C:84
iterator sim::ParticleNavigator::find ( const key_type key)
inline
const_iterator sim::ParticleNavigator::find ( const key_type key) const
inline

Definition at line 150 of file ParticleNavigator.h.

References fParticleList.

150 { return fParticleList.find(key); }
list_type fParticleList
Sorted list of particles in the event.
void sim::ParticleNavigator::insert ( sim::Particle value)

These two methods (insert and Add) do the same thing:

  • Add the Particle to the list, using the track ID as the key.
  • Update the list of primary particles as needed. Note that when you insert a Particle* into a ParticleNavigator, it takes over management of the pointer. Don't delete it yourself!

Definition at line 242 of file ParticleNavigator.cxx.

References fParticleList, fPrimaries, simb::MCParticle::Process(), simb::MCParticle::TrackId(), and trackID.

Referenced by Add(), at(), operator=(), and ParticleNavigator().

243  {
244  int trackID = particle->TrackId();
245  iterator insertion = fParticleList.lower_bound( trackID );
246  if ( insertion == fParticleList.end() ){
247  // The best "hint" we can give is that the particle will go at
248  // the end of the list.
249  fParticleList.insert( insertion, value_type( trackID, particle ) );
250  }
251  else if ( (*insertion).first == trackID ){
252  throw cet::exception("ParticleNavigator") << "sim::ParticleNavigator::insert - ERROR - "
253  << "track ID=" << trackID
254  << " is already in the list";
255  }
256  else{
257  // It turns out that the best hint we can give is one more
258  // than the result of lower_bound.
259  fParticleList.insert( ++insertion, value_type( trackID, particle ) );
260  }
261 
262  // If this is a primary particle, add it to the list. Look to see
263  // if the process name contains the string rimary - leave the
264  // "p" off cause it might be capitalized, but then again maybe not
265  if ( particle->Process().find("rimary") != std::string::npos )
266  fPrimaries.insert( trackID );
267  }
list_type fParticleList
Sorted list of particles in the event.
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
list_type::iterator iterator
Int_t trackID
Definition: plot.C:84
list_type::value_type value_type
primaries_type fPrimaries
Sorted list of the track IDs of primary particles.
bool sim::ParticleNavigator::IsPrimary ( int  trackID) const

Definition at line 143 of file ParticleNavigator.cxx.

References fPrimaries.

Referenced by cheat::TestTrackIds::analyze(), mcchk::LeptonAna::analyze(), sim::ParticleHistory::ParticleHistory(), and cvn::ProngClassify().

144  {
145  return fPrimaries.find( trackID ) != fPrimaries.end();
146  }
Int_t trackID
Definition: plot.C:84
primaries_type fPrimaries
Sorted list of the track IDs of primary particles.
iterator sim::ParticleNavigator::lower_bound ( const key_type key)
inline

Definition at line 153 of file ParticleNavigator.h.

References fParticleList.

153 { return fParticleList.lower_bound(key); }
list_type fParticleList
Sorted list of particles in the event.
const_iterator sim::ParticleNavigator::lower_bound ( const key_type key) const
inline

Definition at line 154 of file ParticleNavigator.h.

References fParticleList, findDuplicateFiles::key, and operator[]().

154 { return fParticleList.lower_bound(key); }
list_type fParticleList
Sorted list of particles in the event.
int sim::ParticleNavigator::NumberOfPrimaries ( ) const
ParticleNavigator sim::ParticleNavigator::operator+ ( const int value) const
inline

Definition at line 124 of file ParticleNavigator.h.

References Add(), and parse_dependency_file_t::list.

125  {
126  return Add(value);
127  }
const XML_Char int const XML_Char * value
Definition: expat.h:331
ParticleNavigator Add(const int &offset) const
ParticleNavigator & sim::ParticleNavigator::operator= ( const ParticleNavigator rhs)

Definition at line 73 of file ParticleNavigator.cxx.

References clear(), HTMLTools::entry(), fParticleList, and insert().

74  {
75  // Usual test for self-assignment.
76  if ( this == &rhs ) return *this;
77 
78  // Clear any contents that we already possess.
79  this->clear();
80 
81  // Copy each entry in the other ParticleNavigator.
82  for ( const_iterator entry = rhs.fParticleList.begin();
83  entry != rhs.fParticleList.end(); ++entry ){
84  const sim::Particle* original = (*entry).second;
85  sim::Particle* copy = new sim::Particle( *original );
86  this->insert( copy );
87  }
88 
89  return *this;
90  }
list_type::const_iterator const_iterator
void insert(sim::Particle *value)
def entry(str)
Definition: HTMLTools.py:26
ParticleNavigator::mapped_type sim::ParticleNavigator::operator[] ( const key_type key) const

Be careful when using operator[] here! It takes the track ID as the argument: sim::ParticleNavigator partList; const sim::Particle* = partList[3]; The above line means the particle with trackID==3, NOT the third particle in the list! Use partList.Particle(3) if you want to get the particles by index number instead of track ID. Note that this only works in a const context. Use the insert() or Add() methods to add a new particle to the list.

Definition at line 330 of file ParticleNavigator.cxx.

References fParticleList, and MECModelEnuComparisons::i.

Referenced by at(), and lower_bound().

331  {
333  if(i == fParticleList.end())
334  throw cet::exception("ParticleNavigator") << "track id is not in map";
335  return (*i).second;
336  }
list_type fParticleList
Sorted list of particles in the event.
list_type::const_iterator const_iterator
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
ParticleNavigator::mapped_type sim::ParticleNavigator::operator[] ( const key_type key)

This non-const version of operator[] does NOT permit you to insert Particles into the list. Use Add() or insert() for that.

Definition at line 320 of file ParticleNavigator.cxx.

References fParticleList, and MECModelEnuComparisons::i.

321  {
323  if(i == fParticleList.end())
324  throw cet::exception("ParticleNavigator") << "track id is not in map";
325  return (*i).second;
326  }
list_type fParticleList
Sorted list of particles in the event.
list_type::const_iterator const_iterator
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
ParticleNavigator::mapped_type sim::ParticleNavigator::Particle ( const size_type  index) const
ParticleNavigator::mapped_type sim::ParticleNavigator::Particle ( const size_type  index)

Definition at line 135 of file ParticleNavigator.cxx.

References fParticleList, and MECModelEnuComparisons::i.

136  {
137  iterator i = fParticleList.begin();
138  std::advance(i,index);
139  return (*i).second;
140  }
list_type fParticleList
Sorted list of particles in the event.
list_type::iterator iterator
const sim::Particle * sim::ParticleNavigator::Primary ( const int  index) const

Definition at line 155 of file ParticleNavigator.cxx.

References HTMLTools::entry(), fParticleList, fPrimaries, and trackID.

Referenced by mmc::Validation::analyze(), mcchk::LeptonAna::analyze(), mono::SlowMonopoleAna::analyze(), mono::Monopole::analyze(), ncs::NCAna::analyze(), sn::SupernovaMCCluster::BuildInteractionTrackIDMap(), trk::CosmicTrackAna::FillEventMCTruthHistograms(), murem::MuonRemove::FillTruthInfo(), tut::TutFilter::filter(), mono::EventSelector::filter(), nuesand::FillNueSandbox::GetECF(), evd::SimulationDrawer::MCTruthLongText(), tut::TutProducer::produce(), murem::MuonRemove::RemoveByEfficiency(), and murem::MuonRemove::RemoveByTruth().

156  {
157  // Advance "index" entries from the beginning of the primary list.
158  primaries_const_iterator primary = fPrimaries.begin();
159  std::advance( primary, index );
160 
161  // Get the track ID from that entry in the list.
162  int trackID = *primary;
163 
164  // Find the entry in the particle list with that track ID.
165  const_iterator entry = fParticleList.find(trackID);
166 
167  // Return the Particle object in that entry.
168  return (*entry).second;
169  }
list_type fParticleList
Sorted list of particles in the event.
list_type::const_iterator const_iterator
primaries_type::const_iterator primaries_const_iterator
Int_t trackID
Definition: plot.C:84
def entry(str)
Definition: HTMLTools.py:26
primaries_type fPrimaries
Sorted list of the track IDs of primary particles.
sim::Particle * sim::ParticleNavigator::Primary ( const int  index)

Definition at line 172 of file ParticleNavigator.cxx.

References HTMLTools::entry(), fParticleList, fPrimaries, and trackID.

173  {
174  // Advance "index" entries from the beginning of the primary list.
175  primaries_const_iterator primary = fPrimaries.begin();
176  std::advance( primary, index );
177 
178  // Get the track ID from that entry in the list.
179  int trackID = *primary;
180 
181  // Find the entry in the particle list with that track ID.
182  iterator entry = fParticleList.find(trackID);
183 
184  // Return the Particle object in that entry.
185  return (*entry).second;
186  }
list_type fParticleList
Sorted list of particles in the event.
list_type::iterator iterator
primaries_type::const_iterator primaries_const_iterator
Int_t trackID
Definition: plot.C:84
def entry(str)
Definition: HTMLTools.py:26
primaries_type fPrimaries
Sorted list of the track IDs of primary particles.
reverse_iterator sim::ParticleNavigator::rbegin ( )
inline

Definition at line 140 of file ParticleNavigator.h.

References fParticleList.

140 { return fParticleList.rbegin(); }
list_type fParticleList
Sorted list of particles in the event.
const_reverse_iterator sim::ParticleNavigator::rbegin ( ) const
inline

Definition at line 141 of file ParticleNavigator.h.

References fParticleList.

141 { return fParticleList.rbegin(); }
list_type fParticleList
Sorted list of particles in the event.
reverse_iterator sim::ParticleNavigator::rend ( )
inline

Definition at line 142 of file ParticleNavigator.h.

References fParticleList.

142 { return fParticleList.rend(); }
list_type fParticleList
Sorted list of particles in the event.
const_reverse_iterator sim::ParticleNavigator::rend ( ) const
inline

Definition at line 143 of file ParticleNavigator.h.

References fParticleList.

143 { return fParticleList.rend(); }
list_type fParticleList
Sorted list of particles in the event.
size_type sim::ParticleNavigator::size ( ) const
inline
void sim::ParticleNavigator::swap ( ParticleNavigator other)
inline

Definition at line 147 of file ParticleNavigator.h.

References fParticleList.

147 { fParticleList.swap( other.fParticleList ); }
list_type fParticleList
Sorted list of particles in the event.
const ParticleNavigator::key_type & sim::ParticleNavigator::TrackId ( const size_type  index) const

Definition at line 119 of file ParticleNavigator.cxx.

References fParticleList, and MECModelEnuComparisons::i.

Referenced by ncs::GenieTruth::analyze().

120  {
121  const_iterator i = fParticleList.begin();
122  std::advance(i,index);
123  return (*i).first;
124  }
list_type fParticleList
Sorted list of particles in the event.
list_type::const_iterator const_iterator
iterator sim::ParticleNavigator::upper_bound ( const key_type key)
inline

Definition at line 151 of file ParticleNavigator.h.

References fParticleList.

151 { return fParticleList.upper_bound(key); }
list_type fParticleList
Sorted list of particles in the event.
const_iterator sim::ParticleNavigator::upper_bound ( const key_type key) const
inline

Definition at line 152 of file ParticleNavigator.h.

References fParticleList.

152 { return fParticleList.upper_bound(key); }
list_type fParticleList
Sorted list of particles in the event.

Friends And Related Function Documentation

ParticleNavigator operator+ ( const int value,
const ParticleNavigator list 
)
friend

Definition at line 231 of file ParticleNavigator.cxx.

232  {
233  return list + value;
234  }
const XML_Char int const XML_Char * value
Definition: expat.h:331
std::ostream& operator<< ( std::ostream &  output,
const ParticleNavigator list 
)
friend

Definition at line 294 of file ParticleNavigator.cxx.

Referenced by Add().

295  {
296  // Determine a field width for the particle number.
297  ParticleNavigator::size_type numberOfParticles = list.size();
298  int numberOfDigits = (int) std::log10( (double) numberOfParticles ) + 1;
299 
300  // A simple header.
301  output.width( numberOfDigits );
302  output << "#" << ": < ID, particle >" << std::endl;
303 
304  // Write each particle on a separate line.
305  ParticleNavigator::size_type nParticle = 0;
306  for ( ParticleNavigator::const_iterator particle = list.begin();
307  particle != list.end(); ++particle, ++nParticle ){
308  output.width( numberOfDigits );
309  output << nParticle << ": "
310  << "<" << (*particle).first
311  << "," << *((*particle).second)
312  << ">" << std::endl;
313  }
314 
315  return output;
316  }
list_type::size_type size_type
ofstream output
list_type::const_iterator const_iterator
T log10(T number)
Definition: d0nt_math.hpp:120

Member Data Documentation

list_type sim::ParticleNavigator::fParticleList
private
primaries_type sim::ParticleNavigator::fPrimaries
private

Sorted list of the track IDs of primary particles.

Definition at line 198 of file ParticleNavigator.h.

Referenced by clear(), insert(), IsPrimary(), NumberOfPrimaries(), and Primary().


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