/usr/include/ThePEG/Handlers/HandlerBase.h is in libthepeg-dev 1.8.0-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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | // -*- C++ -*-
//
// HandlerBase.h is a part of ThePEG - Toolkit for HEP Event Generation
// Copyright (C) 1999-2011 Leif Lonnblad
//
// ThePEG is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef ThePEG_HandlerBase_H
#define ThePEG_HandlerBase_H
// This is the declaration of the HandlerBase class.
#include "ThePEG/Interface/Interfaced.h"
#include "ThePEG/Repository/UseRandom.fh"
#include "ThePEG/Repository/EventGenerator.h"
#include <stdexcept>
namespace ThePEG {
template <typename T = UseRandom>
/**
* HandlerBaseT is a dummy abstract templated class used as base class
* to HandlerBase. HandlerBaseT inherits from the Interfaced class
* adding some functionality such as easy acces to the RandomGenerator
* and the StandardModel object of the controlling EventGenerator
* object. The HandlerBaseT should only be used by the HandlerBase as
* a base class. The fact that it is templated allows classes which in
* turn inherits from HandlerBase to not explicitly depend on
* EventGenerator class if the inlined accessor funtions are not
* actually used. The only class which actually works as a template
* argument is UseRandom, which is used to generate random numbers.
*
* @see Interfaced
* @see RandomGenerator
* @see StandardModel
* @see EventGenerator
*
*/
class HandlerBaseT: public Interfaced {
public:
/** HandlerBase is a friend. */
friend class HandlerBase;
private:
/** @name Standard constructors and destructors are private and can
* only be used from the HandlerBase class. */
//@{
/**
* Default constructor.
*/
HandlerBaseT() {}
public:
/**
* Destructor.
*/
virtual ~HandlerBaseT() {}
//@}
public:
/**
* Return a simple flat random number in the range ]0,1[.
*/
double rnd() const { return T::rnd(); }
/**
* Return a simple flat random number in the range ]0,\a xu[.
*/
double rnd(double xu) const { return T::rnd(xu); }
/**
* Return a simple flat random number in the range ]\a xl,\a xu[.
*/
double rnd(double xl, double xu) const { return T::rnd(xl, xu); }
/**
* Return true with 50% probability.
*/
bool rndbool() const { return T::rndbool(); }
/**
* Return a true with probability \a p.
*/
bool rndbool(double p) const { return T::rndbool(p); }
/**
* Return a true with probability \a p1/(\a p1+\a p2).
*/
bool rndbool(double p1, double p2) const { return T::rndbool(p1, p2); }
/**
* Return -1, 0, or 1 with relative probabilities \a p1, \a p2, \a p3.
*/
int rndsign(double p1, double p2, double p3) const { return T::rndsign(p1, p2, p3); }
/**
* Return an integer \f$i\f$ with probability p\f$i\f$/(\a p0+\a p1).
*/
int rnd2(double p0, double p1) const { return T::rnd2(p0, p1); }
/**
* Return an integer \f$i\f$ with probability p\f$i\f$/(\a p0+\a
* p1+\a p2).
*/
int rnd3(double p0, double p1, double p2) const { return T::rnd3(p0, p1, p2); }
/**
* Return an integer/ \f$i\f$ with probability p\f$i\f$(\a p0+\a
* p1+\a p2+\a p3).
*/
int rnd4(double p0, double p1, double p2, double p3) const { return T::rnd4(p0, p1, p2, p3); }
/**
* Return a simple flat random integrer number in the range [0,\a xu[.
*/
long irnd(long xu = 2) const { return T::irnd(xu); }
/**
* Return a simple flat random integrer number in the range [\a xl,\a xu[.
*/
long irnd(long xl, long xu) const { return T::irnd(xl, xu); }
/**
* Return a reference to the object containing the standard model
* parameters for this run.
*/
const StandardModelBase & SM() const { return *standardModel(); }
/**
* Return a pointer to the object containing the standard model
* parameters for this run.
*/
tSMPtr standardModel() const { return generator()->standardModel(); }
};
/**
* HandlerBase is an abstract base class derived from the Interfaced
* class via the HandlerBaseT class adding some functionality such as
* easy acces to the RandomGenerator and the StandardModel object of
* the controlling EventGenerator object.
*
* @see Interfaced
* @see RandomGenerator
* @see StandardModel
* @see EventGenerator
*
*/
class HandlerBase: public HandlerBaseT<UseRandom> {
public:
/**
* Standard Init function used to initialize the interface.
*/
static void Init();
private:
/**
* Describe an abstract class without persistent data.
*/
static AbstractNoPIOClassDescription<HandlerBase> initHandlerBase;
/**
* Private and non-existent assignment operator.
*/
HandlerBase & operator=(const HandlerBase &);
};
/** @cond TRAITSPECIALIZATIONS */
/**
* This template specialization informs ThePEG about the
* base class of HandlerBase.
*/
template <>
struct BaseClassTrait<HandlerBase,1>: public ClassTraitsType {
/** Typedef of the base class of HandlerBase. Note that HandlerBaseT
* is not treated as a base class in this respect. */
typedef Interfaced NthBase;
};
/**
* This template specialization informs ThePEG about the name of the
* HandlerBase class.
*/
template <>
struct ClassTraits<HandlerBase>: public ClassTraitsBase<HandlerBase> {
/** Return the class name. */
static string className() { return "ThePEG::HandlerBase"; }
};
/** @endcond */
}
#endif /* ThePEG_HandlerBase_H */
|