LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
cheat::ParticleInventoryService Class Reference

#include "ParticleInventoryService.h"

Inheritance diagram for cheat::ParticleInventoryService:
cheat::ParticleInventory

Classes

struct  ParticleInventoryServiceConfig
 

Public Types

using provider_type = ParticleInventory
 

Public Member Functions

const provider_typeprovider () const
 
 ParticleInventoryService (const ParticleInventoryServiceConfig &config, art::ActivityRegistry &reg)
 
 ParticleInventoryService (fhicl::ParameterSet const &pset, art::ActivityRegistry &reg)
 
const sim::ParticleListParticleList () const
 
void Rebuild (const art::Event &evt)
 
void SetEveIdCalculator (sim::EveIdCalculator *ec)
 
const simb::MCParticleTrackIdToParticle_P (int id) const
 
simb::MCParticle TrackIdToParticle (int const id) const
 
const simb::MCParticleTrackIdToMotherParticle_P (int id) const
 
simb::MCParticle TrackIdToMotherParticle (int const id) const
 
const art::Ptr< simb::MCTruth > & TrackIdToMCTruth_P (int id) const
 
simb::MCTruth TrackIdToMCTruth (int const id) const
 
int TrackIdToEveTrackId (int tid) const
 
const art::Ptr< simb::MCTruth > & ParticleToMCTruth_P (const simb::MCParticle *p) const
 
simb::MCTruth ParticleToMCTruth (const simb::MCParticle *p) const
 
const std::vector< art::Ptr< simb::MCTruth > > & MCTruthVector_Ps () const
 
std::vector< const simb::MCParticle * > MCTruthToParticles_Ps (art::Ptr< simb::MCTruth > const &mct) const
 
std::set< int > GetSetOfTrackIds () const
 
std::set< int > GetSetOfEveIds () const
 

Private Member Functions

void priv_PrepEvent (const art::Event &evt, art::ScheduleContext)
 
void priv_PrepParticleList (const art::Event &evt)
 
void priv_PrepMCTruthList (const art::Event &evt)
 
void priv_PrepTrackIdToMCTruthIndex (const art::Event &evt)
 
bool priv_CanRun (const art::Event &evt) const
 
bool priv_ParticleListReady ()
 
bool priv_MCTruthListReady ()
 
bool priv_TrackIdToMCTruthReady ()
 
template<typename Evt >
void PrepEvent (const Evt &evt)
 Function to set up the ParticleInventory state for an event. This is a function to tell the ParticleInventory to prepare itself to work with a particular event. More...
 
bool ParticleListReady () const
 A simple check to determine if the ParticleList has already been prepared for this event or not. More...
 
bool MCTruthListReady () const
 A simple check to determine if the MCTruthList has already been prepared and cached or not. More...
 
bool TrackIdToMCTruthReady () const
 A simple check to determine if the TrackIdToMCTruth map has been prepared or not. More...
 
template<typename Evt >
void PrepParticleList (const Evt &evt) const
 A function to load the ParticleList and cache it This function will find the particle list and load it for later use. Ideally this would would be used for a "lazy" loading of the backtracker, but this does not work in the current setup of art. More...
 
template<typename Evt >
void PrepTrackIdToMCTruthIndex (const Evt &evt) const
 A function to prepare and cache a map of TrackIds and MCTruth object indicies from fMCTruthList. More...
 
template<typename Evt >
void PrepMCTruthList (const Evt &evt) const
 A function to load and cache the MCTruthList of the event. More...
 
template<typename Evt >
void PrepMCTruthListAndTrackIdToMCTruthIndex (const Evt &evt) const
 A function to make both PrepTrackIdToMCTruthIndex and PrepMCTruthList run when both are needed. More...
 
template<typename Evt >
bool CanRun (const Evt &evt) const
 A short function to check if use of the backtracker is appropriate or not based on the type of input file. This function simply checks to see if the file loaded is real data, or MC Simulation, as backtracking on real data makes no sense. If one does try to backtrack real data, this will throw and exception. More...
 
const std::vector< art::Ptr< simb::MCTruth > > & MCTruthList () const
 
const std::map< int, int > & TrackIdToMCTruthIndex () const
 
void ClearEvent ()
 
const simb::MCParticleTrackIdToParticle_P (int const &id) const
 
simb::MCParticle TrackIdToParticle (int const &id) const
 
const simb::MCParticleTrackIdToMotherParticle_P (int const &id) const
 
