Rivet  3.1.3
ParticleUtils.hh
1 #ifndef RIVET_PARTICLEUTILS_HH
2 #define RIVET_PARTICLEUTILS_HH
3 
4 #include "Rivet/Particle.hh"
5 #include "Rivet/Tools/ParticleBaseUtils.hh"
6 #include "Rivet/Tools/ParticleIdUtils.hh"
7 
8 // Macros to map Rivet::Particle functions to PID:: functions of the same name
9 #define PARTICLE_TO_PID_BOOLFN(fname) inline bool fname (const Particle& p) { return PID:: fname (p.pid()); }
10 #define PARTICLE_TO_PID_INTFN(fname) inline int fname (const Particle& p) { return PID:: fname (p.pid()); }
11 #define PARTICLE_TO_PID_DBLFN(fname) inline double fname (const Particle& p) { return PID:: fname (p.pid()); }
12 
13 namespace Rivet {
14 
15 
18 
20 
21 
23  inline int pid(const Particle& p) { return p.pid(); }
24 
26  inline int abspid(const Particle& p) { return p.abspid(); }
27 
28 
30  PARTICLE_TO_PID_BOOLFN(isCharged)
31 
32 
33  PARTICLE_TO_PID_BOOLFN(isNeutral)
34 
35 
36 
37  PARTICLE_TO_PID_BOOLFN(isNeutrino)
38 
39 
40  PARTICLE_TO_PID_BOOLFN(isChargedLepton)
41  PARTICLE_TO_PID_BOOLFN(isChLepton)
42 
43 
44  PARTICLE_TO_PID_BOOLFN(isLepton)
45 
46 
47  PARTICLE_TO_PID_BOOLFN(isPhoton)
48 
49 
50  PARTICLE_TO_PID_BOOLFN(isElectron)
51 
52 
53  PARTICLE_TO_PID_BOOLFN(isMuon)
54 
55 
56  PARTICLE_TO_PID_BOOLFN(isTau)
57 
58 
59  PARTICLE_TO_PID_BOOLFN(isHadron)
60 
61 
62  PARTICLE_TO_PID_BOOLFN(isMeson)
63 
64 
65  PARTICLE_TO_PID_BOOLFN(isBaryon)
66 
67 
68  PARTICLE_TO_PID_BOOLFN(isQuark)
69 
70 
71  PARTICLE_TO_PID_BOOLFN(isParton)
72 
73 
74 
75 
76  PARTICLE_TO_PID_BOOLFN(isWplus)
77 
78 
79  PARTICLE_TO_PID_BOOLFN(isWminus)
80 
81 
82  PARTICLE_TO_PID_BOOLFN(isW)
83 
84 
85  PARTICLE_TO_PID_BOOLFN(isZ)
86 
87 
88  PARTICLE_TO_PID_BOOLFN(isHiggs)
89 
90 
91  PARTICLE_TO_PID_BOOLFN(isStrange)
92 
93 
94  PARTICLE_TO_PID_BOOLFN(isCharm)
95 
96 
97  PARTICLE_TO_PID_BOOLFN(isBottom)
98 
99 
100  PARTICLE_TO_PID_BOOLFN(isTop)
101 
102 
103 
104  PARTICLE_TO_PID_BOOLFN(isHeavyFlavour)
105 
106 
107  PARTICLE_TO_PID_BOOLFN(isHeavyParton)
108 
109 
110  PARTICLE_TO_PID_BOOLFN(isLightParton)
111 
112 
113 
114  PARTICLE_TO_PID_BOOLFN(isHeavyMeson)
115 
116 
117  PARTICLE_TO_PID_BOOLFN(isHeavyBaryon)
118 
119 
120  PARTICLE_TO_PID_BOOLFN(isHeavyHadron)
121 
122 
123 
124  PARTICLE_TO_PID_BOOLFN(isLightMeson)
125 
126 
127  PARTICLE_TO_PID_BOOLFN(isLightBaryon)
128 
129 
130  PARTICLE_TO_PID_BOOLFN(isLightHadron)
131 
132 
133 
134  PARTICLE_TO_PID_BOOLFN(isBottomMeson)
135 
136 
137  PARTICLE_TO_PID_BOOLFN(isBottomBaryon)
138 
139 
140  PARTICLE_TO_PID_BOOLFN(isBottomHadron)
141 
142 
143 
144  PARTICLE_TO_PID_BOOLFN(isCharmMeson)
148 
149 
150  PARTICLE_TO_PID_BOOLFN(isCharmBaryon)
155 
156 
157  PARTICLE_TO_PID_BOOLFN(isCharmHadron)
158 
159 
160  // /// Determine if the PID is that of a strange meson
161  // PARTICLE_TO_PID_BOOLFN(isStrangeMeson)
162 
163  // /// Determine if the PID is that of a strange baryon
164  // PARTICLE_TO_PID_BOOLFN(isStrangeBaryon)
165 
166  // /// Determine if the PID is that of a strange hadron
167  // PARTICLE_TO_PID_BOOLFN(isStrangeHadron)
168 
169 
170 
171 
172  PARTICLE_TO_PID_BOOLFN(isReggeon)
173 
174 
175  PARTICLE_TO_PID_BOOLFN(isDiquark)
176 
177 
178  PARTICLE_TO_PID_BOOLFN(isPentaquark)
179 
180 
181  PARTICLE_TO_PID_BOOLFN(isSUSY)
182 
183 
184  PARTICLE_TO_PID_BOOLFN(isRhadron)
185 
186 
187  PARTICLE_TO_PID_BOOLFN(isTechnicolor)
188 
189 
190  PARTICLE_TO_PID_BOOLFN(isExcited)
191 
192 
193  PARTICLE_TO_PID_BOOLFN(isKK)
194 
195 
196  PARTICLE_TO_PID_BOOLFN(isGraviton)
197 
198 
199  PARTICLE_TO_PID_BOOLFN(isBSM)
200 
201 
202 
203 
204  PARTICLE_TO_PID_BOOLFN(isGenSpecific)
205 
206 
207  PARTICLE_TO_PID_BOOLFN(isResonance)
208 
209 
210  PARTICLE_TO_PID_BOOLFN(isTransportable)
211 
212 
213 
214 
215  PARTICLE_TO_PID_BOOLFN(hasUp)
216 
217 
218  PARTICLE_TO_PID_BOOLFN(hasDown)
219 
220 
221  PARTICLE_TO_PID_BOOLFN(hasStrange)
222 
223 
224  PARTICLE_TO_PID_BOOLFN(hasCharm)
225 
226 
227  PARTICLE_TO_PID_BOOLFN(hasBottom)
228 
229 
230  PARTICLE_TO_PID_BOOLFN(hasTop)
231 
232 
233 
234 
235  PARTICLE_TO_PID_INTFN(jSpin)
236 
237 
238  PARTICLE_TO_PID_INTFN(sSpin)
239 
240 
241  PARTICLE_TO_PID_INTFN(lSpin)
242 
243 
244 
245  PARTICLE_TO_PID_DBLFN(charge)
246 
247 
248  PARTICLE_TO_PID_INTFN(charge3)
249 
250 
251  PARTICLE_TO_PID_DBLFN(abscharge)
252 
253 
254  PARTICLE_TO_PID_INTFN(abscharge3)
255 
256 
257  PARTICLE_TO_PID_INTFN(nuclZ)
258 
259 
260  PARTICLE_TO_PID_INTFN(nuclA)
261 
262 
263  PARTICLE_TO_PID_INTFN(nuclNlambda)
264 
265 
266 
267 
268 
269 
273  inline bool isSameSign(const Particle& a, const Particle& b) { return PID::isSameSign(a.pid(), b.pid()); }
274  inline bool isOppSign(const Particle& a, const Particle& b) { return PID::isOppSign(a.pid(), b.pid()); }
275  inline bool isSameFlav(const Particle& a, const Particle& b) { return PID::isSameFlav(a.pid(), b.pid()); }
276  inline bool isOppFlav(const Particle& a, const Particle& b) { return PID::isOppFlav(a.pid(), b.pid()); }
277 
278  inline bool isOSSF(const Particle& a, const Particle& b) { return PID::isOSSF(a.pid(), b.pid()); }
279  inline bool isSSSF(const Particle& a, const Particle& b) { return PID::isSSSF(a.pid(), b.pid()); }
280  inline bool isOSOF(const Particle& a, const Particle& b) { return PID::isOSOF(a.pid(), b.pid()); }
281  inline bool isSSOF(const Particle& a, const Particle& b) { return PID::isSSOF(a.pid(), b.pid()); }
282 
284 
285 
288 
291  inline bool oppSign(const Particle& a, const Particle& b) {
292  return sign(a.charge3()) == -sign(b.charge3()) && sign(a.charge3()) != ZERO;
293  }
294 
297  inline bool sameSign(const Particle& a, const Particle& b) {
298  return sign(a.charge3()) == sign(b.charge3());
299  }
300 
303  inline bool oppCharge(const Particle& a, const Particle& b) {
304  return a.charge3() == -b.charge3() && a.charge3() != 0;
305  }
306 
309  inline bool sameCharge(const Particle& a, const Particle& b) {
310  return a.charge3() == b.charge3();
311  }
312 
314  inline bool diffCharge(const Particle& a, const Particle& b) {
315  return a.charge3() != b.charge3();
316  }
317 
319 
320 
321 
323 
324 
325 
328 
330  inline bool isFirstWith(const Particle& p, const ParticleSelector& f) {
331  return p.isFirstWith(f);
332  }
333 
335  inline bool isFirstWithout(const Particle& p, const ParticleSelector& f) {
336  return p.isFirstWithout(f);
337  }
338 
339 
341  inline bool isLastWith(const Particle& p, const ParticleSelector& f) {
342  return p.isLastWith(f);
343  }
344 
346  inline bool isLastWithout(const Particle& p, const ParticleSelector& f) {
347  return p.isLastWithout(f);
348  }
349 
350 
351 
353  inline bool hasAncestorWith(const Particle& p, const ParticleSelector& f, bool only_physical=true) {
354  return p.hasAncestorWith(f, only_physical);
355  }
356 
358  inline bool hasAncestorWithout(const Particle& p, const ParticleSelector& f, bool only_physical=true) {
359  return p.hasAncestorWithout(f, only_physical);
360  }
361 
362 
364  inline bool hasParentWith(const Particle& p, const ParticleSelector& f) {
365  return p.hasParentWith(f);
366  }
367 
369  inline bool hasParentWithout(const Particle& p, const ParticleSelector& f) {
370  return p.hasParentWithout(f);
371  }
372 
373 
375  inline bool hasChildWith(const Particle& p, const ParticleSelector& f) {
376  return p.hasChildWith(f);
377  }
378 
380  inline bool hasChildWithout(const Particle& p, const ParticleSelector& f) {
381  return p.hasChildWithout(f);
382  }
383 
384 
386  inline bool hasDescendantWith(const Particle& p, const ParticleSelector& f, bool remove_duplicates=true) {
387  return p.hasDescendantWith(f, remove_duplicates);
388  }
389 
391  inline bool hasDescendantWithout(const Particle& p, const ParticleSelector& f, bool remove_duplicates=true) {
392  return p.hasDescendantWithout(f, remove_duplicates);
393  }
394 
395 
397  inline bool hasStableDescendantWith(const Particle& p, const ParticleSelector& f) {
398  return p.hasStableDescendantWith(f);
399  }
400 
402  inline bool hasStableDescendantWithout(const Particle& p, const ParticleSelector& f) {
403  return p.hasStableDescendantWithout(f);
404  }
405 
406 
407 
409  inline bool isVisible(const Particle& p) { return p.isVisible(); }
410 
419  inline bool isDirect(const Particle& p, bool allow_from_direct_tau=false, bool allow_from_direct_mu=false) {
420  return p.isDirect(allow_from_direct_tau, allow_from_direct_mu);
421  }
422 
427  inline bool isPrompt(const Particle& p, bool allow_from_prompt_tau=false, bool allow_from_prompt_mu=false) {
428  return p.isPrompt(allow_from_prompt_tau, allow_from_prompt_mu);
429  }
430 
431 
433  inline bool isStable(const Particle& p) { return p.isStable(); }
434 
436  inline bool hasHadronicDecay(const Particle& p) {
437  if (p.isStable()) return false;
438  if (p.hasChildWith(isHadron)) return true;
439  return false;
440  }
441 
443  inline bool hasLeptonicDecay(const Particle& p) {
444  if (p.isStable()) return false;
445  if (p.hasChildWith(isHadron)) return false;
446  return true;
447  }
448 
449 
452  inline bool hasAncestor(const Particle& p, PdgId pid) { return p.hasAncestor(pid); }
453 
455  inline bool fromBottom(const Particle& p) { return p.fromBottom(); }
456 
458  inline bool fromCharm(const Particle& p) { return p.fromCharm(); }
459 
461  inline bool fromHadron(const Particle& p) { return p.fromHadron(); }
462 
464  inline bool fromTau(const Particle& p, bool prompt_taus_only=false) {
465  return p.fromTau(prompt_taus_only);
466  }
467 
469  inline bool fromPromptTau(const Particle& p) { return p.fromPromptTau(); }
470 
471  // /// @brief Determine whether the particle is from a hadron or tau decay
472  // DEPRECATED("Too vague: use fromHadron or fromHadronicTau")
473  // inline bool fromDecay(const Particle& p) { return p.fromDecay(); }
474 
476 
477 
482 
485  virtual bool operator()(const Particle& p) const = 0;
486  virtual ~BoolParticleFunctor() {}
487  };
488 
491  BoolParticleAND(const std::vector<ParticleSelector>& sels) : selectors(sels) {}
492  BoolParticleAND(const ParticleSelector& a, const ParticleSelector& b) : selectors({a,b}) {}
493  BoolParticleAND(const ParticleSelector& a, const ParticleSelector& b, const ParticleSelector& c) : selectors({a,b,c}) {}
494  bool operator()(const Particle& p) const {
495  for (const ParticleSelector& sel : selectors) if (!sel(p)) return false;
496  return true;
497  }
498  std::vector<ParticleSelector> selectors;
499  };
501  inline BoolParticleAND operator && (const ParticleSelector& a, const ParticleSelector& b) {
502  return BoolParticleAND(a, b);
503  }
504 
505 
508  BoolParticleOR(const std::vector<ParticleSelector>& sels) : selectors(sels) {}
509  BoolParticleOR(const ParticleSelector& a, const ParticleSelector& b) : selectors({a,b}) {}
510  BoolParticleOR(const ParticleSelector& a, const ParticleSelector& b, const ParticleSelector& c) : selectors({a,b,c}) {}
511  bool operator()(const Particle& p) const {
512  for (const ParticleSelector& sel : selectors) if (sel(p)) return true;
513  return false;
514  }
515  std::vector<ParticleSelector> selectors;
516  };
518  inline BoolParticleOR operator || (const ParticleSelector& a, const ParticleSelector& b) {
519  return BoolParticleOR(a, b);
520  }
521 
524  BoolParticleNOT(const ParticleSelector& sel) : selector(sel) {}
525  bool operator()(const Particle& p) const { return !selector(p); }
526  ParticleSelector selector;
527  };
529  inline BoolParticleNOT operator ! (const ParticleSelector& a) {
530  return BoolParticleNOT(a);
531  }
532 
533 
535  struct HasPID : public BoolParticleFunctor {
536  HasPID(PdgId pid) : targetpids{pid} { }
537  HasPID(vector<PdgId> pids) : targetpids{pids} { }
538  HasPID(initializer_list<PdgId> pids) : targetpids{pids} { }
539  bool operator()(const Particle& p) const { return contains(targetpids, p.pid()); }
540  vector<PdgId> targetpids;
541  };
542  using hasPID = HasPID;
543 
545  struct HasAbsPID : public BoolParticleFunctor {
546  HasAbsPID(PdgId pid) : targetapids{abs(pid)} { }
547  HasAbsPID(vector<PdgId> pids) { for (PdgId pid : pids) targetapids.push_back(abs(pid)); }
548  HasAbsPID(initializer_list<PdgId> pids) { for (PdgId pid : pids) targetapids.push_back(abs(pid)); }
549  bool operator()(const Particle& p) const { return contains(targetapids, p.abspid()); }
550  vector<PdgId> targetapids;
551  };
552  using hasAbsPID = HasAbsPID;
553 
554 
557  FirstParticleWith(const ParticleSelector& f) : fn(f) { }
558  FirstParticleWith(const Cut& c);
559  bool operator()(const Particle& p) const { return isFirstWith(p, fn); }
560  ParticleSelector fn;
561  };
563 
566  FirstParticleWithout(const ParticleSelector& f) : fn(f) { }
567  FirstParticleWithout(const Cut& c);
568  bool operator()(const Particle& p) const { return isFirstWithout(p, fn); }
569  ParticleSelector fn;
570  };
572 
573 
576  template <typename FN>
577  LastParticleWith(const FN& f) : fn(f) { }
578  LastParticleWith(const Cut& c);
579  bool operator()(const Particle& p) const { return isLastWith(p, fn); }
580  std::function<bool(const Particle&)> fn;
581  };
583 
586  LastParticleWithout(const ParticleSelector& f) : fn(f) { }
587  LastParticleWithout(const Cut& c);
588  bool operator()(const Particle& p) const { return isLastWithout(p, fn); }
589  ParticleSelector fn;
590  };
592 
593 
596  HasParticleAncestorWith(const ParticleSelector& f, bool only_physical=true) : fn(f), onlyphysical(only_physical) { }
597  HasParticleAncestorWith(const Cut& c, bool only_physical=true);
598  bool operator()(const Particle& p) const { return hasAncestorWith(p, fn, onlyphysical); }
599  ParticleSelector fn;
600  bool onlyphysical;
601  };
603 
606  HasParticleAncestorWithout(const ParticleSelector& f, bool only_physical=true) : fn(f), onlyphysical(only_physical) { }
607  HasParticleAncestorWithout(const Cut& c, bool only_physical=true);
608  bool operator()(const Particle& p) const { return hasAncestorWithout(p, fn, onlyphysical); }
609  ParticleSelector fn;
610  bool onlyphysical;
611  };
613 
614 
617  HasParticleParentWith(const ParticleSelector& f) : fn(f) { }
618  HasParticleParentWith(const Cut& c);
619  bool operator()(const Particle& p) const { return hasParentWith(p, fn); }
620  ParticleSelector fn;
621  };
623 
626  HasParticleParentWithout(const ParticleSelector& f) : fn(f) { }
627  HasParticleParentWithout(const Cut& c);
628  bool operator()(const Particle& p) const { return hasParentWithout(p, fn); }
629  ParticleSelector fn;
630  };
632 
633 
636  HasParticleChildWith(const ParticleSelector& f) : fn(f) { }
637  HasParticleChildWith(const Cut& c);
638  bool operator()(const Particle& p) const { return hasChildWith(p, fn); }
639  ParticleSelector fn;
640  };
642 
645  HasParticleChildWithout(const ParticleSelector& f) : fn(f) { }
646  HasParticleChildWithout(const Cut& c);
647  bool operator()(const Particle& p) const { return hasChildWithout(p, fn); }
648  ParticleSelector fn;
649  };
651 
652 
655  HasParticleDescendantWith(const ParticleSelector& f, bool remove_duplicates=true) : fn(f), rmduplicates(remove_duplicates) { }
656  HasParticleDescendantWith(const Cut& c, bool remove_duplicates=true);
657  bool operator()(const Particle& p) const { return hasDescendantWith(p, fn, rmduplicates); }
658  ParticleSelector fn;
659  bool rmduplicates;
660  };
662 
665  HasParticleDescendantWithout(const ParticleSelector& f, bool remove_duplicates=true) : fn(f), rmduplicates(remove_duplicates) { }
666  HasParticleDescendantWithout(const Cut& c, bool remove_duplicates=true);
667  bool operator()(const Particle& p) const { return hasDescendantWithout(p, fn, rmduplicates); }
668  ParticleSelector fn;
669  bool rmduplicates;
670  };
672 
674 
675 
678 
680  Particles& ifilter_select(Particles& particles, const Cut& c);
683  inline Particles& ifilterBy(Particles& particles, const Cut& c) { return ifilter_select(particles, c); }
685  inline Particles& iselect(Particles& particles, const Cut& c) { return ifilter_select(particles, c); }
686 
688  inline Particles filter_select(const Particles& particles, const Cut& c) {
689  Particles rtn = particles;
690  return ifilter_select(rtn, c);
691  }
694  inline Particles filterBy(const Particles& particles, const Cut& c) { return filter_select(particles, c); }
696  inline Particles select(const Particles& particles, const Cut& c) { return filter_select(particles, c); }
697 
699  inline Particles filter_select(const Particles& particles, const Cut& c, Particles& out) {
700  out = filter_select(particles, c);
701  return out;
702  }
705  inline Particles filterBy(const Particles& particles, const Cut& c, Particles& out) { return filter_select(particles, c, out); }
707  inline Particles select(const Particles& particles, const Cut& c, Particles& out) { return filter_select(particles, c, out); }
708 
709 
711  Particles& ifilter_discard(Particles& particles, const Cut& c);
713  inline Particles& idiscard(Particles& particles, const Cut& c) { return ifilter_discard(particles, c); }
714 
716  inline Particles filter_discard(const Particles& particles, const Cut& c) {
717  Particles rtn = particles;
718  return ifilter_discard(rtn, c);
719  }
721  inline Particles discard(const Particles& particles, const Cut& c) { return filter_discard(particles, c); }
722 
724  inline Particles filter_discard(const Particles& particles, const Cut& c, Particles& out) {
725  out = filter_discard(particles, c);
726  return out;
727  }
729  inline Particles discard(const Particles& particles, const Cut& c, Particles& out) { return filter_discard(particles, c, out); }
730 
731 
732  // inline void ifilterIsolateDeltaR(Particles& particles, const FourMomenta& vecs) {
733  // ifilter_discard(particles,
734  // }
735 
736 
737  // inline Particles filterIsolateDeltaR(const Particles& particles, const FourMomenta& vecs) {
738  // }
739 
741 
742 
743 
746 
749  inline PdgIdPair pids(const ParticlePair& pp) {
750  return make_pair(pp.first.pid(), pp.second.pid());
751  }
752 
754 
755 
756 
761  namespace Kin {
762 
763  inline double sumPt(const Particles& ps) {
764  return sum(ps, pT, 0.0);
765  }
766 
767  inline FourMomentum sumP4(const Particles& ps) {
768  return sum(ps, p4, FourMomentum());
769  }
770 
771  inline Vector3 sumP3(const Particles& ps) {
772  return sum(ps, p3, Vector3());
773  }
774 
777 
778  }
780 
781 
782  // Import Kin namespace into Rivet
783  using namespace Kin;
784 
785 
787  inline bool isSame(const Particle& a, const Particle& b) {
788  return a.isSame(b);
789  }
790 
792 
793 
794 }
795 
796 #endif
Definition: MC_Cent_pPb.hh:10
int abscharge3(int pid)
Return the absolute value of 3 times the EM charge.
Definition: ParticleIdUtils.hh:865
bool diffCharge(const Particle &a, const Particle &b)
Return true if Particles a and b have a different (not necessarily opposite) charge.
Definition: ParticleUtils.hh:314
bool isLightBaryon(int pid)
Determine if the PID is that of a light flavour (not b or c) baryon.
Definition: ParticleIdUtils.hh:634
bool isBottomBaryon(int pid)
Determine if the PID is that of a b-baryon.
Definition: ParticleIdUtils.hh:650
int nuclA(int pid)
Definition: ParticleIdUtils.hh:99
bool isPhoton(int pid)
Determine if the PID is that of a photon.
Definition: ParticleIdUtils.hh:138
bool hasDown(int pid)
Does this particle contain a down quark?
Definition: ParticleIdUtils.hh:573
bool isHiggs(int pid)
Determine if the PID is that of an SM/lightest SUSY Higgs.
Definition: ParticleIdUtils.hh:194
bool isElectron(int pid)
Determine if the PID is that of an electron or positron.
Definition: ParticleIdUtils.hh:143
bool hasAncestor(const Particle &p, PdgId pid)
Definition: ParticleUtils.hh:452
bool hasDescendantWith(const Particle &p, const ParticleSelector &f, bool remove_duplicates=true)
Determine whether a particle has a descendant which meets the function requirement.
Definition: ParticleUtils.hh:386
bool isTechnicolor(int pid)
Is this a technicolor particle?
Definition: ParticleIdUtils.hh:397
bool fromHadron() const
Determine whether the particle is from a hadron decay.
bool sameCharge(const Particle &a, const Particle &b)
Definition: ParticleUtils.hh:309
Cut operator!(const Cut &cptr)
Logical NOT operation on a cut.
bool isParton(int pid)
Determine if the PID is that of a parton (quark or gluon)
Definition: ParticleIdUtils.hh:132
bool hasUp(int pid)
Does this particle contain an up quark?
Definition: ParticleIdUtils.hh:575
Base type for Particle -> bool functors.
Definition: ParticleUtils.hh:484
bool isNeutral(int pid)
Determine if the particle is electrically neutral.
Definition: ParticleIdUtils.hh:885
bool hasAncestorWithout(const Particle &p, const ParticleSelector &f, bool only_physical=true)
Determine whether a particle has an ancestor which doesn&#39;t meet the function requirement.
Definition: ParticleUtils.hh:358
bool fromCharm() const
Determine whether the particle is from a c-hadron decay.
bool hasStableDescendantWith(const Particle &p, const ParticleSelector &f)
Determine whether a particle has a stable descendant which meets the function requirement.
Definition: ParticleUtils.hh:397
bool isStrange(int pid)
Determine if the PID is that of an s/sbar.
Definition: ParticleIdUtils.hh:214
bool isFirstWithout(const Particle &p, const ParticleSelector &f)
Determine whether a particle is the first in a decay chain not to meet the function requirement...
Definition: ParticleUtils.hh:335
bool isWminus(int pid)
Determine if the PID is that of a W-.
Definition: ParticleIdUtils.hh:179
bool isBSM(int pid)
Is this a BSM particle (including graviton)?
Definition: ParticleIdUtils.hh:511
bool isHeavyBaryon(int pid)
Determine if the PID is that of a heavy flavour (b or c) baryon.
Definition: ParticleIdUtils.hh:619
bool isFirstWithout(const ParticleSelector &f) const
Determine whether a particle is the first in a decay chain not to meet the function requirement...
Definition: Particle.hh:671
Jets filter_select(const Jets &jets, const Cut &c)
Filter a jet collection in-place to the subset that passes the supplied Cut.
Definition: JetUtils.hh:160
bool hasDescendantWith(const ParticleSelector &f, bool remove_duplicates=true) const
Definition: Particle.hh:586
bool isStable() const
Whether this particle is stable according to the generator.
bool isBaryon(int pid)
Check to see if this is a valid baryon.
Definition: ParticleIdUtils.hh:260
bool oppCharge(const Particle &a, const Particle &b)
Definition: ParticleUtils.hh:303
double charge(int pid)
Return the EM charge (as floating point)
Definition: ParticleIdUtils.hh:868
bool isCharged(int pid)
Determine if the particle is electrically charged.
Definition: ParticleIdUtils.hh:880
Determine whether a particle is the last in a decay chain not to meet the cut/function.
Definition: ParticleUtils.hh:585
bool isHeavyMeson(int pid)
Determine if the PID is that of a heavy flavour (b or c) meson.
Definition: ParticleIdUtils.hh:614
bool fromTau(const Particle &p, bool prompt_taus_only=false)
Determine whether the particle is from a tau decay.
Definition: ParticleUtils.hh:464
PID matching functor.
Definition: ParticleUtils.hh:535
bool isLightMeson(int pid)
Determine if the PID is that of a light flavour (not b or c) meson.
Definition: ParticleIdUtils.hh:629
PdgId pid() const
This Particle&#39;s PDG ID code.
Definition: Particle.hh:162
bool isLightHadron(int pid)
Determine if the PID is that of a light flavour (not b or c) hadron.
Definition: ParticleIdUtils.hh:639
bool hasStrange(int pid)
Does this particle contain a strange quark?
Definition: ParticleIdUtils.hh:577
bool hasAncestorWith(const ParticleSelector &f, bool only_physical=true) const
Definition: Particle.hh:403
bool isMuon(int pid)
Determine if the PID is that of an muon or antimuon.
Definition: ParticleIdUtils.hh:148
bool isSUSY(int pid)
Is this a fundamental SUSY particle?
Definition: ParticleIdUtils.hh:362
Particle representation, either from a HepMC::GenEvent or reconstructed.
Definition: Particle.hh:18
Functor for and-combination of selector logic.
Definition: ParticleUtils.hh:490
int pid(const Particle &p)
Unbound function access to PID code.
Definition: ParticleUtils.hh:23
int nuclZ(int pid)
Definition: ParticleIdUtils.hh:90
int lSpin(int pid)
lSpin returns 2L+1, where L is the orbital angular momentum
Definition: ParticleIdUtils.hh:764
bool isVisible(const Particle &p)
Is this particle potentially visible in a detector?
Definition: ParticleUtils.hh:409
|PID| matching functor
Definition: ParticleUtils.hh:545
bool hasStableDescendantWith(const ParticleSelector &f) const
Definition: Particle.hh:628
bool isStable(const Particle &p)
Decide if a given particle is stable, via Particle::isStable()
Definition: ParticleUtils.hh:433
bool isCharm(int pid)
Determine if the PID is that of a c/cbar.
Definition: ParticleIdUtils.hh:217
bool hasChildWith(const ParticleSelector &f) const
Definition: Particle.hh:547
bool isHadron(int pid)
Definition: ParticleIdUtils.hh:322
bool isBottom(int pid)
Determine if the PID is that of a b/bbar.
Definition: ParticleIdUtils.hh:220
bool isPentaquark(int pid)
Check to see if this is a valid pentaquark.
Definition: ParticleIdUtils.hh:300
bool oppSign(const Particle &a, const Particle &b)
Return true if Particles a and b have the opposite charge sign.
Definition: ParticleUtils.hh:291
bool hasStableDescendantWithout(const ParticleSelector &f) const
Definition: Particle.hh:643
Functor for inverting selector logic.
Definition: ParticleUtils.hh:523
bool isLastWith(const Particle &p, const ParticleSelector &f)
Determine whether a particle is the last in a decay chain to meet the function requirement.
Definition: ParticleUtils.hh:341
int charge3(int pid)
Three times the EM charge (as integer)
Definition: ParticleIdUtils.hh:800
bool isBottomHadron(int pid)
Determine if the PID is that of a b-hadron.
Definition: ParticleIdUtils.hh:655
bool isTau(int pid)
Determine if the PID is that of an tau or antitau.
Definition: ParticleIdUtils.hh:153
Cut operator||(const Cut &aptr, const Cut &bptr)
Determine whether a particle has an ancestor which doesn&#39;t meet the cut/function. ...
Definition: ParticleUtils.hh:605
bool fromPromptTau() const
Determine whether the particle is from a prompt tau decay.
Definition: Particle.hh:484
bool isGraviton(int pid)
Is this a graviton?
Definition: ParticleIdUtils.hh:202
Determine whether a particle is the first in a decay chain to meet the cut/function.
Definition: ParticleUtils.hh:556
bool isLepton(int pid)
Definition: ParticleIdUtils.hh:340
bool isTop(int pid)
Determine if the PID is that of a t/tbar.
Definition: ParticleIdUtils.hh:223
double abscharge(int pid)
Return the EM charge (as floating point)
Definition: ParticleIdUtils.hh:871
bool isReggeon(int pid)
Is this a pomeron, odderon, or generic reggeon?
Definition: ParticleIdUtils.hh:232
Jets filter_discard(const Jets &jets, const Cut &c)
Filter a jet collection in-place to the subset that fails the supplied Cut.
Definition: JetUtils.hh:191
Determine whether a particle is the first in a decay chain not to meet the cut/function.
Definition: ParticleUtils.hh:565
bool hasChildWithout(const Particle &p, const ParticleSelector &f)
Determine whether a particle has a child which doesn&#39;t meet the function requirement.
Definition: ParticleUtils.hh:380
Cut operator&&(const Cut &aptr, const Cut &bptr)
bool isW(int pid)
Determine if the PID is that of a W+-.
Definition: ParticleIdUtils.hh:184
Jets & ifilterBy(Jets &jets, const Cut &c)
Definition: JetUtils.hh:154
int abspid(const Particle &p)
Unbound function access to abs PID code.
Definition: ParticleUtils.hh:26
bool hasBottom(int pid)
Does this particle contain a bottom quark?
Definition: ParticleIdUtils.hh:581
Determine whether a particle has a child which meets the cut/function.
Definition: ParticleUtils.hh:635
bool isVisible() const
Is this particle potentially visible in a detector?
bool isTransportable(int pid)
Definition: ParticleIdUtils.hh:935
bool fromBottom(const Particle &p)
Determine whether the particle is from a b-hadron decay.
Definition: ParticleUtils.hh:455
bool isSame(const Particle &other) const
Definition: Particle.hh:696
Jets discard(const Jets &jets, const Cut &c)
New alias for filter_discard.
Definition: JetUtils.hh:196
Determine whether a particle has a descendant which meets the cut/function.
Definition: ParticleUtils.hh:654
bool hasAncestorWith(const Particle &p, const ParticleSelector &f, bool only_physical=true)
Determine whether a particle has an ancestor which meets the function requirement.
Definition: ParticleUtils.hh:353
bool hasCharm(int pid)
Does this particle contain a charm quark?
Definition: ParticleIdUtils.hh:579
CONTAINER::value_type sum(const CONTAINER &c)
Generic sum function, adding x for all x in container c.
Definition: Utils.hh:434
bool isHeavyParton(int pid)
Determine if the PID is that of a heavy parton (c,b,t)
Definition: ParticleIdUtils.hh:603
bool isQuark(int pid)
Determine if the PID is that of a quark.
Definition: ParticleIdUtils.hh:122
Jets select(const Jets &jets, const Cut &c)
New alias for filter_select.
Definition: JetUtils.hh:168
PdgIdPair pids(const ParticlePair &pp)
Definition: ParticleUtils.hh:749
bool isSame(const Particle &a, const Particle &b)
Check Particle equivalence.
Definition: ParticleUtils.hh:787
Determine whether a particle has a descendant which doesn&#39;t meet the cut/function.
Definition: ParticleUtils.hh:664
bool isGenSpecific(int pid)
Determine if the PID is in the generator-specific range.
Definition: ParticleIdUtils.hh:920
bool hasTop(int pid)
Does this particle contain a top quark?
Definition: ParticleIdUtils.hh:583
bool isDirect(const Particle &p, bool allow_from_direct_tau=false, bool allow_from_direct_mu=false)
Decide if a given particle is direct, via Particle::isDirect()
Definition: ParticleUtils.hh:419
bool hasLeptonicDecay(const Particle &p)
Decide if a given particle decays leptonically (decays, and no hadrons)
Definition: ParticleUtils.hh:443
Determine whether a particle has an parent which meets the cut/function.
Definition: ParticleUtils.hh:616
bool isLastWith(const ParticleSelector &f) const
Determine whether a particle is the last in a decay chain to meet the function requirement.
Definition: Particle.hh:676
bool hasDescendantWithout(const ParticleSelector &f, bool remove_duplicates=true) const
Definition: Particle.hh:601
bool hasStableDescendantWithout(const Particle &p, const ParticleSelector &f)
Determine whether a particle has a stable descendant which doesn&#39;t meet the function requirement...
Definition: ParticleUtils.hh:402
Determine whether a particle has an ancestor which meets the cut/function.
Definition: ParticleUtils.hh:595
int charge3() const
Three times the charge of this Particle (i.e. integer multiple of smallest quark charge).
Definition: Particle.hh:179
int nuclNlambda(int pid)
Definition: ParticleIdUtils.hh:108
bool contains(const std::string &s, const std::string &sub)
Does s contain sub as a substring?
Definition: RivetSTL.hh:93
bool hasHadronicDecay(const Particle &p)
Decide if a given particle decays hadronically.
Definition: ParticleUtils.hh:436
bool isCharmMeson(int pid)
Determine if the PID is that of a c-meson.
Definition: ParticleIdUtils.hh:664
bool hasChildWith(const Particle &p, const ParticleSelector &f)
Determine whether a particle has a child which meets the function requirement.
Definition: ParticleUtils.hh:375
bool isRhadron(int pid)
Alias.
Definition: ParticleIdUtils.hh:394
bool isChLepton(int pid)
Definition: ParticleIdUtils.hh:164
bool isFirstWith(const Particle &p, const ParticleSelector &f)
Determine whether a particle is the first in a decay chain to meet the function requirement.
Definition: ParticleUtils.hh:330
bool isHeavyHadron(int pid)
Determine if the PID is that of a heavy flavour (b or c) hadron.
Definition: ParticleIdUtils.hh:624
bool hasAncestorWithout(const ParticleSelector &f, bool only_physical=true) const
Definition: Particle.hh:418
bool isLastWithout(const ParticleSelector &f) const
Determine whether a particle is the last in a decay chain not to meet the function requirement...
Definition: Particle.hh:683
bool isWplus(int pid)
Determine if the PID is that of a W+.
Definition: ParticleIdUtils.hh:174
int jSpin(int pid)
jSpin returns 2J+1, where J is the total spin
Definition: ParticleIdUtils.hh:725
Jets & ifilter_select(Jets &jets, const Cut &c)
Filter a jet collection in-place to the subset that passes the supplied Cut.
bool isLastWithout(const Particle &p, const ParticleSelector &f)
Determine whether a particle is the last in a decay chain not to meet the function requirement...
Definition: ParticleUtils.hh:346
bool isKK(int pid)
Is this a Kaluza-Klein excitation?
Definition: ParticleIdUtils.hh:409
bool isCharmHadron(int pid)
Definition: ParticleIdUtils.hh:684
Determine whether a particle has a child which doesn&#39;t meet the cut/function.
Definition: ParticleUtils.hh:644
bool fromCharm(const Particle &p)
Determine whether the particle is from a c-hadron decay.
Definition: ParticleUtils.hh:458
bool isFirstWith(const ParticleSelector &f) const
Determine whether a particle is the first in a decay chain to meet the function requirement.
Definition: Particle.hh:664
Determine whether a particle is the last in a decay chain to meet the cut/function.
Definition: ParticleUtils.hh:575
bool fromHadron(const Particle &p)
Determine whether the particle is from a hadron decay.
Definition: ParticleUtils.hh:461
bool hasChildWithout(const ParticleSelector &f) const
Definition: Particle.hh:562
Determine whether a particle has an parent which doesn&#39;t meet the cut/function.
Definition: ParticleUtils.hh:625
bool fromPromptTau(const Particle &p)
Determine whether the particle is from a prompt tau decay.
Definition: ParticleUtils.hh:469
bool isLightParton(int pid)
Determine if the PID is that of a light parton (u,d,s)
Definition: ParticleIdUtils.hh:608
bool isZ(int pid)
Determine if the PID is that of a Z0.
Definition: ParticleIdUtils.hh:189
bool isResonance(int pid)
Definition: ParticleIdUtils.hh:927
PdgId abspid() const
Absolute value of the PDG ID code.
Definition: Particle.hh:164
bool isMeson(int pid)
Check to see if this is a valid meson.
Definition: ParticleIdUtils.hh:237
bool fromTau(bool prompt_taus_only=false) const
Determine whether the particle is from a tau decay.
bool isHeavyFlavour(int pid)
Determine if the particle is a heavy flavour hadron or parton.
Definition: ParticleIdUtils.hh:592
bool sameSign(const Particle &a, const Particle &b)
Definition: ParticleUtils.hh:297
Three-dimensional specialisation of Vector.
Definition: Vector3.hh:26
bool isDirect(bool allow_from_direct_tau=false, bool allow_from_direct_mu=false) const
Shorthand definition of &#39;promptness&#39; based on set definition flags.
Jets & iselect(Jets &jets, const Cut &c)
New alias for ifilter_select.
Definition: JetUtils.hh:156
bool isNeutrino(int pid)
Determine if the PID is that of a neutrino.
Definition: ParticleIdUtils.hh:167
Functor for or-combination of selector logic.
Definition: ParticleUtils.hh:507
bool hasParentWithout(const ParticleSelector &f) const
Definition: Particle.hh:359
bool hasParentWithout(const Particle &p, const ParticleSelector &f)
Determine whether a particle has a parent which doesn&#39;t meet the function requirement.
Definition: ParticleUtils.hh:369
bool isPrompt(const Particle &p, bool allow_from_prompt_tau=false, bool allow_from_prompt_mu=false)
Decide if a given particle is prompt, via Particle::isPrompt()
Definition: ParticleUtils.hh:427
Jets filterBy(const Jets &jets, const Cut &c)
Definition: JetUtils.hh:166
Specialized version of the FourVector with momentum/energy functionality.
Definition: Vector4.hh:301
bool isExcited(int pid)
Is this an excited (composite) quark or lepton?
Definition: ParticleIdUtils.hh:403
bool isCharmBaryon(int pid)
Determine if the PID is that of a c-baryon.
Definition: ParticleIdUtils.hh:674
Jets & ifilter_discard(Jets &jets, const Cut &c)
Filter a jet collection in-place to the subset that fails the supplied Cut.
bool isPrompt(bool allow_from_prompt_tau=false, bool allow_from_prompt_mu=false) const
Alias for isDirect.
Definition: Particle.hh:518
Jets & idiscard(Jets &jets, const Cut &c)
New alias for ifilter_discard.
Definition: JetUtils.hh:187
bool hasAncestor(PdgId pid, bool only_physical=true) const
bool hasParentWith(const ParticleSelector &f) const
Definition: Particle.hh:344
std::enable_if< std::is_arithmetic< NUM >::value, int >::type sign(NUM val)
Find the sign of a number.
Definition: MathUtils.hh:266
bool hasDescendantWithout(const Particle &p, const ParticleSelector &f, bool remove_duplicates=true)
Determine whether a particle has a descendant which doesn&#39;t meet the function requirement.
Definition: ParticleUtils.hh:391
int sSpin(int pid)
sSpin returns 2S+1, where S is the spin
Definition: ParticleIdUtils.hh:741
bool isChargedLepton(int pid)
Determine if the PID is that of a charged lepton.
Definition: ParticleIdUtils.hh:158
bool fromBottom() const
Determine whether the particle is from a b-hadron decay.
bool hasParentWith(const Particle &p, const ParticleSelector &f)
Determine whether a particle has a parent which meets the function requirement.
Definition: ParticleUtils.hh:364
bool isBottomMeson(int pid)
Determine if the PID is that of a b-meson.
Definition: ParticleIdUtils.hh:645