rivet is hosted by Hepforge, IPPP Durham
Rivet  2.7.0
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 
17 
18 
20  inline int pid(const Particle& p) { return p.pid(); }
21 
23  inline int abspid(const Particle& p) { return p.abspid(); }
24 
25 
27  PARTICLE_TO_PID_BOOLFN(isCharged)
28 
29 
30  PARTICLE_TO_PID_BOOLFN(isNeutral)
31 
32 
33 
34  PARTICLE_TO_PID_BOOLFN(isNeutrino)
35 
36 
37  PARTICLE_TO_PID_BOOLFN(isChargedLepton)
38  PARTICLE_TO_PID_BOOLFN(isChLepton)
39 
40 
41  PARTICLE_TO_PID_BOOLFN(isLepton)
42 
43 
44  PARTICLE_TO_PID_BOOLFN(isPhoton)
45 
46 
47  PARTICLE_TO_PID_BOOLFN(isElectron)
48 
49 
50  PARTICLE_TO_PID_BOOLFN(isMuon)
51 
52 
53  PARTICLE_TO_PID_BOOLFN(isTau)
54 
55 
56  PARTICLE_TO_PID_BOOLFN(isHadron)
57 
58 
59  PARTICLE_TO_PID_BOOLFN(isMeson)
60 
61 
62  PARTICLE_TO_PID_BOOLFN(isBaryon)
63 
64 
65  PARTICLE_TO_PID_BOOLFN(isQuark)
66 
67 
68  PARTICLE_TO_PID_BOOLFN(isParton)
69 
70 
71 
72 
73  PARTICLE_TO_PID_BOOLFN(isWplus)
74 
75 
76  PARTICLE_TO_PID_BOOLFN(isWminus)
77 
78 
79  PARTICLE_TO_PID_BOOLFN(isW)
80 
81 
82  PARTICLE_TO_PID_BOOLFN(isZ)
83 
84 
85  PARTICLE_TO_PID_BOOLFN(isHiggs)
86 
87 
88  PARTICLE_TO_PID_BOOLFN(isStrange)
89 
90 
91  PARTICLE_TO_PID_BOOLFN(isCharm)
92 
93 
94  PARTICLE_TO_PID_BOOLFN(isBottom)
95 
96 
97  PARTICLE_TO_PID_BOOLFN(isTop)
98 
99 
100 
101  PARTICLE_TO_PID_BOOLFN(isHeavyFlavour)
102 
103 
104  PARTICLE_TO_PID_BOOLFN(isHeavyParton)
105 
106 
107  PARTICLE_TO_PID_BOOLFN(isLightParton)
108 
109 
110 
111  PARTICLE_TO_PID_BOOLFN(isHeavyMeson)
112 
113 
114  PARTICLE_TO_PID_BOOLFN(isHeavyBaryon)
115 
116 
117  PARTICLE_TO_PID_BOOLFN(isHeavyHadron)
118 
119 
120 
121  PARTICLE_TO_PID_BOOLFN(isLightMeson)
122 
123 
124  PARTICLE_TO_PID_BOOLFN(isLightBaryon)
125 
126 
127  PARTICLE_TO_PID_BOOLFN(isLightHadron)
128 
129 
130 
131  PARTICLE_TO_PID_BOOLFN(isBottomMeson)
132 
133 
134  PARTICLE_TO_PID_BOOLFN(isBottomBaryon)
135 
136 
137  PARTICLE_TO_PID_BOOLFN(isBottomHadron)
138 
139 
140 
141  PARTICLE_TO_PID_BOOLFN(isCharmMeson)
145 
146 
147  PARTICLE_TO_PID_BOOLFN(isCharmBaryon)
152 
153 
154  PARTICLE_TO_PID_BOOLFN(isCharmHadron)
155 
156 
157  // /// Determine if the PID is that of a strange meson
158  // PARTICLE_TO_PID_BOOLFN(isStrangeMeson)
159 
160  // /// Determine if the PID is that of a strange baryon
161  // PARTICLE_TO_PID_BOOLFN(isStrangeBaryon)
162 
163  // /// Determine if the PID is that of a strange hadron
164  // PARTICLE_TO_PID_BOOLFN(isStrangeHadron)
165 
166 
167 
168 
169  PARTICLE_TO_PID_BOOLFN(isReggeon)
170 
171 
172  PARTICLE_TO_PID_BOOLFN(isDiquark)
173 
174 
175  PARTICLE_TO_PID_BOOLFN(isPentaquark)
176 
177 
178  PARTICLE_TO_PID_BOOLFN(isSUSY)
179 
180 
181  PARTICLE_TO_PID_BOOLFN(isRhadron)
182 
183 
184  PARTICLE_TO_PID_BOOLFN(isTechnicolor)
185 
186 
187  PARTICLE_TO_PID_BOOLFN(isExcited)
188 
189 
190  PARTICLE_TO_PID_BOOLFN(isKK)
191 
192 
193  PARTICLE_TO_PID_BOOLFN(isGraviton)
194 
195 
196  PARTICLE_TO_PID_BOOLFN(isBSM)
197 
198 
199 
200 
201  PARTICLE_TO_PID_BOOLFN(isGenSpecific)
202 
203 
204  PARTICLE_TO_PID_BOOLFN(isResonance)
205 
206 
207  PARTICLE_TO_PID_BOOLFN(isTransportable)
208 
209 
210 
211 
212  PARTICLE_TO_PID_BOOLFN(hasUp)
213 
214 
215  PARTICLE_TO_PID_BOOLFN(hasDown)
216 
217 
218  PARTICLE_TO_PID_BOOLFN(hasStrange)
219 
220 
221  PARTICLE_TO_PID_BOOLFN(hasCharm)
222 
223 
224  PARTICLE_TO_PID_BOOLFN(hasBottom)
225 
226 
227  PARTICLE_TO_PID_BOOLFN(hasTop)
228 
229 
230 
231 
232  PARTICLE_TO_PID_INTFN(jSpin)
233 
234 
235  PARTICLE_TO_PID_INTFN(sSpin)
236 
237 
238  PARTICLE_TO_PID_INTFN(lSpin)
239 
240 
241 
242  PARTICLE_TO_PID_DBLFN(charge)
243 
244 
245  PARTICLE_TO_PID_INTFN(charge3)
246 
247 
248  PARTICLE_TO_PID_DBLFN(abscharge)
249 
250 
251  PARTICLE_TO_PID_INTFN(abscharge3)
252 
253 
254  PARTICLE_TO_PID_INTFN(threeCharge)
256 
257 
258 
259  PARTICLE_TO_PID_INTFN(nuclZ)
260 
261 
262  PARTICLE_TO_PID_INTFN(nuclA)
263 
264 
265  PARTICLE_TO_PID_INTFN(nuclNlambda)
266 
267  //@}
268 
269 
270 
271 
273 
274  inline bool isSameSign(const Particle& a, const Particle& b) { return PID::isSameSign(a.pid(), b.pid()); }
275  inline bool isOppSign(const Particle& a, const Particle& b) { return PID::isOppSign(a.pid(), b.pid()); }
276  inline bool isSameFlav(const Particle& a, const Particle& b) { return PID::isSameFlav(a.pid(), b.pid()); }
277  inline bool isOppFlav(const Particle& a, const Particle& b) { return PID::isOppFlav(a.pid(), b.pid()); }
278 
279  inline bool isOSSF(const Particle& a, const Particle& b) { return PID::isOSSF(a.pid(), b.pid()); }
280  inline bool isSSSF(const Particle& a, const Particle& b) { return PID::isSSSF(a.pid(), b.pid()); }
281  inline bool isOSOF(const Particle& a, const Particle& b) { return PID::isOSOF(a.pid(), b.pid()); }
282  inline bool isSSOF(const Particle& a, const Particle& b) { return PID::isSSOF(a.pid(), b.pid()); }
283 
285 
286 
288 
289 
292  inline bool oppSign(const Particle& a, const Particle& b) {
293  return sign(a.charge3()) == -sign(b.charge3()) && sign(a.charge3()) != ZERO;
294  }
295 
298  inline bool sameSign(const Particle& a, const Particle& b) {
299  return sign(a.charge3()) == sign(b.charge3());
300  }
301 
304  inline bool oppCharge(const Particle& a, const Particle& b) {
305  return a.charge3() == -b.charge3() && a.charge3() != 0;
306  }
307 
310  inline bool sameCharge(const Particle& a, const Particle& b) {
311  return a.charge3() == b.charge3();
312  }
313 
315  inline bool diffCharge(const Particle& a, const Particle& b) {
316  return a.charge3() != b.charge3();
317  }
318 
320 
321 
322 
324 
325 
326 
328 
329 
331  inline bool isFirstWith(const Particle& p, const ParticleSelector& f) {
332  return p.isFirstWith(f);
333  }
334 
336  inline bool isFirstWithout(const Particle& p, const ParticleSelector& f) {
337  return p.isFirstWithout(f);
338  }
339 
340 
342  inline bool isLastWith(const Particle& p, const ParticleSelector& f) {
343  return p.isLastWith(f);
344  }
345 
347  inline bool isLastWithout(const Particle& p, const ParticleSelector& f) {
348  return p.isLastWithout(f);
349  }
350 
351 
352 
354  inline bool hasAncestorWith(const Particle& p, const ParticleSelector& f) {
355  return p.hasAncestorWith(f);
356  }
357 
359  inline bool hasAncestorWithout(const Particle& p, const ParticleSelector& f) {
360  return p.hasAncestorWithout(f);
361  }
362 
363 
365  inline bool hasParentWith(const Particle& p, const ParticleSelector& f) {
366  return p.hasParentWith(f);
367  }
368 
370  inline bool hasParentWithout(const Particle& p, const ParticleSelector& f) {
371  return p.hasParentWithout(f);
372  }
373 
374 
376  inline bool hasChildWith(const Particle& p, const ParticleSelector& f) {
377  return p.hasChildWith(f);
378  }
379 
381  inline bool hasChildWithout(const Particle& p, const ParticleSelector& f) {
382  return p.hasChildWithout(f);
383  }
384 
385 
387  inline bool hasDescendantWith(const Particle& p, const ParticleSelector& f) {
388  return p.hasDescendantWith(f);
389  // return !p.allDescendants(f).empty();
390  }
391 
393  inline bool hasDescendantWithout(const Particle& p, const ParticleSelector& f) {
394  return p.hasDescendantWithout(f);
395  }
396 
397 
399  inline bool hasStableDescendantWith(const Particle& p, const ParticleSelector& f) {
400  return p.hasStableDescendantWith(f);
401  }
402 
404  inline bool hasStableDescendantWithout(const Particle& p, const ParticleSelector& f) {
405  return p.hasStableDescendantWithout(f);
406  }
407 
408 
409 
411  inline bool isVisible(const Particle& p) { return p.isVisible(); }
412 
421  inline bool isDirect(const Particle& p, bool allow_from_direct_tau=false, bool allow_from_direct_mu=false) {
422  return p.isDirect(allow_from_direct_tau, allow_from_direct_mu);
423  }
424 
429  inline bool isPrompt(const Particle& p, bool allow_from_prompt_tau=false, bool allow_from_prompt_mu=false) {
430  return p.isPrompt(allow_from_prompt_tau, allow_from_prompt_mu);
431  }
432 
433 
435  inline bool isStable(const Particle& p) { return p.isStable(); }
436 
438  inline bool hasHadronicDecay(const Particle& p) {
439  if (p.isStable()) return false;
440  if (p.hasChildWith(isHadron)) return true;
441  return false;
442  }
443 
445  inline bool hasLeptonicDecay(const Particle& p) {
446  if (p.isStable()) return false;
447  if (p.hasChildWith(isHadron)) return false;
448  return true;
449  }
450 
451 
454  inline bool hasAncestor(const Particle& p, PdgId pid) { return p.hasAncestor(pid); }
455 
457  inline bool fromBottom(const Particle& p) { return p.fromBottom(); }
458 
460  inline bool fromCharm(const Particle& p) { return p.fromCharm(); }
461 
463  inline bool fromHadron(const Particle& p) { return p.fromHadron(); }
464 
466  inline bool fromTau(const Particle& p, bool prompt_taus_only=false) {
467  return p.fromTau(prompt_taus_only);
468  }
469 
471  inline bool fromPromptTau(const Particle& p) { return p.fromPromptTau(); }
472 
475  inline bool fromDecay(const Particle& p) { return p.fromDecay(); }
476 
478 
479 
483 
484 
487  virtual bool operator()(const Particle& p) const = 0;
488  virtual ~BoolParticleFunctor() {}
489  };
490 
493  BoolParticleAND(const std::vector<ParticleSelector>& sels) : selectors(sels) {}
494  BoolParticleAND(const ParticleSelector& a, const ParticleSelector& b) : selectors({a,b}) {}
495  BoolParticleAND(const ParticleSelector& a, const ParticleSelector& b, const ParticleSelector& c) : selectors({a,b,c}) {}
496  bool operator()(const Particle& p) const {
497  for (const ParticleSelector& sel : selectors) if (!sel(p)) return false;
498  return true;
499  }
500  std::vector<ParticleSelector> selectors;
501  };
503  inline BoolParticleAND operator && (const ParticleSelector& a, const ParticleSelector& b) {
504  return BoolParticleAND(a, b);
505  }
506 
507 
510  BoolParticleOR(const std::vector<ParticleSelector>& sels) : selectors(sels) {}
511  BoolParticleOR(const ParticleSelector& a, const ParticleSelector& b) : selectors({a,b}) {}
512  BoolParticleOR(const ParticleSelector& a, const ParticleSelector& b, const ParticleSelector& c) : selectors({a,b,c}) {}
513  bool operator()(const Particle& p) const {
514  for (const ParticleSelector& sel : selectors) if (sel(p)) return true;
515  return false;
516  }
517  std::vector<ParticleSelector> selectors;
518  };
520  inline BoolParticleOR operator || (const ParticleSelector& a, const ParticleSelector& b) {
521  return BoolParticleOR(a, b);
522  }
523 
526  BoolParticleNOT(const ParticleSelector& sel) : selector(sel) {}
527  bool operator()(const Particle& p) const { return !selector(p); }
528  ParticleSelector selector;
529  };
531  inline BoolParticleNOT operator ! (const ParticleSelector& a) {
532  return BoolParticleNOT(a);
533  }
534 
535 
537  struct HasPID : public BoolParticleFunctor {
538  HasPID(PdgId pid) : targetpids{pid} { }
539  HasPID(vector<PdgId> pids) : targetpids{pids} { }
540  HasPID(initializer_list<PdgId> pids) : targetpids{pids} { }
541  bool operator()(const Particle& p) const { return contains(targetpids, p.pid()); }
542  vector<PdgId> targetpids;
543  };
544  using hasPID = HasPID;
545 
547  struct HasAbsPID : public BoolParticleFunctor {
548  HasAbsPID(PdgId pid) : targetapids{abs(pid)} { }
549  HasAbsPID(vector<PdgId> pids) { for (PdgId pid : pids) targetapids.push_back(abs(pid)); }
550  HasAbsPID(initializer_list<PdgId> pids) { for (PdgId pid : pids) targetapids.push_back(abs(pid)); }
551  bool operator()(const Particle& p) const { return contains(targetapids, p.abspid()); }
552  vector<PdgId> targetapids;
553  };
554  using hasAbsPID = HasAbsPID;
555 
556 
559  FirstParticleWith(const ParticleSelector& f) : fn(f) { }
560  FirstParticleWith(const Cut& c);
561  bool operator()(const Particle& p) const { return isFirstWith(p, fn); }
562  ParticleSelector fn;
563  };
565 
568  FirstParticleWithout(const ParticleSelector& f) : fn(f) { }
569  FirstParticleWithout(const Cut& c);
570  bool operator()(const Particle& p) const { return isFirstWithout(p, fn); }
571  ParticleSelector fn;
572  };
574 
575 
578  template <typename FN>
579  LastParticleWith(const FN& f) : fn(f) { }
580  LastParticleWith(const Cut& c);
581  bool operator()(const Particle& p) const { return isLastWith(p, fn); }
582  std::function<bool(const Particle&)> fn;
583  };
585 
588  LastParticleWithout(const ParticleSelector& f) : fn(f) { }
589  LastParticleWithout(const Cut& c);
590  bool operator()(const Particle& p) const { return isLastWithout(p, fn); }
591  ParticleSelector fn;
592  };
594 
595 
598  HasParticleAncestorWith(const ParticleSelector& f) : fn(f) { }
599  HasParticleAncestorWith(const Cut& c);
600  bool operator()(const Particle& p) const { return hasAncestorWith(p, fn); }
601  ParticleSelector fn;
602  };
604 
607  HasParticleAncestorWithout(const ParticleSelector& f) : fn(f) { }
608  HasParticleAncestorWithout(const Cut& c);
609  bool operator()(const Particle& p) const { return hasAncestorWithout(p, fn); }
610  ParticleSelector fn;
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) : fn(f) { }
656  HasParticleDescendantWith(const Cut& c);
657  bool operator()(const Particle& p) const { return hasDescendantWith(p, fn); }
658  ParticleSelector fn;
659  };
661 
664  HasParticleDescendantWithout(const ParticleSelector& f) : fn(f) { }
665  HasParticleDescendantWithout(const Cut& c);
666  bool operator()(const Particle& p) const { return hasDescendantWithout(p, fn); }
667  ParticleSelector fn;
668  };
670 
672 
673 
675 
676 
678  Particles& ifilter_select(Particles& particles, const Cut& c);
681  inline Particles& ifilterBy(Particles& particles, const Cut& c) { return ifilter_select(particles, c); }
682 
684  inline Particles filter_select(const Particles& particles, const Cut& c) {
685  Particles rtn = particles;
686  return ifilter_select(rtn, c);
687  }
690  inline Particles filterBy(const Particles& particles, const Cut& c) { return filter_select(particles, c); }
691 
693  inline Particles filter_select(const Particles& particles, const Cut& c, Particles& out) {
694  out = filter_select(particles, c);
695  return out;
696  }
699  inline Particles filterBy(const Particles& particles, const Cut& c, Particles& out) { return filter_select(particles, c, out); }
700 
701 
703  Particles& ifilter_discard(Particles& particles, const Cut& c);
704 
706  inline Particles filter_discard(const Particles& particles, const Cut& c) {
707  Particles rtn = particles;
708  return ifilter_discard(rtn, c);
709  }
710 
712  inline Particles filter_discard(const Particles& particles, const Cut& c, Particles& out) {
713  out = filter_discard(particles, c);
714  return out;
715  }
716 
717 
718  // inline void ifilterIsolateDeltaR(Particles& particles, const FourMomenta& vecs) {
719  // ifilter_discard(particles,
720  // }
721 
722 
723  // inline Particles filterIsolateDeltaR(const Particles& particles, const FourMomenta& vecs) {
724  // }
725 
727 
728 
729 
731 
732 
735  inline PdgIdPair pids(const ParticlePair& pp) {
736  return make_pair(pp.first.pid(), pp.second.pid());
737  }
738 
740 
741 
742 
745 
746  namespace Kin {
747 
748  inline double sumPt(const Particles& ps) {
749  return sum(ps, pT, 0.0);
750  }
751 
752  inline FourMomentum sumP4(const Particles& ps) {
753  return sum(ps, p4, FourMomentum());
754  }
755 
756  inline Vector3 sumP3(const Particles& ps) {
757  return sum(ps, p3, Vector3());
758  }
759 
762 
763  }
765 
766 
767  // Import Kin namespace into Rivet
768  using namespace Kin;
769 
770 
771 }
772 
773 #endif
Definition: ALICE_2010_I880049.cc:13
bool oppSign(const Particle &a, const Particle &b)
Return true if Particles a and b have the opposite charge sign.
Definition: ParticleUtils.hh:292
bool hasHadronicDecay(const Particle &p)
Decide if a given particle decays hadronically.
Definition: ParticleUtils.hh:438
bool fromHadron(const Particle &p)
Determine whether the particle is from a hadron decay.
Definition: ParticleUtils.hh:463
bool hasLeptonicDecay(const Particle &p)
Decide if a given particle decays leptonically (decays, and no hadrons)
Definition: ParticleUtils.hh:445
bool oppCharge(const Particle &a, const Particle &b)
Definition: ParticleUtils.hh:304
int abspid(const Particle &p)
Unbound function access to abs PID code.
Definition: ParticleUtils.hh:23
bool fromHadron() const
Determine whether the particle is from a hadron decay.
Definition: Particle.cc:229
Cut operator!(const Cut &cptr)
Logical NOT operation on a cut.
Definition: Cuts.cc:324
Base type for Particle -> bool functors.
Definition: ParticleUtils.hh:486
bool fromCharm() const
Determine whether the particle is from a c-hadron decay.
Definition: Particle.cc:223
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:404
PdgIdPair pids(const ParticlePair &pp)
Definition: ParticleUtils.hh:735
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:653
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:336
bool hasDescendantWith(const ParticleSelector &f, bool remove_duplicates=true) const
Definition: Particle.hh:568
bool hasDescendantWithout(const Particle &p, const ParticleSelector &f)
Determine whether a particle has a descendant which doesn&#39;t meet the function requirement.
Definition: ParticleUtils.hh:393
bool isStable() const
Whether this particle is stable according to the generator.
Definition: Particle.cc:57
Determine whether a particle is the last in a decay chain not to meet the cut/function.
Definition: ParticleUtils.hh:587
PID matching functor.
Definition: ParticleUtils.hh:537
bool fromBottom(const Particle &p)
Determine whether the particle is from a b-hadron decay.
Definition: ParticleUtils.hh:457
std::vector< GenParticle const * > particles(const GenEvent *ge)
Definition: RivetHepMC.hh:36
PdgId pid() const
This Particle&#39;s PDG ID code.
Definition: Particle.hh:135
bool hasAncestorWith(const ParticleSelector &f, bool only_physical=true) const
Definition: Particle.hh:384
Particle representation, either from a HepMC::GenEvent or reconstructed.
Definition: Particle.hh:18
Functor for and-combination of selector logic.
Definition: ParticleUtils.hh:492
int pid(const Particle &p)
Unbound function access to PID code.
Definition: ParticleUtils.hh:20
bool isVisible(const Particle &p)
Is this particle potentially visible in a detector?
Definition: ParticleUtils.hh:411
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:370
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:429
bool fromTau(const Particle &p, bool prompt_taus_only=false)
Determine whether the particle is from a tau decay.
Definition: ParticleUtils.hh:466
|PID| matching functor
Definition: ParticleUtils.hh:547
Jets & ifilter_discard(Jets &jets, const Cut &c)
Filter a jet collection in-place to the subset that fails the supplied Cut.
Definition: JetUtils.cc:14
bool hasAncestor(const Particle &p, PdgId pid)
Definition: ParticleUtils.hh:454
bool hasStableDescendantWith(const Particle &p, const ParticleSelector &f)
Determine whether a particle has a stable descendant which meets the function requirement.
Definition: ParticleUtils.hh:399
bool hasStableDescendantWith(const ParticleSelector &f) const
Definition: Particle.hh:610
bool hasChildWith(const ParticleSelector &f) const
Definition: Particle.hh:529
bool sameCharge(const Particle &a, const Particle &b)
Definition: ParticleUtils.hh:310
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:165
bool hasStableDescendantWithout(const ParticleSelector &f) const
Definition: Particle.hh:625
Functor for inverting selector logic.
Definition: ParticleUtils.hh:525
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:381
bool hasDescendantWith(const Particle &p, const ParticleSelector &f)
Determine whether a particle has a descendant which meets the function requirement.
Definition: ParticleUtils.hh:387
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:143
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:421
Cut operator||(const Cut &aptr, const Cut &bptr)
Definition: Cuts.cc:320
bool hasParentWith(const Particle &p, const ParticleSelector &f)
Determine whether a particle has a parent which meets the function requirement.
Definition: ParticleUtils.hh:365
Determine whether a particle has an ancestor which doesn&#39;t meet the cut/function. ...
Definition: ParticleUtils.hh:606
bool fromDecay(const Particle &p)
Determine whether the particle is from a hadron or tau decay.
Definition: ParticleUtils.hh:475
bool fromPromptTau() const
Determine whether the particle is from a prompt tau decay.
Definition: Particle.hh:466
bool isStable(const Particle &p)
Decide if a given particle is stable, via Particle::isStable()
Definition: ParticleUtils.hh:435
Determine whether a particle is the first in a decay chain to meet the cut/function.
Definition: ParticleUtils.hh:558
Determine whether a particle is the first in a decay chain not to meet the cut/function.
Definition: ParticleUtils.hh:567
Cut operator&&(const Cut &aptr, const Cut &bptr)
Operators.
Definition: Cuts.cc:316
T sum(const CONTAINER &c, const T &start=T())
Generic sum function, adding x for all x in container c, starting with start.
Definition: Utils.hh:345
Determine whether a particle has a child which meets the cut/function.
Definition: ParticleUtils.hh:635
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:347
bool isVisible() const
Is this particle potentially visible in a detector?
Definition: Particle.cc:43
Determine whether a particle has a descendant which meets the cut/function.
Definition: ParticleUtils.hh:654
Determine whether a particle has a descendant which doesn&#39;t meet the cut/function.
Definition: ParticleUtils.hh:663
Jets filterBy(const Jets &jets, const Cut &c)
Definition: JetUtils.hh:149
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:658
bool hasDescendantWithout(const ParticleSelector &f, bool remove_duplicates=true) const
Definition: Particle.hh:583
Determine whether a particle has an ancestor which meets the cut/function.
Definition: ParticleUtils.hh:597
int charge3() const
Three times the charge of this Particle (i.e. integer multiple of smallest quark charge).
Definition: Particle.hh:155
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:315
bool contains(const std::string &s, const std::string &sub)
Does s contain sub as a substring?
Definition: RivetSTL.hh:76
bool hasAncestorWithout(const ParticleSelector &f, bool only_physical=true) const
Definition: Particle.hh:399
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:665
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:331
bool hasAncestorWith(const Particle &p, const ParticleSelector &f)
Determine whether a particle has an ancestor which meets the function requirement.
Definition: ParticleUtils.hh:354
Determine whether a particle has a child which doesn&#39;t meet the cut/function.
Definition: ParticleUtils.hh:644
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:646
bool hasAncestorWithout(const Particle &p, const ParticleSelector &f)
Determine whether a particle has an ancestor which doesn&#39;t meet the function requirement.
Definition: ParticleUtils.hh:359
Determine whether a particle is the last in a decay chain to meet the cut/function.
Definition: ParticleUtils.hh:577
bool hasChildWithout(const ParticleSelector &f) const
Definition: Particle.hh:544
bool fromCharm(const Particle &p)
Determine whether the particle is from a c-hadron decay.
Definition: ParticleUtils.hh:460
Determine whether a particle has an parent which doesn&#39;t meet the cut/function.
Definition: ParticleUtils.hh:625
Jets & ifilterBy(Jets &jets, const Cut &c)
Definition: JetUtils.hh:140
bool sameSign(const Particle &a, const Particle &b)
Definition: ParticleUtils.hh:298
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:342
PdgId abspid() const
Absolute value of the PDG ID code.
Definition: Particle.hh:137
bool fromTau(bool prompt_taus_only=false) const
Determine whether the particle is from a tau decay.
Definition: Particle.cc:235
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.
Definition: Particle.cc:249
Functor for or-combination of selector logic.
Definition: ParticleUtils.hh:509
bool hasParentWithout(const ParticleSelector &f) const
Definition: Particle.hh:339
Specialized version of the FourVector with momentum/energy functionality.
Definition: Vector4.hh:301
bool isPrompt(bool allow_from_prompt_tau=false, bool allow_from_prompt_mu=false) const
Alias for isDirect.
Definition: Particle.hh:500
Jets & ifilter_select(Jets &jets, const Cut &c)
Filter a jet collection in-place to the subset that passes the supplied Cut.
Definition: JetUtils.cc:7
bool hasChildWith(const Particle &p, const ParticleSelector &f)
Determine whether a particle has a child which meets the function requirement.
Definition: ParticleUtils.hh:376
bool hasAncestor(PdgId pid, bool only_physical=true) const
Definition: Particle.cc:193
bool fromDecay() const
Determine whether the particle is from a hadron or tau decay.
Definition: Particle.hh:485
bool fromPromptTau(const Particle &p)
Determine whether the particle is from a prompt tau decay.
Definition: ParticleUtils.hh:471
bool hasParentWith(const ParticleSelector &f) const
Definition: Particle.hh:324
std::enable_if< std::is_arithmetic< NUM >::value, int >::type sign(NUM val)
Find the sign of a number.
Definition: MathUtils.hh:236
bool fromBottom() const
Determine whether the particle is from a b-hadron decay.
Definition: Particle.cc:217