rivet is hosted by Hepforge, IPPP Durham
Rivet 4.0.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
13namespace Rivet {
14
15
18
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
42
43 PARTICLE_TO_PID_BOOLFN(isLepton)
44
45
46 PARTICLE_TO_PID_BOOLFN(isPhoton)
47
48
49 PARTICLE_TO_PID_BOOLFN(isElectron)
50
51
52 PARTICLE_TO_PID_BOOLFN(isMuon)
53
54
55 PARTICLE_TO_PID_BOOLFN(isTau)
56
57
58 PARTICLE_TO_PID_BOOLFN(isHadron)
59
60
61 PARTICLE_TO_PID_BOOLFN(isMeson)
62
63
64 PARTICLE_TO_PID_BOOLFN(isBaryon)
65
66
67 PARTICLE_TO_PID_BOOLFN(isQuark)
68
69
70 PARTICLE_TO_PID_BOOLFN(isParton)
71
72
73
74
75 PARTICLE_TO_PID_BOOLFN(isWplus)
76
77
78 PARTICLE_TO_PID_BOOLFN(isWminus)
79
80
81 PARTICLE_TO_PID_BOOLFN(isW)
82
83
84 PARTICLE_TO_PID_BOOLFN(isZ)
85
86
87 PARTICLE_TO_PID_BOOLFN(isHiggs)
88
89
90 PARTICLE_TO_PID_BOOLFN(isStrange)
91
92
93 PARTICLE_TO_PID_BOOLFN(isCharm)
94
95
96 PARTICLE_TO_PID_BOOLFN(isBottom)
97
98
99 PARTICLE_TO_PID_BOOLFN(isTop)
100
101
102
103 PARTICLE_TO_PID_BOOLFN(isHeavyFlavour)
104
105
106 PARTICLE_TO_PID_BOOLFN(isHeavyParton)
107
108
109 PARTICLE_TO_PID_BOOLFN(isLightParton)
110
111
112
113 PARTICLE_TO_PID_BOOLFN(isHeavyMeson)
114
115
116 PARTICLE_TO_PID_BOOLFN(isHeavyBaryon)
117
118
119 PARTICLE_TO_PID_BOOLFN(isHeavyHadron)
120
121
122
123 PARTICLE_TO_PID_BOOLFN(isLightMeson)
124
125
126 PARTICLE_TO_PID_BOOLFN(isLightBaryon)
127
128
129 PARTICLE_TO_PID_BOOLFN(isLightHadron)
130
131
132
133 PARTICLE_TO_PID_BOOLFN(isBottomMeson)
134
135
136 PARTICLE_TO_PID_BOOLFN(isBottomBaryon)
137
138
139 PARTICLE_TO_PID_BOOLFN(isBottomHadron)
140
141
142
146 PARTICLE_TO_PID_BOOLFN(isCharmMeson)
147
148
153 PARTICLE_TO_PID_BOOLFN(isCharmBaryon)
154
155
156 PARTICLE_TO_PID_BOOLFN(isCharmHadron)
157
158
159 // /// Determine if the PID is that of a strange meson
160 // PARTICLE_TO_PID_BOOLFN(isStrangeMeson)
161
162 // /// Determine if the PID is that of a strange baryon
163 // PARTICLE_TO_PID_BOOLFN(isStrangeBaryon)
164
165 // /// Determine if the PID is that of a strange hadron
166 // PARTICLE_TO_PID_BOOLFN(isStrangeHadron)
167
168
169
170
171 PARTICLE_TO_PID_BOOLFN(isReggeon)
172
173
174 PARTICLE_TO_PID_BOOLFN(isDiquark)
175
176
177 PARTICLE_TO_PID_BOOLFN(isPentaquark)
178
179
180 PARTICLE_TO_PID_BOOLFN(isSUSY)
181
182
183 PARTICLE_TO_PID_BOOLFN(isRhadron)
184
185
186 PARTICLE_TO_PID_BOOLFN(isTechnicolor)
187
188
189 PARTICLE_TO_PID_BOOLFN(isExcited)
190
191
192 PARTICLE_TO_PID_BOOLFN(isKK)
193
194
195 PARTICLE_TO_PID_BOOLFN(isGraviton)
196
197
198 PARTICLE_TO_PID_BOOLFN(isBSM)
199
200
201
202
203 PARTICLE_TO_PID_BOOLFN(isGenSpecific)
204
205
206 PARTICLE_TO_PID_BOOLFN(isResonance)
207
208
209 PARTICLE_TO_PID_BOOLFN(isTransportable)
210
211
212
213
214 PARTICLE_TO_PID_BOOLFN(hasUp)
215
216
217 PARTICLE_TO_PID_BOOLFN(hasDown)
218
219
220 PARTICLE_TO_PID_BOOLFN(hasStrange)
221
222
223 PARTICLE_TO_PID_BOOLFN(hasCharm)
224
225
226 PARTICLE_TO_PID_BOOLFN(hasBottom)
227
228
229 PARTICLE_TO_PID_BOOLFN(hasTop)
230
231
232
233
234 PARTICLE_TO_PID_INTFN(jSpin)
235
236
237 PARTICLE_TO_PID_INTFN(sSpin)
238
239
240 PARTICLE_TO_PID_INTFN(lSpin)
241
242
243
244 PARTICLE_TO_PID_DBLFN(charge)
245
246
247 PARTICLE_TO_PID_INTFN(charge3)
248
249
250 PARTICLE_TO_PID_DBLFN(abscharge)
251
252
253 PARTICLE_TO_PID_INTFN(abscharge3)
254
255
256 PARTICLE_TO_PID_INTFN(nuclZ)
257
258
259 PARTICLE_TO_PID_INTFN(nuclA)
260
261
262 PARTICLE_TO_PID_INTFN(nuclNlambda)
263
264
265
266
267
271
272 inline bool isSameSign(const Particle& a, const Particle& b) { return PID::isSameSign(a.pid(), b.pid()); }
273 inline bool isOppSign(const Particle& a, const Particle& b) { return PID::isOppSign(a.pid(), b.pid()); }
274 inline bool isSameFlav(const Particle& a, const Particle& b) { return PID::isSameFlav(a.pid(), b.pid()); }
275 inline bool isOppFlav(const Particle& a, const Particle& b) { return PID::isOppFlav(a.pid(), b.pid()); }
276
277 inline bool isOSSF(const Particle& a, const Particle& b) { return PID::isOSSF(a.pid(), b.pid()); }
278 inline bool isSSSF(const Particle& a, const Particle& b) { return PID::isSSSF(a.pid(), b.pid()); }
279 inline bool isOSOF(const Particle& a, const Particle& b) { return PID::isOSOF(a.pid(), b.pid()); }
280 inline bool isSSOF(const Particle& a, const Particle& b) { return PID::isSSOF(a.pid(), b.pid()); }
281
283
284
287
290 inline bool oppSign(const Particle& a, const Particle& b) {
291 return sign(a.charge3()) == -sign(b.charge3()) && sign(a.charge3()) != ZERO;
292 }
293
296 inline bool sameSign(const Particle& a, const Particle& b) {
297 return sign(a.charge3()) == sign(b.charge3());
298 }
299
302 inline bool oppCharge(const Particle& a, const Particle& b) {
303 return a.charge3() == -b.charge3() && a.charge3() != 0;
304 }
305
308 inline bool sameCharge(const Particle& a, const Particle& b) {
309 return a.charge3() == b.charge3();
310 }
311
313 inline bool diffCharge(const Particle& a, const Particle& b) {
314 return a.charge3() != b.charge3();
315 }
316
318
319
320
322
323
324
327
329 inline bool isFirstWith(const Particle& p, const ParticleSelector& f) {
330 return p.isFirstWith(f);
331 }
332
334 inline bool isFirstWithout(const Particle& p, const ParticleSelector& f) {
335 return p.isFirstWithout(f);
336 }
337
338
340 inline bool isLastWith(const Particle& p, const ParticleSelector& f) {
341 return p.isLastWith(f);
342 }
343
345 inline bool isLastWithout(const Particle& p, const ParticleSelector& f) {
346 return p.isLastWithout(f);
347 }
348
349
350
352 inline bool hasAncestorWith(const Particle& p, const ParticleSelector& f, bool only_physical=true) {
353 return p.hasAncestorWith(f, only_physical);
354 }
355
357 inline bool hasAncestorWithout(const Particle& p, const ParticleSelector& f, bool only_physical=true) {
358 return p.hasAncestorWithout(f, only_physical);
359 }
360
361
363 inline bool hasParentWith(const Particle& p, const ParticleSelector& f) {
364 return p.hasParentWith(f);
365 }
366
368 inline bool hasParentWithout(const Particle& p, const ParticleSelector& f) {
369 return p.hasParentWithout(f);
370 }
371
372
374 inline bool hasChildWith(const Particle& p, const ParticleSelector& f) {
375 return p.hasChildWith(f);
376 }
377
379 inline bool hasChildWithout(const Particle& p, const ParticleSelector& f) {
380 return p.hasChildWithout(f);
381 }
382
383
385 inline bool hasDescendantWith(const Particle& p, const ParticleSelector& f, bool remove_duplicates=true) {
386 return p.hasDescendantWith(f, remove_duplicates);
387 }
388
390 inline bool hasDescendantWithout(const Particle& p, const ParticleSelector& f, bool remove_duplicates=true) {
391 return p.hasDescendantWithout(f, remove_duplicates);
392 }
393
394
396 inline bool hasStableDescendantWith(const Particle& p, const ParticleSelector& f) {
397 return p.hasStableDescendantWith(f);
398 }
399
401 inline bool hasStableDescendantWithout(const Particle& p, const ParticleSelector& f) {
402 return p.hasStableDescendantWithout(f);
403 }
404
405
406
408 inline bool isVisible(const Particle& p) { return p.isVisible(); }
409
418 inline bool isDirect(const Particle& p, bool allow_from_direct_tau=false, bool allow_from_direct_mu=false) {
419 return p.isDirect(allow_from_direct_tau, allow_from_direct_mu);
420 }
421
426 inline bool isPrompt(const Particle& p, bool allow_from_prompt_tau=false, bool allow_from_prompt_mu=false) {
427 return p.isPrompt(allow_from_prompt_tau, allow_from_prompt_mu);
428 }
429
430
432 inline bool isStable(const Particle& p) { return p.isStable(); }
433
435 inline bool hasHadronicDecay(const Particle& p) {
436 if (p.isStable()) return false;
437 if (p.hasChildWith(isHadron)) return true;
438 return false;
439 }
440
442 inline bool hasLeptonicDecay(const Particle& p) {
443 if (p.isStable()) return false;
444 if (p.hasChildWith(isHadron)) return false;
445 return true;
446 }
447
448
450 inline bool fromBottom(const Particle& p) { return p.fromBottom(); }
451
453 inline bool fromCharm(const Particle& p) { return p.fromCharm(); }
454
456 inline bool fromHadron(const Particle& p) { return p.fromHadron(); }
457
459 inline bool fromTau(const Particle& p, bool prompt_taus_only=false) {
460 return p.fromTau(prompt_taus_only);
461 }
462
464 inline bool fromPromptTau(const Particle& p) { return p.fromPromptTau(); }
465
467
468
473
476 virtual bool operator()(const Particle& p) const = 0;
477 virtual ~BoolParticleFunctor() {}
478 };
479
482 BoolParticleAND(const std::vector<ParticleSelector>& sels) : selectors(sels) {}
483 BoolParticleAND(const ParticleSelector& a, const ParticleSelector& b) : selectors({a,b}) {}
484 BoolParticleAND(const ParticleSelector& a, const ParticleSelector& b, const ParticleSelector& c) : selectors({a,b,c}) {}
485 bool operator()(const Particle& p) const {
486 for (const ParticleSelector& sel : selectors) if (!sel(p)) return false;
487 return true;
488 }
489 std::vector<ParticleSelector> selectors;
490 };
492 inline BoolParticleAND operator && (const ParticleSelector& a, const ParticleSelector& b) {
493 return BoolParticleAND(a, b);
494 }
495
496
499 BoolParticleOR(const std::vector<ParticleSelector>& sels) : selectors(sels) {}
500 BoolParticleOR(const ParticleSelector& a, const ParticleSelector& b) : selectors({a,b}) {}
501 BoolParticleOR(const ParticleSelector& a, const ParticleSelector& b, const ParticleSelector& c) : selectors({a,b,c}) {}
502 bool operator()(const Particle& p) const {
503 for (const ParticleSelector& sel : selectors) if (sel(p)) return true;
504 return false;
505 }
506 std::vector<ParticleSelector> selectors;
507 };
509 inline BoolParticleOR operator || (const ParticleSelector& a, const ParticleSelector& b) {
510 return BoolParticleOR(a, b);
511 }
512
515 BoolParticleNOT(const ParticleSelector& sel) : selector(sel) {}
516 bool operator()(const Particle& p) const { return !selector(p); }
517 ParticleSelector selector;
518 };
520 inline BoolParticleNOT operator ! (const ParticleSelector& a) {
521 return BoolParticleNOT(a);
522 }
523
524
526 struct HasPID : public BoolParticleFunctor {
527 HasPID(PdgId pid) : targetpids{pid} { }
528 HasPID(vector<PdgId> pids) : targetpids{pids} { }
529 HasPID(initializer_list<PdgId> pids) : targetpids{pids} { }
530 bool operator()(const Particle& p) const { return contains(targetpids, p.pid()); }
531 vector<PdgId> targetpids;
532 };
533 using hasPID = HasPID;
534
537 HasAbsPID(PdgId pid) : targetapids{abs(pid)} { }
538 HasAbsPID(vector<PdgId> pids) { for (PdgId pid : pids) targetapids.push_back(abs(pid)); }
539 HasAbsPID(initializer_list<PdgId> pids) { for (PdgId pid : pids) targetapids.push_back(abs(pid)); }
540 bool operator()(const Particle& p) const { return contains(targetapids, p.abspid()); }
541 vector<PdgId> targetapids;
542 };
543 using hasAbsPID = HasAbsPID;
544
545
548 FirstParticleWith(const ParticleSelector& f) : fn(f) { }
549 FirstParticleWith(const Cut& c);
550 bool operator()(const Particle& p) const { return isFirstWith(p, fn); }
551 ParticleSelector fn;
552 };
554
557 FirstParticleWithout(const ParticleSelector& f) : fn(f) { }
558 FirstParticleWithout(const Cut& c);
559 bool operator()(const Particle& p) const { return isFirstWithout(p, fn); }
560 ParticleSelector fn;
561 };
563
564
567 template <typename FN>
568 LastParticleWith(const FN& f) : fn(f) { }
569 LastParticleWith(const Cut& c);
570 bool operator()(const Particle& p) const { return isLastWith(p, fn); }
571 std::function<bool(const Particle&)> fn;
572 };
574
577 LastParticleWithout(const ParticleSelector& f) : fn(f) { }
578 LastParticleWithout(const Cut& c);
579 bool operator()(const Particle& p) const { return isLastWithout(p, fn); }
580 ParticleSelector fn;
581 };
583
584
587 HasParticleAncestorWith(const ParticleSelector& f, bool only_physical=true) : fn(f), onlyphysical(only_physical) { }
588 HasParticleAncestorWith(const Cut& c, bool only_physical=true);
589 bool operator()(const Particle& p) const { return hasAncestorWith(p, fn, onlyphysical); }
590 ParticleSelector fn;
591 bool onlyphysical;
592 };
594
597 HasParticleAncestorWithout(const ParticleSelector& f, bool only_physical=true) : fn(f), onlyphysical(only_physical) { }
598 HasParticleAncestorWithout(const Cut& c, bool only_physical=true);
599 bool operator()(const Particle& p) const { return hasAncestorWithout(p, fn, onlyphysical); }
600 ParticleSelector fn;
601 bool onlyphysical;
602 };
604
605
608 HasParticleParentWith(const ParticleSelector& f) : fn(f) { }
609 HasParticleParentWith(const Cut& c);
610 bool operator()(const Particle& p) const { return hasParentWith(p, fn); }
611 ParticleSelector fn;
612 };
614
617 HasParticleParentWithout(const ParticleSelector& f) : fn(f) { }
618 HasParticleParentWithout(const Cut& c);
619 bool operator()(const Particle& p) const { return hasParentWithout(p, fn); }
620 ParticleSelector fn;
621 };
623
624
627 HasParticleChildWith(const ParticleSelector& f) : fn(f) { }
628 HasParticleChildWith(const Cut& c);
629 bool operator()(const Particle& p) const { return hasChildWith(p, fn); }
630 ParticleSelector fn;
631 };
633
636 HasParticleChildWithout(const ParticleSelector& f) : fn(f) { }
637 HasParticleChildWithout(const Cut& c);
638 bool operator()(const Particle& p) const { return hasChildWithout(p, fn); }
639 ParticleSelector fn;
640 };
642
643
646 HasParticleDescendantWith(const ParticleSelector& f, bool remove_duplicates=true) : fn(f), rmduplicates(remove_duplicates) { }
647 HasParticleDescendantWith(const Cut& c, bool remove_duplicates=true);
648 bool operator()(const Particle& p) const { return hasDescendantWith(p, fn, rmduplicates); }
649 ParticleSelector fn;
650 bool rmduplicates;
651 };
653
656 HasParticleDescendantWithout(const ParticleSelector& f, bool remove_duplicates=true) : fn(f), rmduplicates(remove_duplicates) { }
657 HasParticleDescendantWithout(const Cut& c, bool remove_duplicates=true);
658 bool operator()(const Particle& p) const { return hasDescendantWithout(p, fn, rmduplicates); }
659 ParticleSelector fn;
660 bool rmduplicates;
661 };
663
665
666
669
671 Particles& iselect(Particles& particles, const Cut& c);
672
674 inline Particles select(const Particles& particles, const Cut& c) {
675 Particles rtn = particles;
676 return iselect(rtn, c);
677 }
678
680 inline Particles select(const Particles& particles, const Cut& c, Particles& out) {
681 out = select(particles, c);
682 return out;
683 }
684
686 Particles& idiscard(Particles& particles, const Cut& c);
687
689 inline Particles discard(const Particles& particles, const Cut& c) {
690 Particles rtn = particles;
691 return idiscard(rtn, c);
692 }
693
695 inline Particles discard(const Particles& particles, const Cut& c, Particles& out) {
696 out = discard(particles, c);
697 return out;
698 }
699
700
701 // inline void ifilterIsolateDeltaR(Particles& particles, const FourMomenta& vecs) {
702 // ifilter_discard(particles,
703 // }
704
705
706 // inline Particles filterIsolateDeltaR(const Particles& particles, const FourMomenta& vecs) {
707 // }
708
710
711
712
715
717 inline PdgIdPair pids(const ParticlePair& pp) {
718 return make_pair(pp.first.pid(), pp.second.pid());
719 }
720
721 namespace Kin {
722
724 inline pair<double,double> energies(const ParticlePair& pp) {
725 return make_pair(pp.first.E(), pp.second.E());
726 }
727
729 inline pair<FourMomentum,FourMomentum> moms(const ParticlePair& pp) {
730 return make_pair(pp.first.mom(), pp.second.mom());
731 }
732
734 inline double mass(const ParticlePair& pp) {
735 return mass(pp.first, pp.second);
736 }
737
739 inline double mass2(const ParticlePair& pp) {
740 return mass2(pp.first, pp.second);
741 }
742
744 inline double mT(const ParticlePair& pp) {
745 return mT(pp.first, pp.second);
746 }
747
749 inline double pT(const ParticlePair& pp) {
750 return pT(pp.first, pp.second);
751 }
752
753 }
754
756
757
763
764 namespace Kin {
765
767 inline double mass(const Particle& p, const FourMomentum& p4) {
768 return mass(p.mom(), p4);
769 }
770
772 inline double mass(const FourMomentum& p4, const Particle& p) {
773 return mass(p4, p.mom());
774 }
775
777 inline double mass(const Particle& p1, const Particle& p2) {
778 return mass(p1.mom(), p2.mom());
779 }
780
782 inline double mass2(const Particle& p, const P4& p4) {
783 return mass2(p.mom(), p4);
784 }
785
787 inline double mass2(const P4& p4, const Particle& p) {
788 return mass2(p4, p.mom());
789 }
790
792 inline double mass2(const Particle& p1, const Particle& p2) {
793 return mass2(p1.mom(), p2.mom());
794 }
795
800 inline double mT(const Particle& p, const P4& p4) {
801 return mT(p.mom(), p4);
802 }
803
808 inline double mT(const P4& p4, const Particle& p) {
809 return mT(p4, p.mom());
810 }
811
816 inline double mT(const Particle& p1, const Particle& p2) {
817 return mT(p1.mom(), p2.mom());
818 }
819
821 inline double pT(const Particle& p, const P4& p4) {
822 return pT(p.mom(), p4);
823 }
824
826 inline double pT(const P4& p4, const Particle& p) {
827 return pT(p4, p.mom());
828 }
829
831 inline double pT(const Particle& p1, const Particle& p2) {
832 return pT(p1.mom(), p2.mom());
833 }
834
835 }
836
838
839
847 namespace Kin {
848
850 inline double pT(const Particle& p) {
851 return p.pT();
852 }
853
854 inline double sumPt(const Particles& ps) {
855 return sum(ps, Kin::pT, 0.0);
856 }
857
858 inline FourMomentum sumP4(const Particles& ps) {
859 return sum(ps, Kin::p4, FourMomentum());
860 }
861
862 inline Vector3 sumP3(const Particles& ps) {
863 return sum(ps, Kin::p3, Vector3());
864 }
865
867
869
870 }
871
872
873 // Import Kin namespace into Rivet
874 using namespace Kin;
875
876
878 inline bool isSame(const Particle& a, const Particle& b) {
879 return a.isSame(b);
880 }
881
883
884
887 inline bool containsPID(const Particles& parts, int id, bool abs=false) {
888 if (abs) return any(parts, HasAbsPID(id));
889 return any(parts, HasPID(id));
890 }
891
892
893
896 inline bool isRadiative(const Particle& part) {
897 const Particles& parents = part.parents();
898 if (parents.size() != 1)
899 return false;
900
901 const Particle& mother = parents[0];
902 return ( part.pid() != mother.pid() ) && ( containsPID(mother.children(), mother.pid()) );
903 }
904
905
909 bool cascadeContains( const Particles& parts,
910 const vector<int>& pids,
911 bool absolute,
912 bool ignorephoton);
913
915
916}
917
918#endif
Particle representation, either from a HepMC::GenEvent or reconstructed.
Definition Particle.hh:45
bool isSame(const Particle &other) const
Definition Particle.hh:695
PdgId pid() const
This Particle's PDG ID code.
Definition Particle.hh:191
Particles parents(const Cut &c=Cuts::OPEN) const
Particles children(const Cut &c=Cuts::OPEN) const
Get a list of the direct descendants from the current particle (with optional selection Cut)
int charge3() const
Three times the charge of this Particle (i.e. integer multiple of smallest quark charge).
Definition Particle.hh:208
Specialised vector of Particle objects.
Definition Particle.hh:21
bool any(const CONTAINER &c)
Return true if x is true for any x in container c, otherwise false.
Definition Utils.hh:330
Jets & idiscard(Jets &jets, const Cut &c)
Filter a jet collection in-place to the subset that fails the supplied Cut.
Jets select(const Jets &jets, const Cut &c)
Filter a jet collection in-place to the subset that passes the supplied Cut.
Definition JetUtils.hh:152
Jets & iselect(Jets &jets, const Cut &c)
Filter a jet collection in-place to the subset that passes the supplied Cut.
Jets discard(const Jets &jets, const Cut &c)
Filter a jet collection in-place to the subset that fails the supplied Cut.
Definition JetUtils.hh:171
double mass2(const FourMomentum &a, const FourMomentum &b)
Calculate mass^2 of two 4-vectors.
Definition Vector4.hh:1466
bool sameCharge(const Particle &a, const Particle &b)
Definition ParticleUtils.hh:308
bool oppCharge(const Particle &a, const Particle &b)
Definition ParticleUtils.hh:302
bool oppSign(const Particle &a, const Particle &b)
Return true if Particles a and b have the opposite charge sign.
Definition ParticleUtils.hh:290
bool sameSign(const Particle &a, const Particle &b)
Definition ParticleUtils.hh:296
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:313
int pid(const Particle &p)
Unbound function access to PID code.
Definition ParticleUtils.hh:23
int abspid(const Particle &p)
Unbound function access to abs PID code.
Definition ParticleUtils.hh:26
bool isSame(const Particle &a, const Particle &b)
Check Particle equivalence.
Definition ParticleUtils.hh:878
bool isVisible(const Particle &p)
Is this particle potentially visible in a detector?
Definition ParticleUtils.hh:408
bool hasParentWith(const Particle &p, const ParticleSelector &f)
Determine whether a particle has a parent which meets the function requirement.
Definition ParticleUtils.hh:363
bool fromHadron(const Particle &p)
Determine whether the particle is from a hadron decay.
Definition ParticleUtils.hh:456
bool hasStableDescendantWith(const Particle &p, const ParticleSelector &f)
Determine whether a particle has a stable descendant which meets the function requirement.
Definition ParticleUtils.hh:396
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:334
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:345
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:418
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:329
bool fromTau(const Particle &p, bool prompt_taus_only=false)
Determine whether the particle is from a tau decay.
Definition ParticleUtils.hh:459
bool hasParentWithout(const Particle &p, const ParticleSelector &f)
Determine whether a particle has a parent which doesn't meet the function requirement.
Definition ParticleUtils.hh:368
bool fromPromptTau(const Particle &p)
Determine whether the particle is from a prompt tau decay.
Definition ParticleUtils.hh:464
bool hasChildWithout(const Particle &p, const ParticleSelector &f)
Determine whether a particle has a child which doesn't meet the function requirement.
Definition ParticleUtils.hh:379
bool fromCharm(const Particle &p)
Determine whether the particle is from a c-hadron decay.
Definition ParticleUtils.hh:453
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:385
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:352
bool hasHadronicDecay(const Particle &p)
Decide if a given particle decays hadronically.
Definition ParticleUtils.hh:435
bool isStable(const Particle &p)
Decide if a given particle is stable, via Particle::isStable()
Definition ParticleUtils.hh:432
bool hasChildWith(const Particle &p, const ParticleSelector &f)
Determine whether a particle has a child which meets the function requirement.
Definition ParticleUtils.hh:374
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:426
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:340
bool hasLeptonicDecay(const Particle &p)
Decide if a given particle decays leptonically (decays, and no hadrons)
Definition ParticleUtils.hh:442
bool hasStableDescendantWithout(const Particle &p, const ParticleSelector &f)
Determine whether a particle has a stable descendant which doesn't meet the function requirement.
Definition ParticleUtils.hh:401
bool hasAncestorWithout(const Particle &p, const ParticleSelector &f, bool only_physical=true)
Determine whether a particle has an ancestor which doesn't meet the function requirement.
Definition ParticleUtils.hh:357
bool fromBottom(const Particle &p)
Determine whether the particle is from a b-hadron decay.
Definition ParticleUtils.hh:450
bool hasDescendantWithout(const Particle &p, const ParticleSelector &f, bool remove_duplicates=true)
Determine whether a particle has a descendant which doesn't meet the function requirement.
Definition ParticleUtils.hh:390
PdgIdPair pids(const ParticlePair &pp)
Get the PDG ID codes of a ParticlePair.
Definition ParticleUtils.hh:717
bool isRadiative(const Particle &part)
Check whether a particle is radiative.
Definition ParticleUtils.hh:896
bool containsPID(const Particles &parts, int id, bool abs=false)
Check for pid membership in a list of particles.
Definition ParticleUtils.hh:887
bool cascadeContains(const Particles &parts, const vector< int > &pids, bool absolute, bool ignorephoton)
Check whether a set of particles' decay chains can contain the requested list of pids.
Definition MC_CENT_PPB_Projections.hh:10
Cut operator!(const Cut &cptr)
Logical NOT operation on a cut.
Cut operator&&(const Cut &aptr, const Cut &bptr)
double mT(double pT1, double pT2, double dphi)
Definition MathUtils.hh:720
std::pair< Particle, Particle > ParticlePair
Typedef for a pair of Particle objects.
Definition Particle.hh:38
constexpr std::enable_if< std::is_arithmetic< NUM >::value, int >::type sign(NUM val)
Find the sign of a number.
Definition MathUtils.hh:265
T sum(const DressedLeptons &c, FN &&fn, const T &start=T())
Generic sum function, adding fn(x) for all x in container c, starting with start.
Definition DressedLepton.hh:60
bool contains(const std::string &s, const std::string &sub)
Does s contain sub as a substring?
Definition RivetSTL.hh:97
Cut operator||(const Cut &aptr, const Cut &bptr)
Functor for and-combination of selector logic.
Definition ParticleUtils.hh:481
Base type for Particle -> bool functors.
Definition ParticleUtils.hh:475
Functor for inverting selector logic.
Definition ParticleUtils.hh:514
Functor for or-combination of selector logic.
Definition ParticleUtils.hh:498
Determine whether a particle is the first in a decay chain to meet the cut/function.
Definition ParticleUtils.hh:547
Determine whether a particle is the first in a decay chain not to meet the cut/function.
Definition ParticleUtils.hh:556
|PID| matching functor
Definition ParticleUtils.hh:536
PID matching functor.
Definition ParticleUtils.hh:526
Determine whether a particle has an ancestor which meets the cut/function.
Definition ParticleUtils.hh:586
Determine whether a particle has an ancestor which doesn't meet the cut/function.
Definition ParticleUtils.hh:596
Determine whether a particle has a child which meets the cut/function.
Definition ParticleUtils.hh:626
Determine whether a particle has a child which doesn't meet the cut/function.
Definition ParticleUtils.hh:635
Determine whether a particle has a descendant which meets the cut/function.
Definition ParticleUtils.hh:645
Determine whether a particle has a descendant which doesn't meet the cut/function.
Definition ParticleUtils.hh:655
Determine whether a particle has an parent which meets the cut/function.
Definition ParticleUtils.hh:607
Determine whether a particle has an parent which doesn't meet the cut/function.
Definition ParticleUtils.hh:616
Determine whether a particle is the last in a decay chain to meet the cut/function.
Definition ParticleUtils.hh:566
Determine whether a particle is the last in a decay chain not to meet the cut/function.
Definition ParticleUtils.hh:576