LCIO
02.17
|
Basic utility for reading a binary stdhep file and filling a LCCollectionVec with MCParticles containing the stdhep file information. More...
#include <LCStdHepRdrNew.h>
Public Member Functions | |
LCStdHepRdrNew (const char *evfile) | |
Open the stdhep input file in the constructer. More... | |
LCStdHepRdrNew (const LCStdHepRdrNew &)=delete | |
no copy constructor More... | |
LCStdHepRdrNew & | operator= (const LCStdHepRdrNew &)=delete |
no assignment operator More... | |
~LCStdHepRdrNew () | |
noop More... | |
long | getNumberOfEvents () const |
Get number of events in the stdhep file. More... | |
long | getNumberOfTotalEventsExpected () const |
Get total number of expected events in the whole set of stdhep files from which this stdhep file belongs to. More... | |
IMPL::LCCollectionVec * | readEvent () |
Read an event and return an LCCollectionVec of MCParticles. More... | |
void | updateNextEvent (IMPL::LCEventImpl *evt, const char *colName=EVENT::LCIO::MCPARTICLE) |
Reads the next stdhep event and adds a new MCParticle collection to the the event with default name 'MCParticle'. More... | |
void | printHeader (std::ostream &os=std::cout) |
Print the file header to the given ostream. More... | |
int | threeCharge (int pdgID) const |
Return the charge of the particle times 3 - code copied from HepPDT package. More... | |
void | setWriteEventNumber (bool writeEventNumber) |
Private Attributes | |
lStdHep * | _reader {} |
bool | _writeEventNumber {false} |
Basic utility for reading a binary stdhep file and filling a LCCollectionVec with MCParticles containing the stdhep file information.
Definition at line 24 of file LCStdHepRdrNew.h.
UTIL::LCStdHepRdrNew::LCStdHepRdrNew | ( | const char * | evfile | ) |
Open the stdhep input file in the constructer.
Definition at line 21 of file LCStdHepRdrNew.cc.
References std::ends(), and std::stringstream::str().
|
delete |
no copy constructor
UTIL::LCStdHepRdrNew::~LCStdHepRdrNew | ( | ) |
noop
Definition at line 35 of file LCStdHepRdrNew.cc.
|
inline |
Get number of events in the stdhep file.
This number is read from the file header (no guarantee that it is correct)
Definition at line 45 of file LCStdHepRdrNew.h.
References _reader, and UTIL::lStdHep::numEvents().
|
inline |
Get total number of expected events in the whole set of stdhep files from which this stdhep file belongs to.
This number is read from the file header (no guarantee that it is correct)
Definition at line 53 of file LCStdHepRdrNew.h.
References _reader, and UTIL::lStdHep::numEventsExpected().
|
delete |
no assignment operator
void UTIL::LCStdHepRdrNew::printHeader | ( | std::ostream & | os = std::cout | ) |
Print the file header to the given ostream.
Definition at line 40 of file LCStdHepRdrNew.cc.
IMPL::LCCollectionVec * UTIL::LCStdHepRdrNew::readEvent | ( | ) |
Read an event and return an LCCollectionVec of MCParticles.
Definition at line 87 of file LCStdHepRdrNew.cc.
References IMPL::MCParticleImpl::addParent(), std::vector< T >::at(), std::vector< T >::begin(), std::vector< T >::end(), std::ends(), EVTWGT_NAME, std::find(), IMPL::MCParticleImpl::getDaughters(), IMPL::LCCollectionVec::getElementAt(), IMPL::MCParticleImpl::getGeneratorStatus(), IMPL::MCParticleImpl::getParents(), IMPL::MCParticleImpl::getPDG(), IDRUP_NAME, LSH_ENDOFFILE, LSH_SUCCESS, IMPL::LCCollectionVec::parameters(), std::vector< T >::resize(), IMPL::MCParticleImpl::setCharge(), IMPL::MCParticleImpl::setColorFlow(), IMPL::MCParticleImpl::setGeneratorStatus(), IMPL::MCParticleImpl::setMass(), IMPL::MCParticleImpl::setMomentum(), IMPL::MCParticleImpl::setPDG(), IMPL::MCParticleImpl::setSimulatorStatus(), IMPL::MCParticleImpl::setSpin(), IMPL::MCParticleImpl::setTime(), EVENT::LCParameters::setValue(), IMPL::MCParticleImpl::setVertex(), std::vector< T >::size(), and std::stringstream::str().
|
inline |
Definition at line 78 of file LCStdHepRdrNew.h.
References _writeEventNumber.
int UTIL::LCStdHepRdrNew::threeCharge | ( | int | pdgID | ) | const |
Return the charge of the particle times 3 - code copied from HepPDT package.
PID digits (base 10) are: n nr nl nq1 nq2 nq3 nj The location enum provides a convenient index into the PID.
Definition at line 489 of file LCStdHepRdrNew.cc.
References std::pow().
void UTIL::LCStdHepRdrNew::updateNextEvent | ( | IMPL::LCEventImpl * | evt, |
const char * | colName = EVENT::LCIO::MCPARTICLE |
||
) |
Reads the next stdhep event and adds a new MCParticle collection to the the event with default name 'MCParticle'.
IO::EndOfDataException | if no event in stdhep file |
Definition at line 49 of file LCStdHepRdrNew.cc.
References IMPL::LCEventImpl::addCollection(), std::endl(), EVTWGT_NAME, EVENT::LCParameters::getFloatVal(), EVENT::LCParameters::getIntVal(), IMPL::LCCollectionVec::getParameters(), IDRUP_NAME, IMPL::LCEventImpl::parameters(), IMPL::LCEventImpl::setEventNumber(), EVENT::LCParameters::setValue(), and IMPL::LCEventImpl::setWeight().
|
private |
Definition at line 84 of file LCStdHepRdrNew.h.
Referenced by getNumberOfEvents(), and getNumberOfTotalEventsExpected().
|
private |
Definition at line 85 of file LCStdHepRdrNew.h.
Referenced by setWriteEventNumber().