4 void anotherCalcMissingMomentum_ATLAS(HepMC::GenEvent *event,
HEP::Event &OutEvt)
10 HepMC::GenEvent::particle_iterator p =
event->particles_begin();
14 while( p != event->particles_end())
17 int pid=(*p)->pdg_id();
22 if ( (*p)->production_vertex() )
24 HepMC::FourVector pos = (*p)->production_vertex()->position();
25 if (pos.rho() > 0.0001)
31 if((prodT > 7e3) || (prodZ > 11e3 )) { p++;
continue;}
44 if(PDG::isInvisible(pid))
46 pmiss+=
HEP::P4((*p)->momentum().px(),(*p)->momentum().py(),(*p)->momentum().pz(),(*p)->momentum().e());
58 if(!PDG::isInvisible(pid)) {p++;
continue;}
61 double decT = (*p)->end_vertex()->position().perp();
62 double decz = fabs((*p)->end_vertex()->position().pz());
72 if((decT < 10.0e3 ) && (decz < 13.0e3)) { p++;
continue;}
80 for ( HepMC::GenVertex::particle_iterator des =(*p)->end_vertex()->particles_begin(HepMC::descendants); des != (*p)->end_vertex()->particles_end(HepMC::descendants);
82 if ((*des)->pdg_id() == pid)
99 if(!islast) {p++;
continue;}
102 pmiss+=
HEP::P4((*p)->momentum().px(),(*p)->momentum().py(),(*p)->momentum().pz(),(*p)->momentum().e());
118 void SortEvent_ATLASHEPMC(HepMC::GenEvent *event,
HEP::Event &OutEvt,
int npileups, std::vector<HEP::PileupEvent*> &pileups,
double &Rjet, std::mt19937 &engine){
120 fastjet::JetDefinition jetDef(fastjet::antikt_algorithm, Rjet);
121 std::vector <HEP::Jet*> outjets;
123 std::vector <fastjet::PseudoJet> inclusiveJets, jets;
124 std::vector <fastjet::PseudoJet> pileupJets, pJInputs;
126 std::vector <fastjet::PseudoJet> fjInputs, bquark_momenta;
130 bquark_momenta.resize(0);
132 HepMC::GenEvent::particle_iterator p =
event->particles_begin();
136 while( p != event->particles_end())
139 int pid=(*p)->pdg_id();
145 HEP::Particle* newpart =
new HEP::Particle((*p)->momentum().px(),(*p)->momentum().py(),(*p)->momentum().pz(),(*p)->momentum().e(),pid);
148 if ( (*p)->production_vertex() )
151 HepMC::FourVector pos = (*p)->production_vertex()->position();
152 if (pos.rho() > 0.0001)
155 if((pos.perp() > 12e3) || (abs(pos.z()) > 23e3 )) { p++;
delete newpart;
continue;}
156 newpart->set_prod(
HEP::P4(pos.x(),pos.y(),pos.z(),pos.t()));
160 if(PDG::isHadron(pid))
163 int pcharge=PDG::get3Q(pid);
168 newpart->set_3Q(pcharge);
169 OutEvt.add_charged_hadron(newpart);
173 OutEvt.add_neutral_hadron((*p)->momentum().px(),(*p)->momentum().py(),(*p)->momentum().pz(),(*p)->momentum().e());
189 if((apid == 11) || (apid == 13) || (apid == 15))
215 newpart->set_3Q(PDG::get3Q(pid));
219 if(apid == 11 || apid == 13 || apid == 22 )
221 if(!isFromHadron(event, *p ))
231 OutEvt.add_neutral_hadron(newpart->
mom());
236 OutEvt.add_charged_hadron(newpart);
262 if( pid == 12 || pid == 14 || pid == 16 || pid == 18 )
275 if((pid > 1000000) && (pid < 9000000))
281 HepMC::FourVector v4((*p)->momentum());
285 fastjet::PseudoJet particleTemp(v4.px(),v4.py(),v4.pz(),v4.e());
288 fjInputs.push_back(particleTemp);
300 if(!((*p)->end_vertex())) { p++;
continue;}
304 if(((*p)->end_vertex()) && (apid == 5))
310 for ( HepMC::GenVertex::particle_iterator des =(*p)->end_vertex()->particles_begin(HepMC::descendants); des != (*p)->end_vertex()->particles_end(HepMC::descendants);
312 if (abs((*des)->pdg_id()) == 5)
320 HepMC::FourVector v4((*p)->momentum());
322 fastjet::PseudoJet tpjet(v4.px(),v4.py(),v4.pz(),v4.e());
324 bquark_momenta.push_back(tpjet);
331 if((apid == 15) && ((*p)->end_vertex()))
337 for ( HepMC::GenVertex::particle_iterator des =(*p)->end_vertex()->particles_begin(HepMC::descendants); des != (*p)->end_vertex()->particles_end(HepMC::descendants);
339 if (abs((*des)->pdg_id()) == 15)
347 HEP::Particle* newpart =
new HEP::Particle((*p)->momentum().px(),(*p)->momentum().py(),(*p)->momentum().pz(),(*p)->momentum().e(),pid);
348 HepMC::FourVector pos = (*p)->production_vertex()->position();
349 newpart->set_prod(
HEP::P4(pos.x(),pos.y(),pos.z(),pos.t()));
350 HepMC::FourVector dec = (*p)->end_vertex()->position();
351 newpart->set_decay(
HEP::P4(dec.x(),dec.y(),dec.z(),dec.t()));
352 newpart->set_3Q(PDG::get3Q(pid));
365 HEP::Particle* newpart =
new HEP::Particle((*p)->momentum().px(),(*p)->momentum().py(),(*p)->momentum().pz(),(*p)->momentum().e(),pid);
366 HepMC::FourVector pos = (*p)->production_vertex()->position();
367 newpart->set_prod(
HEP::P4(pos.x(),pos.y(),pos.z(),pos.t()));
368 HepMC::FourVector dec = (*p)->end_vertex()->position();
369 newpart->set_decay(
HEP::P4(dec.x(),dec.y(),dec.z(),dec.t()));
370 newpart->set_3Q(PDG::get3Q(pid));
376 if(isMetaStableHadron(*p,event))
378 HEP::Particle* newpart =
new HEP::Particle((*p)->momentum().px(),(*p)->momentum().py(),(*p)->momentum().pz(),(*p)->momentum().e(),pid);
379 HepMC::FourVector pos = (*p)->production_vertex()->position();
380 newpart->set_prod(
HEP::P4(pos.x(),pos.y(),pos.z(),pos.t()));
381 HepMC::FourVector dec = (*p)->end_vertex()->position();
383 newpart->set_decay(
HEP::P4(dec.x(),dec.y(),dec.z(),dec.t()));
384 int ch = PDG::get3Q(pid);
390 OutEvt.add_charged_hadron(newpart);
431 fastjet::ClusterSequence clustSeq(fjInputs, jetDef);
432 inclusiveJets = clustSeq.inclusive_jets(1.0);
433 jets = sorted_by_pt(inclusiveJets);
435 std::uniform_int_distribution<> rd_el(0,pileups.size()-1);
437 static std::normal_distribution<double> zdist(0,53.0);
438 static std::normal_distribution<double> tdist(0,160e-12);
564 for(
auto const& bquark : bquark_momenta)
566 if(bquark.delta_R(jet) < Rjet) { btag =
true;
break;}
570 outjets.push_back(tjet);
583 void filleventHEPMC_ATLAS(
HEP::Event &OutEvt, HepMC::GenEvent* evt,
int npileups, std::vector<HEP::PileupEvent*> &pileups, std::mt19937 &engine)
591 if(evt->weights().size() > 0)
594 OutEvt.set_weight(evt->weights()[0]);
598 OutEvt.set_weight(1.0);
607 SortEvent_ATLASHEPMC(evt,OutEvt,npileups,pileups,dR,engine);
609 anotherCalcMissingMomentum_ATLAS(evt, OutEvt);
Simple event class, separating particles into classes.
Definition: heputil.h:227
void set_missingmom(const P4 &pmiss)
Set the missing momentum vector.
Definition: heputil.h:736
void add_particle(Particle *p)
Definition: heputil.h:523
void set_jets(const std::vector< Jet * > &jets)
Set the jets collection.
Definition: heputil.h:709
A 4-momentum class for vectors.
Definition: Vectors.h:45
void clear()
Set the components to zero.
Definition: Vectors.h:82
Definition: Particle.h:24
const P4 & mom() const
Get the 4 vector.
Definition: Particle.h:109
void set_prompt(bool isprompt=true)
Set promptness.
Definition: Particle.h:178