simb::MCParticle TrackIdToMotherParticle (int const &id) const
 
const art::Ptr< simb::MCTruth > & TrackIdToMCTruth_P (int const &id) const
 
simb::MCTruth TrackIdToMCTruth (int const &id) const
 
int TrackIdToEveTrackId (const int &tid) const
 

Detailed Description

Definition at line 42 of file ParticleInventoryService.h.

Member Typedef Documentation

Constructor & Destructor Documentation

cheat::ParticleInventoryService::ParticleInventoryService ( const ParticleInventoryServiceConfig config,
art::ActivityRegistry reg 
)

Definition at line 39 of file ParticleInventoryService.cc.

References fhicl::ParameterSet::get(), cheat::ParticleInventory::ParticleInventory(), priv_PrepEvent(), and art::ActivityRegistry::sPreProcessEvent.

41  : ParticleInventory(config.ParticleInventoryTable())
42  {
43  // std::cout<<"Config Dump from ParticleInventoryService using fhicl Table\n";
44  // config.ParticleInventoryTable.print_allowed_configuration(std::cout);
46  }
void priv_PrepEvent(const art::Event &evt, art::ScheduleContext)
GlobalSignal< detail::SignalResponseType::FIFO, void(Event const &, ScheduleContext)> sPreProcessEvent
ParticleInventory(const ParticleInventoryConfig &config)
cheat::ParticleInventoryService::ParticleInventoryService ( fhicl::ParameterSet const &  pset,
art::ActivityRegistry reg 
)

Member Function Documentation

template<typename Evt >
bool cheat::ParticleInventory::CanRun ( const Evt &  evt) const
inherited

A short function to check if use of the backtracker is appropriate or not based on the type of input file. This function simply checks to see if the file loaded is real data, or MC Simulation, as backtracking on real data makes no sense. If one does try to backtrack real data, this will throw and exception.

Referenced by priv_CanRun().

void cheat::ParticleInventory::ClearEvent ( )
inherited
std::set< int > cheat::ParticleInventoryService::GetSetOfEveIds ( ) const

Definition at line 204 of file ParticleInventoryService.cc.

References cheat::ParticleInventory::GetSetOfEveIds().

205  {
206  // if(!this->priv_ParticleListReady()){this->priv_PrepParticleList();}
207  // Not used for non-lazy mode
209  }
std::set< int > GetSetOfEveIds() const
std::set< int > cheat::ParticleInventoryService::GetSetOfTrackIds ( ) const

Definition at line 197 of file ParticleInventoryService.cc.

References cheat::ParticleInventory::GetSetOfTrackIds().

198  {
199  // if(!this->priv_ParticleListReady()){this->priv_PrepParticleList();}
200  // Not used for non-lazy mode
202  }
std::set< int > GetSetOfTrackIds() const
const std::vector<art::Ptr<simb::MCTruth> >& cheat::ParticleInventory::MCTruthList ( ) const
inlineinherited

Definition at line 223 of file ParticleInventory.h.

223 { return fMCTObj.fMCTruthList; }
std::vector< art::Ptr< simb::MCTruth > > fMCTruthList
A vector containing the MCTruth objects.
bool cheat::ParticleInventory::MCTruthListReady ( ) const
inlineinherited

A simple check to determine if the MCTruthList has already been prepared and cached or not.

Definition at line 206 of file ParticleInventory.h.

References util::empty().

206 { return !((fMCTObj.fMCTruthList).empty()); }
std::vector< art::Ptr< simb::MCTruth > > fMCTruthList
A vector containing the MCTruth objects.
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Definition: StdUtils.h:109
std::vector< const simb::MCParticle * > cheat::ParticleInventoryService::MCTruthToParticles_Ps ( art::Ptr< simb::MCTruth > const &  mct) const

Definition at line 188 of file ParticleInventoryService.cc.

References cheat::ParticleInventory::MCTruthToParticles_Ps().

Referenced by lcvn::AssignLabels::GetTopology().

190  {
191  // if(!this->priv_ParticleListReady()){this->priv_PrepParticleList();}
192  // if(!this->priv_MCTruthListReady()){this->priv_PrepMCTruthList();}
193  // Not used for non-lazy mode
195  }
std::vector< const simb::MCParticle * > MCTruthToParticles_Ps(art::Ptr< simb::MCTruth > const &mct) const
const std::vector< art::Ptr< simb::MCTruth > > & cheat::ParticleInventoryService::MCTruthVector_Ps ( ) const

