ThePEG  1.8.0
HandlerBase.h
1 // -*- C++ -*-
2 //
3 // HandlerBase.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2011 Leif Lonnblad
5 //
6 // ThePEG is licenced under version 2 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 
18 namespace ThePEG {
19 
20 template <typename T = UseRandom>
39 class HandlerBaseT: public Interfaced {
40 public:
41 
43  friend class HandlerBase;
44 
45 private:
46 
54 
55 public:
59  virtual ~HandlerBaseT() {}
61 
62 public:
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 
151 class HandlerBase: public HandlerBaseT<UseRandom> {
152 
153 public:
154 
158  static void Init();
159 
160 private:
161 
166 
170  HandlerBase & operator=(const HandlerBase &);
171 
172 };
173 
180 template <>
181 struct BaseClassTrait<HandlerBase,1>: public ClassTraitsType {
184  typedef Interfaced NthBase;
185 };
186 
191 template <>
192 struct ClassTraits<HandlerBase>: public ClassTraitsBase<HandlerBase> {
194  static string className() { return "ThePEG::HandlerBase"; }
195 };
196 
199 }
200 
201 #endif /* ThePEG_HandlerBase_H */