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);
132 else particleMass = p->
mass();
146 hepmc_particle->set_generated_mass(particleMass);
148 hepmc_particles.push_back(hepmc_particle);
149 genCandToHepMCMap[
p] = hepmc_particle;
153 const reco::Candidate* parton1 = genParticlesHandle->at(0).daughter(0);
154 const reco::Candidate* parton2 = genParticlesHandle->at(1).daughter(0);
155 HepMC::GenVertex* vertex1 =
new HepMC::GenVertex(
FourVector(parton1->
vertex()));
156 HepMC::GenVertex* vertex2 =
new HepMC::GenVertex(
FourVector(parton2->
vertex()));
157 hepmc_event->add_vertex(vertex1);
158 hepmc_event->add_vertex(vertex2);
161 vertex1->add_particle_in(hepmc_particles[0]);
162 vertex2->add_particle_in(hepmc_particles[1]);
163 hepmc_event->set_beam_particles(hepmc_particles[0], hepmc_particles[1]);
166 typedef std::map<const reco::Candidate*, HepMC::GenVertex*> ParticleToVertexMap;
167 ParticleToVertexMap particleToVertexMap;
168 particleToVertexMap[parton1] = vertex1;
169 particleToVertexMap[parton2] = vertex2;
170 for (
unsigned int i=2, n=genParticlesHandle->size();
i<
n; ++
i )
179 HepMC::GenVertex* vertex;
180 if ( particleToVertexMap.find(elder) == particleToVertexMap.end() )
183 hepmc_event->add_vertex(vertex);
184 particleToVertexMap[elder] = vertex;
188 vertex = particleToVertexMap[elder];
193 vertex->add_particle_in(genCandToHepMCMap[mother]);
194 vertex->add_particle_out(hepmc_particles[
i]);
199 hepmc_event->set_signal_process_vertex(*(vertex1->vertices_begin()));
202 hepmc_product->addHepMCData(hepmc_event);
203 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 double mass() const =0
mass
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_
const reco::GenParticle * mother(const reco::GenParticle &p, unsigned int imoth=0)
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