Rivet API documentation

Rivet 4.1.3
ConstLossyFinalState.hh
1// -*- C++ -*-
2#ifndef RIVET_ConstLossyFinalState_HH
3#define RIVET_ConstLossyFinalState_HH
4
5#include "Rivet/Event.hh"
6#include "Rivet/Particle.hh"
7#include "Rivet/Projection.hh"
8#include "Rivet/Config/RivetCommon.hh"
9#include "Rivet/Projections/FinalState.hh"
10#include "Rivet/Projections/LossyFinalState.hh"
11#include "Rivet/Tools/Logging.hh"
12#include "Rivet/Tools/Random.hh"
13
14namespace Rivet {
15
16
18 class ConstRandomFilter {
19 public:
20
21 ConstRandomFilter(double lossFraction)
22 : _lossFraction(lossFraction) {
23 assert(_lossFraction >= 0);
24 }
25
26 // If operator() returns true, particle is deleted ("lost")
27 bool operator()(const Particle&) {
28 return rand01() < _lossFraction;
29 }
30
31 CmpState compare(const ConstRandomFilter& other) const {
32 return cmp(_lossFraction, other._lossFraction);
33 }
34
35
36 protected:
37
38 double _lossFraction;
39 };
40
41
43 class ConstLossyFinalState : public LossyFinalState<ConstRandomFilter> {
44 public:
45
48
50 ConstLossyFinalState(const FinalState& fsp, double lossfraction)
52 setName("ConstLossyFinalState");
53 }
54
56 ConstLossyFinalState(double lossfraction, const Cut& c = Cuts::open())
58 setName("ConstLossyFinalState");
59 }
60
63
65 using Projection::operator=;
66
68 };
69
70
71}
72
73#endif
ConstLossyFinalState(double lossfraction, const Cut &c=Cuts::open())
Stand-alone constructor. Initialises the base FinalState projection.
Definition ConstLossyFinalState.hh:56
RIVET_DEFAULT_PROJ_CLONE(ConstLossyFinalState)
Clone on the heap.
ConstLossyFinalState(const FinalState &fsp, double lossfraction)
Constructor from a FinalState.
Definition ConstLossyFinalState.hh:50
Functor used to implement constant random lossiness.
Definition ConstLossyFinalState.hh:18
Project out all final-state particles in an event. Probably the most important projection in Rivet!
Definition FinalState.hh:12
LossyFinalState(const FinalState &fsp, ConstRandomFilter filter)
Definition LossyFinalState.hh:24
Particle representation, either from a HepMC::GenEvent or reconstructed.
Definition Particle.hh:50
void setName(const std::string &name)
Definition Projection.hh:146
const Cut & open()
Fully open cut singleton, accepts everything.
Definition LHCbCommon.hh:9
double rand01()
Return a uniformly sampled random number between 0 and 1.
Cmp< T > cmp(const T &t1, const T &t2)
Global helper function for easy creation of Cmp objects.
Definition Cmp.hh:253