Jet.cc
Go to the documentation of this file.
00001 #include "Rivet/Jet.hh" 00002 #include "Rivet/Tools/Logging.hh" 00003 #include "Rivet/Tools/ParticleIdUtils.hh" 00004 #include "Rivet/Tools/RivetBoost.hh" 00005 #include "Rivet/ParticleName.hh" 00006 00007 namespace Rivet { 00008 00009 00010 Jet& Jet::setState(const vector<Particle>& particles, const FourMomentum& pjet) { 00011 setParticles(particles); 00012 setMomentum(pjet); 00013 return *this; 00014 } 00015 00016 00017 Jet& Jet::setMomentum(const FourMomentum& momentum) { 00018 _momentum = momentum; 00019 return *this; 00020 } 00021 00022 00023 Jet& Jet::setParticles(const vector<Particle>& particles) { 00024 _particles = particles; 00025 return *this; 00026 } 00027 00028 00029 bool Jet::containsParticle(const Particle& particle) const { 00030 const int barcode = particle.genParticle()->barcode(); 00031 foreach (const Particle& p, particles()) { 00032 if (p.genParticle()->barcode() == barcode) return true; 00033 } 00034 return false; 00035 } 00036 00037 00038 bool Jet::containsParticleId(PdgId pid) const { 00039 foreach (const Particle& p, particles()) { 00040 if (p.pdgId() == pid) return true; 00041 } 00042 return false; 00043 } 00044 00045 00046 bool Jet::containsParticleId(const vector<PdgId>& pids) const { 00047 foreach (const Particle& p, particles()) { 00048 foreach (PdgId pid, pids) { 00049 if (p.pdgId() == pid) return true; 00050 } 00051 } 00052 return false; 00053 } 00054 00055 00056 /// @todo Jet::containsMatch(Matcher m) { ... if m(pid) return true; ... } 00057 00058 00059 double Jet::neutralEnergy() const { 00060 double e_neutral = 0.0; 00061 foreach (const Particle& p, particles()) { 00062 const PdgId pid = p.pdgId(); 00063 if (PID::threeCharge(pid) == 0) { 00064 e_neutral += p.E(); 00065 } 00066 } 00067 return e_neutral; 00068 } 00069 00070 00071 double Jet::hadronicEnergy() const { 00072 double e_hadr = 0.0; 00073 foreach (const Particle& p, particles()) { 00074 const PdgId pid = p.pdgId(); 00075 if (PID::isHadron(pid)) { 00076 e_hadr += p.E(); 00077 } 00078 } 00079 return e_hadr; 00080 } 00081 00082 00083 bool Jet::containsCharm() const { 00084 foreach (const Particle& p, particles()) { 00085 const PdgId pid = p.pdgId(); 00086 if (abs(pid) == PID::CQUARK) return true; 00087 if (PID::isHadron(pid) && PID::hasCharm(pid)) return true; 00088 HepMC::GenVertex* gv = p.genParticle()->production_vertex(); 00089 if (gv) { 00090 foreach (const GenParticle* pi, Rivet::particles(gv, HepMC::ancestors)) { 00091 const PdgId pid2 = pi->pdg_id(); 00092 if (PID::isHadron(pid2) && PID::hasCharm(pid2)) return true; 00093 } 00094 } 00095 } 00096 return false; 00097 } 00098 00099 00100 bool Jet::containsBottom() const { 00101 foreach (const Particle& p, particles()) { 00102 const PdgId pid = p.pdgId(); 00103 if (abs(pid) == PID::BQUARK) return true; 00104 if (PID::isHadron(pid) && PID::hasBottom(pid)) return true; 00105 HepMC::GenVertex* gv = p.genParticle()->production_vertex(); 00106 if (gv) { 00107 foreach (const GenParticle* pi, Rivet::particles(gv, HepMC::ancestors)) { 00108 const PdgId pid2 = pi->pdg_id(); 00109 if (PID::isHadron(pid2) && PID::hasBottom(pid2)) return true; 00110 } 00111 } 00112 } 00113 return false; 00114 } 00115 00116 00117 Jet& Jet::clear() { 00118 //_momenta.clear(); 00119 _particles.clear(); 00120 _momentum = FourMomentum(); 00121 return *this; 00122 } 00123 00124 00125 } Generated on Fri Oct 25 2013 12:41:45 for The Rivet MC analysis system by ![]() |