84 hepmc_event->set_event_number(event.
id().
event());
85 hepmc_event->set_signal_process_id(genEventInfoHandle->
signalProcessID());
86 hepmc_event->set_event_scale(genEventInfoHandle->
qScale());
87 hepmc_event->set_alphaQED(genEventInfoHandle->
alphaQED());
88 hepmc_event->set_alphaQCD(genEventInfoHandle->
alphaQCD());
90 hepmc_event->weights() = genEventInfoHandle->
weights();
92 hepmc_event->set_cross_section(
xsec_);
97 const int pdf_id1 = pdf->
id.first, pdf_id2 = pdf->
id.second;
98 const double pdf_x1 = pdf->
x.first, pdf_x2 = pdf->
x.second;
99 const double pdf_scalePDF = pdf->
scalePDF;
100 const double pdf_xPDF1 = pdf->
xPDF.first, pdf_xPDF2 = pdf->
xPDF.second;
101 HepMC::PdfInfo hepmc_pdfInfo(pdf_id1, pdf_id2, pdf_x1, pdf_x2, pdf_scalePDF, pdf_xPDF1, pdf_xPDF2);
102 hepmc_event->set_pdf_info(hepmc_pdfInfo);
106 std::map<const reco::Candidate*, HepMC::GenParticle*> genCandToHepMCMap;
108 std::vector<HepMC::GenParticle*> hepmc_particles;
110 for (
unsigned int i = 0,
n = genParticlesHandle->
size();
i <
n; ++
i) {
113 hepmc_particle->suggest_barcode(
i + 1);
120 particleMass = p->
mass();
122 hepmc_particle->set_generated_mass(particleMass);
124 hepmc_particles.push_back(hepmc_particle);
125 genCandToHepMCMap[
p] = hepmc_particle;
129 if (!parton1 and p->
pz() > 0) {
131 hepmc_parton1 = hepmc_particle;
132 }
else if (!parton2 and p->
pz() < 0) {
134 hepmc_parton2 = hepmc_particle;
139 HepMC::GenVertex* vertex1 =
nullptr;
140 HepMC::GenVertex* vertex2 =
nullptr;
141 if (parton1 ==
nullptr and parton2 ==
nullptr) {
146 vertex1 =
new HepMC::GenVertex(
FourVector(nullP4));
147 vertex2 =
new HepMC::GenVertex(
FourVector(nullP4));
153 vertex2 =
new HepMC::GenVertex(
FourVector(parton2->vertex()));
155 hepmc_event->add_vertex(vertex1);
156 hepmc_event->add_vertex(vertex2);
157 vertex1->add_particle_in(hepmc_parton1);
158 vertex2->add_particle_in(hepmc_parton2);
162 typedef std::map<const reco::Candidate*, HepMC::GenVertex*> ParticleToVertexMap;
163 ParticleToVertexMap particleToVertexMap;
164 particleToVertexMap[parton1] = vertex1;
165 particleToVertexMap[parton2] = vertex2;
166 for (
unsigned int i = 0, n = genParticlesHandle->
size();
i <
n; ++
i) {
168 if (p == parton1
or p == parton2)
176 if (particleToVertexMap.find(elder) == particleToVertexMap.end()) {
178 hepmc_event->add_vertex(vertex);
179 particleToVertexMap[elder] =
vertex;
181 vertex = particleToVertexMap[elder];
186 vertex->add_particle_in(genCandToHepMCMap[mother]);
187 vertex->add_particle_out(hepmc_particles[
i]);
192 bool hasSignalVertex =
false;
195 for (
auto v = hepmc_event->vertices_begin();
v != hepmc_event->vertices_end(); ++
v) {
197 const int pdgId = (*p)->pdg_id();
200 hepmc_event->set_signal_process_vertex(*
v);
201 hasSignalVertex =
true;
210 if (!hasSignalVertex)
211 hepmc_event->set_signal_process_vertex(*(vertex1->vertices_begin()));
214 hepmc_product->addHepMCData(hepmc_event);
215 event.put(
std::move(hepmc_product),
"unsmeared");
EventNumber_t event() const
virtual double pz() const =0
z coordinate of momentum vector
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) ...
std::pair< double, double > x
edm::ESHandle< ParticleDataTable > pTable_
virtual const Candidate * mother(size_type i=0) const =0
return pointer to mother
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
HepMC::FourVector FourVector(const reco::Candidate::Point &point)
edm::EDGetTokenT< reco::CandidateView > genParticlesToken_
HepMC::GenCrossSection xsec_
std::pair< double, double > xPDF
bool getData(T &iHolder) const
virtual int status() const =0
status word
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
virtual int pdgId() const =0
PDG identifier.
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
virtual size_type numberOfMothers() const =0
number of mothers (zero or one in most of but not all the cases)
std::vector< int > signalParticlePdgIds_
Abs< T >::type abs(const T &t)
virtual double eta() const =0
momentum pseudorapidity
virtual double mass() const =0
mass
math::XYZTLorentzVector LorentzVector
Lorentz vector.
std::vector< double > & weights()
const_reference at(size_type pos) const
virtual const Point & vertex() const =0
vertex position
unsigned int signalProcessID() const