Definition at line 145 of file ParticleInventoryService.cc.

References cheat::ParticleInventory::MCTruthVector_Ps().

146  {
147  //if(!this->priv_MCTruthListReady()){priv_PrepMCTruthList();}
148  // Not used for non-lazy mode
150  }
const std::vector< art::Ptr< simb::MCTruth > > & MCTruthVector_Ps() const
bool cheat::ParticleInventory::ParticleListReady ( ) const
inlineinherited

A simple check to determine if the ParticleList has already been prepared for this event or not.

Definition at line 205 of file ParticleInventory.h.

205 { return !(fParticleList.empty()); }
sim::ParticleList fParticleList
bool empty() const
Definition: ParticleList.h:314
simb::MCTruth cheat::ParticleInventoryService::ParticleToMCTruth ( const simb::MCParticle p) const
inline

Definition at line 91 of file ParticleInventoryService.h.

92  {
93  return *(this->ParticleToMCTruth_P(p));
94  }
const art::Ptr< simb::MCTruth > & ParticleToMCTruth_P(const simb::MCParticle *p) const
const art::Ptr< simb::MCTruth > & cheat::ParticleInventoryService::ParticleToMCTruth_P ( const simb::MCParticle p) const

Definition at line 180 of file ParticleInventoryService.cc.

References simb::MCParticle::TrackId(), and TrackIdToMCTruth_P().

Referenced by NuShowerEff::analyze().

182  {
183  // if(!this->priv_TrackIdToMCTruthReady()){this->priv_PrepTrackIdToMCTruthIndex();}
184  // Not used for non-lazy mode
185  return this->TrackIdToMCTruth_P(p->TrackId());
186  }
int TrackId() const
Definition: MCParticle.h:211
const art::Ptr< simb::MCTruth > & TrackIdToMCTruth_P(int id) const
template<typename Evt >
void cheat::ParticleInventory::PrepEvent ( const Evt &  evt)
inherited

Function to set up the ParticleInventory state for an event. This is a function to tell the ParticleInventory to prepare itself to work with a particular event.

Parameters
evtThe event the ParticleInventory should work with. *Note. This use breaks the multithreading model because the service has a "state".
template<typename Evt >
void cheat::ParticleInventory::PrepMCTruthList ( const Evt &  evt) const
inherited

A function to load and cache the MCTruthList of the event.

Referenced by priv_PrepMCTruthList().

template<typename Evt >
void cheat::ParticleInventory::PrepMCTruthListAndTrackIdToMCTruthIndex ( const Evt &  evt) const
inherited

A function to make both PrepTrackIdToMCTruthIndex and PrepMCTruthList run when both are needed.

template<typename Evt >
void cheat::ParticleInventory::PrepParticleList ( const Evt &  evt) const
inherited

A function to load the ParticleList and cache it This function will find the particle list and load it for later use. Ideally this would would be used for a "lazy" loading of the backtracker, but this does not work in the current setup of art.

Referenced by priv_PrepParticleList().

template<typename Evt >
void cheat::ParticleInventory::PrepTrackIdToMCTruthIndex ( const Evt &  evt) const
inherited

A function to prepare and cache a map of TrackIds and MCTruth object indicies from fMCTruthList.

Referenced by priv_PrepTrackIdToMCTruthIndex().

bool cheat::ParticleInventoryService::priv_CanRun ( const art::Event evt) const
private

Definition at line 76 of file ParticleInventoryService.cc.

References cheat::ParticleInventory::CanRun().

Referenced by priv_PrepEvent(), priv_PrepMCTruthList(), priv_PrepParticleList(), and priv_PrepTrackIdToMCTruthIndex().

77  {
78  return ParticleInventory::CanRun(evt);
79  }
bool CanRun(const Evt &evt) const
A short function to check if use of the backtracker is appropriate or not based on the type of input ...
bool cheat::ParticleInventoryService::priv_MCTruthListReady ( )
inlineprivate

Definition at line 113 of file ParticleInventoryService.h.

Referenced by priv_PrepMCTruthList().

bool MCTruthListReady() const
A simple check to determine if the MCTruthList has already been prepared and cached or not...
bool cheat::ParticleInventoryService::priv_ParticleListReady ( )
inlineprivate

Definition at line 112 of file ParticleInventoryService.h.

Referenced by priv_PrepParticleList().

