rivet is hosted by Hepforge, IPPP Durham
VisibleFinalState.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Projections/VisibleFinalState.hh"
00003 
00004 namespace Rivet {
00005 
00006 
00007   int VisibleFinalState::compare(const Projection& p) const {
00008     return mkNamedPCmp(p, "FS");
00009   }
00010 
00011 
00012   // Since we remove invisibles from the FinalState in project(),
00013   // we need a filter where invisible --> true
00014   bool isInvisibleFilter(const Particle& p) {
00015     // Charged particles are visible
00016     if ( PID::threeCharge( p.pdgId() ) != 0 )
00017       return false;
00018 
00019     // Neutral hadrons are visible
00020     if ( PID::isHadron( p.pdgId() ) )
00021       return false;
00022 
00023     // Photons are visible
00024     if ( p.pdgId() == PID::PHOTON )
00025       return false;
00026 
00027     // Gluons are visible (for parton level analyses)
00028     if ( p.pdgId() == PID::GLUON )
00029       return false;
00030 
00031     // Everything else is invisible
00032     return true;
00033   }
00034 
00035 
00036   void VisibleFinalState::project(const Event& e) {
00037     const FinalState& fs = applyProjection<FinalState>(e, "FS");
00038     _theParticles.clear();
00039     std::remove_copy_if(fs.particles().begin(), fs.particles().end(),
00040                         std::back_inserter(_theParticles), isInvisibleFilter);
00041     MSG_DEBUG("Number of visible final-state particles = "
00042               << _theParticles.size());
00043   }
00044 
00045 
00046 }