#include <GeneratorInterface/LHE2HepMCConverter/src/LHE2HepMCConverter.cc>
Public Member Functions | |
LHE2HepMCConverter (const edm::ParameterSet &) | |
~LHE2HepMCConverter () | |
Static Public Member Functions | |
static void | fillDescriptions (edm::ConfigurationDescriptions &descriptions) |
Private Member Functions | |
virtual void | beginJob () |
virtual void | beginLuminosityBlock (edm::LuminosityBlock &, edm::EventSetup const &) |
virtual void | beginRun (edm::Run &, edm::EventSetup const &) |
virtual void | endJob () |
virtual void | endLuminosityBlock (edm::LuminosityBlock &, edm::EventSetup const &) |
virtual void | endRun (edm::Run &, edm::EventSetup const &) |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
edm::InputTag | _lheEventSrcTag |
const LHERunInfoProduct * | _lheRunSrc |
edm::InputTag | _lheRunSrcTag |
Description: [one line class summary]
Implementation: [Notes on implementation]
Definition at line 46 of file LHE2HepMCConverter.cc.
LHE2HepMCConverter::LHE2HepMCConverter | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 88 of file LHE2HepMCConverter.cc.
References _lheEventSrcTag, _lheRunSrcTag, and edm::ParameterSet::getParameter().
: _lheRunSrc(0) { //register your products produces<edm::HepMCProduct>(); _lheEventSrcTag = iConfig.getParameter<edm::InputTag>("LHEEventProduct"); _lheRunSrcTag = iConfig.getParameter<edm::InputTag>("LHERunInfoProduct"); }
LHE2HepMCConverter::~LHE2HepMCConverter | ( | ) |
Definition at line 100 of file LHE2HepMCConverter.cc.
{ // do anything here that needs to be done at desctruction time // (e.g. close files, deallocate resources etc.) }
void LHE2HepMCConverter::beginJob | ( | void | ) | [private, virtual] |
void LHE2HepMCConverter::beginLuminosityBlock | ( | edm::LuminosityBlock & | , |
edm::EventSetup const & | |||
) | [private, virtual] |
void LHE2HepMCConverter::beginRun | ( | edm::Run & | iRun, |
edm::EventSetup const & | |||
) | [private, virtual] |
Reimplemented from edm::EDProducer.
Definition at line 167 of file LHE2HepMCConverter.cc.
References _lheRunSrc, _lheRunSrcTag, edm::Run::getByLabel(), edm::HandleBase::isValid(), edm::InputTag::label(), and edm::Handle< T >::product().
{ edm::Handle<LHERunInfoProduct> lheRunSrcHandle; iRun.getByLabel(_lheRunSrcTag, lheRunSrcHandle); if (lheRunSrcHandle.isValid()) { _lheRunSrc = lheRunSrcHandle.product(); } else { if (_lheRunSrcTag.label() != "source" ) { iRun.getByLabel("source", lheRunSrcHandle); if (lheRunSrcHandle.isValid()) { _lheRunSrc = lheRunSrcHandle.product(); edm::LogInfo("LHE2HepMCConverter") << "Taking LHERunInfoproduct from source"; } else edm::LogWarning("LHE2HepMCConverter") << "No LHERunInfoProduct from source"; } } }
void LHE2HepMCConverter::endJob | ( | void | ) | [private, virtual] |
void LHE2HepMCConverter::endLuminosityBlock | ( | edm::LuminosityBlock & | , |
edm::EventSetup const & | |||
) | [private, virtual] |
void LHE2HepMCConverter::endRun | ( | edm::Run & | , |
edm::EventSetup const & | |||
) | [private, virtual] |
void LHE2HepMCConverter::fillDescriptions | ( | edm::ConfigurationDescriptions & | descriptions | ) | [static] |
Reimplemented from edm::EDProducer.
Definition at line 210 of file LHE2HepMCConverter.cc.
References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().
{ //The following says we do not know what parameters are allowed so do no validation // Please change this to state exactly what you do use, even if it is no parameters edm::ParameterSetDescription desc; desc.setUnknown(); descriptions.addDefault(desc); }
void LHE2HepMCConverter::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 115 of file LHE2HepMCConverter.cc.
References _lheEventSrcTag, _lheRunSrc, lhef::HEPRUP::EBMUP, configurableAnalysis::GenParticle, edm::Event::getByLabel(), LHERunInfoProduct::heprup(), i, lhef::HEPRUP::IDBMUP, AlCaHLTBitMon_ParallelJobs::p, edm::Event::put(), and v.
{ using namespace edm; Handle<LHEEventProduct> lheEventSrc; iEvent.getByLabel(_lheEventSrcTag, lheEventSrc); HepMC::GenEvent *evt = new HepMC::GenEvent(); HepMC::GenVertex* v = new HepMC::GenVertex(); evt->add_vertex(v); if (_lheRunSrc){ HepMC::FourVector beam1(0, 0, _lheRunSrc->heprup().EBMUP.first, _lheRunSrc->heprup().EBMUP.first); HepMC::GenParticle* gp1 = new HepMC::GenParticle(beam1, _lheRunSrc->heprup().IDBMUP.first, 4); v->add_particle_in(gp1); HepMC::FourVector beam2(0, 0, _lheRunSrc->heprup().EBMUP.second, _lheRunSrc->heprup().EBMUP.second); HepMC::GenParticle* gp2 = new HepMC::GenParticle(beam2, _lheRunSrc->heprup().IDBMUP.second, 4); v->add_particle_in(gp2); evt->set_beam_particles(gp1, gp2); } else { LogWarning("LHE2HepMCConverter") << "Could not retrieve the LHERunInfoProduct for this event. You'll miss the beam particles in your HepMC product." ; } for (int i = 0; i < lheEventSrc->hepeup().NUP; ++i) { if (lheEventSrc->hepeup().ISTUP[i] != 1) { //cout << reader->hepeup.ISTUP[i] << ", " << reader->hepeup.IDUP[i] << endl; continue; } HepMC::FourVector p(lheEventSrc->hepeup().PUP[i][0], lheEventSrc->hepeup().PUP[i][1], lheEventSrc->hepeup().PUP[i][2], lheEventSrc->hepeup().PUP[i][3]); HepMC::GenParticle* gp = new HepMC::GenParticle(p, lheEventSrc->hepeup().IDUP[i], 1); gp->set_generated_mass(lheEventSrc->hepeup().PUP[i][4]); v->add_particle_out(gp); } std::auto_ptr<HepMCProduct> pOut(new HepMCProduct(evt)); iEvent.put(pOut); }
Definition at line 68 of file LHE2HepMCConverter.cc.
Referenced by LHE2HepMCConverter(), and produce().
const LHERunInfoProduct* LHE2HepMCConverter::_lheRunSrc [private] |
Definition at line 70 of file LHE2HepMCConverter.cc.
Referenced by beginRun(), and produce().
Definition at line 69 of file LHE2HepMCConverter.cc.
Referenced by beginRun(), and LHE2HepMCConverter().