Rivet API documentation

Rivet 4.1.3
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 {
24 return accept(x);
25 }
26
28 virtual bool operator==(const Cut&) const = 0;
29
31 virtual std::string toString() const = 0;
32
34 virtual ~CutBase() { }
35
36
37 protected:
38
40 virtual bool _accept(const CuttableBase&) const = 0;
41 };
42
43
45 inline bool operator==(const Cut& a, const Cut& b) {
46 return *a == b;
47 }
48
51 Cut operator,(const Cut&, const Cut&) = delete;
52 Cut& operator,(Cut&, Cut&) = delete;
53 Cut operator,(Cut, Cut) = delete;
55
56
58 namespace Cuts {
59
61 enum Quantity {
62 pT = 0,
63 pt = 0,
64 Et = 1,
65 et = 1,
66 E = 2,
67 energy = 2,
68 mass,
69 rap,
70 absrap,
71 eta,
72 abseta,
73 phi,
74 pid,
75 abspid,
76 charge,
77 abscharge,
78 charge3,
79 abscharge3,
80 pz
81 };
82
84 const Cut& open(); //< access by factory function
85
86 extern const Cut& OPEN; //= open(); //< access by constant
87 extern const Cut& NOCUT; //= open(); //< access by constant
88
91 Cut range(Quantity, double m, double n);
92 inline Cut ptIn(double m, double n) {
93 return range(pT, m, n);
94 }
95 inline Cut etIn(double m, double n) {
96 return range(Et, m, n);
97 }
98 inline Cut energyIn(double m, double n) {
99 return range(energy, m, n);
100 }
101 inline Cut massIn(double m, double n) {
102 return range(mass, m, n);
103 }
104 inline Cut rapIn(double m, double n) {
105 return range(rap, m, n);
106 }
107 inline Cut absrapIn(double m, double n) {
108 return range(absrap, m, n);
109 }
110 inline Cut etaIn(double m, double n) {
111 return range(eta, m, n);
112 }
113 inline Cut absetaIn(double m, double n) {
114 return range(abseta, m, n);
115 }
117
118 }
119
120
123 Cut operator==(Cuts::Quantity, double);
124 Cut operator!=(Cuts::Quantity, double);
125 Cut operator<(Cuts::Quantity, double);
126 Cut operator>(Cuts::Quantity, double);
127 Cut operator<=(Cuts::Quantity, double);
128 Cut operator>=(Cuts::Quantity, double);
129
132 inline Cut operator==(Cuts::Quantity qty, int i) {
133 return qty == double(i);
134 }
135 inline Cut operator!=(Cuts::Quantity qty, int i) {
136 return qty != double(i);
137 }
138 // Cut operator == (Cuts::Quantity qty, int i);
139 // Cut operator != (Cuts::Quantity qty, int i);
140 inline Cut operator<(Cuts::Quantity qty, int i) {
141 return qty < double(i);
142 }
143 inline Cut operator>(Cuts::Quantity qty, int i) {
144 return qty > double(i);
145 }
146 inline Cut operator<=(Cuts::Quantity qty, int i) {
147 return qty <= double(i);
148 }
149 inline Cut operator>=(Cuts::Quantity qty, int i) {
150 return qty >= double(i);
151 }
153
155
156
159
162 Cut operator&&(const Cut& aptr, const Cut& bptr);
165 Cut operator||(const Cut& aptr, const Cut& bptr);
167 Cut operator!(const Cut& cptr);
168
170 Cut operator&(const Cut& aptr, const Cut& bptr);
172 Cut operator|(const Cut& aptr, const Cut& bptr);
174 Cut operator~(const Cut& cptr);
176 Cut operator^(const Cut& aptr, const Cut& bptr);
177
179
180
182 inline std::ostream& operator<<(std::ostream& os, const Cut& cptr) {
183 os << cptr->toString();
184 return os;
185 }
186
187
188}
189
190#endif
double Et(const ParticleBase &p)
Unbound function access to ET.
Definition ParticleBaseUtils.hh:834
Namespace used for ambiguous identifiers.
Definition Cuts.hh:58
const Cut & open()
Fully open cut singleton, accepts everything.
Quantity
Available categories of cut objects.
Definition Cuts.hh:61
Definition LHCbCommon.hh:9
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:45
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:463
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.
Cut operator||(const Cut &aptr, const Cut &bptr)