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   ChargedFinalState::ChargedFinalState(const Cut& c) {
00013     setName("ChargedFinalState");
00014     addProjection(FinalState(c), "FS");
00015   }
00016 
00017   ChargedFinalState::ChargedFinalState(double mineta, double maxeta, double minpt) {
00018     setName("ChargedFinalState");
00019     addProjection(FinalState(mineta, maxeta, minpt), "FS");
00020   }
00021 
00022   int ChargedFinalState::compare(const Projection& p) const {
00023     return mkNamedPCmp(p, "FS");
00024   }
00025 }
00026 
00027 namespace {
00028   inline bool chargedParticleFilter(const Rivet::Particle& p) {
00029     return Rivet::PID::threeCharge(p.pdgId()) == 0;
00030   }
00031 }
00032 
00033 namespace Rivet {
00034   void ChargedFinalState::project(const Event& e) {
00035     const FinalState& fs = applyProjection<FinalState>(e, "FS");
00036     _theParticles.clear();
00037     std::remove_copy_if(fs.particles().begin(), fs.particles().end(),
00038                         std::back_inserter(_theParticles), chargedParticleFilter);
00039     MSG_DEBUG("Number of charged final-state particles = " << _theParticles.size());
00040     if (getLog().isActive(Log::TRACE)) {
00041       for (vector<Particle>::iterator p = _theParticles.begin(); p != _theParticles.end(); ++p) {
00042         MSG_TRACE("Selected: " << p->pdgId() << ", charge = " << PID::threeCharge(p->pdgId())/3.0);
00043       }
00044     }
00045   }
00046 
00047 
00048 }