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