herwig is hosted by Hepforge, IPPP Durham
Herwig  7.1.5
ShowerApproximationKernel.h
1 // -*- C++ -*-
2 //
3 // ShowerApproximationKernel.h is a part of Herwig - A multi-purpose Monte Carlo event generator
4 // Copyright (C) 2002-2017 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_ShowerApproximationKernel_H
10 #define Herwig_ShowerApproximationKernel_H
11 //
12 // This is the declaration of the ShowerApproximationKernel class.
13 //
14 
15 #include "ThePEG/Handlers/HandlerBase.h"
16 #include "ThePEG/Handlers/StandardXComb.h"
17 #include "Herwig/MatrixElement/Matchbox/Matching/ShowerApproximation.h"
18 #include "Herwig/MatrixElement/Matchbox/Phasespace/InvertedTildeKinematics.h"
19 #include "Herwig/MatrixElement/Matchbox/Dipoles/SubtractionDipole.h"
20 #include "Herwig/Sampling/exsample/exponential_generator.h"
21 
22 namespace Herwig {
23 
24 using namespace ThePEG;
25 
26 class ShowerApproximationGenerator;
27 
37 
38 public:
39 
43  struct MaxTryException {};
44 
45 public:
46 
53 
57  virtual ~ShowerApproximationKernel();
59 
60 public:
61 
65  void setBornXComb(tStdXCombPtr xc) { theBornXComb = xc; }
66 
70  tcStdXCombPtr bornCXComb() const { return theBornXComb; }
71 
75  tStdXCombPtr bornXComb() const { return theBornXComb; }
76 
80  void setRealXComb(tStdXCombPtr xc) { theRealXComb = xc; }
81 
85  tcStdXCombPtr realCXComb() const { return theRealXComb; }
86 
90  tStdXCombPtr realXComb() const { return theRealXComb; }
91 
95  void setTildeXCombs(const vector<StdXCombPtr>& xc) { theTildeXCombs = xc; }
96 
100  const vector<StdXCombPtr>& tildeXCombs() const { return theTildeXCombs; }
101 
105  void setDipole(Ptr<SubtractionDipole>::tptr dip) { theDipole = dip; }
106 
110  Ptr<SubtractionDipole>::tptr dipole() const { return theDipole; }
111 
115  void showerApproximation(Ptr<ShowerApproximation>::tptr app) { theShowerApproximation = app; }
116 
120  Ptr<ShowerApproximation>::tptr showerApproximation() const { return theShowerApproximation; }
121 
125  void showerApproximationGenerator(Ptr<ShowerApproximationGenerator>::tptr);
126 
130  Ptr<ShowerApproximationGenerator>::tptr showerApproximationGenerator() const;
131 
135  double generate();
136 
137 public:
138 
142  void ptCut(Energy pt) { dipole()->ptCut(pt); }
143 
148  int nDim() const {
149  return
150  nDimBorn() +
151  dipole()->nDimRadiation();
152  }
153 
158  int nDimBorn() const {
159  return bornCXComb()->lastRandomNumbers().size();
160  }
161 
165  const vector<bool>& sampleFlags();
166 
173  const pair<vector<double>,vector<double> >& support();
174 
179  const vector<double>& parameterPoint();
180 
186  void startPresampling();
187 
192  void stopPresampling();
193 
197  void veto(const vector<double>&, double, double) {
200  }
201 
205  void accept(const vector<double>&, double, double) {
208  }
209 
213  bool presampling() const { return thePresampling; }
214 
219  unsigned long presamplingPoints() const { return thePresamplingPoints; }
220 
225  unsigned long maxtry() const { return theMaxTry; }
226 
231  unsigned long freezeGrid() const { return theFreezeGrid; }
232 
237  void presamplingPoints(unsigned long p) { thePresamplingPoints = p; }
238 
243  void maxtry(unsigned long p) { theMaxTry = p; }
244 
249  void freezeGrid(unsigned long n) { theFreezeGrid = n; }
250 
254  double evaluate(const vector<double>&);
255 
260  int evolutionVariable() const {
261  return
262  nDimBorn() +
263  (showerApproximation()->showerInvertedTildeKinematics() ?
264  showerApproximation()->showerInvertedTildeKinematics()->evolutionVariable() :
265  dipole()->invertedTildeKinematics()->evolutionVariable());
266  }
267 
272  double evolutionCutoff() const {
273  return
274  showerApproximation()->showerInvertedTildeKinematics() ?
275  showerApproximation()->showerInvertedTildeKinematics()->evolutionCutoff() :
276  dipole()->invertedTildeKinematics()->evolutionCutoff();
277  }
278 
282  void doCompensate(bool yes = true) { theDoCompensate = yes; }
283 
284 public:
285 
288 
289  inline const vector<bool>& variable_flags () {
290  return sampleFlags();
291  }
292 
293  inline size_t evolution_variable () const { return evolutionVariable(); }
294 
295  inline double evolution_cutoff () const {
296  return evolutionCutoff();
297  }
298 
299  inline const vector<double>& parameter_point () {
300  return parameterPoint();
301  }
302 
303  inline void start_presampling () {
304  startPresampling();
305  }
306 
307  inline void stop_presampling () {
308  stopPresampling();
309  }
310 
311  inline size_t dimension () const {
312  return nDim();
313  }
314 
315  inline unsigned long presampling_points () const {
316  return presamplingPoints();
317  }
318 
320 
321 public:
322 
329  void persistentOutput(PersistentOStream & os) const;
330 
336  void persistentInput(PersistentIStream & is, int version);
338 
345  static void Init();
346 
347 protected:
348 
355  virtual IBPtr clone() const;
356 
361  virtual IBPtr fullclone() const;
363 
364 
365 // If needed, insert declarations of virtual function defined in the
366 // InterfacedBase class here (using ThePEG-interfaced-decl in Emacs).
367 
368 
369 private:
370 
374  Ptr<SubtractionDipole>::ptr theDipole;
375 
379  Ptr<ShowerApproximation>::ptr theShowerApproximation;
380 
384  StdXCombPtr theBornXComb;
385 
389  StdXCombPtr theRealXComb;
390 
394  vector<StdXCombPtr> theTildeXCombs;
395 
400 
405  unsigned long thePresamplingPoints;
406 
411  unsigned long theMaxTry;
412 
417  unsigned long theFreezeGrid;
418 
422  vector<bool> theFlags;
423 
427  pair<vector<double>,vector<double> > theSupport;
428 
432  Ptr<ShowerApproximationGenerator>::tptr theShowerApproximationGenerator;
433 
437  vector<double> theLastParameterPoint;
438 
442  vector<double> theLastBornPoint;
443 
447  typedef
450 
454  typedef
457 
462 
467 
472  ShowerApproximationKernel & operator=(const ShowerApproximationKernel &) = delete;
473 
474 };
475 
476 }
477 
478 #endif /* Herwig_ShowerApproximationKernel_H */
void setRealXComb(tStdXCombPtr xc)
Set the XComb object describing the real emission process.
vector< double > theLastParameterPoint
The last parameter point.
double evolutionCutoff() const
Return the cutoff on the evolution random number corresponding to the pt cut.
Ptr< SubtractionDipole >::ptr theDipole
The dipole in charge of the emission.
Ptr< ShowerApproximation >::tptr showerApproximation() const
Return the shower approximation.
unsigned long thePresamplingPoints
The number of points to presample this splitting generator.
tcStdXCombPtr realCXComb() const
Return the XComb object describing the real emission process.
void ptCut(Energy pt)
Set a pt cut on the dipole to generate the radiation.
exsample::exponential_generator< ShowerApproximationKernel, UseRandom > * ExponentialGeneratorPtr
Define a pointer to the Sudakov sampler.
void veto(const vector< double > &, double, double)
Indicate that a veto with the given kernel value and overestimate has occured.
unsigned long freezeGrid() const
Return the number of accepted points after which the grid should be frozen.
Exception to communicate sampler maxtry events.
void accept(const vector< double > &, double, double)
Indicate that an accept with the given kernel value and overestimate has occured. ...
ThePEG::Ptr< InterfacedBase >::pointer IBPtr
void setDipole(Ptr< SubtractionDipole >::tptr dip)
Set the dipole in charge for the emission.
unsigned long theFreezeGrid
Return the number of accepted points after which the grid should be frozen.
StdXCombPtr theRealXComb
The XComb describing the process after radiation.
ShowerApproximationKernel generates emissions according to a shower approximation entering a NLO matc...
vector< double > theLastBornPoint
The last random numbers used for Born sampling.
tStdXCombPtr realXComb() const
Return the XComb object describing the real emission process.
Ptr< ShowerApproximationGenerator >::tptr theShowerApproximationGenerator
The shower approximation generator.
Ptr< SubtractionDipole >::tptr dipole() const
Return the dipole in charge for the emission.
tcStdXCombPtr bornCXComb() const
Return the XComb object describing the Born process.
int nDim() const
Return the number of random numbers needed to sample this kernel.
void presamplingPoints(unsigned long p)
Set the number of points to presample this splitting generator.
bool thePresampling
True, if currently being presampled.
void setBornXComb(tStdXCombPtr xc)
Set the XComb object describing the Born process.
void doCompensate(bool yes=true)
True, if sampler should apply compensation.
void maxtry(unsigned long p)
Set the maximum number of trials to generate a splitting.
unsigned long presamplingPoints() const
Return the number of points to presample this splitting generator.
const vector< StdXCombPtr > & tildeXCombs() const
Return the tilde xcomb objects associated to the real xcomb.
Ptr< ShowerApproximation >::ptr theShowerApproximation
The shower approximation to consider.
ExponentialGeneratorPtr sampler
The Sudakov sampler.
pair< vector< double >, vector< double > > theSupport
The support.
void showerApproximation(Ptr< ShowerApproximation >::tptr app)
Set the shower approximation.
exsample::exponential_generator< ShowerApproximationKernel, UseRandom > ExponentialGenerator
Define the Sudakov sampler.
void freezeGrid(unsigned long n)
Set the number of accepted points after which the grid should be frozen.
pair< double, double > generate(const Generator< Density > &gen, double r)
Generate a random variable and return its weight.
vector< bool > theFlags
The sampling flags.
void setTildeXCombs(const vector< StdXCombPtr > &xc)
Set the tilde xcomb objects associated to the real xcomb.
int nDimBorn() const
Return the number of random numbers needed to sample the Born process.
unsigned long maxtry() const
Return the maximum number of trials to generate a splitting.
-*- C++ -*-
unsigned long theMaxTry
The maximum number of trials to generate a splitting.
bool presampling() const
Return true, if currently being presampled.
int evolutionVariable() const
Return the index of the random number corresponding to the evolution variable.
tStdXCombPtr bornXComb() const
Return the XComb object describing the Born process.
bool theDoCompensate
True, if sampler should apply compensation.
StdXCombPtr theBornXComb
The XComb off which radiation will be generated.
vector< StdXCombPtr > theTildeXCombs
The tilde xcomb objects associated to the real xcomb.