Rivet: /Users/chrisg/software/rivet/include/Rivet/Projections/ConstLossyFinalState.hh Source File

| Rivet 3.1.9

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