JetAlg.hh
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #ifndef RIVET_JetAlg_HH 00003 #define RIVET_JetAlg_HH 00004 00005 #include "Rivet/Projection.hh" 00006 #include "Rivet/Projections/FinalState.hh" 00007 #include "Rivet/Projections/VisibleFinalState.hh" 00008 #include "Rivet/Particle.hh" 00009 #include "Rivet/Jet.hh" 00010 00011 namespace Rivet { 00012 00013 00014 /// Abstract base class for projections which can return a set of {@link Jet}s. 00015 class JetAlg : public Projection { 00016 public: 00017 00018 /// Constructor 00019 JetAlg(const FinalState& fs); 00020 00021 JetAlg() {}; 00022 00023 /// Clone on the heap. 00024 virtual const Projection* clone() const = 0; 00025 00026 /// Destructor 00027 virtual ~JetAlg() { } 00028 00029 /// @brief Include invisible particles in jet construction. 00030 /// The default behaviour is that jets are only constructed from visible 00031 /// (i.e. charged under an SM gauge group) particles. Some jet studies, 00032 /// including those from ATLAS, use a definition in which neutrinos from hadron 00033 /// decays are included (via MC correction) in the experimental jet definition. 00034 /// Setting this flag to true avoids the automatic restriction to a VisibleFinalState. 00035 void useInvisibles(bool useinvis=true) { 00036 _useInvisibles = useinvis; 00037 } 00038 00039 00040 /// Get jets in no guaranteed order, with optional cuts on \f$ p_\perp \f$ and rapidity. 00041 /// @note Returns a copy rather than a reference, due to cuts 00042 /// @todo Can't this be a const Cut& arg? 00043 virtual Jets jets(const Cut & c = Cuts::open()) const { 00044 const Jets rawjets = _jets(0.0); // arg means no pT cut 00045 // Just return a copy of rawjets if the cut is open 00046 if (c == Cuts::open()) return rawjets; 00047 // If there is a non-trivial cut... 00048 Jets rtn; 00049 rtn.reserve(size()); 00050 foreach (const Jet& j, rawjets) 00051 if (c->accept(j)) rtn.push_back(j); 00052 return rtn; 00053 } 00054 00055 /// Get the jets, ordered by supplied sorting function object, with optional cuts on \f$ p_\perp \f$ and rapidity. 00056 /// @note Returns a copy rather than a reference, due to cuts and sorting 00057 template <typename F> 00058 Jets jets(F sorter, const Cut & c = Cuts::open()) const { 00059 /// @todo Will the vector be efficiently std::move'd by value through this function chain? 00060 return sortBy(jets(c), sorter); 00061 } 00062 00063 /// Get the jets, ordered by supplied sorting function object, with optional cuts on \f$ p_\perp \f$ and rapidity. 00064 /// @note Returns a copy rather than a reference, due to cuts and sorting 00065 template <typename F> 00066 Jets jets(const Cut & c , F sorter) const { 00067 /// @todo Will the vector be efficiently std::move'd by value through this function chain? 00068 return sortBy(jets(c), sorter); 00069 } 00070 00071 00072 /// Get the jets, ordered by \f$ p_T \f$, with optional cuts. 00073 /// 00074 /// @note Returns a copy rather than a reference, due to cuts and sorting 00075 /// 00076 /// This is a very common use-case, so is available as syntatic sugar for jets(c, cmpMomByPt). 00077 /// @todo The other sorted accessors should be removed in a cleanup. 00078 Jets jetsByPt(const Cut & c = Cuts::open()) const { 00079 return jets(c, cmpMomByPt); 00080 } 00081 00082 00083 /// @name Old sorted jet accessors 00084 /// @deprecated Use the versions with sorter function arguments 00085 //@{ 00086 00087 /// Get the jets, ordered by \f$ |p| \f$, with optional cuts on \f$ p_\perp \f$ and rapidity. 00088 /// @note Returns a copy rather than a reference, due to cuts and sorting 00089 /// @deprecated Use the version with a sorter function argument. 00090 DEPRECATED("Use the version with a sorter function argument.") 00091 Jets jetsByP(const Cut & c = Cuts::open()) const { 00092 return jets(c, cmpMomByP); 00093 } 00094 00095 /// Get the jets, ordered by \f$ E \f$, with optional cuts on \f$ p_\perp \f$ and rapidity. 00096 /// @note Returns a copy rather than a reference, due to cuts and sorting 00097 /// @deprecated Use the version with a sorter function argument. 00098 DEPRECATED("Use the version with a sorter function argument.") 00099 Jets jetsByE(const Cut & c = Cuts::open()) const { 00100 return jets(c, cmpMomByE); 00101 } 00102 00103 /// Get the jets, ordered by \f$ E_T \f$, with optional cuts on \f$ p_\perp \f$ and rapidity. 00104 /// @note Returns a copy rather than a reference, due to cuts and sorting 00105 /// @deprecated Use the version with a sorter function argument. 00106 DEPRECATED("Use the version with a sorter function argument.") 00107 Jets jetsByEt(const Cut & c = Cuts::open()) const { 00108 return jets(c, cmpMomByEt); 00109 } 00110 00111 //@} 00112 00113 00114 /// @name Old jet accessors 00115 /// @deprecated Use the versions with Cut arguments 00116 //@{ 00117 00118 /// Get jets in no guaranteed order, with optional cuts on \f$ p_\perp \f$ and rapidity. 00119 /// 00120 /// @deprecated Use the version with a Cut argument 00121 /// @note Returns a copy rather than a reference, due to cuts 00122 DEPRECATED("Use the version with a Cut argument.") 00123 Jets jets(double ptmin, double ptmax=MAXDOUBLE, 00124 double rapmin=-MAXDOUBLE, double rapmax=MAXDOUBLE, 00125 RapScheme rapscheme=PSEUDORAPIDITY) const { 00126 if (rapscheme == PSEUDORAPIDITY) { 00127 return jets((Cuts::pT >= ptmin) & (Cuts::pT < ptmax) & (Cuts::rapIn(rapmin, rapmax))); 00128 } else if (rapscheme == RAPIDITY) { 00129 return jets((Cuts::pT >= ptmin) & (Cuts::pT < ptmax) & (Cuts::etaIn(rapmin, rapmax))); 00130 } 00131 throw LogicError("Unknown rapidity scheme. This shouldn't be possible!"); 00132 } 00133 00134 /// Get the jets, ordered by \f$ p_T \f$, with a cut on \f$ p_\perp \f$. 00135 /// 00136 /// @deprecated Use the version with a Cut argument 00137 /// @note Returns a copy rather than a reference, due to cuts and sorting 00138 /// 00139 /// This is a very common use-case, so is available as syntatic sugar for jets(Cuts::pT >= ptmin, cmpMomByPt). 00140 /// @todo The other sorted accessors should be removed in a cleanup. 00141 Jets jetsByPt(double ptmin) const { 00142 return jets(Cuts::pT >= ptmin, cmpMomByPt); 00143 } 00144 00145 //@} 00146 00147 00148 protected: 00149 00150 /// @brief Internal pure virtual method for getting jets in no guaranteed order. 00151 /// An optional cut on min \f$ p_\perp \f$ is applied in this function, since that is 00152 /// directly supported by FastJet and it seems a shame to not make use of that. But 00153 /// all other jet cuts are applied at the @c ::jets() function level. 00154 /// @todo Remove the ptmin cut 00155 virtual Jets _jets(double ptmin=0) const = 0; 00156 00157 00158 public: 00159 00160 /// Number of jets. 00161 virtual size_t size() const = 0; 00162 /// Determine if the jet collection is empty. 00163 bool empty() const { return size() != 0; } 00164 00165 /// Clear the projection. 00166 virtual void reset() = 0; 00167 00168 typedef Jet entity_type; 00169 typedef Jets collection_type; 00170 00171 /// Template-usable interface common to FinalState. 00172 collection_type entities() const { return jets(); } 00173 00174 /// Do the calculation locally (no caching). 00175 virtual void calc(const Particles& constituents, const Particles& tagparticles=Particles()) = 0; 00176 00177 00178 protected: 00179 00180 /// Perform the projection on the Event. 00181 virtual void project(const Event& e) = 0; 00182 00183 /// Compare projections. 00184 virtual int compare(const Projection& p) const = 0; 00185 00186 00187 protected: 00188 00189 /// Flag to determine whether or not the VFS wrapper is to be used. 00190 bool _useInvisibles; 00191 00192 }; 00193 00194 00195 } 00196 00197 #endif Generated on Tue Mar 24 2015 17:35:27 for The Rivet MC analysis system by ![]() |