File indexing completed on 2025-04-19 09:06:51
0001 #ifndef RIVET_Cuts_HH
0002 #define RIVET_Cuts_HH
0003
0004 #include "Rivet/Tools/Cuts.fhh"
0005 #include <string>
0006
0007 namespace Rivet {
0008
0009
0010
0011 class CutBase {
0012 public:
0013
0014
0015
0016
0017 template <typename ClassToCheck>
0018 bool accept(const ClassToCheck&) const;
0019
0020
0021
0022 template <typename ClassToCheck>
0023 bool operator () (const ClassToCheck& x) const { return accept(x); }
0024
0025
0026 virtual bool operator == (const Cut&) const = 0;
0027
0028
0029 virtual std::string toString() const = 0;
0030
0031
0032 virtual ~CutBase() {}
0033
0034
0035 protected:
0036
0037
0038 virtual bool _accept(const CuttableBase&) const = 0;
0039
0040 };
0041
0042
0043
0044 inline bool operator == (const Cut& a, const Cut& b) { return *a == b; }
0045
0046
0047
0048 Cut operator , (const Cut&, const Cut&) = delete;
0049 Cut& operator , (Cut&, Cut&) = delete;
0050 Cut operator , (Cut, Cut) = delete;
0051
0052
0053
0054
0055 namespace Cuts {
0056
0057
0058 enum Quantity { pT=0, pt=0, Et=1, et=1, E=2, energy=2,
0059 mass, rap, absrap, eta, abseta, phi,
0060 pid, abspid, charge, abscharge, charge3, abscharge3, pz };
0061
0062
0063 const Cut& open();
0064
0065 extern const Cut& OPEN;
0066 extern const Cut& NOCUT;
0067
0068
0069
0070 Cut range(Quantity, double m, double n);
0071 inline Cut ptIn(double m, double n) { return range(pT, m,n); }
0072 inline Cut etIn(double m, double n) { return range(Et, m,n); }
0073 inline Cut energyIn(double m, double n) { return range(energy, m,n); }
0074 inline Cut massIn(double m, double n) { return range(mass, m,n); }
0075 inline Cut rapIn(double m, double n) { return range(rap, m,n); }
0076 inline Cut absrapIn(double m, double n) { return range(absrap, m,n); }
0077 inline Cut etaIn(double m, double n) { return range(eta, m,n); }
0078 inline Cut absetaIn(double m, double n) { return range(abseta, m,n); }
0079
0080
0081 }
0082
0083
0084
0085
0086 Cut operator == (Cuts::Quantity, double);
0087 Cut operator != (Cuts::Quantity, double);
0088 Cut operator < (Cuts::Quantity, double);
0089 Cut operator > (Cuts::Quantity, double);
0090 Cut operator <= (Cuts::Quantity, double);
0091 Cut operator >= (Cuts::Quantity, double);
0092
0093
0094
0095 inline Cut operator == (Cuts::Quantity qty, int i) { return qty == double(i); }
0096 inline Cut operator != (Cuts::Quantity qty, int i) { return qty != double(i); }
0097
0098
0099 inline Cut operator < (Cuts::Quantity qty, int i) { return qty < double(i); }
0100 inline Cut operator > (Cuts::Quantity qty, int i) { return qty > double(i); }
0101 inline Cut operator <= (Cuts::Quantity qty, int i) { return qty <= double(i); }
0102 inline Cut operator >= (Cuts::Quantity qty, int i) { return qty >= double(i); }
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113 Cut operator && (const Cut & aptr, const Cut & bptr);
0114
0115
0116 Cut operator || (const Cut & aptr, const Cut & bptr);
0117
0118 Cut operator ! (const Cut & cptr);
0119
0120
0121 Cut operator & (const Cut & aptr, const Cut & bptr);
0122
0123 Cut operator | (const Cut & aptr, const Cut & bptr);
0124
0125 Cut operator ~ (const Cut & cptr);
0126
0127 Cut operator ^ (const Cut & aptr, const Cut & bptr);
0128
0129
0130
0131
0132
0133 inline std::ostream& operator << (std::ostream& os, const Cut& cptr) {
0134 os << cptr->toString();
0135 return os;
0136 }
0137
0138
0139 }
0140
0141 #endif