Cuts.hh
Go to the documentation of this file.
00001 #ifndef RIVET_Cuts_HH 00002 #define RIVET_Cuts_HH 00003 #include <boost/smart_ptr.hpp> 00004 00005 namespace Rivet { 00006 00007 /// @internal Forward declaration of helper class. Not for end users. 00008 class CuttableBase; 00009 00010 /// @internal Base class for cut objects. 00011 /// @note End users should always use the @ref Cut typedef instead. 00012 class CutBase; 00013 /// Main cut object 00014 typedef boost::shared_ptr<CutBase> Cut; 00015 00016 class CutBase { 00017 public: 00018 /// Main work method. 00019 /// @internal Forwards the received object to @ref accept_, 00020 /// wrapped in the Cuttable converter 00021 template <typename ClassToCheck> bool accept(const ClassToCheck &) const; 00022 /// Comparison to another Cut 00023 virtual bool operator==(const Cut & c) const = 0; 00024 /// Default destructor 00025 virtual ~CutBase() {} 00026 protected: 00027 /// @internal Actual accept implementation, overloadable by various cut combiners 00028 virtual bool accept_(const CuttableBase &) const = 0; 00029 }; 00030 00031 /// Main cut object 00032 typedef boost::shared_ptr<CutBase> Cut; 00033 00034 // compare two cuts for equality, forwards to the cut-specific implementation 00035 inline bool operator==(const Cut & a, const Cut & b) { return *a == b; } 00036 00037 /// Namespace used for ambiguous identifiers. 00038 namespace Cuts { 00039 /// Available categories of cut objects 00040 enum Quantity { pT, mass, rap, eta, phi }; 00041 /// Fully open cut singleton, accepts everything 00042 const Cut & open(); 00043 } 00044 00045 /// @name Cut constructors 00046 //@{ 00047 Cut operator < (Cuts::Quantity, double); 00048 Cut operator > (Cuts::Quantity, double); 00049 Cut operator <= (Cuts::Quantity, double); 00050 Cut operator >= (Cuts::Quantity, double); 00051 00052 /// @name Shortcuts for common cuts 00053 //@{ 00054 Cut Range(Cuts::Quantity, double m, double n); 00055 inline Cut EtaIn(double m, double n) { return Range(Cuts::eta,m,n); } 00056 /// @todo Can do more here: AbsEtaLess, PtGtr 00057 //@} 00058 00059 /// @internal Overload helpers for integer arguments 00060 //@{ 00061 inline Cut operator < (Cuts::Quantity qty, int i) { return qty < double(i); } 00062 inline Cut operator > (Cuts::Quantity qty, int i) { return qty > double(i); } 00063 inline Cut operator <= (Cuts::Quantity qty, int i) { return qty <= double(i); } 00064 inline Cut operator >= (Cuts::Quantity qty, int i) { return qty >= double(i); } 00065 //@} 00066 00067 //@} 00068 00069 /// @name Cut combiners 00070 //@{ 00071 /// Logical AND operation on two cuts 00072 Cut operator & (const Cut aptr, const Cut bptr); 00073 /// Logical OR operation on two cuts 00074 Cut operator | (const Cut aptr, const Cut bptr); 00075 /// Logical NOT operation on a cut 00076 Cut operator ~ (const Cut cptr); 00077 /// Logical XOR operation on two cuts 00078 Cut operator ^ (const Cut aptr, const Cut bptr); 00079 //@} 00080 } 00081 00082 #endif 00083 Generated on Thu Feb 6 2014 17:38:44 for The Rivet MC analysis system by 1.7.6.1 |