ThePEG  1.8.0
SamplerBase.h
1 // -*- C++ -*-
2 //
3 // SamplerBase.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_SamplerBase_H
10 #define ThePEG_SamplerBase_H
11 // This is the declaration of the SamplerBase class.
12 
13 #include "ThePEG/Interface/Interfaced.h"
14 #include "SamplerBase.fh"
15 #include "ThePEG/Handlers/StandardEventHandler.fh"
16 // #include "SamplerBase.xh"
17 
18 namespace ThePEG {
19 
35 class SamplerBase: public Interfaced {
36 
37 public:
38 
44  virtual ~SamplerBase();
46 
47 public:
48 
54  void setEventHandler(tStdEHPtr eh) { theEventHandler = eh; }
55 
62  virtual void initialize() = 0;
63 
68  virtual double generate() = 0;
69 
73  virtual void rejectLast() = 0;
74 
78  const vector<double> & lastPoint() const { return theLastPoint; }
79 
85  virtual int lastBin() const { return 0; }
86 
91  virtual CrossSection integratedXSec() const = 0;
92 
97  virtual CrossSection integratedXSecErr() const = 0;
98 
102  virtual CrossSection maxXSec() const = 0;
103 
108  virtual double sumWeights() const = 0;
110 
111 protected:
112 
116  vector<double> & lastPoint() { return theLastPoint; }
117 
121  tStdEHPtr eventHandler() const { return theEventHandler; }
122 
123 public:
124 
131  void persistentOutput(PersistentOStream & os) const;
132 
138  void persistentInput(PersistentIStream & is, int version);
140 
144  static void Init();
145 
146 private:
147 
151  tStdEHPtr theEventHandler;
152 
156  vector<double> theLastPoint;
157 
158 private:
159 
164 
168  SamplerBase & operator=(const SamplerBase &);
169 
170 };
171 
172 }
173 
174 
175 namespace ThePEG {
176 
183 template <>
184 struct BaseClassTrait<SamplerBase,1>: public ClassTraitsType {
186  typedef Interfaced NthBase;
187 };
188 
193 template <>
194 struct ClassTraits<SamplerBase>: public ClassTraitsBase<SamplerBase> {
196  static string className() { return "ThePEG::SamplerBase"; }
197 
198 };
199 
202 }
203 
204 #endif /* ThePEG_SamplerBase_H */
virtual void rejectLast()=0
Reject the last chosen phase space point.
PersistentIStream is used to read persistent objects from a stream where they were previously written...
vector< double > & lastPoint()
Return the last generated phase space point.
Definition: SamplerBase.h:116
virtual ~SamplerBase()
Destructor.
virtual int lastBin() const
If the sampler is able to sample several different functions separately, this function should return ...
Definition: SamplerBase.h:85
virtual CrossSection maxXSec() const =0
Return the overestimated integrated cross section.
ClassTraitsType is an empty, non-polymorphic, base class.
Definition: ClassTraits.h:30
tStdEHPtr theEventHandler
The associated event handler.
Definition: SamplerBase.h:151
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
static void Init()
Standard Init function used to initialize the interfaces.
PersistentOStream is used to write objects persistently to a stream from which they can be read in ag...
A concreate implementation of ClassDescriptionBase describing an abstract class with persistent data...
void setEventHandler(tStdEHPtr eh)
Set the event handler for which the function StandardEventHandler::dSigDR(const vector<double> &) fun...
Definition: SamplerBase.h:54
virtual void initialize()=0
Initialize the the sampler, possibly doing presampling of the phase space.
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
tStdEHPtr eventHandler() const
Return the associated event handler.
Definition: SamplerBase.h:121
static AbstractClassDescription< SamplerBase > initSamplerBase
Describe an abstract base class with persistent data.
Definition: SamplerBase.h:163
This is the base class for all phase space sampler classes to be used by the EventHandler class to sa...
Definition: SamplerBase.h:35
SamplerBase & operator=(const SamplerBase &)
Private and non-existent assignment operator.
virtual CrossSection integratedXSec() const =0
Return the total integrated cross section determined from the Monte Carlo sampling so far...
virtual CrossSection integratedXSecErr() const =0
Return the error on the total integrated cross section determined from the Monte Carlo sampling so fa...
The Interfaced class is derived from the InterfacedBase class adding a couple of things particular to...
Definition: Interfaced.h:38
The default concrete implementation of ClassTraitsBase.
Definition: ClassTraits.h:134
virtual double sumWeights() const =0
Return the sum of the weights returned by generate() so far (of the events that were not rejeted)...
This template class allows the compiler to check calculations with physical quantities for dimensiona...
Definition: PhysicalQty.h:81
const vector< double > & lastPoint() const
Return the last generated phase space point.
Definition: SamplerBase.h:78
BaseClassTraits describes the base classes of the templated class.
Definition: ClassTraits.h:156
virtual double generate()=0
Generarate a new phase space point and return a weight associated with it.
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
The templated ClassTraitsBase class defines a set of default information about classes used by ThePEG...
Definition: ClassTraits.h:52
vector< double > theLastPoint
The last generated phase space point.
Definition: SamplerBase.h:156