16 #include "cetlib_except/exception.h" 19 #include <TLorentzVector.h> 49 for (std::pair<int, simb::MCParticle*>
const& partInfo:
m_particleList)
65 typedef std::set< key_type > keyList_type;
71 if (!particle)
continue;
72 Double_t totalInitialEnergy = particle->
E();
73 if ( totalInitialEnergy < cut ) {
74 keyList.insert( (*i).first );
89 std::advance(i,index);
96 std::advance(i,index);
104 std::advance(i,index);
125 std::advance( primary, index );
128 int trackID = *primary;
134 return (*entry).second;
142 std::advance( primary, index );
145 int trackID = *primary;
151 return (*entry).second;
158 std::vector<const simb::MCParticle*> primaries;
164 primaries.push_back(iPartPair.second);
168 <<
"sim::ParticleList::GetPrimaries() collected " << primaries.size()
169 <<
" primaries, not " <<
m_primaries.size() <<
" as expected\n";
269 int trackID =
key(particle);
276 else if ( (*insertion).first == trackID ){
277 throw cet::exception(
"ParticleList") <<
"sim::ParticleList::insert - ERROR - " 278 <<
"track ID=" << trackID
279 <<
" is already in the list\n";
290 if ( particle->
Process().find(
"rimary") != std::string::npos )
298 if (
part ==
nullptr)
return;
338 delete position->second;
356 int numberOfDigits = (int) std::log10( (
double) numberOfParticles ) + 1;
359 output.width( numberOfDigits );
360 output <<
"#" <<
": < ID, particle >" << std::endl;
365 particle != list.
end(); ++particle, ++nParticle ){
366 output.width( numberOfDigits );
367 output << nParticle <<
": " 368 <<
"<" << (*particle).first <<
",";
369 if (particle->second)
370 output << *(particle->second);
372 auto iArch = list.
m_archive.find(particle->first);
374 output <<
"lost [INTERNAL ERROR!]";
376 output <<
"(archived) " << iArch->second;
378 output <<
">" << std::endl;
396 if ( eveIdCalculator.get() == 0 ){
403 if ( saveEveIdCalculator != eveIdCalculator.get() ) {
404 saveEveIdCalculator = eveIdCalculator.get();
405 eveIdCalculator->Init(
this );
407 if ( eveIdCalculator->ParticleList() != this ){
408 eveIdCalculator->Init(
this );
413 return eveIdCalculator->CalculateEveId( trackID );
420 eveIdCalculator.reset(calc);
424 std::ostream&
operator<<
427 output <<
"Mother ID=" << info.Mother() << std::endl;
double E(const int i=0) const
void insert(simb::MCParticle *value)
ParticleList MakeCopy() const
Returns a copy of this object.
key_type key(mapped_type const &part) const
Extracts the key from the specified value.
const key_type & TrackId(const size_type) const
primaries_type m_primaries
list_type::value_type value_type
list_type::const_iterator const_iterator
list_type::iterator iterator
primaries_type::const_iterator primaries_const_iterator
int EveId(const int trackID) const
std::string Process() const
mapped_type const & Particle(const size_type) const
bool IsPrimary(int trackID) const
friend std::ostream & operator<<(std::ostream &output, const ParticleList &)
list_type::size_type size_type
Interface for calculating the "ultimate mother" of a particle in a simulated event.
int GetMotherOf(const key_type &key) const
This function seeks for the exact key, not its absolute value.
list_type::key_type key_type
static std::unique_ptr< EveIdCalculator > eveIdCalculator
std::vector< const simb::MCParticle * > GetPrimaries() const
const simb::MCParticle * Primary(const int) const
size_type erase(const key_type &key)
list_type m_particleList
Sorted list of particles in the event.
Particle list in DetSim contains Monte Carlo particle information.
static void AdoptEveIdCalculator(EveIdCalculator *)
archive_type m_archive
archive of the particles no longer among us
int NumberOfPrimaries() const
list_type::mapped_type mapped_type
void Archive(const key_type &key)
Removes the particle from the list, keeping minimal info of it.
cet::coded_exception< error, detail::translate > exception