LossyFinalState.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Rivet.hh"
00003 #include "Rivet/Projections/LossyFinalState.hh"
00004 #include "Rivet/Tools/ParticleIdUtils.hh"
00005 #include <algorithm>
00006 
00007 namespace Rivet {
00008 
00009 
00010   int LossyFinalState::compare(const Projection& p) const {
00011     const LossyFinalState& other = pcast<LossyFinalState>(p);
00012     const int fscmp = mkNamedPCmp(other, "FS");
00013     if (fscmp) return fscmp;
00014     return cmp(_lossFraction, other._lossFraction);
00015   }
00016 
00017 
00018   void LossyFinalState::project(const Event& e) {
00019     const FinalState& fs = applyProjection<FinalState>(e, "FS");
00020     getLog() << Log::DEBUG << "Pre-loss number of FS particles = " << fs.particles().size() << endl;
00021     _theParticles.clear();
00022     std::remove_copy_if(fs.particles().begin(), fs.particles().end(),
00023                         std::back_inserter(_theParticles), RandomFilter(_lossFraction));
00024     getLog() << Log::DEBUG << "Filtered number of FS particles = " << _theParticles.size()
00025              << " (should be ~" << (1-_lossFraction)*100 << "%)" << endl;
00026   }
00027 
00028 
00029 }