23 #include "cetlib_except/exception.h"
24 #include "messagefacility/MessageLogger/MessageLogger.h"
26 #include <TLorentzVector.h>
57 list.
insert(partInfo.second?
new simb::MCParticle(*(partInfo.second)):
nullptr);
72 typedef std::set< key_type > keyList_type;
78 const simb::MCParticle* particle = (*i).second;
79 if (!particle)
continue;
80 Double_t totalInitialEnergy = particle->E();
81 if ( totalInitialEnergy < cut ) keyList.insert( (*i).first );
85 for ( keyList_type::const_iterator i = keyList.begin(); i != keyList.end(); ++i ) this->
erase( *i );
93 std::advance(i,index);
101 std::advance(i,index);
110 std::advance(i,index);
132 std::advance( primary, index );
135 int trackID = *primary;
141 return (*entry).second;
147 std::vector<const simb::MCParticle*> primaries;
154 primaries.push_back(iPartPair.second);
158 throw cet::exception(
"MCTruthParticleList")
159 <<
"sim::MCTruthParticleList::GetPrimaries() collected " << primaries.size()
160 <<
" primaries, not " <<
m_primaries.size() <<
" as expected\n";
261 int trackID =
key(particle);
269 else if ( (*insertion).first != trackID ){
278 if ( particle->Process().find(
"rimary") != std::string::npos )
286 if (part ==
nullptr)
return;
307 return part? part->Mother():
m_archive.at(key).Mother();
322 delete position->second;
340 int numberOfDigits = (int) std::log10( (
double) numberOfParticles ) + 1;
343 output.width( numberOfDigits );
344 output <<
"#" <<
": < ID, particle >" << std::endl;
349 particle != list.
end(); ++particle, ++nParticle )
351 output.width( numberOfDigits );
352 output << nParticle <<
": "
353 <<
"<" << (*particle).first <<
",";
354 if (particle->second)
355 output << *(particle->second);
357 auto iArch = list.
m_archive.find(particle->first);
359 output <<
"lost [INTERNAL ERROR!]";
361 output <<
"(archived) " << iArch->second;
363 output <<
">" << std::endl;
404 std::ostream&
operator<<
407 output <<
"Mother ID=" <<
info.Mother() << std::endl;
std::vector< const simb::MCParticle * > GetPrimaries() const
std::ostream & operator<<(std::ostream &output, const MCTruthParticleHistory &list)
list_type::const_iterator const_iterator
void Archive(const key_type &key)
Removes the particle from the list, keeping minimal info of it.
int GetMotherOf(const key_type &key) const
This function seeks for the exact key, not its absolute value.
primaries_type::const_iterator primaries_const_iterator
Particle list in DetSim contains Monte Carlo particle information.
MCTruthParticleList MakeCopy() const
Returns a copy of this object.
list_type::size_type size_type
const simb::MCParticle * Primary(const int) const
list_type m_MCTruthParticleList
Sorted list of particles in the event.
Interface for calculating the "ultimate mother" of a particle in a simulated event.
key_type key(mapped_type const &part) const
Extracts the key from the specified value.
archive_type m_archive
archive of the particles no longer among us
int EveId(const int trackID) const
list_type::value_type value_type
std::unique_ptr< MCTruthEveIdCalculator > m_eveIdCalculator
mapped_type const & Particle(const size_type) const
void AdoptEveIdCalculator(MCTruthEveIdCalculator *) const
list_type::mapped_type mapped_type
int NumberOfPrimaries() const
list_type::key_type key_type
void insert(const simb::MCParticle *value)
size_type erase(const key_type &key)
BEGIN_PROLOG sequence::SlidingWindowTriggerPatternsOppositeWindows END_PROLOG simSlidingORM6O6 effSlidingORW output
virtual ~MCTruthParticleList()
primaries_type m_primaries
const key_type & TrackId(const size_type) const
bool IsPrimary(int trackID) const
list_type::iterator iterator