46 std::cout <<
"[StdhepMCParticleProcessor] Starting process()" << std::endl;
48 std::cout <<
"opening file : " <<
inFilename_ << std::endl;
51 std::stringstream description;
53 description <<
" file generated with LCIO stdhepjob from " <<
inFilename_;
68 std::unique_ptr<IMPL::LCEventImpl> evt(
new IMPL::LCEventImpl() ) ;
69 evt->setRunNumber(0) ;
70 evt->setEventNumber(count) ;
76 EVENT::LCCollection* lc_particles{
nullptr};
81 for (
int iparticle = 0; iparticle < lc_particles->getNumberOfElements(); ++iparticle){
83 IMPL::MCParticleImpl* lc_particle =
static_cast<IMPL::MCParticleImpl*
>(lc_particles->getElementAt(iparticle));
89 particle->
setCharge(lc_particle->getCharge());
92 particle->
setTime(lc_particle->getTime());
95 particle->
setEnergy(lc_particle->getEnergy());
104 particle->
setMass(lc_particle->getMass());
107 particle->
setPDG(lc_particle->getPDG());
110 particle->
setID(lc_particle->id());
113 std::vector<EVENT::MCParticle*> parentVec = lc_particle->getParents();
114 if(parentVec.size() > 0) particle->
setMomPDG(parentVec.at(0)->getPDG());
117 particle->
setGenStatus(lc_particle->getGeneratorStatus());
120 particle->
setSimStatus(lc_particle->getSimulatorStatus());
133 catch (EVENT::DataNotAvailableException e)
135 std::cout << e.what() << std::endl;
143 catch( IO::EndOfDataException& e ) {
146 std::cout <<
" converted " << count << std::endl ;
148 std::cout <<
"==================================================== "
149 << std::endl << std::endl ;
Processor used to translate StdHep MCParticles to ROOT MCParticle objects.
void setVertexPosition(const double *vtx_pos)
void setEndpointMomentum(const double *momentum_ep)
void setPDG(const int pdg)
void setMass(const double mass)
void setGenStatus(const int gen)
void setMomPDG(const int momPDG)
void setCharge(const int charge)
void setMomentum(const double *momentum)
void setEnergy(const double energy)
void setTime(const double time)
void setEndPoint(const double *ep_pos)
void setSimStatus(const int sim)
Processor used to translate StdHep MCParticles to ROOT MCParticle objects. more details.
std::string mcPartCollStdhep_
name temporary lcio collection
virtual void configure(const ParameterSet ¶meters)
Configure the Processor.
virtual void finalize()
Callback for the Processor to take any necessary action when the processing of events finishes.
int skipEvent_
skipped event numbers to convet
TTree * tree_
TTree holds converted MCParticles for each event.
int maxEvent_
max stdhep event number to convert
std::vector< MCParticle * > mc_particles_
list of converted MCParticles
virtual void initialize(std::string inFilename, std::string outFilename)
Callback for the Processor to take any necessary action when the processing of events starts.
~StdhepMCParticleProcessor()
StdhepMCParticleProcessor(const std::string &name, Process &process)
Class constructor.
std::string mcPartCollRoot_
name root collection
virtual bool process()
Process the event and put new data products into it.