Rivet API documentation

Rivet 4.1.3
ParticleBaseUtils.hh
1#ifndef RIVET_PARTICLEBASEUTILS_HH
2#define RIVET_PARTICLEBASEUTILS_HH
3
4#include "Rivet/ParticleBase.hh"
5#include "Rivet/Tools/Utils.hh"
6
7namespace Rivet {
8
9
12
18
20 using ParticleBaseSelector = function<bool(const ParticleBase&)>;
22 using ParticleBaseSorter = function<bool(const ParticleBase&, const ParticleBase&)>;
23
24
27 virtual bool operator()(const ParticleBase& p) const = 0;
28 virtual ~BoolParticleBaseFunctor() { }
29 };
30
31
33 struct PtGtr : public BoolParticleBaseFunctor {
34 PtGtr(double pt)
35 : ptcut(pt) { }
36 PtGtr(const FourMomentum& p)
37 : ptcut(p.pT()) { }
38 bool operator()(const ParticleBase& p) const {
39 return p.pT() > ptcut;
40 }
41 double ptcut;
42 };
43 using pTGtr = PtGtr;
44 using ptGtr = PtGtr;
45
47 struct PtLess : public BoolParticleBaseFunctor {
48 PtLess(const FourMomentum& p)
49 : ptcut(p.pT()) { }
50 PtLess(double pt)
51 : ptcut(pt) { }
52 bool operator()(const ParticleBase& p) const {
53 return p.pT() < ptcut;
54 }
55 double ptcut;
56 };
57 using pTLess = PtLess;
58 using ptLess = PtLess;
59
61 struct PtInRange : public BoolParticleBaseFunctor {
62 PtInRange(pair<double, double> ptcuts)
63 : ptcut(ptcuts) { }
64 PtInRange(double ptlow, double pthigh)
65 : PtInRange(make_pair(ptlow, pthigh)) { }
66 PtInRange(const FourMomentum& p1, const FourMomentum& p2)
67 : PtInRange(p1.pT(), p2.pT()) { }
68 bool operator()(const ParticleBase& p) const {
69 return p.pT() >= ptcut.first && p.pT() < ptcut.second;
70 }
71 pair<double, double> ptcut;
72 };
73 using pTInRange = PtInRange;
74 using ptInRange = PtInRange;
75
76
78 struct EtaGtr : public BoolParticleBaseFunctor {
79 EtaGtr(double eta)
80 : etacut(eta) { }
81 EtaGtr(const FourMomentum& p)
82 : etacut(p.eta()) { }
83 bool operator()(const ParticleBase& p) const {
84 return p.eta() > etacut;
85 }
86 double etacut;
87 };
88 using etaGtr = EtaGtr;
89
91 struct EtaLess : public BoolParticleBaseFunctor {
92 EtaLess(double eta)
93 : etacut(eta) { }
94 EtaLess(const FourMomentum& p)
95 : etacut(p.eta()) { }
96 bool operator()(const ParticleBase& p) const {
97 return p.eta() < etacut;
98 }
99 double etacut;
100 };
101 using etaLess = EtaLess;
102
104 struct EtaInRange : public BoolParticleBaseFunctor {
105 EtaInRange(pair<double, double> etacuts)
106 : etacut(etacuts) { }
107 EtaInRange(double etalow, double etahigh)
108 : EtaInRange(make_pair(etalow, etahigh)) { }
109 EtaInRange(const FourMomentum& p1, const FourMomentum& p2)
110 : EtaInRange(p1.eta(), p2.eta()) { }
111 bool operator()(const ParticleBase& p) const {
112 return p.eta() >= etacut.first && p.eta() < etacut.second;
113 }
114 pair<double, double> etacut;
115 };
116 using etaInRange = EtaInRange;
117
118
120 struct AbsEtaGtr : public BoolParticleBaseFunctor {
121 AbsEtaGtr(double abseta)
122 : absetacut(abseta) { }
123 AbsEtaGtr(const FourMomentum& p)
124 : absetacut(p.abseta()) { }
125 bool operator()(const ParticleBase& p) const {
126 return p.abseta() > absetacut;
127 }
128 double absetacut;
129 };
130 using absEtaGtr = AbsEtaGtr;
131 using absetaGtr = AbsEtaGtr;
132
134 struct AbsEtaLess : public BoolParticleBaseFunctor {
135 AbsEtaLess(double abseta)
136 : absetacut(abseta) { }
137 AbsEtaLess(const FourMomentum& p)
138 : absetacut(p.abseta()) { }
139 bool operator()(const ParticleBase& p) const {
140 return p.abseta() < absetacut;
141 }
142 double absetacut;
143 };
144 using absEtaLess = AbsEtaLess;
145 using absetaLess = AbsEtaLess;
146
148 struct AbsEtaInRange : public BoolParticleBaseFunctor {
149 AbsEtaInRange(const pair<double, double>& absetacuts)
150 : absetacut(absetacuts) { }
151 AbsEtaInRange(double absetalow, double absetahigh)
152 : AbsEtaInRange(make_pair(absetalow, absetahigh)) { }
153 AbsEtaInRange(const FourMomentum& p1, const FourMomentum& p2)
154 : AbsEtaInRange(p1.abseta(), p2.abseta()) { }
155 bool operator()(const ParticleBase& p) const {
156 return p.abseta() >= absetacut.first && p.abseta() < absetacut.second;
157 }
158 pair<double, double> absetacut;
159 };
160 using absEtaInRange = AbsEtaInRange;
161 using absetaInRange = AbsEtaInRange;
162
163
165 struct RapGtr : public BoolParticleBaseFunctor {
166 RapGtr(double rap)
167 : rapcut(rap) { }
168 RapGtr(const FourMomentum& p)
169 : rapcut(p.rap()) { }
170 bool operator()(const ParticleBase& p) const {
171 return p.rap() > rapcut;
172 }
173 double rapcut;
174 };
175 using rapGtr = RapGtr;
176
178 struct RapLess : public BoolParticleBaseFunctor {
179 RapLess(double rap)
180 : rapcut(rap) { }
181 RapLess(const FourMomentum& p)
182 : rapcut(p.rap()) { }
183 bool operator()(const ParticleBase& p) const {
184 return p.rap() < rapcut;
185 }
186 double rapcut;
187 };
188 using rapLess = RapLess;
189
191 struct RapInRange : public BoolParticleBaseFunctor {
192 RapInRange(const pair<double, double>& rapcuts)
193 : rapcut(rapcuts) { }
194 RapInRange(double raplow, double raphigh)
195 : RapInRange(make_pair(raplow, raphigh)) { }
196 RapInRange(const FourMomentum& p1, const FourMomentum& p2)
197 : RapInRange(p1.rap(), p2.rap()) { }
198 bool operator()(const ParticleBase& p) const {
199 return p.rap() >= rapcut.first && p.rap() < rapcut.second;
200 }
201 pair<double, double> rapcut;
202 };
203 using rapInRange = RapInRange;
204
205
207 struct AbsRapGtr : public BoolParticleBaseFunctor {
208 AbsRapGtr(double absrap)
209 : absrapcut(absrap) { }
210 AbsRapGtr(const FourMomentum& p)
211 : absrapcut(p.absrap()) { }
212 bool operator()(const ParticleBase& p) const {
213 return p.absrap() > absrapcut;
214 }
215 double absrapcut;
216 };
217 using absRapGtr = AbsRapGtr;
218 using absrapGtr = AbsRapGtr;
219
221 struct AbsRapLess : public BoolParticleBaseFunctor {
222 AbsRapLess(double absrap)
223 : absrapcut(absrap) { }
224 AbsRapLess(const FourMomentum& p)
225 : absrapcut(p.absrap()) { }
226 bool operator()(const ParticleBase& p) const {
227 return p.absrap() < absrapcut;
228 }
229 double absrapcut;
230 };
231 using absRapLess = AbsRapLess;
232 using absrapLess = AbsRapLess;
233
235 struct AbsRapInRange : public BoolParticleBaseFunctor {
236 AbsRapInRange(const pair<double, double>& absrapcuts)
237 : absrapcut(absrapcuts) { }
238 AbsRapInRange(double absraplow, double absraphigh)
239 : AbsRapInRange(make_pair(absraplow, absraphigh)) { }
240 AbsRapInRange(const FourMomentum& p1, const FourMomentum& p2)
241 : AbsRapInRange(p1.absrap(), p2.absrap()) { }
242 bool operator()(const ParticleBase& p) const {
243 return p.absrap() >= absrapcut.first && p.absrap() < absrapcut.second;
244 }
245 pair<double, double> absrapcut;
246 };
247 using absRapInRange = AbsRapInRange;
248 using absrapInRange = AbsRapInRange;
249
250
252
253
255 struct DeltaRGtr : public BoolParticleBaseFunctor {
256 DeltaRGtr(const ParticleBase& vec, double dr, RapScheme scheme = PSEUDORAPIDITY)
257 : refvec(vec.mom()), drcut(dr), rapscheme(scheme) { }
258 DeltaRGtr(const FourMomentum& vec, double dr, RapScheme scheme = PSEUDORAPIDITY)
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());
265 }
266 bool operator()(const ParticleBase& p) const {
267 return deltaR(p, refvec, rapscheme) > drcut;
268 }
269 FourMomentum refvec;
270 double drcut;
271 RapScheme rapscheme;
272 };
273 using deltaRGtr = DeltaRGtr;
274
276 struct DeltaRLess : public BoolParticleBaseFunctor {
277 DeltaRLess(const ParticleBase& vec, double dr, RapScheme scheme = PSEUDORAPIDITY)
278 : refvec(vec.mom()), drcut(dr), rapscheme(scheme) { }
279 DeltaRLess(const FourMomentum& vec, double dr, RapScheme scheme = PSEUDORAPIDITY)
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());
286 }
287 bool operator()(const ParticleBase& p) const {
288 return deltaR(p, refvec, rapscheme) < drcut;
289 }
290 FourMomentum refvec;
291 double drcut;
292 RapScheme rapscheme;
293 };
294 using deltaRLess = DeltaRLess;
295
297 struct DeltaRInRange : public BoolParticleBaseFunctor {
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());
311 }
312 DeltaRInRange(const Vector3& vec, double drmin, double drmax)
313 : DeltaRInRange(vec, make_pair(drmin, drmax)) { }
314 bool operator()(const ParticleBase& p) const {
315 const double dR = deltaR(p, refvec, rapscheme);
316 return dR >= drcut.first && dR < drcut.second;
317 }
318 FourMomentum refvec;
319 pair<double, double> drcut;
320 RapScheme rapscheme;
321 };
322 using deltaRInRange = DeltaRInRange;
323
324
326 struct DeltaPhiGtr : public BoolParticleBaseFunctor {
327 DeltaPhiGtr(const ParticleBase& vec, double dphi)
328 : refvec(vec.p3()), dphicut(dphi) { }
329 DeltaPhiGtr(const FourMomentum& vec, double dphi)
330 : refvec(vec.p3()), dphicut(dphi) { }
331 DeltaPhiGtr(const Vector3& vec, double dphi)
332 : refvec(vec), dphicut(dphi) { }
333 bool operator()(const ParticleBase& p) const {
334 return deltaPhi(p, refvec) > dphicut;
335 }
336 Vector3 refvec;
337 double dphicut;
338 };
339 using deltaPhiGtr = DeltaPhiGtr;
340
342 struct DeltaPhiLess : public BoolParticleBaseFunctor {
343 DeltaPhiLess(const ParticleBase& vec, double dphi)
344 : refvec(vec.p3()), dphicut(dphi) { }
345 DeltaPhiLess(const FourMomentum& vec, double dphi)
346 : refvec(vec.p3()), dphicut(dphi) { }
347 DeltaPhiLess(const Vector3& vec, double dphi)
348 : refvec(vec), dphicut(dphi) { }
349 bool operator()(const ParticleBase& p) const {
350 return deltaPhi(p, refvec) < dphicut;
351 }
352 Vector3 refvec;
353 double dphicut;
354 };
355 using deltaPhiLess = DeltaPhiLess;
356
358 struct DeltaPhiInRange : public BoolParticleBaseFunctor {
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)) { }
371 bool operator()(const ParticleBase& p) const {
372 const double dphi = deltaPhi(p, refvec);
373 return dphi >= dphicut.first && dphi < dphicut.second;
374 }
375 Vector3 refvec;
376 pair<double, double> dphicut;
377 };
378 using deltaPhiInRange = DeltaPhiInRange;
379
380
382 struct DeltaEtaGtr : public BoolParticleBaseFunctor {
383 DeltaEtaGtr(const ParticleBase& vec, double deta)
384 : refvec(vec.p3()), detacut(deta) { }
385 DeltaEtaGtr(const FourMomentum& vec, double deta)
386 : refvec(vec.p3()), detacut(deta) { }
387 DeltaEtaGtr(const Vector3& vec, double deta)
388 : refvec(vec), detacut(deta) { }
389 bool operator()(const ParticleBase& p) const {
390 return std::abs(deltaEta(p, refvec)) > detacut;
391 }
392 Vector3 refvec;
393 double detacut;
394 };
395 using deltaEtaGtr = DeltaEtaGtr;
396
398 struct DeltaEtaLess : public BoolParticleBaseFunctor {
399 DeltaEtaLess(const ParticleBase& vec, double deta)
400 : refvec(vec.p3()), detacut(deta) { }
401 DeltaEtaLess(const FourMomentum& vec, double deta)
402 : refvec(vec.p3()), detacut(deta) { }
403 DeltaEtaLess(const Vector3& vec, double deta)
404 : refvec(vec), detacut(deta) { }
405 bool operator()(const ParticleBase& p) const {
406 return std::abs(deltaEta(p, refvec)) < detacut;
407 }
408 Vector3 refvec;
409 double detacut;
410 };
411 using deltaEtaLess = DeltaEtaLess;
412
414 struct DeltaEtaInRange : public BoolParticleBaseFunctor {
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)) { }
427 bool operator()(const ParticleBase& p) const {
428 const double deta = deltaEta(p, refvec);
429 return deta >= detacut.first && deta < detacut.second;
430 }
431 Vector3 refvec;
432 pair<double, double> detacut;
433 };
434 using deltaEtaInRange = DeltaEtaInRange;
435
436
438 struct DeltaRapGtr : public BoolParticleBaseFunctor {
439 DeltaRapGtr(const ParticleBase& vec, double drap)
440 : refvec(vec.mom()), drapcut(drap) { }
441 DeltaRapGtr(const FourMomentum& vec, double drap)
442 : refvec(vec), drapcut(drap) { }
443 bool operator()(const ParticleBase& p) const {
444 return std::abs(deltaRap(p, refvec)) > drapcut;
445 }
446 FourMomentum refvec;
447 double drapcut;
448 };
449 using deltaRapGtr = DeltaRapGtr;
450
452 struct DeltaRapLess : public BoolParticleBaseFunctor {
453 DeltaRapLess(const ParticleBase& vec, double drap)
454 : refvec(vec.mom()), drapcut(drap) { }
455 DeltaRapLess(const FourMomentum& vec, double drap)
456 : refvec(vec), drapcut(drap) { }
457 bool operator()(const ParticleBase& p) const {
458 return std::abs(deltaRap(p, refvec)) < drapcut;
459 }
460 FourMomentum refvec;
461 double drapcut;
462 };
463 using deltaRapLess = DeltaRapLess;
464
466 struct DeltaRapInRange : public BoolParticleBaseFunctor {
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)) { }
475 bool operator()(const ParticleBase& p) const {
476 const double drap = deltaRap(p, refvec);
477 return drap >= drapcut.first && drap < drapcut.second;
478 }
479 FourMomentum refvec;
480 pair<double, double> drapcut;
481 };
482 using deltaRapInRange = DeltaRapInRange;
483
485
486
492
495 virtual double operator()(const ParticleBase& p) const = 0;
496 virtual ~DoubleParticleBaseFunctor() { }
497 };
498
500 struct DeltaRWRT : public DoubleParticleBaseFunctor {
501 DeltaRWRT(const ParticleBase& pb, RapScheme scheme = PSEUDORAPIDITY)
502 : p(pb.mom()), rapscheme(scheme) { }
503 DeltaRWRT(const FourMomentum& p4, RapScheme scheme = PSEUDORAPIDITY)
504 : p(p4), rapscheme(scheme) { }
505 DeltaRWRT(const Vector3& p3)
506 : p(p3.mod(), p3.x(), p3.y(), p3.z()), rapscheme(PSEUDORAPIDITY) { }
507 double operator()(const ParticleBase& pb) const {
508 return deltaR(p, pb, rapscheme);
509 }
510 double operator()(const FourMomentum& p4) const {
511 return deltaR(p, p4, rapscheme);
512 }
513 double operator()(const Vector3& p3) const {
514 return deltaR(p, p3);
515 }
516 const FourMomentum p;
517 RapScheme rapscheme;
518 };
519 using deltaRWRT = DeltaRWRT;
520
522 struct DeltaPhiWRT : public DoubleParticleBaseFunctor {
523 DeltaPhiWRT(const ParticleBase& pb)
524 : p(pb.mom().vector3()) { }
525 DeltaPhiWRT(const FourMomentum& p4)
526 : p(p4.vector3()) { }
527 DeltaPhiWRT(const Vector3& p3)
528 : p(p3) { }
529 double operator()(const ParticleBase& pb) const {
530 return deltaPhi(p, pb);
531 }
532 double operator()(const FourMomentum& p4) const {
533 return deltaPhi(p, p4);
534 }
535 double operator()(const Vector3& p3) const {
536 return deltaPhi(p, p3);
537 }
538 const Vector3 p;
539 };
540 using deltaPhiWRT = DeltaPhiWRT;
541
543 struct DeltaEtaWRT : public DoubleParticleBaseFunctor {
544 DeltaEtaWRT(const ParticleBase& pb)
545 : p(pb.mom().vector3()) { }
546 DeltaEtaWRT(const FourMomentum& p4)
547 : p(p4.vector3()) { }
548 DeltaEtaWRT(const Vector3& p3)
549 : p(p3) { }
550 double operator()(const ParticleBase& pb) const {
551 return deltaEta(p, pb);
552 }
553 double operator()(const FourMomentum& p4) const {
554 return deltaEta(p, p4);
555 }
556 double operator()(const Vector3& p3) const {
557 return deltaEta(p, p3);
558 }
559 const Vector3 p;
560 };
561 using deltaEtaWRT = DeltaEtaWRT;
562
564 struct AbsDeltaEtaWRT : public DoubleParticleBaseFunctor {
565 AbsDeltaEtaWRT(const ParticleBase& pb)
566 : p(pb.mom().vector3()) { }
567 AbsDeltaEtaWRT(const FourMomentum& p4)
568 : p(p4.vector3()) { }
569 AbsDeltaEtaWRT(const Vector3& p3)
570 : p(p3) { }
571 double operator()(const ParticleBase& pb) const {
572 return fabs(deltaEta(p, pb));
573 }
574 double operator()(const FourMomentum& p4) const {
575 return fabs(deltaEta(p, p4));
576 }
577 double operator()(const Vector3& p3) const {
578 return fabs(deltaEta(p, p3));
579 }
580 const Vector3 p;
581 };
582 using absDeltaEtaWRT = AbsDeltaEtaWRT;
583
585 struct DeltaRapWRT : public DoubleParticleBaseFunctor {
586 DeltaRapWRT(const ParticleBase& pb)
587 : p(pb.mom()) { }
588 DeltaRapWRT(const FourMomentum& p4)
589 : p(p4) { }
590 double operator()(const ParticleBase& pb) const {
591 return deltaRap(p, pb);
592 }
593 double operator()(const FourMomentum& p4) const {
594 return deltaRap(p, p4);
595 }
596 const FourMomentum p;
597 };
598 using deltaRapWRT = DeltaRapWRT;
599
601 struct AbsDeltaRapWRT : public DoubleParticleBaseFunctor {
602 AbsDeltaRapWRT(const ParticleBase& pb)
603 : p(pb.mom()) { }
604 AbsDeltaRapWRT(const FourMomentum& p4)
605 : p(p4) { }
606 double operator()(const ParticleBase& pb) const {
607 return fabs(deltaRap(p, pb));
608 }
609 double operator()(const FourMomentum& p4) const {
610 return fabs(deltaRap(p, p4));
611 }
612 const FourMomentum p;
613 };
614 using absDeltaRapWRT = AbsDeltaRapWRT;
615
617
618
621
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); });
629 }
630 }
631
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);
640 return tmp;
641 }
642
643
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); })) {
652 selected += pbfilt;
653 }
654 }
655 return selected;
656 }
657
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);
664 }
665
666
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) {
675 if (!all(tocompare,
676 [&](const typename PBCONTAINER2::value_type& pbcmp) { return fn(pbfilt, pbcmp); })) {
677 selected += pbfilt;
678 }
679 }
680 return selected;
681 }
682
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);
689 }
690
691
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); })) {
700 selected += pbfilt;
701 }
702 }
703 return selected;
704 }
705
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);
712 }
713
715
716
719
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));
724 }
725 }
726
727 template <typename PBCONTAINER1, typename PBCONTAINER2>
728 inline PBCONTAINER1 discardIfAnyDeltaRLess(const PBCONTAINER1& tofilter,
729 const PBCONTAINER2& tocompare,
730 double dR) {
731 PBCONTAINER1 tmp{tofilter};
732 idiscardIfAnyDeltaRLess(tmp, tocompare, dR);
733 return tmp;
734 }
735
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));
740 }
741 }
742
743 template <typename PBCONTAINER1, typename PBCONTAINER2>
744 inline PBCONTAINER1 discardIfAnyDeltaPhiLess(const PBCONTAINER1& tofilter,
745 const PBCONTAINER2& tocompare,
746 double dphi) {
747 PBCONTAINER1 tmp{tofilter};
748 idiscardIfAnyDeltaPhiLess(tmp, tocompare, dphi);
749 return tmp;
750 }
751
752
753 template <typename PBCONTAINER1, typename PBCONTAINER2>
754 inline PBCONTAINER1 selectIfAnyDeltaRLess(const PBCONTAINER1& tofilter,
755 const PBCONTAINER2& tocompare,
756 double dR) {
757 PBCONTAINER1 selected;
758 for (const typename PBCONTAINER1::value_type& f : tofilter) {
759 if (any(tocompare, deltaRLess(f, dR))) selected.push_back(f);
760 }
761 return selected;
762 }
763
764 template <typename PBCONTAINER1, typename PBCONTAINER2>
765 inline void iselectIfAnyDeltaRLess(PBCONTAINER1& tofilter, const PBCONTAINER2& tocompare, double dR) {
766 tofilter = selectIfAnyDeltaRLess(tofilter, tocompare, dR);
767 }
768
769
770 template <typename PBCONTAINER1, typename PBCONTAINER2>
771 inline PBCONTAINER1 selectIfAnyDeltaPhiLess(const PBCONTAINER1& tofilter,
772 const PBCONTAINER2& tocompare,
773 double dphi) {
774 PBCONTAINER1 selected;
775 for (const typename PBCONTAINER1::value_type& f : tofilter) {
776 if (any(tocompare, deltaPhiLess(f, dphi))) selected.push_back(f);
777 }
778 return selected;
779 }
780
781 template <typename PBCONTAINER1, typename PBCONTAINER2>
782 inline void iselectIfAnyDeltaPhiLess(PBCONTAINER1& tofilter, const PBCONTAINER2& tocompare, double dphi) {
783 tofilter = selectIfAnyDeltaPhiLess(tofilter, tocompare, dphi);
784 }
785
786
788
790
791
797 namespace Kin {
798
801 return p.mom();
802 }
803
804 inline FourMomentum p4(const ParticleBase& p) {
805 return p.mom();
806 }
807
809 inline Vector3 p3(const ParticleBase& p) {
810 return p.p3();
811 }
812
814 inline Vector3 pTvec(const ParticleBase& p) {
815 return p.pTvec();
816 }
817
819 inline double p(const ParticleBase& p) {
820 return p.p();
821 }
822
824 inline double pT(const ParticleBase& p) {
825 return p.pT();
826 }
827
829 inline double E(const ParticleBase& p) {
830 return p.E();
831 }
832
834 inline double Et(const ParticleBase& p) {
835 return p.Et();
836 }
837
839 inline double eta(const ParticleBase& p) {
840 return p.eta();
841 }
842
844 inline double abseta(const ParticleBase& p) {
845 return p.abseta();
846 }
847
849 inline double rap(const ParticleBase& p) {
850 return p.rap();
851 }
852
854 inline double absrap(const ParticleBase& p) {
855 return p.absrap();
856 }
857
859 inline double mass(const ParticleBase& p) {
860 return p.mass();
861 }
862
863
864 // /// Unbound function access to pair pT
865 // inline double pairPt(const ParticleBase& p1, const ParticleBase& p2) { return (p1.mom() + p2.mom()).pT(); }
866
867 // /// Unbound function access to pair mass
868 // inline double pairMass(const ParticleBase& p1, const ParticleBase& p2) { return (p1.mom() + p2.mom()).mass(); }
869
870
872 inline double mass(const ParticleBase& p, const FourMomentum& p4) {
873 return mass(p.mom(), p4);
874 }
875
877 inline double mass(const FourMomentum& p4, const ParticleBase& p) {
878 return mass(p4, p.mom());
879 }
880
882 inline double mass(const ParticleBase& p1, const ParticleBase& p2) {
883 return mass(p1.mom(), p2.mom());
884 }
885
887 inline double mass2(const ParticleBase& p, const P4& p4) {
888 return mass2(p.mom(), p4);
889 }
890
892 inline double mass2(const P4& p4, const ParticleBase& p) {
893 return mass2(p4, p.mom());
894 }
895
897 inline double mass2(const ParticleBase& p1, const ParticleBase& p2) {
898 return mass2(p1.mom(), p2.mom());
899 }
900
905 inline double mT(const ParticleBase& p, const P4& p4) {
906 return mT(p.mom(), p4);
907 }
908
913 inline double mT(const P4& p4, const ParticleBase& p) {
914 return mT(p4, p.mom());
915 }
916
921 inline double mT(const ParticleBase& p1, const ParticleBase& p2) {
922 return mT(p1.mom(), p2.mom());
923 }
924
929 inline double mT(const ParticleBase& p1, const Vector4& p2) {
930 return mT(p1.mom(), p2);
931 }
932
937 inline double mT(const Vector4& p1, const ParticleBase& p2) {
938 return mT(p1, p2.mom());
939 }
940
945 inline double mT(const ParticleBase& p1, const Vector3& p2) {
946 return mT(p1.mom(), p2);
947 }
948
953 inline double mT(const Vector3& p1, const ParticleBase& p2) {
954 return mT(p1, p2.mom());
955 }
956
958 inline double pT(const ParticleBase& p, const P4& p4) {
959 return pT(p.mom(), p4);
960 }
961
963 inline double pT(const P4& p4, const ParticleBase& p) {
964 return pT(p4, p.mom());
965 }
966
968 inline double pT(const ParticleBase& p1, const ParticleBase& p2) {
969 return pT(p1.mom(), p2.mom());
970 }
971
972 }
973
974 // Import Kin namespace into Rivet
975 using namespace Kin;
976
978
979
982
987 // auto closestMassIndex = std::bind(closestMatchIndex, std::placeholders::_1, Kin::mass, std::placeholders::_2, std::placeholders::_3);
988 template <typename CONTAINER, typename = isCIterable<CONTAINER>>
989 inline int closestMassIndex(const CONTAINER& c,
990 double mtarget,
991 double mmin = -DBL_MAX,
992 double mmax = DBL_MAX) {
993 return closestMatchIndex(c, Kin::mass, mtarget, mmin, mmax);
994 }
995
1000 template <typename CONTAINER1, typename CONTAINER2, typename = isCIterable<CONTAINER1, CONTAINER2>>
1001 inline pair<int, int> closestMassIndices(const CONTAINER1& c1,
1002 const CONTAINER2& c2,
1003 double mtarget,
1004 double mmin = -DBL_MAX,
1005 double mmax = DBL_MAX) {
1006 return closestMatchIndices(c1, c2, Kin::mass, mtarget, mmin, mmax);
1007 }
1008
1013 template <typename CONTAINER, typename T, typename = isCIterable<CONTAINER>>
1014 inline int closestMassIndex(const CONTAINER& c,
1015 const T& x,
1016 double mtarget,
1017 double mmin = -DBL_MAX,
1018 double mmax = DBL_MAX) {
1019 using FN = double(const ParticleBase&, const T&);
1020 return closestMatchIndex<CONTAINER, T, FN>(c, x, Kin::mass, mtarget, mmin, mmax);
1021 }
1022
1023
1028 template <typename CONTAINER, typename T, typename = isCIterable<CONTAINER>>
1029 inline int closestMassIndex(const T& x,
1030 const CONTAINER& c,
1031 double mtarget,
1032 double mmin = -DBL_MAX,
1033 double mmax = DBL_MAX) {
1034 return closestMatchIndex(x, c, Kin::mass, mtarget, mmin, mmax);
1035 }
1036
1038
1039
1042
1044 template <typename CONTAINER, typename = isCIterable<CONTAINER>>
1045 inline double sumPt(const CONTAINER& c) {
1046 return sum(c, Kin::pT, 0.0);
1047 }
1048
1050 template <typename CONTAINER, typename = isCIterable<CONTAINER>>
1051 inline double sumE(const CONTAINER& c) {
1052 return sum(c, Kin::E, 0.0);
1053 }
1054
1056 template <typename CONTAINER, typename = isCIterable<CONTAINER>>
1057 inline double sumEt(const CONTAINER& c) {
1058 return sum(c, Kin::Et, 0.0);
1059 }
1060
1062 template <typename CONTAINER, typename = isCIterable<CONTAINER>>
1063 inline double sumMass(const CONTAINER& c) {
1064 return sum(c, Kin::mass, 0.0);
1065 }
1066
1068 template <typename CONTAINER, typename = isCIterable<CONTAINER>>
1069 inline FourMomentum sumP4(const CONTAINER& c) {
1070 return sum(c, Kin::p4, FourMomentum());
1071 }
1072
1074 template <typename CONTAINER, typename = isCIterable<CONTAINER>>
1075 inline Vector3 sumP3(const CONTAINER& c) {
1076 return sum(c, Kin::p3, Vector3());
1077 }
1078
1080 template <typename CONTAINER, typename = isCIterable<CONTAINER>>
1081 inline Vector3 sumPtVec(const CONTAINER& c) {
1082 return sum(c, Kin::pTvec, Vector3());
1083 }
1084
1085
1091 template <typename CONTAINER, typename = isCIterable<CONTAINER>>
1092 inline double deltaPhiMin(const CONTAINER& c) {
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;
1099 }
1100 }
1101 return rtn;
1102 }
1103
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;
1118 }
1119 }
1120 return rtn;
1121 }
1122
1123
1129 template <typename CONTAINER, typename = isCIterable<CONTAINER>>
1130 inline double deltaEtaMin(const CONTAINER& c) {
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;
1137 }
1138 }
1139 return rtn;
1140 }
1141
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;
1156 }
1157 }
1158 return rtn;
1159 }
1160
1161
1167 template <typename CONTAINER, typename = isCIterable<CONTAINER>>
1168 inline double deltaRapMin(const CONTAINER& c) {
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;
1175 }
1176 }
1177 return rtn;
1178 }
1179
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;
1194 }
1195 }
1196 return rtn;
1197 }
1198
1199
1205 template <typename CONTAINER, typename = isCIterable<CONTAINER>>
1206 inline double deltaRMin(const CONTAINER& c) {
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;
1213 }
1214 }
1215 return rtn;
1216 }
1217
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;
1232 }
1233 }
1234 return rtn;
1235 }
1236
1237
1239 template <typename CONTAINER, typename PVEC, typename = isCIterable<CONTAINER>>
1240 inline double mTmin(const CONTAINER& psvis, const PVEC& pinvis) {
1241 return min(
1242 transform(psvis, [&](const typename CONTAINER::value_type& pvis) { return mT(pvis, pinvis); }));
1243 }
1244
1246
1247}
1248
1249#endif
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