thepeg is hosted by Hepforge, IPPP Durham
ThePEG  2.2.1
StandardEventHandler.h
1 // -*- C++ -*-
2 //
3 // StandardEventHandler.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_StandardEventHandler_H
10 #define ThePEG_StandardEventHandler_H
11 // This is the declaration of the StandardEventHandler class.
12 
13 #include "ThePEG/Config/ThePEG.h"
14 #include "ThePEG/Handlers/EventHandler.h"
15 #include "ThePEG/Repository/Strategy.fh"
16 #include "ThePEG/Handlers/SamplerBase.fh"
17 #include "ThePEG/PDF/PartonBin.fh"
18 #include "ThePEG/MatrixElement/MEBase.fh"
19 #include "SubProcessHandler.fh"
20 #include "StandardXComb.fh"
21 #include "StandardEventHandler.fh"
22 #include "ThePEG/Utilities/XSecStat.h"
23 #include <fstream>
24 
25 namespace ThePEG {
26 
45 
46 public:
47 
49  typedef vector<SubHdlPtr> SubHandlerList;
50 
53 
55  typedef vector<StdXCombPtr> XVector;
56 
58  typedef vector<CrossSection> XSVector;
59 
62  typedef map<tMEPtr,XVector> MEXMap;
63 
64 public:
65 
72 
76  virtual ~StandardEventHandler();
78 
79 public:
80 
85  virtual void initialize();
86 
91  virtual void statistics(ostream &) const;
92 
96  tSamplerPtr sampler() { return theSampler; }
97 
101  tcSamplerPtr sampler() const { return theSampler; }
102 
108  virtual CrossSection histogramScale() const;
109 
115  virtual CrossSection integratedXSec() const;
116 
122  virtual CrossSection integratedXSecErr() const;
123 
129  virtual CrossSection integratedXSecNoReweight() const;
130 
137 
145  virtual CrossSection dSigDR(const vector<double> & r);
146 
150  virtual EventPtr generateEvent();
151 
156  virtual EventPtr continueEvent();
157 
161  void reweight(double factor) const;
162 
166  const XVector & xCombs() const { return theXCombs; }
167 
171  virtual void select(tXCombPtr newXComb);
172 
179 
187  tCutsPtr cuts() const { return theCuts; }
188 
193  int nBins() const;
194 
199  int maxDim(int bin) const { return theMaxDims[bin]; }
200 
205  int lumiDim() const { return theLumiDim; }
206 
211  int nDim(int bin) const { return lumiDim() + maxDim(bin); }
213 
214 protected:
215 
229  virtual CrossSection dSigDR(const pair<double,double> ll, Energy2 maxS,
230  int ibin, int nr, const double * r);
231 
237  tStdXCombPtr select(int bin, double & weight);
238 
252  void addME(Energy maxEnergy, tSubHdlPtr sub, tPExtrPtr extractor,
253  tCutsPtr cuts, tCascHdlPtr ckkw, tMEPtr me, const PBPair & pBins,
254  const PartonPairVec& allPBins);
255 
261 
269  virtual void initGroups();
270 
278 
282  void setScale(Energy2);
283 
287  XVector & xCombs() { return theXCombs; }
288 
292  virtual void clean();
293 
294 private:
295 
299  const SubHandlerList & subProcesses() const { return theSubProcesses; }
300 
304  SubHandlerList & subProcesses() { return theSubProcesses; }
305 
306 public:
307 
313  virtual void doupdate();
314 
320  virtual void doinit();
321 
326  virtual void doinitrun();
327 
332  virtual void dofinish();
334 
341  void persistentOutput(PersistentOStream & os) const;
342 
348  void persistentInput(PersistentIStream & is, int version);
350 
354  static void Init();
355 
356 protected:
357 
364  virtual IBPtr clone() const;
365 
370  virtual IBPtr fullclone() const;
372 
377  void reject(double weight);
378 
379 private:
380 
391 
395  SubHandlerList theSubProcesses;
396 
400  CutsPtr theCuts;
401 
406 
410  XVector theXCombs;
411 
416  vector<int> theMaxDims;
417 
423 
429  SamplerPtr theSampler;
430 
436 
441 
446 
450  void setIncomingA(PDPtr);
451 
455  void setIncomingB(PDPtr);
456 
457 protected:
458 
464  class StandardEventHandlerUpdateException: public UpdateException {};
465 
470  class StandardEventHandlerInitError: public Exception {};
473 private:
474 
478  const StandardEventHandler & operator=(const StandardEventHandler &) = delete;
479 
480 };
481 
488 template <>
491  typedef EventHandler NthBase;
492 };
493 
498 template <>
500  : public ClassTraitsBase<StandardEventHandler> {
504  static string className() { return "ThePEG::StandardEventHandler"; }
505 };
506 
509 }
510 
511 #endif /* ThePEG_StandardEventHandler_H */
virtual void doinitrun()
Initialize this object.
LorentzRotation theCurrentEventBoost
The boost needed to transform the current collision from the CMS system to the lab system...
map< tMEPtr, XVector > MEXMap
Map of pointers to StandardXComb objects indexed by pointers to the corresponding MEBase object...
PersistentIStream is used to read persistent objects from a stream where they were previously written...
The EventHandler is the base class used to implement event handlers in ThePEG.
Definition: EventHandler.h:63
ClassTraitsType is an empty, non-polymorphic, base class.
Definition: ClassTraits.h:30
virtual CrossSection integratedXSecErr() const
The estimated error int total integrated cross section of the processes generated in this run...
A concreate implementation of ClassDescriptionBase describing a concrete class with persistent data...
virtual ~StandardEventHandler()
Destructor.
LorentzRotation & currentEventBoost()
Return the boost needed to transform the current collision from the CMS system to the lab system...
PersistentOStream is used to write objects persistently to a stream from which they can be read in ag...
StandardEventHandler()
Default constructor.
The LorentzRotation class combine a SpinOneLorentzRotation and a spin SpinHalfLorentzRotation to prov...
TransientRCPtr is a simple wrapper around a bare pointer which can be assigned to and from an RCPtr a...
Definition: RCPtr.h:519
int maxDim(int bin) const
Return the number of phase space dimensions needed for the sampling of indicated bin of StandardXComb...
XVector theXCombs
The StandardXComb objects.
virtual void clean()
Throw away the last generated event before generating a new one.
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
const StandardEventHandler & operator=(const StandardEventHandler &)=delete
Private and non-existent assignment operator.
void addME(Energy maxEnergy, tSubHdlPtr sub, tPExtrPtr extractor, tCutsPtr cuts, tCascHdlPtr ckkw, tMEPtr me, const PBPair &pBins, const PartonPairVec &allPBins)
Create and add StandardXComb objects.
This is the main config header file for ThePEG.
void setIncomingB(PDPtr)
Helper function for the interface.
SamplerPtr theSampler
The phase space sampler responsible for generating phase space points according to the cross section ...
virtual EventPtr continueEvent()
Continue generating an event if the generation has been stopped before finishing. ...
virtual CrossSection dSigDR(const vector< double > &r)
Return the cross section for the chosen phase space point.
void reweight(double factor) const
Reweight a partially generated event.
void setScale(Energy2)
Set information about the current sub-process.
tcSamplerPtr sampler() const
Return the sampler assigned to this event handler.
static ClassDescription< StandardEventHandler > initStandardEventHandler
Standard Initialization object.
virtual CrossSection integratedXSec() const
The estimated total integrated cross section of the processes generated in this run.
tSamplerPtr sampler()
Return the sampler assigned to this event handler.
int nBins() const
Return the number of separate bins of StandardXComb objects to sample.
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
CutsPtr theCuts
The kinematical cuts used for this collision handler.
const LorentzRotation & currentEventBoost() const
Return the boost needed to transform the current event from the CMS system to the lab system...
virtual CrossSection integratedXSecErrNoReweight() const
The estimated error int total integrated cross section of the processes generated in this run...
void reject(double weight)
Reject a (partially) generated event.
int lumiDim() const
The number of phase space dimensions used by the luminosity function.
vector< CrossSection > XSVector
A vector of cross sections.
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
PDPtr theIncomingA
The first of the incoming particle types.
vector< int > theMaxDims
The number of degrees of freedom needed to generate the phase space for the different bins...
virtual void select(tXCombPtr newXComb)
Change the XComb object.
XSecStat xSecStats
The overall cross section statistics.
virtual void initialize()
Initialize this event handler and all related objects needed to generate events.
RCPtr is a reference counted (smart) pointer.
Definition: RCPtr.h:60
int nDim(int bin) const
The number of dimensions of the basic phase space to generate sub-processes in for a given bin of Sta...
int theLumiDim
The number of phase space dimensions used by the luminosity function.
PDPtr theIncomingB
The second of the incoming particle types.
Selector< StdXCombPtr > XSelector
A weighted list of pointers to StandardXComb objects.
virtual EventPtr generateEvent()
Generate an event.
void setIncomingA(PDPtr)
Helper function for the interface.
XVector & xCombs()
Return the vector of StandardXComb objects.
const XVector & xCombs() const
Return the vector of StandardXComb objects.
virtual void doinit()
Initialize this object after the setup phase before saving an EventGenerator to disk.
virtual CrossSection histogramScale() const
Histogram scale.
Exception is the base class for all exceptions to be used in ThePEG.
Definition: Exception.h:44
The StandardEventHandler class is the main class for generating simple events without overlayed colli...
Selector is a templated class for storing objects associated with probabilities in a way such that...
Definition: Selector.h:46
const SubHandlerList & subProcesses() const
Access the list of sub-process handlers.
virtual void statistics(ostream &) const
Write out accumulated statistics about intergrated cross sections and stuff.
SubHandlerList theSubProcesses
The list of SubProcessHandlers.
The default concrete implementation of ClassTraitsBase.
Definition: ClassTraits.h:134
virtual void dofinish()
Finalize this object.
tCollPtr performCollision()
For the sub-procss and phase-space point selected in the previous call to dSigDR, produce the first s...
virtual void doupdate()
Check sanity of the object during the setup phase.
bool collisionCuts
True if cuts on collision objects should be performed.
tCutsPtr cuts() const
Return a reference to the Cuts of this EventHandler.
virtual CrossSection integratedXSecNoReweight() const
The estimated total integrated cross section of the processes generated in this run, excluding reweighting.
BaseClassTraits describes the base classes of the templated class.
Definition: ClassTraits.h:156
XSecStat is a concrete helper class used to collect statistics about the cross section for a specific...
Definition: XSecStat.h:36
vector< SubHdlPtr > SubHandlerList
A vector of SubProcessHandlers.
virtual IBPtr clone() const
Make a simple clone of this object.
virtual void initGroups()
Initialize groups of StepHandlers.
SubHandlerList & subProcesses()
Access the list of sub-process handlers.
static void Init()
Standard Init function used to initialize the interface.
vector< StdXCombPtr > XVector
A vector of pointers to StandardXComb objects.
The templated ClassTraitsBase class defines a set of default information about classes used by ThePEG...
Definition: ClassTraits.h:52