rivet is hosted by Hepforge, IPPP Durham
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   bool Particle::hasAncestor(PdgId pdg_id) const {
00009     /// @todo Shouldn't a const vertex be being returned? Ah, HepMC...
00010     GenVertex* prodVtx = genParticle()->production_vertex();
00011     if (prodVtx == 0) return false;
00012     foreach (const GenParticle* ancestor, particles(prodVtx, HepMC::ancestors)) {
00013       if (ancestor->pdg_id() == pdg_id) return true;
00014     }
00015     return false;
00016   }
00017 
00018 
00019   bool Particle::fromDecay() const {
00020     /// @todo Shouldn't a const vertex be being returned? Ah, HepMC...
00021     GenVertex* prodVtx = genParticle()->production_vertex();
00022     if (prodVtx == NULL) return false;
00023     foreach (const GenParticle* ancestor, particles(prodVtx, HepMC::ancestors)) {
00024       const PdgId pid = ancestor->pdg_id();
00025       if (ancestor->status() == 2 && (PID::isHadron(pid) || abs(pid) == PID::TAU)) return true;
00026     }
00027     return false;
00028   }
00029 
00030 
00031 }