LArSoft  v06_85_00
Liquid Argon Software toolkit - http://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 ()
 
void Rebuild (const art::Event &evt)
 
void SetEveIdCalculator (sim::EveIdCalculator *ec)
 
const simb::MCParticleTrackIdToParticle_P (int const &id)
 
simb::MCParticle TrackIdToParticle (int const &id)
 
const simb::MCParticleTrackIdToMotherParticle_P (int const &id)
 
simb::MCParticle TrackIdToMotherParticle (int const &id)
 
const art::Ptr< simb::MCTruth > & TrackIdToMCTruth_P (int const &id)
 
simb::MCTruth TrackIdToMCTruth (int const &id)
 
int TrackIdToEveTrackId (const int &tid) const
 
const art::Ptr< simb::MCTruth > & ParticleToMCTruth_P (const simb::MCParticle *p)
 
simb::MCTruth ParticleToMCTruth (const simb::MCParticle *p)
 
const std::vector< art::Ptr< simb::MCTruth > > & MCTruthVector_Ps ()
 
const std::vector< const simb::MCParticle * > MCTruthToParticles_Ps (art::Ptr< simb::MCTruth > const &mct)
 
std::set< int > GetSetOfTrackIds ()
 
std::set< int > GetSetOfEveIds ()
 

Private Member Functions

void priv_PrepEvent (const art::Event &evt)
 
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 sim::ParticleListParticleList () const
 
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
 
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
 
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
 

Detailed Description

Definition at line 32 of file ParticleInventoryService.h.

Member Typedef Documentation

Constructor & Destructor Documentation

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

Definition at line 47 of file ParticleInventoryService_service.cc.

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

Referenced by provider().

48  :ParticleInventory(config.ParticleInventoryTable())
49  {
50 // std::cout<<"Config Dump from ParticleInventoryService using fhicl Table\n";
51 // config.ParticleInventoryTable.print_allowed_configuration(std::cout);
53  }
GlobalSignal< detail::SignalResponseType::FIFO, void(Event const &)> 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(), and cheat::ParticleInventory::TrackIdToMCTruthReady().

std::set< int > cheat::ParticleInventoryService::GetSetOfEveIds ( )

Definition at line 181 of file ParticleInventoryService_service.cc.

References DEFINE_ART_SERVICE, and cheat::ParticleInventory::GetSetOfEveIds().

Referenced by ParticleToMCTruth().

181  {
182 // if(!this->priv_ParticleListReady()){this->priv_PrepParticleList();}
183 // Not used for non-lazy mode
185  }
std::set< int > GetSetOfEveIds() const
std::set< int > cheat::ParticleInventory::GetSetOfEveIds ( ) const
inherited

Definition at line 113 of file ParticleInventory.cc.

References sim::ParticleList::EveId(), cheat::ParticleInventory::fParticleList, and cheat::ParticleInventory::GetSetOfTrackIds().

Referenced by GetSetOfEveIds(), cheat::BackTracker::GetSetOfEveIds(), cheat::PhotonBackTracker::GetSetOfEveIds(), and cheat::ParticleInventory::ParticleToMCTruth().

113  {
114  std::set<int> ret;
115  std::set<int> tIds=this->GetSetOfTrackIds();
116  for(auto tId : tIds){
117  ret.emplace(fParticleList.EveId(tId));
118  }
119  return ret;
120  }
sim::ParticleList fParticleList
int EveId(const int trackID) const
std::set< int > GetSetOfTrackIds() const
std::set< int > cheat::ParticleInventoryService::GetSetOfTrackIds ( )

Definition at line 175 of file ParticleInventoryService_service.cc.

References cheat::ParticleInventory::GetSetOfTrackIds().

Referenced by ParticleToMCTruth().

175  {
176 // if(!this->priv_ParticleListReady()){this->priv_PrepParticleList();}
177 // Not used for non-lazy mode
179  }
std::set< int > GetSetOfTrackIds() const
std::set< int > cheat::ParticleInventory::GetSetOfTrackIds ( ) const
inherited

