47 return HepMC::FourVector(10*point.x(), 10*point.y(), 10*point.z(), 0);
53 return HepMC::FourVector(lvec.px(), lvec.py(), lvec.pz(), std::hypot(lvec.P(),
std::max(0., lvec.mass())));
66 produces<edm::HepMCProduct>();
87 event.getByLabel(genParticlesLabel_, genParticlesHandle);
90 event.getByLabel(genEventInfoLabel_, genEventInfoHandle);
94 HepMC::GenEvent* hepmc_event =
new HepMC::GenEvent();
95 hepmc_event->set_event_number(event.
id().
event());
96 hepmc_event->set_signal_process_id(genEventInfoHandle->signalProcessID());
97 hepmc_event->set_event_scale(genEventInfoHandle->qScale());
98 hepmc_event->set_alphaQED(genEventInfoHandle->alphaQED());
99 hepmc_event->set_alphaQCD(genEventInfoHandle->alphaQCD());
101 hepmc_event->weights() = genEventInfoHandle->weights();
105 const int pdf_id1 = pdf->
id.first, pdf_id2 = pdf->
id.second;
106 const double pdf_x1 = pdf->
x.first, pdf_x2 = pdf->
x.second;
107 const double pdf_scalePDF = pdf->
scalePDF;
108 const double pdf_xPDF1 = pdf->
xPDF.first, pdf_xPDF2 = pdf->
xPDF.second;
109 HepMC::PdfInfo hepmc_pdfInfo(pdf_id1, pdf_id2, pdf_x1, pdf_x2, pdf_scalePDF, pdf_xPDF1, pdf_xPDF2);
110 hepmc_event->set_pdf_info(hepmc_pdfInfo);
121 std::map<const reco::Candidate*, HepMC::GenParticle*> genCandToHepMCMap;
122 std::vector<HepMC::GenParticle*> hepmc_particles;
123 for (
unsigned int i=0,
n=genParticlesHandle->size();
i<
n; ++
i )
127 hepmc_particle->suggest_barcode(
i+1);
130 double particleMass = pTable_->particle(p->
pdgId())->mass();
144 hepmc_particle->set_generated_mass(particleMass);
146 hepmc_particles.push_back(hepmc_particle);
147 genCandToHepMCMap[
p] = hepmc_particle;
151 const reco::Candidate* parton1 = genParticlesHandle->at(0).daughter(0);
152 const reco::Candidate* parton2 = genParticlesHandle->at(1).daughter(0);
153 HepMC::GenVertex* vertex1 =
new HepMC::GenVertex(FourVector(parton1->
vertex()));
154 HepMC::GenVertex* vertex2 =
new HepMC::GenVertex(FourVector(parton2->
vertex()));
155 hepmc_event->add_vertex(vertex1);
156 hepmc_event->add_vertex(vertex2);
159 vertex1->add_particle_in(hepmc_particles[0]);
160 vertex2->add_particle_in(hepmc_particles[1]);
161 hepmc_event->set_beam_particles(hepmc_particles[0], hepmc_particles[1]);
164 typedef std::map<const reco::Candidate*, HepMC::GenVertex*> ParticleToVertexMap;
165 ParticleToVertexMap particleToVertexMap;
166 particleToVertexMap[parton1] = vertex1;
167 particleToVertexMap[parton2] = vertex2;
168 for (
unsigned int i=2, n=genParticlesHandle->size();
i<
n; ++
i )
177 HepMC::GenVertex* vertex;
178 if ( particleToVertexMap.find(elder) == particleToVertexMap.end() )
180 vertex =
new HepMC::GenVertex(FourVector(elder->
vertex()));
181 hepmc_event->add_vertex(vertex);
182 particleToVertexMap[elder] = vertex;
186 vertex = particleToVertexMap[elder];
191 vertex->add_particle_in(genCandToHepMCMap[mother]);
192 vertex->add_particle_out(hepmc_particles[
i]);
197 hepmc_event->set_signal_process_vertex(*(vertex1->vertices_begin()));
200 hepmc_product->addHepMCData(hepmc_event);
201 event.put(hepmc_product);
T getParameter(std::string const &) const
EventNumber_t event() const
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
virtual const Candidate * mother(size_type i=0) const =0
return pointer to mother
void produce(edm::Event &event, const edm::EventSetup &eventSetup)
#define DEFINE_FWK_MODULE(type)
virtual int status() const =0
status word
std::pair< double, double > x
~GenParticles2HepMCConverter()
virtual size_type numberOfMothers() const =0
number of mothers (zero or one in most of but not all the cases)
edm::ESHandle< ParticleDataTable > pTable_
HepMC::FourVector FourVector(const reco::Candidate::Point &point)
void getData(T &iHolder) const
std::pair< double, double > xPDF
edm::InputTag genEventInfoLabel_
HepMC::FourVector FourVector(const reco::Candidate::LorentzVector &lvec)
void beginRun(edm::Run &run, const edm::EventSetup &eventSetup)
virtual const Point & vertex() const =0
vertex position
edm::InputTag genParticlesLabel_
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
virtual int pdgId() const =0
PDG identifier.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
math::XYZPoint Point
point in the space
GenParticles2HepMCConverter(const edm::ParameterSet &pset)
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector