rivet is hosted by Hepforge, IPPP Durham
Rivet 4.0.0
Cuts.hh
1#ifndef RIVET_Cuts_HH
2#define RIVET_Cuts_HH
3
4#include "Rivet/Tools/Cuts.fhh"
5#include <string>
6
7namespace Rivet {
8
9
11 class CutBase {
12 public:
13
17 template <typename ClassToCheck>
18 bool accept(const ClassToCheck&) const;
19
22 template <typename ClassToCheck>
23 bool operator () (const ClassToCheck& x) const { return accept(x); }
24
26 virtual bool operator == (const Cut&) const = 0;
27
29 virtual std::string toString() const = 0;
30
32 virtual ~CutBase() {}
33
34
35 protected:
36
38 virtual bool _accept(const CuttableBase&) const = 0;
39
40 };
41
42
44 inline bool operator == (const Cut& a, const Cut& b) { return *a == b; }
45
48 Cut operator , (const Cut&, const Cut&) = delete;
49 Cut& operator , (Cut&, Cut&) = delete;
50 Cut operator , (Cut, Cut) = delete;
52
53
55 namespace Cuts {
56
58 enum Quantity { pT=0, pt=0, Et=1, et=1, E=2, energy=2,
59 mass, rap, absrap, eta, abseta, phi,
60 pid, abspid, charge, abscharge, charge3, abscharge3, pz };
61
63 const Cut& open(); //< access by factory function
64
65 extern const Cut& OPEN; //= open(); //< access by constant
66 extern const Cut& NOCUT; //= open(); //< access by constant
67
70 Cut range(Quantity, double m, double n);
71 inline Cut ptIn(double m, double n) { return range(pT, m,n); }
72 inline Cut etIn(double m, double n) { return range(Et, m,n); }
73 inline Cut energyIn(double m, double n) { return range(energy, m,n); }
74 inline Cut massIn(double m, double n) { return range(mass, m,n); }
75 inline Cut rapIn(double m, double n) { return range(rap, m,n); }
76 inline Cut absrapIn(double m, double n) { return range(absrap, m,n); }
77 inline Cut etaIn(double m, double n) { return range(eta, m,n); }
78 inline Cut absetaIn(double m, double n) { return range(abseta, m,n); }
80
81 }
82
83
86 Cut operator == (Cuts::Quantity, double);
87 Cut operator != (Cuts::Quantity, double);
88 Cut operator < (Cuts::Quantity, double);
89 Cut operator > (Cuts::Quantity, double);
90 Cut operator <= (Cuts::Quantity, double);
91 Cut operator >= (Cuts::Quantity, double);
92
95 inline Cut operator == (Cuts::Quantity qty, int i) { return qty == double(i); }
96 inline Cut operator != (Cuts::Quantity qty, int i) { return qty != double(i); }
97 // Cut operator == (Cuts::Quantity qty, int i);
98 // Cut operator != (Cuts::Quantity qty, int i);
99 inline Cut operator < (Cuts::Quantity qty, int i) { return qty < double(i); }
100 inline Cut operator > (Cuts::Quantity qty, int i) { return qty > double(i); }
101 inline Cut operator <= (Cuts::Quantity qty, int i) { return qty <= double(i); }
102 inline Cut operator >= (Cuts::Quantity qty, int i) { return qty >= double(i); }
104
106
107
110
113 Cut operator && (const Cut & aptr, const Cut & bptr);
116 Cut operator || (const Cut & aptr, const Cut & bptr);
118 Cut operator ! (const Cut & cptr);
119
121 Cut operator & (const Cut & aptr, const Cut & bptr);
123 Cut operator | (const Cut & aptr, const Cut & bptr);
125 Cut operator ~ (const Cut & cptr);
127 Cut operator ^ (const Cut & aptr, const Cut & bptr);
128
130
131
133 inline std::ostream& operator << (std::ostream& os, const Cut& cptr) {
134 os << cptr->toString();
135 return os;
136 }
137
138
139}
140
141#endif
const Cut & open()
Fully open cut singleton, accepts everything.
Quantity
Available categories of cut objects.
Definition Cuts.hh:58
Definition MC_CENT_PPB_Projections.hh:10
Cut operator|(const Cut &aptr, const Cut &bptr)
Logical OR operation on two cuts.
Cut operator!(const Cut &cptr)
Logical NOT operation on a cut.
bool operator==(const Cut &a, const Cut &b)
Compare two cuts for equality, forwards to the cut-specific implementation.
Definition Cuts.hh:44
Cut operator&&(const Cut &aptr, const Cut &bptr)
Cut operator^(const Cut &aptr, const Cut &bptr)
Logical XOR operation on two cuts.
std::ostream & operator<<(std::ostream &os, const AnalysisInfo &ai)
Stream an AnalysisInfo as a text description.
Definition AnalysisInfo.hh:362
Cut operator&(const Cut &aptr, const Cut &bptr)
Logical AND operation on two cuts.
Cut operator,(const Cut &, const Cut &)=delete
Cut operator~(const Cut &cptr)
Logical NOT operation on a cut.
std::string toString(const AnalysisInfo &ai)
String representation.
Cut operator||(const Cut &aptr, const Cut &bptr)