Jet.hh
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #ifndef RIVET_Jet_HH 00003 #define RIVET_Jet_HH 00004 00005 #include "Rivet/Config/RivetCommon.hh" 00006 #include "Rivet/Jet.fhh" 00007 #include "Rivet/Particle.hh" 00008 #include "Rivet/Tools/ParticleUtils.hh" 00009 #include "fastjet/PseudoJet.hh" 00010 #include <numeric> 00011 00012 namespace Rivet { 00013 00014 00015 /// @brief Representation of a clustered jet of particles. 00016 class Jet : public ParticleBase { 00017 public: 00018 00019 /// @name Constructors 00020 //@{ 00021 00022 /// Constructor from a FastJet PseudoJet, with optional full particle constituents information. 00023 Jet(const fastjet::PseudoJet& pj, const Particles& particles=Particles(), const Particles& tags=Particles()) { 00024 setState(pj, particles, tags); 00025 } 00026 00027 /// Set the jet data, with optional full particle information. 00028 Jet(const FourMomentum& pjet, const Particles& particles=Particles(), const Particles& tags=Particles()) { 00029 setState(pjet, particles, tags); 00030 } 00031 00032 /// Set all the jet data, with full particle information. 00033 /// @deprecated Prefer the form where the 4-vec comes first and the particles list is optional. 00034 DEPRECATED("Prefer the form where the 4-vec comes first and the particles list is optional.") 00035 Jet(const Particles& particles, const FourMomentum& pjet) { 00036 setState(pjet, particles); 00037 } 00038 00039 /// Default constructor -- only for STL storability 00040 Jet() { clear(); } 00041 00042 //@} 00043 00044 00045 /// @name Access jet constituents 00046 //@{ 00047 00048 /// Number of particles in this jet. 00049 size_t size() const { return _particles.size(); } 00050 00051 /// Get the particles in this jet. 00052 vector<Particle>& particles() { return _particles; } 00053 /// Get the particles in this jet (const version) 00054 const vector<Particle>& particles() const { return _particles; } 00055 00056 /// Get the particles in this jet (FastJet-like alias) 00057 vector<Particle>& constituents() { return particles(); } 00058 /// Get the particles in this jet (FastJet-like alias, const version) 00059 const vector<Particle>& constituents() const { return particles(); } 00060 00061 /// Check whether this jet contains a particular particle. 00062 bool containsParticle(const Particle& particle) const; 00063 /// Nicer alias for containsParticleId 00064 bool containsPID(const Particle& particle) const { return containsParticle(particle); } 00065 00066 /// Check whether this jet contains a certain particle type. 00067 bool containsParticleId(PdgId pid) const; 00068 /// Nicer alias for containsParticleId 00069 bool containsPID(PdgId pid) const { return containsParticleId(pid); } 00070 00071 /// Check whether this jet contains at least one of certain particle types. 00072 bool containsParticleId(const vector<PdgId>& pids) const; 00073 /// Nicer alias for containsParticleId 00074 bool containsPID(const vector<PdgId>& pids) const { return containsParticleId(pids); } 00075 00076 00077 /// @brief Particles which have been tag-matched to this jet 00078 /// 00079 /// General sources of tag particles are planned. The default jet finding 00080 /// adds b-hadron, c-hadron, and tau tags by ghost association. 00081 Particles& tags() { return _tags; } 00082 /// @brief Particles which have been tag-matched to this jet (const version) 00083 /// 00084 /// General sources of tag particles are planned. The default jet finding 00085 /// adds b-hadron, c-hadron, and tau tags by ghost association. 00086 const Particles& tags() const { return _tags; } 00087 00088 00089 /// @brief b particles which have been tag-matched to this jet 00090 /// 00091 /// The default jet finding adds b-hadron tags by ghost association. 00092 Particles bTags() const { 00093 Particles rtn; 00094 foreach (const Particle& tp, _tags) { 00095 if (hasBottom(tp)) rtn.push_back(tp); 00096 } 00097 return rtn; 00098 } 00099 /// Does this jet have at least one b-tag? 00100 bool bTagged() const { 00101 return !bTags().empty(); 00102 } 00103 00104 00105 /// @brief c particles which have been tag-matched to this jet by some external means 00106 /// 00107 /// The default jet finding adds c-hadron tags by ghost association. 00108 Particles cTags() const { 00109 Particles rtn; 00110 foreach (const Particle& tp, _tags) { 00111 if (hasCharm(tp)) rtn.push_back(tp); 00112 } 00113 return rtn; 00114 } 00115 /// Does this jet have at least one c-tag? 00116 bool cTagged() const { 00117 return !cTags().empty(); 00118 } 00119 00120 00121 /// @brief Tau particles which have been tag-matched to this jet by some external means 00122 /// 00123 /// The default jet finding adds tau tags by ghost association. 00124 Particles tauTags() const { 00125 Particles rtn; 00126 foreach (const Particle& tp, _tags) { 00127 if (isTau(tp)) rtn.push_back(tp); 00128 } 00129 return rtn; 00130 } 00131 /// Does this jet have at least one tau-tag? 00132 bool tauTagged() const { 00133 return !tauTags().empty(); 00134 } 00135 00136 00137 /// @brief Check whether this jet contains a bottom-flavoured hadron. 00138 /// 00139 /// @deprecated The bTags() or bTagged() function is probably what you want 00140 /// for tagging. This one ignores the tags() list and draws conclusions 00141 /// based directly on the jet constituents; the other gives a much better match 00142 /// to typical experimental methods. 00143 /// 00144 /// @note The decision is made by first trying to find a bottom-flavoured particle 00145 /// in the particles list. Most likely this will fail unless bottom hadrons 00146 /// are set stable. If @a include_decay_products is true (the default), a 00147 /// fallback is attempted, using the post-hadronization ancestor history of 00148 /// all constituents. 00149 //DEPRECATED("Prefer the bTags() or bTagged() function") 00150 bool containsBottom(bool include_decay_products=true) const; 00151 00152 /// @brief Check whether this jet contains a charm-flavoured hadron. 00153 /// 00154 /// @deprecated The cTags() or cTagged() function is probably what you want 00155 /// for tagging. This one ignores the tags() list and draws conclusions 00156 /// based directly on the jet constituents; the other gives a much better match 00157 /// to typical experimental methods. 00158 /// 00159 /// @note The decision is made by first trying to find a charm-flavoured particle 00160 /// in the particles list. Most likely this will fail unless charmed hadrons 00161 /// are set stable. If @a include_decay_products is true (the default), a 00162 /// fallback is attempted, using the post-hadronization ancestor history of 00163 /// all constituents. 00164 //DEPRECATED("Prefer the cTags() or cTagged() function") 00165 bool containsCharm(bool include_decay_products=true) const; 00166 00167 //@} 00168 00169 00170 /// @name Access additional effective jet 4-vector properties 00171 //@{ 00172 00173 /// Get equivalent single momentum four-vector. 00174 const FourMomentum& momentum() const { return _momentum; } 00175 00176 /// Get the total energy of this jet. 00177 double totalEnergy() const { return momentum().E(); } 00178 00179 /// Get the energy carried in this jet by neutral particles. 00180 double neutralEnergy() const; 00181 00182 /// Get the energy carried in this jet by hadrons. 00183 double hadronicEnergy() const; 00184 00185 //@} 00186 00187 00188 /// @name Interaction with FastJet 00189 //@{ 00190 00191 /// Access the internal FastJet3 PseudoJet (as a const reference) 00192 const fastjet::PseudoJet& pseudojet() const { return _pseudojet; } 00193 00194 /// Cast operator to FastJet3 PseudoJet (as a const reference) 00195 operator const fastjet::PseudoJet& () const { return pseudojet(); } 00196 00197 //@} 00198 00199 00200 /// @name Set the jet constituents and properties 00201 //@{ 00202 00203 /// @brief Set the jet data from a FastJet PseudoJet, with optional particle constituents and tags lists. 00204 /// 00205 /// @note The particles() list will be extracted from PseudoJet constituents 00206 /// by default, making use of an attached user info if one is found. 00207 Jet& setState(const fastjet::PseudoJet& pj, const Particles& particles=Particles(), const Particles& tags=Particles()); 00208 00209 /// Set all the jet data, with optional full particle constituent and tag information. 00210 Jet& setState(const FourMomentum& mom, const Particles& particles, const Particles& tags=Particles()); 00211 00212 /// @deprecated Prefer the 4-mom first-arg versions 00213 DEPRECATED("Prefer the 4-mom first-arg versions") 00214 Jet& setState(const Particles& particles, const FourMomentum& mom) { return setState(mom, particles); } 00215 00216 // /// Set the effective 4-momentum of the jet. 00217 // /// @todo Update for PseudoJet -- should momentum be separated from the cseq, etc.? 00218 // Jet& setMomentum(const FourMomentum& momentum); 00219 00220 /// @brief Set the particles collection with full particle information. 00221 /// 00222 /// If set, this overrides particle info extracted from the PseudoJet 00223 Jet& setParticles(const Particles& particles); 00224 Jet& setConstituents(const Particles& particles) { return setParticles(particles); } 00225 00226 /// Reset this jet as empty. 00227 Jet& clear(); 00228 00229 //@} 00230 00231 00232 private: 00233 00234 /// FJ3 PseudoJet member to unify PseudoJet and Jet 00235 fastjet::PseudoJet _pseudojet; 00236 00237 /// Full constituent particle information. (Filled from PseudoJet if possible.) 00238 /// @todo Make these mutable or similar? Add a flag to force a cache rebuild? 00239 Particles _particles; 00240 00241 /// Particles used to tag this jet (can be anything, but c and b hadrons are the most common) 00242 Particles _tags; 00243 00244 /// Effective jet 4-vector (just for caching) 00245 mutable FourMomentum _momentum; 00246 00247 }; 00248 00249 00250 } 00251 00252 #endif Generated on Tue Mar 24 2015 17:35:27 for The Rivet MC analysis system by ![]() |