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 
00019   ChargedFinalState::ChargedFinalState(const vector<pair<double, double> >& etaRanges,
00020                                        double minpt) {
00021     setName("ChargedFinalState");
00022     addProjection(FinalState(etaRanges, minpt), "FS");
00023   }
00024 
00025 
00026   int ChargedFinalState::compare(const Projection& p) const {
00027     return mkNamedPCmp(p, "FS");
00028   }
00029 
00030 
00031   bool chargedParticleFilter(const Particle& p) {
00032     return PID::threeCharge(p.pdgId()) == 0;
00033   }
00034 
00035 
00036   void ChargedFinalState::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), chargedParticleFilter);
00041     MSG_DEBUG("Number of charged final-state particles = " << _theParticles.size());
00042     if (getLog().isActive(Log::TRACE)) {
00043       for (vector<Particle>::iterator p = _theParticles.begin(); p != _theParticles.end(); ++p) {
00044         MSG_TRACE("Selected: " << p->pdgId() << ", charge = " << PID::threeCharge(p->pdgId())/3.0);
00045       }
00046     }
00047   }
00048 
00049 
00050 }