ChargedFinalState.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Rivet.hh"
00003 #include "Rivet/Projections/ChargedFinalState.hh"
00004 #include "Rivet/Cmp.hh"
00005 #include "HepPDT/ParticleID.hh"
00006 
00007 namespace Rivet {
00008 
00009   int ChargedFinalState::compare(const Projection& p) const {
00010     const ChargedFinalState& other = dynamic_cast<const ChargedFinalState&>(p);
00011     return pcmp(_fsproj, other._fsproj);
00012   }
00013   
00014   
00015   void ChargedFinalState::project(const Event& e) {
00016     Log log = getLog();
00017     const FinalState& fs = e.applyProjection(_fsproj);
00018     _theParticles.clear();
00019     const ParticleVector& fsps = fs.particles();
00020     _theParticles.reserve(fsps.size());
00021     for (ParticleVector::const_iterator p = fsps.begin(); p != fsps.end(); ++p) {
00022       HepPDT::ParticleID pInfo = p->getPdgId();
00023       bool isHadron = pInfo.isHadron();
00024       if (pInfo.threeCharge() != 0) {
00025         _theParticles.push_back(*p);
00026       }
00027     }
00028     getLog() << Log::DEBUG << "Number of charged final-state particles = " 
00029              << _theParticles.size() << endl;
00030   } 
00031   
00032 }