Particle.cc
Go to the documentation of this file.
00001 #include "Rivet/Particle.hh" 00002 #include "Rivet/Tools/RivetBoost.hh" 00003 #include "Rivet/Tools/ParticleIdUtils.hh" 00004 00005 namespace Rivet { 00006 00007 00008 /// @todo Neaten this up with C++11, via one waliker function and several uses with lamba tests 00009 00010 00011 bool Particle::hasAncestor(PdgId pdg_id) const { 00012 /// @todo Shouldn't a const vertex be being returned? Ah, HepMC... 00013 GenVertex* prodVtx = genParticle()->production_vertex(); 00014 if (prodVtx == 0) return false; 00015 foreach (const GenParticle* ancestor, particles(prodVtx, HepMC::ancestors)) { 00016 if (ancestor->pdg_id() == pdg_id) return true; 00017 } 00018 return false; 00019 } 00020 00021 00022 bool Particle::fromDecay() const { 00023 /// @todo Shouldn't a const vertex be being returned? Ah, HepMC... 00024 GenVertex* prodVtx = genParticle()->production_vertex(); 00025 if (prodVtx == NULL) return false; 00026 foreach (const GenParticle* ancestor, particles(prodVtx, HepMC::ancestors)) { 00027 const PdgId pid = ancestor->pdg_id(); 00028 if (ancestor->status() == 2 && (PID::isHadron(pid) || abs(pid) == PID::TAU)) return true; 00029 } 00030 return false; 00031 } 00032 00033 00034 bool Particle::fromBottom() const { 00035 /// @todo Shouldn't a const vertex be being returned? Ah, HepMC... 00036 GenVertex* prodVtx = genParticle()->production_vertex(); 00037 if (prodVtx == NULL) return false; 00038 foreach (const GenParticle* ancestor, particles(prodVtx, HepMC::ancestors)) { 00039 const PdgId pid = ancestor->pdg_id(); 00040 if (ancestor->status() == 2 && (PID::isHadron(pid) && PID::hasBottom(pid))) return true; 00041 } 00042 return false; 00043 } 00044 00045 00046 bool Particle::fromCharm() const { 00047 /// @todo Shouldn't a const vertex be being returned? Ah, HepMC... 00048 GenVertex* prodVtx = genParticle()->production_vertex(); 00049 if (prodVtx == NULL) return false; 00050 foreach (const GenParticle* ancestor, particles(prodVtx, HepMC::ancestors)) { 00051 const PdgId pid = ancestor->pdg_id(); 00052 if (ancestor->status() == 2 && (PID::isHadron(pid) && PID::hasCharm(pid) && !PID::hasBottom(pid))) return true; 00053 } 00054 return false; 00055 } 00056 00057 00058 bool Particle::fromTau() const { 00059 /// @todo Shouldn't a const vertex be being returned? Ah, HepMC... 00060 GenVertex* prodVtx = genParticle()->production_vertex(); 00061 if (prodVtx == NULL) return false; 00062 foreach (const GenParticle* ancestor, particles(prodVtx, HepMC::ancestors)) { 00063 const PdgId pid = ancestor->pdg_id(); 00064 if (ancestor->status() == 2 && abs(pid) == PID::TAU) return true; 00065 } 00066 return false; 00067 } 00068 00069 00070 } Generated on Tue Sep 30 2014 19:45:46 for The Rivet MC analysis system by ![]() |