LossyFinalState.hh
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #ifndef RIVET_LossyFinalState_HH 00003 #define RIVET_LossyFinalState_HH 00004 00005 #include "Rivet/Tools/Logging.hh" 00006 #include "Rivet/Config/RivetCommon.hh" 00007 #include "Rivet/Particle.hh" 00008 #include "Rivet/Event.hh" 00009 #include "Rivet/Projection.hh" 00010 #include "Rivet/Projections/FinalState.hh" 00011 00012 namespace Rivet { 00013 00014 00015 /// @brief Templated FS projection which can lose some of the supplied particles. 00016 template <typename FILTER> 00017 class LossyFinalState : public FinalState { 00018 public: 00019 00020 /// @name Constructors 00021 //@{ 00022 00023 /// Constructor from FinalState. 00024 LossyFinalState(const FinalState& fsp, FILTER filter) 00025 : _filter(filter) 00026 { 00027 setName("LossyFinalState"); 00028 addProjection(fsp, "FS"); 00029 } 00030 00031 /// Stand-alone constructor. Initialises the base FinalState projection. 00032 LossyFinalState(FILTER filter, 00033 double mineta = -MAXDOUBLE, 00034 double maxeta = MAXDOUBLE, 00035 double minpt = 0.0) 00036 : _filter(filter) 00037 { 00038 setName("LossyFinalState"); 00039 addProjection(FinalState(mineta, maxeta, minpt), "FS"); 00040 } 00041 00042 /// Virtual destructor, to allow subclassing 00043 virtual ~LossyFinalState() { } 00044 00045 /// Clone on the heap. 00046 DEFAULT_RIVET_PROJ_CLONE(LossyFinalState); 00047 00048 //@} 00049 00050 00051 protected: 00052 00053 /// Apply the projection on the supplied event. 00054 void project(const Event& e) { 00055 const FinalState& fs = applyProjection<FinalState>(e, "FS"); 00056 getLog() << Log::DEBUG << "Pre-loss number of FS particles = " << fs.particles().size() << endl; 00057 _theParticles.clear(); 00058 std::remove_copy_if(fs.particles().begin(), fs.particles().end(), 00059 std::back_inserter(_theParticles), _filter); 00060 getLog() << Log::DEBUG << "Filtered number of FS particles = " << _theParticles.size() << endl; 00061 } 00062 00063 00064 /// Compare projections. 00065 int compare(const Projection& p) const { 00066 const LossyFinalState<FILTER>& other = pcast< LossyFinalState<FILTER> >(p); 00067 const int fscmp = mkNamedPCmp(other, "FS"); 00068 if (fscmp) return fscmp; 00069 return _filter.compare(other._filter); 00070 } 00071 00072 00073 protected: 00074 00075 /// Filtering object: must support operator(const Particle&) and compare(const Filter&) 00076 FILTER _filter; 00077 00078 }; 00079 00080 00081 } 00082 00083 #endif Generated on Tue Dec 13 2016 16:32:38 for The Rivet MC analysis system by ![]() |