ThePEG  1.8.0
StandardEventHandler.h
1 // -*- C++ -*-
2 //
3 // StandardEventHandler.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_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 <fstream>
23 
24 namespace ThePEG {
25 
44 
45 public:
46 
48  typedef vector<SubHdlPtr> SubHandlerList;
49 
52 
54  typedef vector<StdXCombPtr> XVector;
55 
57  typedef vector<CrossSection> XSVector;
58 
61  typedef map<tMEPtr,XVector> MEXMap;
62 
63 public:
64 
71 
75  virtual ~StandardEventHandler();
77 
78 public:
79 
84  virtual void initialize();
85 
90  virtual void statistics(ostream &) const;
91 
97  virtual CrossSection histogramScale() const;
98 
104  virtual CrossSection integratedXSec() const;
105 
111  virtual CrossSection integratedXSecErr() const;
112 
118  virtual CrossSection integratedXSecNoReweight() const;
119 
126 
134  virtual CrossSection dSigDR(const vector<double> & r);
135 
139  virtual EventPtr generateEvent();
140 
145  virtual EventPtr continueEvent();
146 
150  void reweight(double factor) const;
151 
155  const XVector & xCombs() const { return theXCombs; }
156 
160  virtual void select(tXCombPtr newXComb);
161 
168 
176  tCutsPtr cuts() const { return theCuts; }
177 
182  int nBins() const;
183 
188  int maxDim(int bin) const { return theMaxDims[bin]; }
189 
193  bool weighted() const { return weightedEvents; }
194 
199  int lumiDim() const { return theLumiDim; }
200 
205  int nDim(int bin) const { return lumiDim() + maxDim(bin); }
207 
208 protected:
209 
223  virtual CrossSection dSigDR(const pair<double,double> ll, Energy2 maxS,
224  int ibin, int nr, const double * r);
225 
231  tStdXCombPtr select(int bin, double & weight);
232 
246  void addME(Energy maxEnergy, tSubHdlPtr sub, tPExtrPtr extractor,
247  tCutsPtr cuts, tCascHdlPtr ckkw, tMEPtr me, const PBPair & pBins,
248  const PartonPairVec& allPBins);
249 
255 
263  virtual void initGroups();
264 
272 
276  void setScale(Energy2);
277 
281  XVector & xCombs() { return theXCombs; }
282 
286  const XSVector & xSecs() const { return theXSecs; }
287 
291  XSVector & xSecs() { return theXSecs; }
292 
300  int binStrategy() const { return theBinStrategy; }
301 
302 private:
303 
307  const SubHandlerList & subProcesses() const { return theSubProcesses; }
308 
312  SubHandlerList & subProcesses() { return theSubProcesses; }
313 
314 public:
315 
321  virtual void doupdate();
322 
328  virtual void doinit();
329 
334  virtual void doinitrun();
335 
340  virtual void dofinish();
342 
349  void persistentOutput(PersistentOStream & os) const;
350 
356  void persistentInput(PersistentIStream & is, int version);
358 
362  static void Init();
363 
364 protected:
365 
372  virtual IBPtr clone() const;
373 
378  virtual IBPtr fullclone() const;
380 
385  void reject(double weight);
386 
390  tSamplerPtr sampler() { return theSampler; }
391 
395  tcSamplerPtr sampler() const { return theSampler; }
396 
397 private:
398 
409 
413  SubHandlerList theSubProcesses;
414 
418  CutsPtr theCuts;
419 
423  XVector theXCombs;
424 
429  XSVector theXSecs;
430 
439 
444  MEXMap theMEXMap;
445 
450  vector<int> theMaxDims;
451 
457 
462 
468  SamplerPtr theSampler;
469 
475 
480 
484  void setIncomingA(PDPtr);
485 
489  void setIncomingB(PDPtr);
490 
491 protected:
492 
498  class StandardEventHandlerUpdateException: public UpdateException {};
499 
504  class StandardEventHandlerInitError: public Exception {};
507 private:
508 
513 
514 };
515 
522 template <>
525  typedef EventHandler NthBase;
526 };
527 
532 template <>
534  : public ClassTraitsBase<StandardEventHandler> {
538  static string className() { return "ThePEG::StandardEventHandler"; }
539 };
540 
543 }
544 
545 #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
const StandardEventHandler & operator=(const StandardEventHandler &)
Private and non-existent assignment operator.
XSVector & xSecs()
Return the vector of cross sections.
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:509
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.
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
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.
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. ...
bool weightedEvents
True if this event handler should produce weightes events.
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.
QTY< 0, 1, 0 >::Type Energy
Energy.
Definition: Unitsystem.h:34
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...
XSVector theXSecs
The (incrementally summed) cross sections associated with the StandardXComb objects for the last sele...
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.
bool weighted() const
Return true if this event handler should produce weightes events.
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.
const XSVector & xSecs() const
Return the vector of cross sections.
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.
MEXMap theMEXMap
The map used to store all XBins with the same matrix element for option 1 in theBinStrategy.
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
int theBinStrategy
The strategy to be used when sampling different StandardXComb objects.
This template class allows the compiler to check calculations with physical quantities for dimensiona...
Definition: PhysicalQty.h:81
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.
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
vector< SubHdlPtr > SubHandlerList
A vector of SubProcessHandlers.
int binStrategy() const
Return the strategy to be used when sampling different StandardXComb objects.
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