bool ParticleListReady() const
A simple check to determine if the ParticleList has already been prepared for this event or not...
void cheat::ParticleInventoryService::priv_PrepEvent ( const art::Event evt,
art::ScheduleContext   
)
private

Definition at line 64 of file ParticleInventoryService.cc.

References cheat::ParticleInventory::ClearEvent(), priv_CanRun(), priv_PrepMCTruthList(), priv_PrepParticleList(), and priv_PrepTrackIdToMCTruthIndex().

Referenced by ParticleInventoryService(), and Rebuild().

65  {
66  //fEvt=&evt;
68  if (!this->priv_CanRun(evt)) { return; }
69  this->priv_PrepParticleList(evt);
70  this->priv_PrepMCTruthList(evt);
72  //fEvt=nullptr; //dont keep the cached pointer since it will expire right after this, and I want to make sure bad calls to prep functions fail.
73  }
void priv_PrepParticleList(const art::Event &evt)
void priv_PrepMCTruthList(const art::Event &evt)
void priv_PrepTrackIdToMCTruthIndex(const art::Event &evt)
bool priv_CanRun(const art::Event &evt) const
void cheat::ParticleInventoryService::priv_PrepMCTruthList ( const art::Event evt)
private

Definition at line 114 of file ParticleInventoryService.cc.

References cheat::ParticleInventory::PrepMCTruthList(), priv_CanRun(), and priv_MCTruthListReady().

Referenced by priv_PrepEvent().

115  {
116  // if(!this->priv_CanRun(*fEvt)){throw;}
117  if (!this->priv_CanRun(evt)) { throw; }
118  if (this->priv_MCTruthListReady()) {
119  return;
120  } //If the event is data or if the truth list is already built there is nothing for us to do.
121  try {
123  }
124  //try{ ParticleInventory::PrepMCTruthList(*fEvt); }
125  catch (...) {
126  mf::LogWarning("ParticleInventory")
127  << "Rebuild failed to get the MCParticles. This is expected when running on a generation "
128  "or simulation step.";
129  }
130  //ToDo. Find out exactly which exception is thrown and catch only that.
131 
132  } //End PrepMCTruthList
void PrepMCTruthList(const Evt &evt) const
A function to load and cache the MCTruthList of the event.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
bool priv_CanRun(const art::Event &evt) const
void cheat::ParticleInventoryService::priv_PrepParticleList ( const art::Event evt)
private

Definition at line 82 of file ParticleInventoryService.cc.

References cheat::ParticleInventory::PrepParticleList(), priv_CanRun(), and priv_ParticleListReady().

Referenced by priv_PrepEvent().

83  {
84  if (!this->priv_CanRun(evt)) { throw; }
85  //if(!this->priv_CanRun(*fEvt)) {throw;}
86  if (this->priv_ParticleListReady()) { return; }
87  //try{ParticleInventory::PrepParticleList(*fEvt);}
88  try {
90  }
91  catch (...) {
92  mf::LogWarning("ParticleInventory")
93  << "Rebuild failed to get the MCParticles. This is expected when running on a generation "
94  "or simulation step.";
95  }
96  }
void PrepParticleList(const Evt &evt) const
A function to load the ParticleList and cache it This function will find the particle list and load i...
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
bool priv_CanRun(const art::Event &evt) const
void cheat::ParticleInventoryService::priv_PrepTrackIdToMCTruthIndex ( const art::Event evt)
private

Definition at line 98 of file ParticleInventoryService.cc.

References cheat::ParticleInventory::PrepTrackIdToMCTruthIndex(), priv_CanRun(), and priv_TrackIdToMCTruthReady().

Referenced by priv_PrepEvent().

99  {
100  if (!this->priv_CanRun(evt)) { throw; }
101  //if(!this->priv_CanRun(*fEvt)){throw;}
102  if (this->priv_TrackIdToMCTruthReady()) { return; }
103  //try{ParticleInventory::PrepTrackIdToMCTruthIndex(*fEvt);}
104  try {
106  }
107  catch (...) {
108  mf::LogWarning("ParticleInventory")
109  << "Rebuild failed to get the MCParticles. This is expected when running on a generation "
110  "or simulation step.";
111  }
112  } //End priv_PrepTrackIdToMCTruthIndexList
void PrepTrackIdToMCTruthIndex(const Evt &evt) const
A function to prepare and cache a map of TrackIds and MCTruth object indicies from fMCTruthList...
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
bool priv_CanRun(const art::Event &evt) const
bool cheat::ParticleInventoryService::priv_TrackIdToMCTruthReady ( )
inlineprivate

