rivet is hosted by Hepforge, IPPP Durham
FinalPartons.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 #include "Rivet/Projections/FinalPartons.hh"
00004 #include "Rivet/Tools/RivetHepMC.hh"
00005 
00006 namespace Rivet {
00007 
00008 
00009     bool FinalPartons::accept(const Particle& p) const {
00010 
00011         // reject if *not* a parton
00012         if (!isParton(p))
00013             return false;
00014 
00015         // accept partons if they end on a standard hadronization vertex
00016         if (p.genParticle()->end_vertex() != NULL &&
00017                 p.genParticle()->end_vertex()->id() == 5)
00018           return true;
00019 
00020         // reject if p has a parton child.
00021         foreach (const Particle& c, p.children()) {
00022             if (isParton(c))
00023                 return false;
00024         }
00025 
00026         // reject if from a hadron or tau decay.
00027         if (p.fromDecay())
00028             return false;
00029 
00030         return _cuts->accept(p);
00031     }
00032 
00033 
00034     void FinalPartons::project(const Event& e) {
00035         _theParticles.clear();
00036 
00037         foreach (const GenParticle* gp, Rivet::particles(e.genEvent())) {
00038             if (!gp) continue;
00039 
00040             const Particle p(gp);
00041             if (accept(p)) _theParticles.push_back(p);
00042         }
00043     }
00044 
00045 
00046 }