herwig is hosted by Hepforge, IPPP Durham
Herwig 7.3.0
ShowerApproximationKernel.h
1// -*- C++ -*-
2//
3// ShowerApproximationKernel.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_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
22namespace Herwig {
23
24using namespace ThePEG;
25
26class ShowerApproximationGenerator;
27
37
38public:
39
43 struct MaxTryException {};
44
45public:
46
51
52public:
53
57 void setBornXComb(tStdXCombPtr xc) { theBornXComb = xc; }
58
62 tcStdXCombPtr bornCXComb() const { return theBornXComb; }
63
67 tStdXCombPtr bornXComb() const { return theBornXComb; }
68
72 void setRealXComb(tStdXCombPtr xc) { theRealXComb = xc; }
73
77 tcStdXCombPtr realCXComb() const { return theRealXComb; }
78
82 tStdXCombPtr realXComb() const { return theRealXComb; }
83
87 void setTildeXCombs(const vector<StdXCombPtr>& xc) { theTildeXCombs = xc; }
88
92 const vector<StdXCombPtr>& tildeXCombs() const { return theTildeXCombs; }
93
97 void setDipole(Ptr<SubtractionDipole>::tptr dip) { theDipole = dip; }
98
102 Ptr<SubtractionDipole>::tptr dipole() const { return theDipole; }
103
107 void showerApproximation(Ptr<ShowerApproximation>::tptr app) { theShowerApproximation = app; }
108
112 Ptr<ShowerApproximation>::tptr showerApproximation() const { return theShowerApproximation; }
113
117 void showerApproximationGenerator(Ptr<ShowerApproximationGenerator>::tptr);
118
122 Ptr<ShowerApproximationGenerator>::tptr showerApproximationGenerator() const;
123
127 double generate();
128
129public:
130
134 void ptCut(Energy pt) { dipole()->ptCut(pt); }
135
140 int nDim() const {
141 return
142 nDimBorn() +
143 dipole()->nDimRadiation();
144 }
145
150 int nDimBorn() const {
151 return bornCXComb()->lastRandomNumbers().size();
152 }
153
157 const vector<bool>& sampleFlags();
158
165 const pair<vector<double>,vector<double> >& support();
166
171 const vector<double>& parameterPoint();
172
179
185
189 void veto(const vector<double>&, double, double) {
192 }
193
197 void accept(const vector<double>&, double, double) {
200 }
201
205 bool presampling() const { return thePresampling; }
206
211 unsigned long presamplingPoints() const { return thePresamplingPoints; }
212
217 unsigned long maxtry() const { return theMaxTry; }
218
223 unsigned long freezeGrid() const { return theFreezeGrid; }
224
229 void presamplingPoints(unsigned long p) { thePresamplingPoints = p; }
230
235 void maxtry(unsigned long p) { theMaxTry = p; }
236
241 void freezeGrid(unsigned long n) { theFreezeGrid = n; }
242
246 double evaluate(const vector<double>&);
247
252 int evolutionVariable() const {
253 return
254 nDimBorn() +
255 (showerApproximation()->showerInvertedTildeKinematics() ?
256 showerApproximation()->showerInvertedTildeKinematics()->evolutionVariable() :
257 dipole()->invertedTildeKinematics()->evolutionVariable());
258 }
259
264 double evolutionCutoff() const {
265 return
266 showerApproximation()->showerInvertedTildeKinematics() ?
267 showerApproximation()->showerInvertedTildeKinematics()->evolutionCutoff() :
268 dipole()->invertedTildeKinematics()->evolutionCutoff();
269 }
270
274 void doCompensate(bool yes = true) { theDoCompensate = yes; }
275
276public:
277
280
281 inline const vector<bool>& variable_flags () {
282 return sampleFlags();
283 }
284
285 inline size_t evolution_variable () const { return evolutionVariable(); }
286
287 inline double evolution_cutoff () const {
288 return evolutionCutoff();
289 }
290
291 inline const vector<double>& parameter_point () {
292 return parameterPoint();
293 }
294
295 inline void start_presampling () {
297 }
298
299 inline void stop_presampling () {
301 }
302
303 inline size_t dimension () const {
304 return nDim();
305 }
306
307 inline unsigned long presampling_points () const {
308 return presamplingPoints();
309 }
310
312
313public:
314
322
328 void persistentInput(PersistentIStream & is, int version);
330
337 static void Init();
338
339protected:
340
347 virtual IBPtr clone() const;
348
353 virtual IBPtr fullclone() const;
355
356
357// If needed, insert declarations of virtual function defined in the
358// InterfacedBase class here (using ThePEG-interfaced-decl in Emacs).
359
360
361private:
362
366 Ptr<SubtractionDipole>::ptr theDipole;
367
371 Ptr<ShowerApproximation>::ptr theShowerApproximation;
372
376 StdXCombPtr theBornXComb;
377
381 StdXCombPtr theRealXComb;
382
386 vector<StdXCombPtr> theTildeXCombs;
387
392
397 unsigned long thePresamplingPoints;
398
403 unsigned long theMaxTry;
404
409 unsigned long theFreezeGrid;
410
414 vector<bool> theFlags;
415
419 pair<vector<double>,vector<double> > theSupport;
420
424 Ptr<ShowerApproximationGenerator>::tptr theShowerApproximationGenerator;
425
429 vector<double> theLastParameterPoint;
430
434 vector<double> theLastBornPoint;
435
439 typedef
442
446 typedef
449
454
459
465
466};
467
468}
469
470#endif /* Herwig_ShowerApproximationKernel_H */
ShowerApproximationKernel generates emissions according to a shower approximation entering a NLO matc...
exsample::exponential_generator< ShowerApproximationKernel, UseRandom > ExponentialGenerator
Define the Sudakov sampler.
tcStdXCombPtr bornCXComb() const
Return the XComb object describing the Born process.
ShowerApproximationKernel & operator=(const ShowerApproximationKernel &)=delete
The assignment operator is private and must never be called.
void ptCut(Energy pt)
Set a pt cut on the dipole to generate the radiation.
void setBornXComb(tStdXCombPtr xc)
Set the XComb object describing the Born process.
vector< StdXCombPtr > theTildeXCombs
The tilde xcomb objects associated to the real xcomb.
const vector< StdXCombPtr > & tildeXCombs() const
Return the tilde xcomb objects associated to the real xcomb.
Ptr< SubtractionDipole >::tptr dipole() const
Return the dipole in charge for the emission.
StdXCombPtr theBornXComb
The XComb off which radiation will be generated.
tStdXCombPtr realXComb() const
Return the XComb object describing the real emission process.
void veto(const vector< double > &, double, double)
Indicate that a veto with the given kernel value and overestimate has occured.
void startPresampling()
Indicate that presampling of this kernel will be performed in the next calls to evaluate until stopPr...
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
pair< vector< double >, vector< double > > theSupport
The support.
void showerApproximation(Ptr< ShowerApproximation >::tptr app)
Set the shower approximation.
void doCompensate(bool yes=true)
True, if sampler should apply compensation.
int nDim() const
Return the number of random numbers needed to sample this kernel.
exsample::exponential_generator< ShowerApproximationKernel, UseRandom > * ExponentialGeneratorPtr
Define a pointer to the Sudakov sampler.
Ptr< ShowerApproximation >::tptr showerApproximation() const
Return the shower approximation.
const vector< double > & parameterPoint()
Return the parameter point associated to the splitting previously supplied through fixParameters.
Ptr< ShowerApproximation >::ptr theShowerApproximation
The shower approximation to consider.
void accept(const vector< double > &, double, double)
Indicate that an accept with the given kernel value and overestimate has occured.
void setRealXComb(tStdXCombPtr xc)
Set the XComb object describing the real emission process.
tcStdXCombPtr realCXComb() const
Return the XComb object describing the real emission process.
StdXCombPtr theRealXComb
The XComb describing the process after radiation.
vector< bool > theFlags
The sampling flags.
vector< double > theLastParameterPoint
The last parameter point.
const vector< bool > & sampleFlags()
Flag, which variables are free variables.
bool theDoCompensate
True, if sampler should apply compensation.
unsigned long freezeGrid() const
Return the number of accepted points after which the grid should be frozen.
vector< double > theLastBornPoint
The last random numbers used for Born sampling.
unsigned long theMaxTry
The maximum number of trials to generate a splitting.
void setTildeXCombs(const vector< StdXCombPtr > &xc)
Set the tilde xcomb objects associated to the real xcomb.
unsigned long thePresamplingPoints
The number of points to presample this splitting generator.
Ptr< ShowerApproximationGenerator >::tptr showerApproximationGenerator() const
Return the shower approximation generator.
int evolutionVariable() const
Return the index of the random number corresponding to the evolution variable.
Ptr< SubtractionDipole >::ptr theDipole
The dipole in charge of the emission.
double generate()
Generate the next emission.
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
tStdXCombPtr bornXComb() const
Return the XComb object describing the Born process.
void maxtry(unsigned long p)
Set the maximum number of trials to generate a splitting.
double evolutionCutoff() const
Return the cutoff on the evolution random number corresponding to the pt cut.
unsigned long theFreezeGrid
Return the number of accepted points after which the grid should be frozen.
unsigned long presamplingPoints() const
Return the number of points to presample this splitting generator.
unsigned long maxtry() const
Return the maximum number of trials to generate a splitting.
const pair< vector< double >, vector< double > > & support()
Return the support of the splitting kernel.
void showerApproximationGenerator(Ptr< ShowerApproximationGenerator >::tptr)
Set the shower approximation generator.
void setDipole(Ptr< SubtractionDipole >::tptr dip)
Set the dipole in charge for the emission.
int nDimBorn() const
Return the number of random numbers needed to sample the Born process.
virtual IBPtr clone() const
Make a simple clone of this object.
ExponentialGeneratorPtr sampler
The Sudakov sampler.
void stopPresampling()
Indicate that presampling of this kernel is done until startPresampling() is called.
static void Init()
The standard Init function used to initialize the interfaces.
Ptr< ShowerApproximationGenerator >::tptr theShowerApproximationGenerator
The shower approximation generator.
void presamplingPoints(unsigned long p)
Set the number of points to presample this splitting generator.
void freezeGrid(unsigned long n)
Set the number of accepted points after which the grid should be frozen.
ShowerApproximationKernel()
The default constructor.
double evaluate(const vector< double > &)
Evalute the splitting kernel.
bool thePresampling
True, if currently being presampled.
bool presampling() const
Return true, if currently being presampled.
The generator for sudakov-type distributions.
-*- C++ -*-
ThePEG::Ptr< InterfacedBase >::pointer IBPtr
Exception to communicate sampler maxtry events.