Definition at line 114 of file ParticleInventoryService.h.

References DECLARE_ART_SERVICE.

Referenced by priv_PrepTrackIdToMCTruthIndex().

bool TrackIdToMCTruthReady() const
A simple check to determine if the TrackIdToMCTruth map has been prepared or not. ...
const provider_type* cheat::ParticleInventoryService::provider ( ) const
inline

Definition at line 53 of file ParticleInventoryService.h.

References tca::evt.

53 { return static_cast<const provider_type*>(this); }
void cheat::ParticleInventoryService::Rebuild ( const art::Event evt)

Definition at line 58 of file ParticleInventoryService.cc.

References art::ScheduleContext::invalid(), and priv_PrepEvent().

Referenced by cheat::BackTrackerLoader::produce(), and cheat::PhotonBackTrackerLoader::produce().

59  {
61  }
void priv_PrepEvent(const art::Event &evt, art::ScheduleContext)
static ScheduleContext invalid()
void cheat::ParticleInventoryService::SetEveIdCalculator ( sim::EveIdCalculator ec)
inline
int cheat::ParticleInventoryService::TrackIdToEveTrackId ( int  tid) const
int cheat::ParticleInventory::TrackIdToEveTrackId ( const int &  tid) const
inlineinherited

Definition at line 254 of file ParticleInventory.h.

Referenced by cheat::BackTracker::HitToEveTrackIDEs(), and TrackIdToEveTrackId().

254 { return fParticleList.EveId(tid); }
sim::ParticleList fParticleList
int EveId(const int trackID) const
simb::MCTruth cheat::ParticleInventoryService::TrackIdToMCTruth ( int const  id) const
inline

Definition at line 81 of file ParticleInventoryService.h.

Referenced by lar_pandora::LArPandoraInput::CreatePandoraMCParticles().

83  {
84  return *(this->TrackIdToMCTruth_P(id));
85  }
const art::Ptr< simb::MCTruth > & TrackIdToMCTruth_P(int id) const
simb::MCTruth cheat::ParticleInventory::TrackIdToMCTruth ( int const &  id) const
inlineinherited

Definition at line 246 of file ParticleInventory.h.

248  {
249  return *(this->TrackIdToMCTruth_P(id));
250  }
const art::Ptr< simb::MCTruth > & TrackIdToMCTruth_P(int const &id) const
const art::Ptr< simb::MCTruth > & cheat::ParticleInventoryService::TrackIdToMCTruth_P ( int  id) const

Definition at line 168 of file ParticleInventoryService.cc.

References cheat::ParticleInventory::TrackIdToMCTruth_P().

Referenced by pfpf::PFPAna::analyze(), cluster::ClusterAna::analyze(), cluster::ClusterTrackAna::analyze(), opreco::OpticalRecoAna::get_MC_particle_origin(), tca::GetOrigin(), evd::SimulationDrawer::MCTruthVectors2D(), and ParticleToMCTruth_P().

169  {
170  // if(!this->priv_TrackIdToMCTruthReady()){this->priv_PrepTrackIdToMCTruthIndex();}
171  // Not used for non-lazy mode
173  }
const art::Ptr< simb::MCTruth > & TrackIdToMCTruth_P(int const &id) const
const art::Ptr< simb::MCTruth > & cheat::ParticleInventory::TrackIdToMCTruth_P ( int const &  id) const
inherited

Definition at line 65 of file ParticleInventory.cc.

References util::abs(), cheat::ParticleInventory::fMCTObj, cheat::ParticleInventory::MCTObjects::fMCTruthList, and cheat::ParticleInventory::MCTObjects::fTrackIdToMCTruthIndex.

Referenced by cheat::ParticleInventory::MCTruthToParticles_Ps(), cheat::ParticleInventory::ParticleToMCTruth_P(), and TrackIdToMCTruth_P().

66  {
67  // find the entry in the MCTruth collection for this track id
68  auto mctItr = fMCTObj.fTrackIdToMCTruthIndex.find(abs(id));
69  if (mctItr != fMCTObj.fTrackIdToMCTruthIndex.end()) {
70  int partIndex = mctItr->second;
71  return fMCTObj.fMCTruthList.at(partIndex);
72  }
73  else {
74  throw cet::exception("ParticleInventory")
75  << "Attempt to find MCTruth for TrackId: " << id << " has failed.";
76  }
77  }
constexpr auto abs(T v)
Returns the absolute value of the argument.
std::vector< art::Ptr< simb::MCTruth > > fMCTruthList
A vector containing the MCTruth objects.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
const std::map<int, int>& cheat::ParticleInventory::TrackIdToMCTruthIndex ( ) const
inlineinherited

