/usr/include/Rivet/Projections/ConstLossyFinalState.hh is in librivet-dev 1.8.3-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | // -*- C++ -*-
#ifndef RIVET_ConstLossyFinalState_HH
#define RIVET_ConstLossyFinalState_HH
#include "Rivet/Tools/Logging.hh"
#include "Rivet/Rivet.hh"
#include "Rivet/Particle.hh"
#include "Rivet/Event.hh"
#include "Rivet/Projection.hh"
#include "Rivet/Projections/FinalState.hh"
#include "Rivet/Projections/LossyFinalState.hh"
namespace Rivet {
/// Functor used to implement constant random lossiness.
class ConstRandomFilter {
public:
ConstRandomFilter(double lossFraction)
: _lossFraction(lossFraction)
{
assert(_lossFraction >= 0);
}
// If operator() returns true, particle is deleted ("lost")
bool operator()(const Particle&) {
/// @todo Use a better RNG
return (rand()/static_cast<double>(RAND_MAX) < _lossFraction);
}
int compare(const ConstRandomFilter& other) const {
return cmp(_lossFraction, other._lossFraction);
}
private:
double _lossFraction;
};
/// @brief Randomly lose a constant fraction of particles.
class ConstLossyFinalState : public LossyFinalState<ConstRandomFilter> {
public:
/// @name Constructors
//@{
/// Constructor from a FinalState.
ConstLossyFinalState(const FinalState& fsp, double lossfraction)
: LossyFinalState<ConstRandomFilter>(fsp, ConstRandomFilter(lossfraction))
{
setName("ConstLossyFinalState");
}
/// Stand-alone constructor. Initialises the base FinalState projection.
ConstLossyFinalState(double lossfraction,
double mineta = -MAXRAPIDITY,
double maxeta = MAXRAPIDITY,
double minpt = 0.0)
: LossyFinalState<ConstRandomFilter>(ConstRandomFilter(lossfraction), mineta, maxeta, minpt)
{
setName("ConstLossyFinalState");
}
/// Clone on the heap.
virtual const Projection* clone() const {
return new ConstLossyFinalState(*this);
}
//@}
};
}
#endif
|