rivet is hosted by Hepforge, IPPP Durham
IdentifiedFinalState.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Projections/IdentifiedFinalState.hh"
00003 
00004 namespace Rivet {
00005 
00006 
00007   IdentifiedFinalState::IdentifiedFinalState(const FinalState& fsp) {
00008     setName("IdentifiedFinalState");
00009     addProjection(fsp, "FS");
00010   }
00011 
00012 
00013   IdentifiedFinalState::IdentifiedFinalState(double etamin, double etamax, double ptMin)
00014     : FinalState(etamin, etamax, ptMin)
00015   {
00016     setName("IdentifiedFinalState");
00017     addProjection(FinalState(etamin, etamax, ptMin), "FS");
00018   }
00019 
00020 
00021   // IdentifiedFinalState::IdentifiedFinalState(const vector<pair<double, double> >& etaRanges,
00022   //                                            double ptMin)
00023   //   : FinalState(etaRanges, ptMin)
00024   // {
00025   //   setName("IdentifiedFinalState");
00026   //   addProjection(FinalState(etaRanges, ptMin), "FS");
00027   // }
00028 
00029 
00030   int IdentifiedFinalState::compare(const Projection& p) const {
00031     const PCmp fscmp = mkNamedPCmp(p, "FS");
00032     if (fscmp != EQUIVALENT) return fscmp;
00033 
00034     const IdentifiedFinalState& other = dynamic_cast<const IdentifiedFinalState&>(p);
00035     int pidssize = cmp(_pids.size(), other._pids.size());
00036     if (pidssize != EQUIVALENT) return pidssize;
00037     return cmp(_pids, other._pids);
00038   }
00039 
00040 
00041   void IdentifiedFinalState::project(const Event& e) {
00042     const FinalState& fs = applyProjection<FinalState>(e, "FS");
00043     _theParticles.clear();
00044     _theParticles.reserve(fs.particles().size());
00045     foreach (const Particle& p, fs.particles()) {
00046       if (acceptedIds().find(p.pdgId()) != acceptedIds().end()) {
00047         _theParticles.push_back(p);
00048       }
00049     }
00050   }
00051 
00052 
00053 }