Definition at line 104 of file ParticleInventory.cc.

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

Referenced by cheat::ParticleInventory::GetSetOfEveIds(), GetSetOfTrackIds(), cheat::BackTracker::GetSetOfTrackIds(), cheat::PhotonBackTracker::GetSetOfTrackIds(), and cheat::ParticleInventory::ParticleToMCTruth().

104  {
105  std::set<int> ret;
106  for( auto partItr=fParticleList.begin(); partItr!=fParticleList.end(); ++partItr){
107  ret.emplace((partItr->second)->TrackId());
108  }
109  return ret;
110  }
sim::ParticleList fParticleList
iterator begin()
Definition: ParticleList.h:305
const std::vector< art::Ptr<simb::MCTruth> >& cheat::ParticleInventory::MCTruthList ( ) const
inlineinherited

Definition at line 218 of file ParticleInventory.h.

References cheat::ParticleInventory::fMCTObj, and cheat::ParticleInventory::MCTObjects::fMCTruthList.

218 { 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 201 of file ParticleInventory.h.

References cheat::ParticleInventory::fMCTObj, and cheat::ParticleInventory::MCTObjects::fMCTruthList.

Referenced by priv_MCTruthListReady().

201 { return !( (fMCTObj.fMCTruthList).empty() ); }
std::vector< art::Ptr< simb::MCTruth > > fMCTruthList
A vector containing the MCTruth objects.
const std::vector< const simb::MCParticle * > cheat::ParticleInventoryService::MCTruthToParticles_Ps ( art::Ptr< simb::MCTruth > const &  mct)

Definition at line 167 of file ParticleInventoryService_service.cc.

References cheat::ParticleInventory::MCTruthToParticles_Ps().

Referenced by ParticleToMCTruth().

168  {
169 // if(!this->priv_ParticleListReady()){this->priv_PrepParticleList();}
170 // if(!this->priv_MCTruthListReady()){this->priv_PrepMCTruthList();}
171 // Not used for non-lazy mode
173  }
const std::vector< const simb::MCParticle * > MCTruthToParticles_Ps(art::Ptr< simb::MCTruth > const &mct) const
const std::vector< const simb::MCParticle * > cheat::ParticleInventory::MCTruthToParticles_Ps ( art::Ptr< simb::MCTruth > const &  mct) const
inherited

Definition at line 92 of file ParticleInventory.cc.

References cheat::ParticleInventory::fParticleList, and cheat::ParticleInventory::TrackIdToMCTruth_P().

Referenced by MCTruthToParticles_Ps(), and cheat::ParticleInventory::ParticleToMCTruth().

93  {
94  std::vector<const simb::MCParticle*> ret;
95  // sim::ParticleList::value_type is a pair (track Id, particle pointer)
96  for (const sim::ParticleList::value_type& TrackIdpair: fParticleList) {
97  if( this->TrackIdToMCTruth_P(TrackIdpair.first) == mct )
98  ret.push_back(TrackIdpair.second);
99  }
100  return ret;
101  }
sim::ParticleList fParticleList
list_type::value_type value_type
Definition: ParticleList.h:130
const art::Ptr< simb::MCTruth > & TrackIdToMCTruth_P(int const &id) const
const std::vector< art::Ptr< simb::MCTruth > > & cheat::ParticleInventoryService::MCTruthVector_Ps ( )

Definition at line 126 of file ParticleInventoryService_service.cc.

References cheat::ParticleInventory::MCTruthVector_Ps().

Referenced by ParticleToMCTruth().

126  {
127  //if(!this->priv_MCTruthListReady()){priv_PrepMCTruthList();}
128  // Not used for non-lazy mode
130  }
const std::vector< art::Ptr< simb::MCTruth > > & MCTruthVector_Ps() const
const std::vector< art::Ptr< simb::MCTruth > > & cheat::ParticleInventory::MCTruthVector_Ps ( ) const
inherited

Definition at line 87 of file ParticleInventory.cc.

References cheat::ParticleInventory::fMCTObj, and cheat::ParticleInventory::MCTObjects::fMCTruthList.

Referenced by MCTruthVector_Ps(), and cheat::ParticleInventory::ParticleToMCTruth().

87  {
88  return fMCTObj.fMCTruthList;
89  }
std::vector< art::Ptr< simb::MCTruth > > fMCTruthList
A vector containing the MCTruth objects.
const sim::ParticleList & cheat::ParticleInventoryService::ParticleList ( )

Definition at line 120 of file ParticleInventoryService_service.cc.

References cheat::ParticleInventory::ParticleList().

Referenced by cheat::CheckBackTracking::analyze(), opreco::OpticalRecoAna::analyze(), larg4::LArG4Ana::analyze(), pfpf::PFPAna::analyze(), cluster::ClusterAna::analyze(), cluster::DBclusterAna::analyze(), hit::HitFinderAna::analyze(), opdet::SimPhotonCounter::analyze(), cheat::RecoCheckAna::CheckRecoEvents(), cheat::RecoCheckAna::CheckRecoVertices(), simfilter::FilterPrimaryPDG::filter(), tca::TrajClusterAlg::GetHitCollection(), ems::MCinfo::Info(), tca::MCParticleListUtils::MakeCheatShower(), tca::TruthMatcher::MatchTrueHits(), tca::TruthMatcher::MatchTruth(), tca::MCParticleListUtils::PrimaryElectronPFPID(), tca::MCParticleListUtils::PrimaryElectronStart(), tca::MCParticleListUtils::PrimaryElectronTjID(), DUNE::NeutrinoShowerEff::processEff(), DUNE::NeutrinoTrackingEff::processEff(), DUNE::MuonTrackingEff::processEff(), vertex::VertexCheater::produce(), shwf::ShowerCheater::produce(), trkf::TrackCheater::produce(), cluster::ClusterCheater::produce(), trkf::TrackKalmanCheater::produce(), provider(), tca::TruthMatcher::StudyPiZeros(), and tca::TruthMatcher::StudyShowerParents().

120  {
121 // if(!this->priv_ParticleListReady()){this->priv_PrepParticleList();}
122 // Not used for non lazy functions
124  } //This should be replaced with a public struct so we can get away from the nutools dependency.
const sim::ParticleList & ParticleList() const
const sim::ParticleList& cheat::ParticleInventory::ParticleList ( ) const
inlineinherited
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 200 of file ParticleInventory.h.

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

Referenced by priv_ParticleListReady().

200 { return !( fParticleList.empty() ); }
sim::ParticleList fParticleList
bool empty() const
Definition: ParticleList.h:314
simb::MCTruth cheat::ParticleInventoryService::ParticleToMCTruth ( const simb::MCParticle p)
inline
simb::MCTruth cheat::ParticleInventory::ParticleToMCTruth ( const simb::MCParticle p) const
inlineinherited
const art::Ptr< simb::MCTruth > & cheat::ParticleInventoryService::ParticleToMCTruth_P ( const simb::MCParticle p)

Definition at line 160 of file ParticleInventoryService_service.cc.

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

Referenced by ParticleToMCTruth(), and TrackIdToMCTruth().

161  {
162 // if(!this->priv_TrackIdToMCTruthReady()){this->priv_PrepTrackIdToMCTruthIndex();}
163 // Not used for non-lazy mode
164  return this->TrackIdToMCTruth_P(p->TrackId());
165  }
int TrackId() const
Definition: MCParticle.h:214
const art::Ptr< simb::MCTruth > & TrackIdToMCTruth_P(int const &id)
const art::Ptr< simb::MCTruth > & cheat::ParticleInventory::ParticleToMCTruth_P ( const simb::MCParticle p) const
inherited

Definition at line 81 of file ParticleInventory.cc.

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

Referenced by cheat::ParticleInventory::ParticleToMCTruth(), and cheat::ParticleInventory::TrackIdToEveTrackId().

82  {
83  return this->TrackIdToMCTruth_P(p->TrackId());
84  }
int TrackId() const
Definition: MCParticle.h:214
const art::Ptr< simb::MCTruth > & TrackIdToMCTruth_P(int const &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(), and cheat::ParticleInventory::TrackIdToMCTruthReady().

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.

Referenced by cheat::ParticleInventory::TrackIdToMCTruthReady().

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(), and cheat::ParticleInventory::TrackIdToMCTruthReady().

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(), and cheat::ParticleInventory::TrackIdToMCTruthReady().

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

Definition at line 80 of file ParticleInventoryService_service.cc.

References cheat::ParticleInventory::CanRun().

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

80  {
81  return ParticleInventory::CanRun(evt);
82  }
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 99 of file ParticleInventoryService.h.

References cheat::ParticleInventory::MCTruthListReady().

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 98 of file ParticleInventoryService.h.

References cheat::ParticleInventory::ParticleListReady().

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)
private

Definition at line 69 of file ParticleInventoryService_service.cc.

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

Referenced by ParticleInventoryService(), ParticleToMCTruth(), and Rebuild().

69  {
70  //fEvt=&evt;
72  if( ! this->priv_CanRun(evt) ) { return; }
73  this->priv_PrepParticleList(evt);
74  this->priv_PrepMCTruthList(evt);
76  //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.
77  }
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 104 of file ParticleInventoryService_service.cc.

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

Referenced by ParticleToMCTruth(), and priv_PrepEvent().

104  {
105 // if(!this->priv_CanRun(*fEvt)){throw;}
106  if(!this->priv_CanRun(evt)){throw;}
107  if(this->priv_MCTruthListReady( ) ){ return;} //If the event is data or if the truth list is already built there is nothing for us to do.
109  //try{ ParticleInventory::PrepMCTruthList(*fEvt); }
110  catch(...){ mf::LogWarning("ParticleInventory") << "Rebuild failed to get the MCParticles. This is expected when running on a gernation or simulation step.";}
111  //ToDo. Find out exactly which exception is thrown and catch only that.
112 
113  }//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 85 of file ParticleInventoryService_service.cc.

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

Referenced by ParticleToMCTruth(), and priv_PrepEvent().

85  {
86  if(!this->priv_CanRun(evt)) {throw;}
87  //if(!this->priv_CanRun(*fEvt)) {throw;}
88  if(this->priv_ParticleListReady()){ return; }
89  //try{ParticleInventory::PrepParticleList(*fEvt);}
91  catch(...){ mf::LogWarning("ParticleInventory") << "Rebuild failed to get the MCParticles. This is expected when running on a gernation or simulation step.";}
92  }
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 95 of file ParticleInventoryService_service.cc.

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

Referenced by ParticleToMCTruth(), and priv_PrepEvent().

95  {
96  if(!this->priv_CanRun(evt)){throw;}
97  //if(!this->priv_CanRun(*fEvt)){throw;}
98  if( this->priv_TrackIdToMCTruthReady()){ return; }
99  //try{ParticleInventory::PrepTrackIdToMCTruthIndex(*fEvt);}
101  catch(...){ mf::LogWarning("ParticleInventory") << "Rebuild failed to get the MCParticles. This is expected when running on a gernation or simulation step.";}
102  }//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 100 of file ParticleInventoryService.h.

References DECLARE_ART_SERVICE, and cheat::ParticleInventory::TrackIdToMCTruthReady().

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 44 of file ParticleInventoryService.h.

References ParticleInventoryService(), ParticleList(), and Rebuild().

45  { return static_cast<const provider_type*>(this); }
void cheat::ParticleInventoryService::Rebuild ( const art::Event evt)
void cheat::ParticleInventoryService::SetEveIdCalculator ( sim::EveIdCalculator ec)
inline
int cheat::ParticleInventoryService::TrackIdToEveTrackId ( const int &  tid) const

Definition at line 155 of file ParticleInventoryService_service.cc.

References cheat::ParticleInventory::TrackIdToEveTrackId().

Referenced by TrackIdToMCTruth().

156  {
158  }
int TrackIdToEveTrackId(const int &tid) const
simb::MCTruth cheat::ParticleInventoryService::TrackIdToMCTruth ( int const &  id)
inline

Definition at line 68 of file ParticleInventoryService.h.

References ParticleToMCTruth_P(), TrackIdToEveTrackId(), and TrackIdToMCTruth_P().

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

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

Definition at line 233 of file ParticleInventory.h.

References cheat::ParticleInventory::TrackIdToMCTruth_P().

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

Definition at line 148 of file ParticleInventoryService_service.cc.

References cheat::ParticleInventory::TrackIdToMCTruth_P().

Referenced by cluster::ClusterAna::analyze(), pfpf::PFPAna::analyze(), opreco::OpticalRecoAna::get_MC_particle_origin(), tca::TrajClusterAlg::GetHitCollection(), tca::GetOrigin(), tca::TruthMatcher::MatchTrueHits(), ParticleToMCTruth_P(), TrackIdToMCTruth(), and TrackIdToMotherParticle().

149  {
150 // if(!this->priv_TrackIdToMCTruthReady()){this->priv_PrepTrackIdToMCTruthIndex();}
151 // Not used for non-lazy mode
153  }
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 67 of file ParticleInventory.cc.

References cheat::ParticleInventory::fMCTObj, cheat::ParticleInventory::MCTObjects::fMCTruthList, and cheat::ParticleInventory::MCTObjects::fTrackIdToMCTruthIndex.

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

68  {
69  // find the entry in the MCTruth collection for this track id
70  auto mctItr = fMCTObj.fTrackIdToMCTruthIndex.find(abs(id));
71  if(mctItr!=fMCTObj.fTrackIdToMCTruthIndex.end()){
72  int partIndex = mctItr->second;
73  return fMCTObj.fMCTruthList.at(partIndex);
74  }else{
75  throw cet::exception("ParticleInventory") << "Attempt to find MCTruth for TrackId: "
76  << id <<" has failed.";
77  }
78  }
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
simb::MCParticle cheat::ParticleInventoryService::TrackIdToMotherParticle ( int const &  id)
inline

Definition at line 64 of file ParticleInventoryService.h.

References TrackIdToMCTruth_P(), and TrackIdToMotherParticle_P().

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

Definition at line 229 of file ParticleInventory.h.

References cheat::ParticleInventory::TrackIdToMCTruth_P(), and cheat::ParticleInventory::TrackIdToMotherParticle_P().

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

Definition at line 141 of file ParticleInventoryService_service.cc.

References cheat::ParticleInventory::TrackIdToMotherParticle_P().

Referenced by tca::TruthMatcher::MatchTrueHits(), TrackIdToMotherParticle(), and TrackIdToParticle().

142  {
143 // if(!this->priv_ParticleListReady()){this->priv_PrepParticleList();}
144 // Not used for non-lazy mode
146  }
const simb::MCParticle * TrackIdToMotherParticle_P(int const &id) const
const simb::MCParticle * cheat::ParticleInventory::TrackIdToMotherParticle_P ( int const &  id) const
inherited
simb::MCParticle cheat::ParticleInventoryService::TrackIdToParticle ( int const &  id)
inline

Definition at line 60 of file ParticleInventoryService.h.

References TrackIdToMotherParticle_P(), and TrackIdToParticle_P().

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

Definition at line 225 of file ParticleInventory.h.

References cheat::ParticleInventory::TrackIdToMotherParticle_P(), and cheat::ParticleInventory::TrackIdToParticle_P().

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

Definition at line 48 of file ParticleInventory.cc.

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

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

48  {
50  if(part_it == fParticleList.end()){
51  mf::LogWarning("ParticleInventory") << "Particle with TrackId: "
52  << id << " not found in inventory. "
53  << "Returning null pointer.";
54  return 0;
55  }
56  return part_it->second;
57  }//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: