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() )
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);
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
virtual int status() const =0
status word
std::pair< double, double > x
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_
virtual const Point & vertex() const =0
vertex position
edm::InputTag genParticlesLabel_
virtual int pdgId() const =0
PDG identifier.
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector