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