Definition at line 225 of file ParticleInventory.h.

226  {
228  }
bool cheat::ParticleInventory::TrackIdToMCTruthReady ( ) const
inlineinherited

A simple check to determine if the TrackIdToMCTruth map has been prepared or not.

Definition at line 207 of file ParticleInventory.h.

207 { return !(fMCTObj.fTrackIdToMCTruthIndex.empty()); }
simb::MCParticle cheat::ParticleInventoryService::TrackIdToMotherParticle ( int const  id) const
inline

Definition at line 74 of file ParticleInventoryService.h.

Referenced by nnet::RawWaveformDump::analyze(), and nnet::RawWaveformClnSigDump::analyze().

76  {
77  return *(this->TrackIdToMotherParticle_P(id));
78  }
const simb::MCParticle * TrackIdToMotherParticle_P(int id) const
simb::MCParticle cheat::ParticleInventory::TrackIdToMotherParticle ( int const &  id) const
inlineinherited

Definition at line 239 of file ParticleInventory.h.

241  {
242  return *(this->TrackIdToMotherParticle_P(id));
243  }
const simb::MCParticle * TrackIdToMotherParticle_P(int const &id) const
const simb::MCParticle * cheat::ParticleInventoryService::TrackIdToMotherParticle_P ( int  id) const

Definition at line 161 of file ParticleInventoryService.cc.

References cheat::ParticleInventory::TrackIdToMotherParticle_P().

Referenced by NuShowerEff::analyze(), and shower::TCShowerTemplateMaker::showerProfileTrue().

162  {
163  // if(!this->priv_ParticleListReady()){this->priv_PrepParticleList();}
164  // Not used for non-lazy mode
166  }
const simb::MCParticle * TrackIdToMotherParticle_P(int const &id) const
const simb::MCParticle * cheat::ParticleInventory::TrackIdToMotherParticle_P ( int const &  id) const
inherited

Definition at line 59 of file ParticleInventory.cc.

References util::abs(), sim::ParticleList::EveId(), cheat::ParticleInventory::fParticleList, and cheat::ParticleInventory::TrackIdToParticle_P().

Referenced by TrackIdToMotherParticle_P().

60  {
61  return this->TrackIdToParticle_P(fParticleList.EveId(abs(id)));
62  }
sim::ParticleList fParticleList
constexpr auto abs(T v)
Returns the absolute value of the argument.
int EveId(const int trackID) const
const simb::MCParticle * TrackIdToParticle_P(int const &id) const
simb::MCParticle cheat::ParticleInventoryService::TrackIdToParticle ( int const  id) const
inline

Definition at line 68 of file ParticleInventoryService.h.

69  {
70  return *(this->TrackIdToParticle_P(id));
71  } //Users are encouraged to use TrackIdToParticleP
const simb::MCParticle * TrackIdToParticle_P(int id) const
simb::MCParticle cheat::ParticleInventory::TrackIdToParticle ( int const &  id) const
inlineinherited

Definition at line 233 of file ParticleInventory.h.

234  {
235  return *(this->TrackIdToParticle_P(id));
236  } //Users are encouraged to use TrackIdToParticleP
const simb::MCParticle * TrackIdToParticle_P(int const &id) const
const simb::MCParticle * cheat::ParticleInventory::TrackIdToParticle_P ( int const &  id) const
inherited

Definition at line 46 of file ParticleInventory.cc.

References sim::ParticleList::end(), sim::ParticleList::find(), and cheat::ParticleInventory::fParticleList.

Referenced by cheat::ParticleInventory::TrackIdToMotherParticle_P(), and TrackIdToParticle_P().

47  {
49  if (part_it == fParticleList.end()) {
50  mf::LogWarning("ParticleInventory")
51  << "Particle with TrackId: " << id << " not found in inventory. "
52  << "Returning null pointer.";
53  return 0;
54  }
55  return part_it->second;
56  } //End TrackIdToParticle
sim::ParticleList fParticleList
list_type::const_iterator const_iterator
Definition: ParticleList.h:132
iterator find(const key_type &key)
Definition: ParticleList.h:318
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning

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