46 return HepMC::FourVector(10*point.x(), 10*point.y(), 10*point.z(), 0);
52 return HepMC::FourVector(lvec.px(), lvec.py(), lvec.pz(), std::hypot(lvec.P(),
std::max(0., lvec.mass())));
59 cmEnergy_(pset.getUntrackedParameter<double>(
"cmEnergy", 13000))
65 produces<edm::HepMCProduct>(
"unsmeared");
79 hepmc_event->set_event_number(event.
id().
event());
80 hepmc_event->set_signal_process_id(genEventInfoHandle->signalProcessID());
81 hepmc_event->set_event_scale(genEventInfoHandle->qScale());
82 hepmc_event->set_alphaQED(genEventInfoHandle->alphaQED());
83 hepmc_event->set_alphaQCD(genEventInfoHandle->alphaQCD());
85 hepmc_event->weights() = genEventInfoHandle->weights();
89 if ( pdf !=
nullptr ) {
90 const int pdf_id1 = pdf->
id.first, pdf_id2 = pdf->
id.second;
91 const double pdf_x1 = pdf->
x.first, pdf_x2 = pdf->
x.second;
92 const double pdf_scalePDF = pdf->
scalePDF;
93 const double pdf_xPDF1 = pdf->
xPDF.first, pdf_xPDF2 = pdf->
xPDF.second;
94 HepMC::PdfInfo hepmc_pdfInfo(pdf_id1, pdf_id2, pdf_x1, pdf_x2, pdf_scalePDF, pdf_xPDF1, pdf_xPDF2);
95 hepmc_event->set_pdf_info(hepmc_pdfInfo);
99 std::map<const reco::Candidate*, HepMC::GenParticle*> genCandToHepMCMap;
101 std::vector<HepMC::GenParticle*> hepmc_particles;
103 for (
unsigned int i=0,
n=genParticlesHandle->size();
i<
n; ++
i )
107 hepmc_particle->suggest_barcode(
i+1);
112 else particleMass = p->
mass();
114 hepmc_particle->set_generated_mass(particleMass);
116 hepmc_particles.push_back(hepmc_particle);
117 genCandToHepMCMap[
p] = hepmc_particle;
121 if ( !parton1 and p->
pz() > 0 ) {
123 hepmc_parton1 = hepmc_particle;
125 else if ( !parton2 and p->
pz() < 0 ) {
127 hepmc_parton2 = hepmc_particle;
132 HepMC::GenVertex* vertex1 =
nullptr;
133 HepMC::GenVertex* vertex2 =
nullptr;
134 if ( parton1 ==
nullptr and parton2 ==
nullptr ) {
139 vertex1 =
new HepMC::GenVertex(
FourVector(nullP4));
140 vertex2 =
new HepMC::GenVertex(
FourVector(nullP4));
147 vertex2 =
new HepMC::GenVertex(
FourVector(parton2->vertex()));
149 hepmc_event->add_vertex(vertex1);
150 hepmc_event->add_vertex(vertex2);
151 vertex1->add_particle_in(hepmc_parton1);
152 vertex2->add_particle_in(hepmc_parton2);
153 hepmc_event->set_beam_particles(hepmc_parton1, hepmc_parton2);
156 typedef std::map<const reco::Candidate*, HepMC::GenVertex*> ParticleToVertexMap;
157 ParticleToVertexMap particleToVertexMap;
158 particleToVertexMap[parton1] = vertex1;
159 particleToVertexMap[parton2] = vertex2;
160 for (
unsigned int i=0, n=genParticlesHandle->size();
i<
n; ++
i )
163 if ( p == parton1
or p == parton2 )
continue;
170 HepMC::GenVertex* vertex;
171 if ( particleToVertexMap.find(elder) == particleToVertexMap.end() )
174 hepmc_event->add_vertex(vertex);
175 particleToVertexMap[elder] = vertex;
179 vertex = particleToVertexMap[elder];
184 vertex->add_particle_in(genCandToHepMCMap[mother]);
185 vertex->add_particle_out(hepmc_particles[
i]);
190 bool hasSignalVertex =
false;
193 for (
auto v = hepmc_event->vertices_begin();
v != hepmc_event->vertices_end(); ++
v ) {
194 for (
auto p = (*v)->particles_begin(HepMC::children);
195 p != (*v)->particles_end(HepMC::children); ++
p ) {
196 const int pdgId = (*p)->pdg_id();
198 hepmc_event->set_signal_process_vertex(*
v);
199 hasSignalVertex =
true;
203 if ( hasSignalVertex )
break;
207 if ( !hasSignalVertex ) hepmc_event->set_signal_process_vertex(*(vertex1->vertices_begin()));
210 hepmc_product->addHepMCData(hepmc_event);
211 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
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
#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)
virtual double pz() const =0
z coordinate of momentum vector
edm::ESHandle< ParticleDataTable > pTable_
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_
void getData(T &iHolder) const
std::pair< double, double > xPDF
HepMC::FourVector FourVector(const reco::Candidate::LorentzVector &lvec)
std::vector< int > signalParticlePdgIds_
Abs< T >::type abs(const T &t)
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 double eta() const =0
momentum pseudorapidity
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector