![]() |
|
|||
File indexing completed on 2025-09-18 09:31:14
0001 // -*- C++ -*- 0002 #ifndef RIVET_JetFinder_HH 0003 #define RIVET_JetFinder_HH 0004 0005 #include "Rivet/Projection.hh" 0006 #include "Rivet/Projections/FinalState.hh" 0007 #include "Rivet/Projections/VisibleFinalState.hh" 0008 #include "Rivet/Particle.hh" 0009 #include "Rivet/Jet.hh" 0010 0011 namespace Rivet { 0012 0013 0014 /// Enum for the treatment of muons: whether to include all, some, or none in jet-finding 0015 enum class JetMuons { NONE, DECAY, ALL }; 0016 0017 /// Enum for the treatment of invisible particles: whether to include all, some, or none in jet-finding 0018 enum class JetInvisibles { NONE, DECAY, ALL }; 0019 0020 0021 /// Convenience container of params for simple jet definitions 0022 struct JetScheme { 0023 JetScheme(JetAlg a, double rparam, 0024 JetMuons usemuons=JetMuons::ALL, 0025 JetInvisibles useinvis=JetInvisibles::NONE) 0026 : alg(a), R(rparam), muons(usemuons), invis(useinvis) 0027 { } 0028 0029 /// Default constructor just for STL storage 0030 JetScheme() : JetScheme(JetAlg::ANTIKT, 0.4) { } 0031 0032 /// Params 0033 JetAlg alg; 0034 double R; 0035 JetMuons muons = JetMuons::ALL; 0036 JetInvisibles invis = JetInvisibles::NONE; 0037 }; 0038 0039 0040 /// Abstract base class for projections which can return a set of {@link Jet}s. 0041 class JetFinder : public Projection { 0042 public: 0043 0044 /// Constructor 0045 JetFinder(const FinalState& fs, 0046 JetMuons usemuons = JetMuons::ALL, 0047 JetInvisibles useinvis = JetInvisibles::NONE); 0048 0049 /// Default constructor 0050 JetFinder() = default; 0051 0052 /// Clone on the heap. 0053 virtual unique_ptr<Projection> clone() const = 0; 0054 0055 /// Destructor 0056 virtual ~JetFinder() = default; 0057 0058 /// Import to avoid warnings about overload-hiding 0059 using Projection::operator =; 0060 0061 0062 /// @name Control the treatment of muons and invisible particles 0063 /// 0064 /// Since MC-based jet calibration (and/or particle flow) can add back in 0065 /// particles that weren't seen in calorimeters/trackers. 0066 /// @{ 0067 0068 /// @brief Include (some) muons in jet construction. 0069 /// 0070 /// The default behaviour is that jets are only constructed from visible 0071 /// particles. Some jet studies, including those from ATLAS, use a definition 0072 /// in which neutrinos from hadron decays are included via MC-based calibrations. 0073 /// Setting this flag to true avoids the automatic restriction to a VisibleFinalState. 0074 void useMuons(JetMuons usemuons = JetMuons::ALL) { 0075 _useMuons = usemuons; 0076 } 0077 0078 /// @brief Include (some) invisible particles in jet construction. 0079 /// 0080 /// The default behaviour is that jets are only constructed from visible 0081 /// particles. Some jet studies, including those from ATLAS, use a definition 0082 /// in which neutrinos from hadron decays are included via MC-based calibrations. 0083 /// Setting this flag to true avoids the automatic restriction to a VisibleFinalState. 0084 void useInvisibles(JetInvisibles useinvis = JetInvisibles::DECAY) { 0085 _useInvisibles = useinvis; 0086 } 0087 0088 /// @} 0089 0090 0091 /// @name Access to jet objects 0092 /// @{ 0093 0094 /// Get jets in no guaranteed order, with an optional Cut 0095 /// @note Returns a copy rather than a reference, due to cuts 0096 virtual Jets jets(const Cut& c=Cuts::open()) const { 0097 return select(_jets(), c); 0098 } 0099 0100 /// Get jets in no guaranteed order, with a selection functor 0101 /// @note Returns a copy rather than a reference, due to cuts 0102 virtual Jets jets(const JetSelector& selector) const { 0103 return select(_jets(), selector); 0104 } 0105 0106 0107 /// Get the jets with a Cut applied, and ordered by supplied sorting functor 0108 /// @note Returns a copy rather than a reference, due to cuts and sorting 0109 Jets jets(const Cut& c, const JetSorter& sorter) const { 0110 /// @todo Will the vector be efficiently std::move'd by value through this function chain? 0111 return sortBy(jets(c), sorter); 0112 } 0113 0114 /// Get the jets, ordered by supplied sorting functor, with an optional Cut 0115 /// @note Returns a copy rather than a reference, due to cuts and sorting 0116 Jets jets(const JetSorter& sorter, const Cut& c=Cuts::open()) const { 0117 /// @todo Will the vector be efficiently std::move'd by value through this function chain? 0118 return jets(c, sorter); 0119 } 0120 0121 /// Get the jets, ordered by supplied sorting function object, with optional cuts on \f$ p_\perp \f$ and rapidity. 0122 /// @note Returns a copy rather than a reference, due to cuts and sorting 0123 Jets jets(const JetSelector& selector, const JetSorter& sorter) const { 0124 /// @todo Will the vector be efficiently std::move'd by value through this function chain? 0125 return sortBy(jets(selector), sorter); 0126 } 0127 0128 /// Get the jets, ordered by supplied sorting functor and with a selection functor applied 0129 /// @note Returns a copy rather than a reference, due to cuts and sorting 0130 Jets jets(const JetSorter& sorter, const JetSelector selector) const { 0131 return jets(selector, sorter); 0132 } 0133 0134 0135 /// Get the jets, ordered by \f$ p_T \f$, with optional cuts. 0136 /// 0137 /// @note Returns a copy rather than a reference, due to cuts and sorting 0138 /// 0139 /// This is a very common use-case, so is available as syntatic sugar for jets(c, cmpMomByPt). 0140 Jets jetsByPt(const Cut& c=Cuts::open()) const { 0141 return jets(c, cmpMomByPt); 0142 } 0143 0144 /// Get the jets, ordered by \f$ p_T \f$, with cuts via a selection functor. 0145 /// 0146 /// @note Returns a copy rather than a reference, due to cuts and sorting 0147 /// 0148 /// This is a very common use-case, so is available as syntatic sugar for jets(c, cmpMomByPt). 0149 Jets jetsByPt(const JetSelector& selector) const { 0150 return jets(selector, cmpMomByPt); 0151 } 0152 0153 /// @} 0154 0155 0156 protected: 0157 0158 /// @brief Internal pure virtual method for getting jets in no guaranteed order. 0159 virtual Jets _jets() const = 0; 0160 0161 0162 public: 0163 0164 /// Count the jets 0165 size_t size() const { return jets().size(); } 0166 /// Count the jets after a Cut is applied. 0167 size_t size(const Cut& c) const { return jets(c).size(); } 0168 /// Count the jets after a selection functor is applied. 0169 size_t size(const JetSelector& s) const { return jets(s).size(); } 0170 0171 /// Is this jet finder empty? 0172 bool empty() const { return size() == 0; } 0173 /// Is this jet finder empty after a Cut is applied? 0174 bool empty(const Cut& c) const { return size(c) == 0; } 0175 /// Is this jet finder empty after a selection functor is applied? 0176 bool empty(const JetSelector& s) const { return size(s) == 0; } 0177 0178 /// Clear the projection. 0179 virtual void reset() = 0; 0180 0181 typedef Jet entity_type; 0182 typedef Jets collection_type; 0183 0184 /// Template-usable interface common to FinalState. 0185 collection_type entities() const { return jets(); } 0186 0187 // /// Do the calculation locally (no caching). 0188 // virtual void calc(const Particles& constituents, const Particles& tagparticles=Particles()) = 0; 0189 0190 0191 protected: 0192 0193 /// Perform the projection on the Event. 0194 virtual void project(const Event& e) = 0; 0195 0196 /// Compare projections. 0197 virtual CmpState compare(const Projection& p) const = 0; 0198 0199 0200 protected: 0201 0202 /// Flag to determine whether or not to exclude (some) muons from the would-be constituents. 0203 JetMuons _useMuons; 0204 0205 /// Flag to determine whether or not to exclude (some) invisible particles from the would-be constituents. 0206 JetInvisibles _useInvisibles; 0207 0208 0209 }; 0210 0211 0212 } 0213 0214 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |