1#ifndef RIVET_PARTICLEBASEUTILS_HH
2#define RIVET_PARTICLEBASEUTILS_HH
4#include "Rivet/ParticleBase.hh"
5#include "Rivet/Tools/Utils.hh"
39 return p.pT() > ptcut;
53 return p.pT() < ptcut;
62 PtInRange(pair<double, double> ptcuts)
64 PtInRange(
double ptlow,
double pthigh)
65 : PtInRange(make_pair(ptlow, pthigh)) { }
67 : PtInRange(p1.
pT(), p2.
pT()) { }
69 return p.pT() >= ptcut.first &&
p.pT() < ptcut.second;
71 pair<double, double> ptcut;
84 return p.eta() > etacut;
97 return p.eta() < etacut;
105 EtaInRange(pair<double, double> etacuts)
106 : etacut(etacuts) { }
107 EtaInRange(
double etalow,
double etahigh)
108 : EtaInRange(make_pair(etalow, etahigh)) { }
110 : EtaInRange(p1.
eta(), p2.
eta()) { }
112 return p.eta() >= etacut.first &&
p.eta() < etacut.second;
114 pair<double, double> etacut;
124 : absetacut(
p.abseta()) { }
126 return p.abseta() > absetacut;
138 : absetacut(
p.abseta()) { }
140 return p.abseta() < absetacut;
149 AbsEtaInRange(
const pair<double, double>& absetacuts)
150 : absetacut(absetacuts) { }
151 AbsEtaInRange(
double absetalow,
double absetahigh)
152 : AbsEtaInRange(make_pair(absetalow, absetahigh)) { }
156 return p.abseta() >= absetacut.first &&
p.abseta() < absetacut.second;
158 pair<double, double> absetacut;
169 : rapcut(
p.rap()) { }
171 return p.rap() > rapcut;
182 : rapcut(
p.rap()) { }
184 return p.rap() < rapcut;
192 RapInRange(
const pair<double, double>& rapcuts)
193 : rapcut(rapcuts) { }
194 RapInRange(
double raplow,
double raphigh)
195 : RapInRange(make_pair(raplow, raphigh)) { }
197 : RapInRange(p1.
rap(), p2.
rap()) { }
199 return p.rap() >= rapcut.first &&
p.rap() < rapcut.second;
201 pair<double, double> rapcut;
211 : absrapcut(
p.absrap()) { }
213 return p.absrap() > absrapcut;
225 : absrapcut(
p.absrap()) { }
227 return p.absrap() < absrapcut;
236 AbsRapInRange(
const pair<double, double>& absrapcuts)
237 : absrapcut(absrapcuts) { }
238 AbsRapInRange(
double absraplow,
double absraphigh)
239 : AbsRapInRange(make_pair(absraplow, absraphigh)) { }
243 return p.absrap() >= absrapcut.first &&
p.absrap() < absrapcut.second;
245 pair<double, double> absrapcut;
257 : refvec(vec.
mom()), drcut(dr), rapscheme(scheme) { }
259 : refvec(vec), drcut(dr), rapscheme(scheme) { }
260 DeltaRGtr(
const Vector3& vec,
double dr)
261 : drcut(dr), rapscheme(PSEUDORAPIDITY) {
262 refvec.setPx(vec.x());
263 refvec.setPy(vec.y());
264 refvec.setPz(vec.z());
267 return deltaR(
p, refvec, rapscheme) > drcut;
278 : refvec(vec.
mom()), drcut(dr), rapscheme(scheme) { }
280 : refvec(vec), drcut(dr), rapscheme(scheme) { }
281 DeltaRLess(
const Vector3& vec,
double dr)
282 : drcut(dr), rapscheme(PSEUDORAPIDITY) {
283 refvec.setPx(vec.x());
284 refvec.setPy(vec.y());
285 refvec.setPz(vec.z());
288 return deltaR(
p, refvec, rapscheme) < drcut;
298 DeltaRInRange(
const ParticleBase& vec,
const pair<double, double>& dr,
RapScheme scheme = PSEUDORAPIDITY)
299 : refvec(vec.
mom()), drcut(dr), rapscheme(scheme) { }
300 DeltaRInRange(
const ParticleBase& vec,
double drmin,
double drmax,
RapScheme scheme = PSEUDORAPIDITY)
301 : DeltaRInRange(vec, make_pair(drmin, drmax), scheme) { }
302 DeltaRInRange(
const FourMomentum& vec,
const pair<double, double>& dr,
RapScheme scheme = PSEUDORAPIDITY)
303 : refvec(vec), drcut(dr), rapscheme(scheme) { }
304 DeltaRInRange(
const FourMomentum& vec,
double drmin,
double drmax,
RapScheme scheme = PSEUDORAPIDITY)
305 : DeltaRInRange(vec, make_pair(drmin, drmax), scheme) { }
306 DeltaRInRange(
const Vector3& vec,
const pair<double, double>& dr)
307 : drcut(dr), rapscheme(PSEUDORAPIDITY) {
308 refvec.setPx(vec.x());
309 refvec.setPy(vec.y());
310 refvec.setPz(vec.z());
312 DeltaRInRange(
const Vector3& vec,
double drmin,
double drmax)
313 : DeltaRInRange(vec, make_pair(drmin, drmax)) { }
315 const double dR =
deltaR(
p, refvec, rapscheme);
316 return dR >= drcut.first && dR < drcut.second;
319 pair<double, double> drcut;
328 : refvec(vec.
p3()), dphicut(dphi) { }
330 : refvec(vec.
p3()), dphicut(dphi) { }
331 DeltaPhiGtr(
const Vector3& vec,
double dphi)
332 : refvec(vec), dphicut(dphi) { }
344 : refvec(vec.
p3()), dphicut(dphi) { }
346 : refvec(vec.
p3()), dphicut(dphi) { }
347 DeltaPhiLess(
const Vector3& vec,
double dphi)
348 : refvec(vec), dphicut(dphi) { }
359 DeltaPhiInRange(
const ParticleBase& vec,
const pair<double, double>& dphi)
360 : refvec(vec.
mom()), dphicut(dphi) { }
361 DeltaPhiInRange(
const ParticleBase& vec,
double dphimin,
double dphimax)
362 : DeltaPhiInRange(vec, make_pair(dphimin, dphimax)) { }
363 DeltaPhiInRange(
const FourMomentum& vec,
const pair<double, double>& dphi)
364 : refvec(vec), dphicut(dphi) { }
365 DeltaPhiInRange(
const FourMomentum& vec,
double dphimin,
double dphimax)
366 : DeltaPhiInRange(vec, make_pair(dphimin, dphimax)) { }
367 DeltaPhiInRange(
const Vector3& vec,
const pair<double, double>& dphi)
368 : refvec(vec), dphicut(dphi) { }
369 DeltaPhiInRange(
const Vector3& vec,
double dphimin,
double dphimax)
370 : DeltaPhiInRange(vec, make_pair(dphimin, dphimax)) { }
373 return dphi >= dphicut.first && dphi < dphicut.second;
376 pair<double, double> dphicut;
384 : refvec(vec.
p3()), detacut(deta) { }
386 : refvec(vec.
p3()), detacut(deta) { }
387 DeltaEtaGtr(
const Vector3& vec,
double deta)
388 : refvec(vec), detacut(deta) { }
390 return std::abs(
deltaEta(
p, refvec)) > detacut;
400 : refvec(vec.
p3()), detacut(deta) { }
402 : refvec(vec.
p3()), detacut(deta) { }
403 DeltaEtaLess(
const Vector3& vec,
double deta)
404 : refvec(vec), detacut(deta) { }
406 return std::abs(
deltaEta(
p, refvec)) < detacut;
415 DeltaEtaInRange(
const ParticleBase& vec,
const pair<double, double>& deta)
416 : refvec(vec.
mom()), detacut(deta) { }
417 DeltaEtaInRange(
const ParticleBase& vec,
double detamin,
double detamax)
418 : DeltaEtaInRange(vec, make_pair(detamin, detamax)) { }
419 DeltaEtaInRange(
const FourMomentum& vec,
const pair<double, double>& deta)
420 : refvec(vec), detacut(deta) { }
421 DeltaEtaInRange(
const FourMomentum& vec,
double detamin,
double detamax)
422 : DeltaEtaInRange(vec, make_pair(detamin, detamax)) { }
423 DeltaEtaInRange(
const Vector3& vec,
const pair<double, double>& deta)
424 : refvec(vec), detacut(deta) { }
425 DeltaEtaInRange(
const Vector3& vec,
double detamin,
double detamax)
426 : DeltaEtaInRange(vec, make_pair(detamin, detamax)) { }
429 return deta >= detacut.first && deta < detacut.second;
432 pair<double, double> detacut;
440 : refvec(vec.
mom()), drapcut(drap) { }
442 : refvec(vec), drapcut(drap) { }
444 return std::abs(
deltaRap(
p, refvec)) > drapcut;
454 : refvec(vec.
mom()), drapcut(drap) { }
456 : refvec(vec), drapcut(drap) { }
458 return std::abs(
deltaRap(
p, refvec)) < drapcut;
467 DeltaRapInRange(
const ParticleBase& vec,
const pair<double, double>& drap)
468 : refvec(vec.
mom()), drapcut(drap) { }
469 DeltaRapInRange(
const ParticleBase& vec,
double drapmin,
double drapmax)
470 : DeltaRapInRange(vec, make_pair(drapmin, drapmax)) { }
471 DeltaRapInRange(
const FourMomentum& vec,
const pair<double, double>& drap)
472 : refvec(vec), drapcut(drap) { }
473 DeltaRapInRange(
const FourMomentum& vec,
double drapmin,
double drapmax)
474 : DeltaRapInRange(vec, make_pair(drapmin, drapmax)) { }
477 return drap >= drapcut.first && drap < drapcut.second;
480 pair<double, double> drapcut;
502 : p(pb.
mom()), rapscheme(scheme) { }
504 : p(
p4), rapscheme(scheme) { }
506 : p(
p3.mod(),
p3.x(),
p3.y(),
p3.z()), rapscheme(PSEUDORAPIDITY) { }
508 return deltaR(p, pb, rapscheme);
513 double operator()(
const Vector3&
p3)
const {
526 : p(
p4.vector3()) { }
535 double operator()(
const Vector3&
p3)
const {
547 : p(
p4.vector3()) { }
556 double operator()(
const Vector3&
p3)
const {
568 : p(
p4.vector3()) { }
577 double operator()(
const Vector3&
p3)
const {
622 template <
typename PBCONTAINER1,
typename PBCONTAINER2>
623 inline void idiscardIfAny(PBCONTAINER1& tofilter,
624 const PBCONTAINER2& tocompare,
625 typename std::function<
bool(
const typename PBCONTAINER1::value_type&,
626 const typename PBCONTAINER2::value_type&)> fn) {
627 for (
const auto& pbcmp : tocompare) {
628 idiscard(tofilter, [&](
const typename PBCONTAINER1::value_type& pbfilt) {
return fn(pbfilt, pbcmp); });
632 template <
typename PBCONTAINER1,
typename PBCONTAINER2>
633 inline PBCONTAINER1 discardIfAny(
634 const PBCONTAINER1& tofilter,
635 const PBCONTAINER2& tocompare,
636 typename std::function<
bool(
const typename PBCONTAINER1::value_type&,
637 const typename PBCONTAINER2::value_type&)> fn) {
638 PBCONTAINER1 tmp{tofilter};
639 idiscardIfAny(tmp, tocompare, fn);
644 template <
typename PBCONTAINER1,
typename PBCONTAINER2>
645 inline PBCONTAINER1 selectIfAny(
const PBCONTAINER1& tofilter,
646 const PBCONTAINER2& tocompare,
647 typename std::function<
bool(
const typename PBCONTAINER1::value_type&,
648 const typename PBCONTAINER2::value_type&)> fn) {
649 PBCONTAINER1 selected;
650 for (
const auto& pbfilt : tofilter) {
651 if (
any(tocompare, [&](
const typename PBCONTAINER2::value_type& pbcmp) {
return fn(pbfilt, pbcmp); })) {
658 template <
typename PBCONTAINER1,
typename PBCONTAINER2>
659 inline void iselectIfAny(PBCONTAINER1& tofilter,
660 const PBCONTAINER2& tocompare,
661 typename std::function<
bool(
const typename PBCONTAINER1::value_type&,
662 const typename PBCONTAINER2::value_type&)> fn) {
663 tofilter = selectIfAny(tofilter, tocompare, fn);
667 template <
typename PBCONTAINER1,
typename PBCONTAINER2>
668 inline PBCONTAINER1 discardIfAll(
669 const PBCONTAINER1& tofilter,
670 const PBCONTAINER2& tocompare,
671 typename std::function<
bool(
const typename PBCONTAINER1::value_type&,
672 const typename PBCONTAINER2::value_type&)> fn) {
673 PBCONTAINER1 selected;
674 for (
const auto& pbfilt : tofilter) {
676 [&](
const typename PBCONTAINER2::value_type& pbcmp) {
return fn(pbfilt, pbcmp); })) {
683 template <
typename PBCONTAINER1,
typename PBCONTAINER2>
684 inline void idiscardIfAll(PBCONTAINER1& tofilter,
685 const PBCONTAINER2& tocompare,
686 typename std::function<
bool(
const typename PBCONTAINER1::value_type&,
687 const typename PBCONTAINER2::value_type&)> fn) {
688 tofilter = discardIfAll(tofilter, tocompare, fn);
692 template <
typename PBCONTAINER1,
typename PBCONTAINER2>
693 inline PBCONTAINER1 selectIfAll(
const PBCONTAINER1& tofilter,
694 const PBCONTAINER2& tocompare,
695 typename std::function<
bool(
const typename PBCONTAINER1::value_type&,
696 const typename PBCONTAINER2::value_type&)> fn) {
697 PBCONTAINER1 selected;
698 for (
const auto& pbfilt : tofilter) {
699 if (
all(tocompare, [&](
const typename PBCONTAINER2::value_type& pbcmp) {
return fn(pbfilt, pbcmp); })) {
706 template <
typename PBCONTAINER1,
typename PBCONTAINER2>
707 inline void iselectIfAll(PBCONTAINER1& tofilter,
708 const PBCONTAINER2& tocompare,
709 typename std::function<
bool(
const typename PBCONTAINER1::value_type&,
710 const typename PBCONTAINER2::value_type&)> fn) {
711 tofilter = selectIfAll(tofilter, tocompare, fn);
720 template <
typename PBCONTAINER1,
typename PBCONTAINER2>
721 inline void idiscardIfAnyDeltaRLess(PBCONTAINER1& tofilter,
const PBCONTAINER2& tocompare,
double dR) {
722 for (
const typename PBCONTAINER2::value_type& pb : tocompare) {
723 idiscard(tofilter, deltaRLess(pb, dR));
727 template <
typename PBCONTAINER1,
typename PBCONTAINER2>
728 inline PBCONTAINER1 discardIfAnyDeltaRLess(
const PBCONTAINER1& tofilter,
729 const PBCONTAINER2& tocompare,
731 PBCONTAINER1 tmp{tofilter};
732 idiscardIfAnyDeltaRLess(tmp, tocompare, dR);
736 template <
typename PBCONTAINER1,
typename PBCONTAINER2>
737 inline void idiscardIfAnyDeltaPhiLess(PBCONTAINER1& tofilter,
const PBCONTAINER2& tocompare,
double dphi) {
738 for (
const typename PBCONTAINER2::value_type& pb : tocompare) {
739 idiscard(tofilter, deltaPhiLess(pb, dphi));
743 template <
typename PBCONTAINER1,
typename PBCONTAINER2>
744 inline PBCONTAINER1 discardIfAnyDeltaPhiLess(
const PBCONTAINER1& tofilter,
745 const PBCONTAINER2& tocompare,
747 PBCONTAINER1 tmp{tofilter};
748 idiscardIfAnyDeltaPhiLess(tmp, tocompare, dphi);
753 template <
typename PBCONTAINER1,
typename PBCONTAINER2>
754 inline PBCONTAINER1 selectIfAnyDeltaRLess(
const PBCONTAINER1& tofilter,
755 const PBCONTAINER2& tocompare,
757 PBCONTAINER1 selected;
758 for (
const typename PBCONTAINER1::value_type& f : tofilter) {
759 if (
any(tocompare, deltaRLess(f, dR))) selected.push_back(f);
764 template <
typename PBCONTAINER1,
typename PBCONTAINER2>
765 inline void iselectIfAnyDeltaRLess(PBCONTAINER1& tofilter,
const PBCONTAINER2& tocompare,
double dR) {
766 tofilter = selectIfAnyDeltaRLess(tofilter, tocompare, dR);
770 template <
typename PBCONTAINER1,
typename PBCONTAINER2>
771 inline PBCONTAINER1 selectIfAnyDeltaPhiLess(
const PBCONTAINER1& tofilter,
772 const PBCONTAINER2& tocompare,
774 PBCONTAINER1 selected;
775 for (
const typename PBCONTAINER1::value_type& f : tofilter) {
776 if (
any(tocompare, deltaPhiLess(f, dphi))) selected.push_back(f);
781 template <
typename PBCONTAINER1,
typename PBCONTAINER2>
782 inline void iselectIfAnyDeltaPhiLess(PBCONTAINER1& tofilter,
const PBCONTAINER2& tocompare,
double dphi) {
783 tofilter = selectIfAnyDeltaPhiLess(tofilter, tocompare, dphi);
906 return mT(
p.mom(),
p4);
914 return mT(
p4,
p.mom());
930 return mT(p1.
mom(), p2);
938 return mT(p1, p2.
mom());
946 return mT(p1.
mom(), p2);
954 return mT(p1, p2.
mom());
959 return pT(
p.mom(),
p4);
964 return pT(
p4,
p.mom());
988 template <
typename CONTAINER,
typename = isCIterable<CONTAINER>>
991 double mmin = -DBL_MAX,
992 double mmax = DBL_MAX) {
1000 template <
typename CONTAINER1,
typename CONTAINER2,
typename = isCIterable<CONTAINER1, CONTAINER2>>
1002 const CONTAINER2& c2,
1004 double mmin = -DBL_MAX,
1005 double mmax = DBL_MAX) {
1013 template <
typename CONTAINER,
typename T,
typename = isCIterable<CONTAINER>>
1017 double mmin = -DBL_MAX,
1018 double mmax = DBL_MAX) {
1028 template <
typename CONTAINER,
typename T,
typename = isCIterable<CONTAINER>>
1032 double mmin = -DBL_MAX,
1033 double mmax = DBL_MAX) {
1044 template <
typename CONTAINER,
typename = isCIterable<CONTAINER>>
1045 inline double sumPt(
const CONTAINER& c) {
1050 template <
typename CONTAINER,
typename = isCIterable<CONTAINER>>
1051 inline double sumE(
const CONTAINER& c) {
1056 template <
typename CONTAINER,
typename = isCIterable<CONTAINER>>
1057 inline double sumEt(
const CONTAINER& c) {
1062 template <
typename CONTAINER,
typename = isCIterable<CONTAINER>>
1068 template <
typename CONTAINER,
typename = isCIterable<CONTAINER>>
1074 template <
typename CONTAINER,
typename = isCIterable<CONTAINER>>
1080 template <
typename CONTAINER,
typename = isCIterable<CONTAINER>>
1091 template <
typename CONTAINER,
typename = isCIterable<CONTAINER>>
1093 double rtn = DBL_MAX;
1094 for (
size_t i = 0; i < c.size(); ++i) {
1095 for (
size_t j = i; j < c.size(); ++j) {
1096 if (i == j)
continue;
1097 const double dphi = fabs(
deltaPhi(c[i], c[j]));
1098 if (dphi < rtn) rtn = dphi;
1111 template <
typename CONTAINER1,
typename CONTAINER2,
typename = isCIterable<CONTAINER1, CONTAINER2>>
1112 inline double deltaPhiMin(
const CONTAINER1& c1,
const CONTAINER2& c2) {
1113 double rtn = DBL_MAX;
1114 for (
size_t i = 0; i < c1.size(); ++i) {
1115 for (
size_t j = 0; j < c2.size(); ++j) {
1116 const double dphi =
deltaPhi(c1[i], c2[j]);
1117 if (dphi < rtn) rtn = dphi;
1129 template <
typename CONTAINER,
typename = isCIterable<CONTAINER>>
1131 double rtn = DBL_MAX;
1132 for (
size_t i = 0; i < c.size(); ++i) {
1133 for (
size_t j = i; j < c.size(); ++j) {
1134 if (i == j)
continue;
1135 const double deta = fabs(
deltaEta(c[i], c[j]));
1136 if (deta < rtn) rtn = deta;
1149 template <
typename CONTAINER1,
typename CONTAINER2,
typename = isCIterable<CONTAINER1, CONTAINER2>>
1150 inline double deltaEtaMin(
const CONTAINER1& c1,
const CONTAINER2& c2) {
1151 double rtn = DBL_MAX;
1152 for (
size_t i = 0; i < c1.size(); ++i) {
1153 for (
size_t j = 0; j < c2.size(); ++j) {
1154 const double deta =
deltaEta(c1[i], c2[j]);
1155 if (deta < rtn) rtn = deta;
1167 template <
typename CONTAINER,
typename = isCIterable<CONTAINER>>
1169 double rtn = DBL_MAX;
1170 for (
size_t i = 0; i < c.size(); ++i) {
1171 for (
size_t j = i; j < c.size(); ++j) {
1172 if (i == j)
continue;
1173 const double dy = fabs(
deltaRap(c[i], c[j]));
1174 if (dy < rtn) rtn = dy;
1187 template <
typename CONTAINER1,
typename CONTAINER2,
typename = isCIterable<CONTAINER1, CONTAINER2>>
1188 inline double deltaRapMin(
const CONTAINER1& c1,
const CONTAINER2& c2) {
1189 double rtn = DBL_MAX;
1190 for (
size_t i = 0; i < c1.size(); ++i) {
1191 for (
size_t j = 0; j < c2.size(); ++j) {
1192 const double dy =
deltaRap(c1[i], c2[j]);
1193 if (dy < rtn) rtn = dy;
1205 template <
typename CONTAINER,
typename = isCIterable<CONTAINER>>
1207 double rtn = DBL_MAX;
1208 for (
size_t i = 0; i < c.size(); ++i) {
1209 for (
size_t j = i; j < c.size(); ++j) {
1210 if (i == j)
continue;
1211 const double dr = fabs(
deltaR(c[i], c[j]));
1212 if (dr < rtn) rtn = dr;
1225 template <
typename CONTAINER1,
typename CONTAINER2,
typename = isCIterable<CONTAINER1, CONTAINER2>>
1226 inline double deltaRMin(
const CONTAINER1& c1,
const CONTAINER2& c2) {
1227 double rtn = DBL_MAX;
1228 for (
size_t i = 0; i < c1.size(); ++i) {
1229 for (
size_t j = 0; j < c2.size(); ++j) {
1230 const double dr =
deltaR(c1[i], c2[j]);
1231 if (dr < rtn) rtn = dr;
1239 template <
typename CONTAINER,
typename PVEC,
typename = isCIterable<CONTAINER>>
1240 inline double mTmin(
const CONTAINER& psvis,
const PVEC& pinvis) {
1242 transform(psvis, [&](
const typename CONTAINER::value_type& pvis) {
return mT(pvis, pinvis); }));
Specialized version of the FourVector with momentum/energy functionality.
Definition Vector4.hh:363
double rap() const
Alias for rapidity.
Definition Vector4.hh:668
double absrap() const
Absolute rapidity.
Definition Vector4.hh:677
double pT() const
Calculate the transverse momentum .
Definition Vector4.hh:700
Vector3 vector3() const
Get the spatial part of the 4-vector as a 3-vector.
Definition Vector4.hh:219
double abseta() const
Get the directly (alias).
Definition Vector4.hh:214
double eta() const
Synonym for pseudorapidity.
Definition Vector4.hh:205
Base class for particle-like things like Particle and Jet.
Definition ParticleBase.hh:13
const FourMomentum & mom() const
Get the equivalent momentum four-vector (const) (alias).
Definition ParticleBase.hh:39
ThreeMomentum p3() const
Get the 3-momentum directly.
Definition ParticleBase.hh:164
Three-dimensional specialisation of Vector.
Definition Vector3.hh:39
int closestMatchIndex(const CONTAINER &c, FN &&fn, double target, double minval=-DBL_MAX, double maxval=DBL_MAX)
Return the index from a vector which best matches fn(c[i]) to the target value.
Definition Utils.hh:814
pair< int, int > closestMatchIndices(const CONTAINER1 &c1, const CONTAINER2 &c2, FN &&fn, double target, double minval=-DBL_MAX, double maxval=DBL_MAX)
Return the indices from two vectors which best match fn(c1[i], c2[j]) to the target value.
Definition Utils.hh:847
bool any(const CONTAINER &c)
Return true if x is true for any x in container c, otherwise false.
Definition Utils.hh:364
bool all(const CONTAINER &c)
Return true if x is true for all x in container c, otherwise false.
Definition Utils.hh:391
Jets & idiscard(Jets &jets, const Cut &c)
Filter a jet collection in-place to the subset that fails the supplied Cut.
function< bool(const ParticleBase &)> ParticleBaseSelector
std::function instantiation for functors taking a ParticleBase and returning a bool
Definition ParticleBaseUtils.hh:20
function< bool(const ParticleBase &, const ParticleBase &)> ParticleBaseSorter
std::function instantiation for functors taking two ParticleBase and returning a bool
Definition ParticleBaseUtils.hh:22
double pT(const ParticleBase &p)
Unbound function access to pT.
Definition ParticleBaseUtils.hh:824
FourMomentum p4(const ParticleBase &p)
Unbound function access to momentum.
Definition ParticleBaseUtils.hh:804
Vector3 pTvec(const ParticleBase &p)
Unbound function access to pTvec.
Definition ParticleBaseUtils.hh:814
Vector3 p3(const ParticleBase &p)
Unbound function access to p3.
Definition ParticleBaseUtils.hh:809
FourMomentum mom(const ParticleBase &p)
Unbound function access to momentum.
Definition ParticleBaseUtils.hh:800
double absrap(const ParticleBase &p)
Unbound function access to abs rapidity.
Definition ParticleBaseUtils.hh:854
double E(const ParticleBase &p)
Unbound function access to E.
Definition ParticleBaseUtils.hh:829
double eta(const ParticleBase &p)
Unbound function access to eta.
Definition ParticleBaseUtils.hh:839
double mass(const ParticleBase &p)
Unbound function access to mass.
Definition ParticleBaseUtils.hh:859
double mass2(const ParticleBase &p, const P4 &p4)
Get the mass^2 of a ParticleBase and a P4.
Definition ParticleBaseUtils.hh:887
double rap(const ParticleBase &p)
Unbound function access to rapidity.
Definition ParticleBaseUtils.hh:849
double Et(const ParticleBase &p)
Unbound function access to ET.
Definition ParticleBaseUtils.hh:834
double p(const ParticleBase &p)
Unbound function access to p.
Definition ParticleBaseUtils.hh:819
double abseta(const ParticleBase &p)
Unbound function access to abseta.
Definition ParticleBaseUtils.hh:844
double mT(const ParticleBase &p, const P4 &p4)
Get the transverse mass of a ParticleBase and a P4.
Definition ParticleBaseUtils.hh:905
int closestMassIndex(const CONTAINER &c, double mtarget, double mmin=-DBL_MAX, double mmax=DBL_MAX)
Return the index from a vector which best matches mass(c[i]) to the target value.
Definition ParticleBaseUtils.hh:989
pair< int, int > closestMassIndices(const CONTAINER1 &c1, const CONTAINER2 &c2, double mtarget, double mmin=-DBL_MAX, double mmax=DBL_MAX)
Return the indices from two vectors which best match mass(c1[i], c2[j]) to the target value.
Definition ParticleBaseUtils.hh:1001
double mTmin(const CONTAINER &psvis, const PVEC &pinvis)
Get the minimum transverse mass of a pair of vectors, one of them taken from a list.
Definition ParticleBaseUtils.hh:1240
double sumEt(const CONTAINER &c)
Return the ET sum of a collection of particle-like objects.
Definition ParticleBaseUtils.hh:1057
double deltaEtaMin(const CONTAINER &c)
Calculate the minimum pseudorapidity separation in a collection of particle-like objects.
Definition ParticleBaseUtils.hh:1130
double deltaRapMin(const CONTAINER &c)
Calculate the minimum rapidity separation in a collection of particle-like objects.
Definition ParticleBaseUtils.hh:1168
double sumE(const CONTAINER &c)
Return the energy sum of a collection of particle-like objects.
Definition ParticleBaseUtils.hh:1051
double deltaRMin(const CONTAINER &c)
Calculate the minimum rapidity separation in a collection of particle-like objects.
Definition ParticleBaseUtils.hh:1206
double sumPt(const CONTAINER &c)
Return the pT sum of a collection of particle-like objects.
Definition ParticleBaseUtils.hh:1045
Vector3 sumPtVec(const CONTAINER &c)
Return the four-momentum sum of a collection of particle-like objects.
Definition ParticleBaseUtils.hh:1081
FourMomentum sumP4(const CONTAINER &c)
Return the four-momentum sum of a collection of particle-like objects.
Definition ParticleBaseUtils.hh:1069
double sumMass(const CONTAINER &c)
Return the mass sum of a collection of particle-like objects.
Definition ParticleBaseUtils.hh:1063
double deltaPhiMin(const CONTAINER &c)
Calculate the minimum phi separation in a collection of particle-like objects.
Definition ParticleBaseUtils.hh:1092
Vector3 sumP3(const CONTAINER &c)
Return the four-momentum sum of a collection of particle-like objects.
Definition ParticleBaseUtils.hh:1075
Definition LHCbCommon.hh:9
double deltaR(double rap1, double phi1, double rap2, double phi2)
Definition MathUtils.hh:754
double deltaPhi(double phi1, double phi2, bool sign=false)
Calculate the difference between two angles in radians.
Definition MathUtils.hh:724
double deltaEta(double eta1, double eta2, bool sign=false)
Definition MathUtils.hh:732
double mT(double pT1, double pT2, double dphi)
Definition MathUtils.hh:777
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:66
std::enable_if_t< std::is_arithmetic_v< N1 > &&std::is_arithmetic_v< N2 >, signed_if_mixed_t< N1, N2 > > min(N1 a, N2 b)
Get the minimum of two numbers.
Definition MathUtils.hh:113
RapScheme
Enum for rapidity variable to be used in calculating , applying rapidity cuts, etc.
Definition MathConstants.hh:46
double deltaRap(double y1, double y2, bool sign=false)
Definition MathUtils.hh:740
Calculator of with respect to a given momentum.
Definition ParticleBaseUtils.hh:564
Calculator of with respect to a given momentum.
Definition ParticleBaseUtils.hh:601
Abs pseudorapidity greater-than functor.
Definition ParticleBaseUtils.hh:120
Abs pseudorapidity in-range functor.
Definition ParticleBaseUtils.hh:148
Abs pseudorapidity momentum less-than functor.
Definition ParticleBaseUtils.hh:134
Abs rapidity greater-than functor.
Definition ParticleBaseUtils.hh:207
Abs rapidity in-range functor.
Definition ParticleBaseUtils.hh:235
Abs rapidity momentum less-than functor.
Definition ParticleBaseUtils.hh:221
Base type for Particle -> bool functors.
Definition ParticleBaseUtils.hh:26
(with respect to another momentum, vec) greater-than functor
Definition ParticleBaseUtils.hh:382
(with respect to another 4-momentum, vec) in-range functor
Definition ParticleBaseUtils.hh:414
(with respect to another momentum, vec) less-than functor
Definition ParticleBaseUtils.hh:398
Calculator of with respect to a given momentum.
Definition ParticleBaseUtils.hh:543
(with respect to another momentum, vec) greater-than functor
Definition ParticleBaseUtils.hh:326
(with respect to another 4-momentum, vec) in-range functor
Definition ParticleBaseUtils.hh:358
(with respect to another momentum, vec) less-than functor
Definition ParticleBaseUtils.hh:342
Calculator of with respect to a given momentum.
Definition ParticleBaseUtils.hh:522
(with respect to another 4-momentum, vec) greater-than functor
Definition ParticleBaseUtils.hh:255
(with respect to another 4-momentum, vec) in-range functor
Definition ParticleBaseUtils.hh:297
(with respect to another 4-momentum, vec) less-than functor
Definition ParticleBaseUtils.hh:276
Calculator of with respect to a given momentum.
Definition ParticleBaseUtils.hh:500
(with respect to another momentum, vec) greater-than functor
Definition ParticleBaseUtils.hh:438
(with respect to another 4-momentum, vec) in-range functor
Definition ParticleBaseUtils.hh:466
(with respect to another momentum, vec) less-than functor
Definition ParticleBaseUtils.hh:452
Calculator of with respect to a given momentum.
Definition ParticleBaseUtils.hh:585
Base type for Particle -> double functors.
Definition ParticleBaseUtils.hh:494
Pseudorapidity greater-than functor.
Definition ParticleBaseUtils.hh:78
Pseudorapidity in-range functor.
Definition ParticleBaseUtils.hh:104
Pseudorapidity less-than functor.
Definition ParticleBaseUtils.hh:91
Transverse momentum greater-than functor.
Definition ParticleBaseUtils.hh:33
Transverse momentum in-range functor.
Definition ParticleBaseUtils.hh:61
Transverse momentum less-than functor.
Definition ParticleBaseUtils.hh:47
Rapidity greater-than functor.
Definition ParticleBaseUtils.hh:165
Rapidity in-range functor.
Definition ParticleBaseUtils.hh:191
Rapidity momentum less-than functor.
Definition ParticleBaseUtils.hh:178