herwig is hosted by Hepforge, IPPP Durham
Herwig  7.2.1
ProcessHandler.h
1 // -*- C++ -*-
2 //
3 // ProcessHandler.h is a part of Herwig - A multi-purpose Monte Carlo event generator
4 // Copyright (C) 2002-2019 The Herwig Collaboration
5 //
6 // Herwig 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 HERWIG_ProcessHandler_H
10 #define HERWIG_ProcessHandler_H
11 //
12 // This is the declaration of the ProcessHandler class.
13 //
14 #include "ThePEG/Interface/Interfaced.h"
15 #include "ThePEG/Handlers/StandardEventHandler.h"
16 #include "ThePEG/Handlers/StandardXComb.h"
17 #include "ThePEG/Handlers/SubProcessHandler.h"
18 #include "ThePEG/Handlers/LuminosityFunction.h"
19 #include "ThePEG/Repository/EventGenerator.h"
20 #include "ThePEG/Handlers/SamplerBase.h"
21 #include "ThePEG/Cuts/Cuts.h"
22 #include "ThePEG/MatrixElement/MEBase.h"
23 #include "ThePEG/Handlers/CascadeHandler.h"
24 
25 #include <cassert>
26 
27 #include "ProcessHandler.fh"
28 #include "stat.h"
29 
30 namespace Herwig {
31 using namespace ThePEG;
32 
48 class ProcessHandler: public Interfaced, public LastXCombInfo<> {
49 
50 public:
51 
54 
56  typedef vector<StdXCombPtr> XVector;
57 
59  typedef vector<CrossSection> XSVector;
60 
63  typedef map<tMEPtr,XVector> MEXMap;
64 
65 public:
66 
73 
78 
82  virtual ~ProcessHandler();
84 
85 public:
86 
89 
94  inline tStdXCombPtr generate();
96 
97 
104  void persistentOutput(PersistentOStream & os) const;
105 
111  void persistentInput(PersistentIStream & is, int version);
113 
120  static void Init();
121 
126  void initialize(tSubHdlPtr sub, tCutsPtr cuts, tEHPtr eh);
127 
131  CrossSection integratedXSec() const;
132 
137  void statistics(ostream &, Stat &) const;
138 
146  virtual CrossSection dSigDR(const vector<double> & r);
147 
148 
151 
157  inline int statLevel() const;
158 
162  inline const cPDPair & incoming() const;
163 
167  inline const LuminosityFunction & lumiFn() const;
168 
173  inline int lumiDim() const;
174 
179  int nBins() const;
180 
185  inline int maxDim(int bin) const;
186 
191  inline int nDim(int bin) const;
192 
197  inline long maxLoop() const;
198 
199 
200 protected:
201 
215  virtual CrossSection dSigDR(const pair<double,double> ll, Energy2 maxS,
216  int ibin, int nr, const double * r);
217 
218 
224  tStdXCombPtr select(int bin, double weight);
225 
238  void addME(Energy maxEnergy, tSubHdlPtr sub, tPExtrPtr extractor, tCutsPtr cuts,
239  tCascHdlPtr ckkw, tMEPtr me, const PBPair & pBins);
240 
244  inline const XVector & xCombs() const;
245 
249  inline XVector & xCombs();
250 
254  inline const XSVector & xSecs() const;
255 
259  inline XSVector & xSecs();
260 
268  inline int binStrategy() const;
269 
270 
277  inline virtual IBPtr clone() const;
278 
283  inline virtual IBPtr fullclone() const;
285 
286 private:
287 
296  inline tEHPtr eventHandler() const;
297 
301  inline tSamplerPtr sampler();
302 
306  inline tcSamplerPtr sampler() const;
307 
313  inline tCutsPtr cuts() const;
314 
318  inline tSubHdlPtr subProcess();
319 
320 
321 protected:
322 
329  virtual void doinitrun();
330 
332 
333 private:
334 
339  ProcessHandler & operator=(const ProcessHandler &) = delete;
340 
345  SamplerPtr theSampler;
346 
354 
358  tCutsPtr theCuts;//used a transient pointer,
359  //because regular pointer is already in MPIHandler
360 
361 
365  tSubHdlPtr theSubProcess;//used a transient pointer,
366  //because regular pointer is already in MPIHandler
367 
371  XVector theXCombs;
372 
377  XSVector theXSecs;
378 
387 
392  MEXMap theMEXMap;
393 
394 
399  vector<int> theMaxDims;
400 
401 
402 
403 protected:
404 
412  class InitError: public Exception {};
413 
416 };
417 
418 }
419 
420 #include "ProcessHandler.icc"
421 
422 #endif /* HERWIG_ProcessHandler_H */
tSubHdlPtr theSubProcess
The SubProcessHandler that is connected to this ProcessHandler.
XSVector theXSecs
The (incrementally summed) cross sections associated with the StandardXComb objects for the last sele...
ThePEG::Ptr< InterfacedBase >::pointer IBPtr
Documentation for the statistics struct.
Definition: stat.h:18
vector< CrossSection > XSVector
A vector of cross sections.
map< tMEPtr, XVector > MEXMap
Map of pointers to StandardXComb objects indexed by pointers to the corresponding MEBase object...
XVector theXCombs
The StandardXComb objects.
ThePEG::Ptr< EventHandler >::transient_pointer tEHPtr
ThePEG::Ptr< CascadeHandler >::transient_pointer tCascHdlPtr
vector< int > theMaxDims
The number of degrees of freedom needed to generate the phase space for the different bins...
int theBinStrategy
The strategy to be used when sampling different StandardXComb objects.
Selector< StdXCombPtr > XSelector
A weighted list of pointers to StandardXComb objects.
pair< double, double > generate(const Generator< Density > &gen, double r)
Generate a random variable and return its weight.
tCutsPtr theCuts
The kinematical cuts used for this collision handler.
MEXMap theMEXMap
The map used to store all XBins with the same matrix element for option 1 in theBinStrategy.
-*- C++ -*-
This class is for handling the sampling of semi hard partonic interactions.
pair< cPDPtr, cPDPtr > cPDPair
vector< StdXCombPtr > XVector
A vector of pointers to StandardXComb objects.
tEHPtr theHandler
A pointer to the EventHandler that calls us.
SamplerPtr theSampler
The phase space sampler responsible for generating phase space points according to the cross section ...
ThePEG::Ptr< PartonExtractor >::transient_pointer tPExtrPtr