2 bool isfinal(
const HepMC::GenParticle* p )
7 if ( (!(p->end_vertex())))
11 cout <<
"Particle with no end vertex and status" << p->status() << endl;
31 bool isDT(
const HepMC::GenParticle* p,
const HepMC::GenEvent *event)
34 int pid = p->pdg_id();
35 int pch = PDG::get3Q(pid);
38 if (pch == 0)
return false;
42 if(PDG::isHadron(pid))
return false;
47 if(p->momentum().m() < 20.)
return false;
52 for ( HepMC::GenVertex::particle_iterator des = p->end_vertex()->particles_begin(HepMC::descendants); des != p->end_vertex()->particles_end(HepMC::descendants);
54 if ((*des)->pdg_id() == pid)
63 if(!p->end_vertex())
return false;
64 if(!p->production_vertex())
return false;
66 HepMC::FourVector pos = p->production_vertex()->position();
67 HepMC::FourVector dec = p->end_vertex()->position();
69 double pperp = pos.perp();
70 double dperp = dec.perp();
75 if(((dperp - pperp) < 3.0 ) && (fabs(dz-pz) < 3.0))
return false;
79 if((pperp > 1100.0) || (dperp < 160.0) || (fabs(pz) > 2700.0))
return false;
91 bool isMetaStableHadron(
const HepMC::GenParticle* p,
const HepMC::GenEvent *event)
94 int pid = p->pdg_id();
99 if(!(PDG::isHadron(pid)))
return false;
106 if(p->momentum().m() < 20.)
return false;
113 double prodT=p->production_vertex()->position().perp();
114 double prodZ=p->production_vertex()->position().pz();
116 if( (prodT > 200.) || (fabs(prodZ) > 270.)) {
return false;}
122 for ( HepMC::GenVertex::particle_iterator des = p->end_vertex()->particles_begin(HepMC::descendants); des != p->end_vertex()->particles_end(HepMC::descendants);
124 if ((*des)->pdg_id() == pid)
130 double decT=p->end_vertex()->position().perp();
131 double decZ=p->end_vertex()->position().pz();
134 if( (decT < 300.0) ){
return false;}
152 bool isHSCP(
const HepMC::GenParticle* p,
const HepMC::GenEvent *event)
155 int pid = p->pdg_id();
156 int pch = PDG::get3Q(pid);
158 if (pch == 0)
return false;
160 if(PDG::isHadron(pid))
return false;
167 if(p->momentum().m() < 20.)
return false;
172 for ( HepMC::GenVertex::particle_iterator des = p->end_vertex()->particles_begin(HepMC::descendants); des != p->end_vertex()->particles_end(HepMC::descendants);
174 if ((*des)->pdg_id() == pid)
258 void DebugMyElectron(HepMC::GenEvent *event,
const HepMC::GenParticle* p )
261 const HepMC::GenParticle* q =
new HepMC::GenParticle;
263 cout <<
"Diagnosing" << endl;
264 int pid = p->pdg_id();
265 bool foundGenuineMother=
false;
266 while((!foundGenuineMother) && (q->production_vertex()))
268 for ( HepMC::GenVertex::particle_iterator mother= q->production_vertex()->particles_begin(HepMC::parents);
269 mother != q->production_vertex()->particles_end(HepMC::parents); ++mother)
271 cout <<
"mother id: " << (*mother)->pdg_id() <<
", ";
272 if((*mother)->pdg_id() == pid)
279 foundGenuineMother=
true;
291 bool SAFEisFromHadron(HepMC::GenEvent *event,
const HepMC::GenParticle* p )
296 bool foundGenuineMother=
false;
297 int pid = p->pdg_id();
298 const HepMC::GenParticle* q =
new HepMC::GenParticle;
303 while((!foundGenuineMother) && (q->production_vertex()))
305 foundGenuineMother=
true;
306 for ( HepMC::GenVertex::particle_iterator mother= q->production_vertex()->particles_begin(HepMC::parents);
307 mother != q->production_vertex()->particles_end(HepMC::parents);
310 if((*mother)->pdg_id() == pid)
313 foundGenuineMother=
false;
318 mpid=(*mother)->pdg_id();
319 ismotherhadron=PDG::isHadron(mpid);
322 foundGenuineMother=
true;
357 bool isFromHadron(HepMC::GenEvent *event,
const HepMC::GenParticle* p )
362 bool foundGenuineMother=
false;
363 int pid = p->pdg_id();
366 if (apid < 10)
return false;
367 if (apid == 21)
return false;
368 if (PDG::isHadron(pid))
return true;
374 if(apid > 24)
return false;
376 if(!(p->production_vertex()))
return false;
378 for ( HepMC::GenVertex::particle_iterator mother= p->production_vertex()->particles_begin(HepMC::parents);
379 mother != p->production_vertex()->particles_end(HepMC::parents);
382 if (isFromHadron(event, *mother))
return true;
392 void calcMissingMomentum(
HEP::Event &OutEvt, std::mt19937 &engine)
408 pmiss+=invisible->mom();
426 void anotherCalcMissingMomentum(HepMC::GenEvent *event,
HEP::Event &OutEvt)
432 HepMC::GenEvent::particle_iterator p =
event->particles_begin();
436 while( p != event->particles_end())
439 int pid=(*p)->pdg_id();
444 if ( (*p)->production_vertex() )
446 HepMC::FourVector pos = (*p)->production_vertex()->position();
447 if (pos.rho() > 0.0001)
453 if((prodT > 7e3) || (prodZ > 11e3 )) { p++;
continue;}
466 if(PDG::isInvisible(pid))
468 pmiss+=
HEP::P4((*p)->momentum().px(),(*p)->momentum().py(),(*p)->momentum().pz(),(*p)->momentum().e());
480 if(!PDG::isInvisible(pid)) {p++;
continue;}
483 double decT = (*p)->end_vertex()->position().perp();
484 double decz = fabs((*p)->end_vertex()->position().pz());
494 if((decT < 7.0e3 ) && (decz < 11.0e3)) { p++;
continue;}
502 for ( HepMC::GenVertex::particle_iterator des =(*p)->end_vertex()->particles_begin(HepMC::descendants); des != (*p)->end_vertex()->particles_end(HepMC::descendants);
504 if ((*des)->pdg_id() == pid)
521 if(!islast) {p++;
continue;}
524 pmiss+=
HEP::P4((*p)->momentum().px(),(*p)->momentum().py(),(*p)->momentum().pz(),(*p)->momentum().e());
538 void betterCalcMissingMomentum(HepMC::GenEvent *event,
HEP::Event &OutEvt)
543 HepMC::GenEvent::particle_iterator p =
event->particles_begin();
547 while( p != event->particles_end())
550 int pid=(*p)->pdg_id();
555 if ( (*p)->production_vertex() )
557 HepMC::FourVector pos = (*p)->production_vertex()->position();
558 if (pos.rho() > 0.0001)
562 if((prodT > 12e3) || (prodZ > 23e3 )) { p++;
continue;}
576 if(PDG::isHadron(pid))
579 if((prodT > 3000.0)|| (prodZ > 5000.0)) {p++;
continue;}
580 pmiss-=
HEP::P4((*p)->momentum().px(),(*p)->momentum().py(),(*p)->momentum().pz(),(*p)->momentum().e());
584 if( (apid == 22) || (PDG::get3Q(pid) !=0 ) )
586 if((prodT > 1700.0)|| (prodZ > 4000.0)) {p++;
continue;}
587 pmiss-=
HEP::P4((*p)->momentum().px(),(*p)->momentum().py(),(*p)->momentum().pz(),(*p)->momentum().e());
595 if((!(*p)->end_vertex()) || (!(*p)->production_vertex())) {p++;
continue;}
598 for ( HepMC::GenVertex::particle_iterator des =(*p)->end_vertex()->particles_begin(HepMC::descendants); des != (*p)->end_vertex()->particles_end(HepMC::descendants);
600 if ((*des)->pdg_id() == pid)
607 if(!islast) { p++;
continue;}
609 double decZ= fabs((*p)->end_vertex()->position().pz());
610 double decT=(*p)->end_vertex()->position().perp();
612 if(PDG::isHadron(pid))
614 if((prodT > 3000.0)|| (prodZ > 5000.0) || (decZ < 4e3 ) ||(decT < 1.77e3)) {p++;
continue;}
615 pmiss-=
HEP::P4((*p)->momentum().px(),(*p)->momentum().py(),(*p)->momentum().pz(),(*p)->momentum().e());
620 if(PDG::isCharged(pid))
624 if( (prodT > 1.77e3) || (prodZ > 4000.0) || (decZ < 1.2e4) || (decT < 7.0e3)){ p++;
continue;}
625 pmiss-=
HEP::P4((*p)->momentum().px(),(*p)->momentum().py(),(*p)->momentum().pz(),(*p)->momentum().e());
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
const std::vector< Particle * > & invisible_particles() const
Get invisible final state particles.
Definition: heputil.h:641
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