File indexing completed on 2025-05-12 09:05:03
0001
0002 #ifndef RIVET_LossyFinalState_HH
0003 #define RIVET_LossyFinalState_HH
0004
0005 #include "Rivet/Tools/Logging.hh"
0006 #include "Rivet/Config/RivetCommon.hh"
0007 #include "Rivet/Particle.hh"
0008 #include "Rivet/Event.hh"
0009 #include "Rivet/Projection.hh"
0010 #include "Rivet/Projections/FinalState.hh"
0011
0012 namespace Rivet {
0013
0014
0015
0016 template <typename FILTER>
0017 class LossyFinalState : public FinalState {
0018 public:
0019
0020
0021
0022
0023
0024 LossyFinalState(const FinalState& fsp, FILTER filter)
0025 : _filter(filter)
0026 {
0027 setName("LossyFinalState");
0028 declare(fsp, "FS");
0029 }
0030
0031
0032 LossyFinalState(FILTER filter, const Cut& c=Cuts::open())
0033 : _filter(filter)
0034 {
0035 setName("LossyFinalState");
0036 declare(FinalState(c), "FS");
0037 }
0038
0039
0040 virtual ~LossyFinalState() { }
0041
0042
0043 RIVET_DEFAULT_PROJ_CLONE(LossyFinalState);
0044
0045
0046
0047
0048 using Projection::operator =;
0049
0050
0051
0052 void project(const Event& e) {
0053 const FinalState& fs = apply<FinalState>(e, "FS");
0054 getLog() << Log::DEBUG << "Pre-loss number of FS particles = " << fs.particles().size() << '\n';
0055 _theParticles.clear();
0056 std::remove_copy_if(fs.particles().begin(), fs.particles().end(),
0057 std::back_inserter(_theParticles), _filter);
0058 getLog() << Log::DEBUG << "Filtered number of FS particles = " << _theParticles.size() << '\n';
0059 }
0060
0061
0062
0063 CmpState compare(const Projection& p) const {
0064 const LossyFinalState<FILTER>& other = pcast< LossyFinalState<FILTER> >(p);
0065 const CmpState fscmp = mkNamedPCmp(other, "FS");
0066 if (fscmp != CmpState::EQ) return fscmp;
0067 return _filter.compare(other._filter);
0068 }
0069
0070
0071 protected:
0072
0073
0074 FILTER _filter;
0075
0076 };
0077
0078
0079 }
0080
0081 #endif