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 walker 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 == NULL) 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::fromBottom() 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) && PID::hasBottom(pid))) return true; 00029 } 00030 return false; 00031 } 00032 00033 00034 bool Particle::fromCharm() 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::hasCharm(pid) && !PID::hasBottom(pid))) return true; 00041 } 00042 return false; 00043 } 00044 00045 00046 00047 bool Particle::fromHadron() const { 00048 /// @todo Shouldn't a const vertex be being returned? Ah, HepMC... 00049 GenVertex* prodVtx = genParticle()->production_vertex(); 00050 if (prodVtx == NULL) return false; 00051 foreach (const GenParticle* ancestor, particles(prodVtx, HepMC::ancestors)) { 00052 const PdgId pid = ancestor->pdg_id(); 00053 if (ancestor->status() == 2 && PID::isHadron(pid)) return true; 00054 } 00055 return false; 00056 } 00057 00058 00059 bool Particle::fromTau(bool prompt_taus_only) const { 00060 /// @todo Shouldn't a const vertex be being returned? Ah, HepMC... 00061 if (prompt_taus_only && fromHadron()) return false; 00062 GenVertex* prodVtx = genParticle()->production_vertex(); 00063 if (prodVtx == NULL) return false; 00064 foreach (const GenParticle* ancestor, particles(prodVtx, HepMC::ancestors)) { 00065 const PdgId pid = ancestor->pdg_id(); 00066 if (ancestor->status() == 2 && abs(pid) == PID::TAU) return true; 00067 } 00068 return false; 00069 } 00070 00071 00072 // bool Particle::fromDecay() const { 00073 // /// @todo Shouldn't a const vertex be being returned? Ah, HepMC... 00074 // GenVertex* prodVtx = genParticle()->production_vertex(); 00075 // if (prodVtx == NULL) return false; 00076 // foreach (const GenParticle* ancestor, particles(prodVtx, HepMC::ancestors)) { 00077 // const PdgId pid = ancestor->pdg_id(); 00078 // if (ancestor->status() == 2 && (PID::isHadron(pid) || abs(pid) == PID::TAU)) return true; 00079 // } 00080 // return false; 00081 // } 00082 00083 00084 } Generated on Tue Mar 24 2015 17:35:28 for The Rivet MC analysis system by ![]() |