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>(
"unsmeared");
87 event.getByToken(genParticlesToken_, genParticlesHandle);
90 event.getByToken(genEventInfoToken_, 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);
131 if ( pTable_->particle(p->
pdgId()) ) particleMass = pTable_->particle(p->
pdgId())->
mass();
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() )
182 vertex =
new HepMC::GenVertex(FourVector(elder->
vertex()));
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,
"unsmeared");
void produce(edm::Event &event, const edm::EventSetup &eventSetup) override
T getParameter(std::string const &) const
EventNumber_t event() const
edm::EDGetTokenT< GenEventInfoProduct > genEventInfoToken_
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
#define DEFINE_FWK_MODULE(type)
virtual double mass() const =0
mass
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)
edm::EDGetTokenT< reco::CandidateView > genParticlesToken_
void getData(T &iHolder) const
std::pair< double, double > xPDF
HepMC::FourVector FourVector(const reco::Candidate::LorentzVector &lvec)
virtual const Point & vertex() const =0
vertex position
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