00001 // -*- C++ -*- 00002 00003 #include "Rivet/Tools/Logging.hh" 00004 #include "Rivet/Projections/ChargedLeptons.hh" 00005 #include "Rivet/Cmp.hh" 00006 #include "HepPDT/ParticleID.hh" 00007 00008 00009 namespace Rivet { 00010 00011 int ChargedLeptons::compare(const Projection& p) const { 00012 const ChargedLeptons& other = dynamic_cast<const ChargedLeptons &>(p); 00013 return pcmp(*_fsproj, *other._fsproj); 00014 } 00015 00016 00017 void ChargedLeptons::project(const Event& e) { 00018 Log& log = getLog(); 00019 00020 // Reset result 00021 _theChargedLeptons.clear(); 00022 00023 // Project into final state 00024 const FinalState& fs = e.applyProjection(*_fsproj); 00025 00026 // Get hadron and charge info for each particle, and fill counters appropriately 00027 for (ParticleVector::const_iterator p = fs.particles().begin(); p != fs.particles().end(); ++p) { 00028 HepPDT::ParticleID pInfo = p->getPdgId(); 00029 bool isHadron = pInfo.isHadron(); 00030 if (!isHadron) { 00031 if (pInfo.threeCharge() != 0) { 00032 // Put it into the C.L. vector 00033 _theChargedLeptons.push_back(Particle(*p)); 00034 } 00035 } 00036 } 00037 log << Log::DEBUG << "Done" << endl; 00038 } 00039 00040 }