thepeg is hosted by Hepforge, IPPP Durham
ThePEG 2.3.0
HandlerBase.h
1// -*- C++ -*-
2//
3// HandlerBase.h is a part of ThePEG - Toolkit for HEP Event Generation
4// Copyright (C) 1999-2019 Leif Lonnblad
5//
6// ThePEG is licenced under version 3 of the GPL, see COPYING for details.
7// Please respect the MCnet academic guidelines, see GUIDELINES for details.
8//
9#ifndef ThePEG_HandlerBase_H
10#define ThePEG_HandlerBase_H
11// This is the declaration of the HandlerBase class.
12
13#include "ThePEG/Interface/Interfaced.h"
14#include "ThePEG/Repository/UseRandom.fh"
15#include "ThePEG/Repository/EventGenerator.h"
16#include <stdexcept>
17
18namespace ThePEG {
19
20template <typename T = UseRandom>
39class HandlerBaseT: public Interfaced {
40public:
41
43 friend class HandlerBase;
44
45private:
46
54
55public:
59 virtual ~HandlerBaseT() {}
61
62public:
63
67 double rnd() const { return T::rnd(); }
68
72 double rnd(double xu) const { return T::rnd(xu); }
73
77 double rnd(double xl, double xu) const { return T::rnd(xl, xu); }
78
82 bool rndbool() const { return T::rndbool(); }
83
87 bool rndbool(double p) const { return T::rndbool(p); }
88
92 bool rndbool(double p1, double p2) const { return T::rndbool(p1, p2); }
93
97 int rndsign(double p1, double p2, double p3) const { return T::rndsign(p1, p2, p3); }
98
102 int rnd2(double p0, double p1) const { return T::rnd2(p0, p1); }
103
108 int rnd3(double p0, double p1, double p2) const { return T::rnd3(p0, p1, p2); }
109
114 int rnd4(double p0, double p1, double p2, double p3) const { return T::rnd4(p0, p1, p2, p3); }
115
119 long irnd(long xu = 2) const { return T::irnd(xu); }
120
124 long irnd(long xl, long xu) const { return T::irnd(xl, xu); }
125
130 const StandardModelBase & SM() const { return *standardModel(); }
131
136 tSMPtr standardModel() const { return generator()->standardModel(); }
137};
138
151class HandlerBase: public HandlerBaseT<UseRandom> {
152
153public:
154
158 static void Init();
159
160private:
161
166
170 HandlerBase & operator=(const HandlerBase &) = delete;
171
172};
173
180template <>
184 typedef Interfaced NthBase;
185};
186
191template <>
192struct ClassTraits<HandlerBase>: public ClassTraitsBase<HandlerBase> {
194 static string className() { return "ThePEG::HandlerBase"; }
195};
196
199}
200
201#endif /* ThePEG_HandlerBase_H */
A concreate implementation of ClassDescriptionBase describing an abstract class without persistent da...
HandlerBaseT is a dummy abstract templated class used as base class to HandlerBase.
Definition: HandlerBase.h:39
double rnd(double xl, double xu) const
Return a simple flat random number in the range ]xl,xu[.
Definition: HandlerBase.h:77
long irnd(long xu=2) const
Return a simple flat random integrer number in the range [0,xu[.
Definition: HandlerBase.h:119
virtual ~HandlerBaseT()
Destructor.
Definition: HandlerBase.h:59
double rnd() const
Return a simple flat random number in the range ]0,1[.
Definition: HandlerBase.h:67
double rnd(double xu) const
Return a simple flat random number in the range ]0,xu[.
Definition: HandlerBase.h:72
bool rndbool(double p1, double p2) const
Return a true with probability p1/(p1+p2).
Definition: HandlerBase.h:92
bool rndbool(double p) const
Return a true with probability p.
Definition: HandlerBase.h:87
int rndsign(double p1, double p2, double p3) const
Return -1, 0, or 1 with relative probabilities p1, p2, p3.
Definition: HandlerBase.h:97
bool rndbool() const
Return true with 50% probability.
Definition: HandlerBase.h:82
HandlerBaseT()
Default constructor.
Definition: HandlerBase.h:53
int rnd2(double p0, double p1) const
Return an integer with probability p /(p0+p1).
Definition: HandlerBase.h:102
int rnd3(double p0, double p1, double p2) const
Return an integer with probability p /(p0+p1+p2).
Definition: HandlerBase.h:108
const StandardModelBase & SM() const
Return a reference to the object containing the standard model parameters for this run.
Definition: HandlerBase.h:130
tSMPtr standardModel() const
Return a pointer to the object containing the standard model parameters for this run.
Definition: HandlerBase.h:136
int rnd4(double p0, double p1, double p2, double p3) const
Return an integer/ with probability p (p0+p1+p2+p3).
Definition: HandlerBase.h:114
long irnd(long xl, long xu) const
Return a simple flat random integrer number in the range [xl,xu[.
Definition: HandlerBase.h:124
HandlerBase is an abstract base class derived from the Interfaced class via the HandlerBaseT class ad...
Definition: HandlerBase.h:151
static AbstractNoPIOClassDescription< HandlerBase > initHandlerBase
Describe an abstract class without persistent data.
Definition: HandlerBase.h:165
static void Init()
Standard Init function used to initialize the interface.
HandlerBase & operator=(const HandlerBase &)=delete
Private and non-existent assignment operator.
The Interfaced class is derived from the InterfacedBase class adding a couple of things particular to...
Definition: Interfaced.h:38
tEGPtr generator() const
Return a pointer to the EventGenerator controlling the run.
Definition: Interfaced.h:99
TransientRCPtr is a simple wrapper around a bare pointer which can be assigned to and from an RCPtr a...
Definition: RCPtr.h:519
StandardModelBase is used to handle standard model parameters in an EventGenerator.
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
BaseClassTraits describes the base classes of the templated class.
Definition: ClassTraits.h:156
int NthBase
The type of the BaseN'th base class (int means there are no further base classes).
Definition: ClassTraits.h:161
static string className()
Return the name of class T.
Definition: ClassTraits.h:66
ClassTraitsType is an empty, non-polymorphic, base class.
Definition: ClassTraits.h:30