rivet is hosted by Hepforge, IPPP Durham
ChargedFinalState.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Projections/ChargedFinalState.hh"
00003 
00004 namespace Rivet {
00005 
00006 
00007   ChargedFinalState::ChargedFinalState(const FinalState& fsp) {
00008     setName("ChargedFinalState");
00009     addProjection(fsp, "FS");
00010   }
00011 
00012 
00013   ChargedFinalState::ChargedFinalState(double mineta, double maxeta, double minpt) {
00014     setName("ChargedFinalState");
00015     addProjection(FinalState(mineta, maxeta, minpt), "FS");
00016   }
00017 
00018   int ChargedFinalState::compare(const Projection& p) const {
00019     return mkNamedPCmp(p, "FS");
00020   }
00021 }
00022 
00023 namespace {
00024   inline bool chargedParticleFilter(const Rivet::Particle& p) {
00025     return Rivet::PID::threeCharge(p.pdgId()) == 0;
00026   }
00027 }
00028 
00029 namespace Rivet {
00030   void ChargedFinalState::project(const Event& e) {
00031     const FinalState& fs = applyProjection<FinalState>(e, "FS");
00032     _theParticles.clear();
00033     std::remove_copy_if(fs.particles().begin(), fs.particles().end(),
00034                         std::back_inserter(_theParticles), chargedParticleFilter);
00035     MSG_DEBUG("Number of charged final-state particles = " << _theParticles.size());
00036     if (getLog().isActive(Log::TRACE)) {
00037       for (vector<Particle>::iterator p = _theParticles.begin(); p != _theParticles.end(); ++p) {
00038         MSG_TRACE("Selected: " << p->pdgId() << ", charge = " << PID::threeCharge(p->pdgId())/3.0);
00039       }
00040     }
00041   }
00042 
00043 
00044 }