herwig is hosted by Hepforge, IPPP Durham
Herwig 7.3.0
DipoleSplittingGenerator.h
1// -*- C++ -*-
2//
3// DipoleSplittingGenerator.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_DipoleSplittingGenerator_H
10#define HERWIG_DipoleSplittingGenerator_H
11//
12// This is the declaration of the DipoleSplittingGenerator class.
13//
14
15#include "ThePEG/Handlers/HandlerBase.h"
16
17#include "Herwig/Shower/Dipole/Kernels/DipoleSplittingKernel.h"
18#include "DipoleSplittingReweight.h"
19#include "Herwig/Shower/Dipole/Utility/DipoleMCCheck.h"
20#include "Herwig/Sampling/exsample/exponential_generator.h"
21
22#include <tuple>
23
24namespace Herwig {
25
26using namespace ThePEG;
27
39
40public:
41
48
54
55public:
56
60 Ptr<DipoleSplittingKernel>::tptr splittingKernel() const;
61
65 Ptr<DipoleSplittingReweight>::tptr splittingReweight() const;
66
70 Ptr<DipoleSplittingKinematics>::tptr splittingKinematics() const;
71
75 void splittingKernel(Ptr<DipoleSplittingKernel>::tptr sp);
76
80 void splittingReweight(Ptr<DipoleSplittingReweight>::tptr sp);
81
85 void wrap(Ptr<DipoleSplittingGenerator>::ptr other);
86
91 bool wrapping() const { return theOtherGenerator; }
92
93public:
94
99
104
111 map<string,double>& variations,
112 Energy optHardPt = ZERO,
113 Energy optCutoff = ZERO);
114
122 map<string,double>& variations,
123 Energy optHardPt = ZERO,
124 Energy optCutoff = ZERO);
125
130
135
136
138 double sudakov(const DipoleSplittingInfo&,Energy down);
140 double dosudakov(const DipoleSplittingInfo&,Energy down);
142 double wrappedSudakov(DipoleSplittingInfo& split,Energy down);
144 double sudakovExpansion(const DipoleSplittingInfo&,Energy down,Energy fixedScale);
146 double dosudakovExpansion(const DipoleSplittingInfo&,Energy down,Energy fixedScale);
148 double wrappedSudakovExpansion(DipoleSplittingInfo& split,Energy down,Energy fixedScale);
149
153 void doPartialUnweighting(double wref) {
154 partialUnweighting = true;
155 theReferenceWeight = wref;
156 }
157
158public:
159
164 void debugGenerator(ostream&) const;
165
170 void debugLastEvent(ostream&) const;
171
172protected:
173
178 Energy optHardPt = ZERO);
179
185 void doGenerate(map<string,double>& variations,
186 Energy optCutoff = ZERO);
187
188public:
189
194 int nDim() const;
195
199 const vector<bool>& sampleFlags();
200
207 const pair<vector<double>,vector<double> >& support();
208
213 const vector<double>& parameterPoint() const { return parameters; }
214
221
227
232 unsigned long presamplingPoints() const { return splittingKernel()->presamplingPoints(); }
233
238 unsigned long maxtry() const { return splittingKernel()->maxtry(); }
239
244 unsigned long freezeGrid() const { return splittingKernel()->freezeGrid(); }
245
249 double detuning() const { return splittingKernel()->detuning(); }
250
256 bool haveOverestimate() const;
257
261 double overestimate(const vector<double>&);
262
267 double invertOverestimateIntegral(double) const;
268
272 double evaluate(const vector<double>&);
273
277 void veto(const vector<double>&, double p, double r);
278
282 void accept(const vector<double>&, double p, double r);
283
287 double splittingWeight() const {
288 if ( wrapping() )
289 return theOtherGenerator->splittingWeight();
290 return theSplittingWeight;
291 }
292
296 void doCompensate(bool yes = true) { theDoCompensate = yes; }
297
301 vector<std::tuple<Energy,double,bool> > splittingWeightVector() const {
302 if ( wrapping() )
303 return theOtherGenerator->splittingWeightVector();
305 }
306
307public:
308
311
312 inline const vector<bool>& variable_flags () {
313 return sampleFlags();
314 }
315
316 inline size_t evolution_variable () const { return 0; }
317
318 inline double evolution_cutoff () { return support().first[0]; }
319
320 inline const vector<double>& parameter_point () const {
321 return parameterPoint();
322 }
323
324 inline void start_presampling () {
326 }
327
328 inline void stop_presampling () {
330 }
331
332 inline size_t dimension () const {
333 return nDim();
334 }
335
336 inline unsigned long presampling_points () const {
337 return presamplingPoints();
338 }
339
341
342public:
343
351
357 void persistentInput(PersistentIStream & is, int version);
359
366 static void Init();
367
368protected:
369
376 virtual IBPtr clone() const;
377
382 virtual IBPtr fullclone() const;
384
385
386// If needed, insert declarations of virtual function defined in the
387// InterfacedBase class here (using ThePEG-interfaced-decl in Emacs).
388
389private:
390
394 Ptr<DipoleSplittingGenerator>::ptr theOtherGenerator;
395
400 Ptr<DipoleSplittingKernel>::ptr theSplittingKernel;
401
405 Ptr<DipoleSplittingReweight>::ptr theSplittingReweight;
406
412
417
423
429
435
439 vector<double> parameters;
440
444 vector<bool> theFlags;
445
449 pair<vector<double>,vector<double> > theSupport;
450
454 Ptr<DipoleMCCheck>::ptr theMCCheck;
455
460
464 map<string,double> currentWeights;
465
470
471
476
483
487 bool partialUnweighting = false;
488
493 vector<std::tuple<Energy,double,bool> > theSplittingWeightVector;
494
495private:
496
502
508
509};
510
511}
512
513#include "ThePEG/Utilities/ClassTraits.h"
514
515namespace ThePEG {
516
521template <>
522struct BaseClassTrait<Herwig::DipoleSplittingGenerator,1> {
524 typedef HandlerBase NthBase;
525};
526
529template <>
530struct ClassTraits<Herwig::DipoleSplittingGenerator>
531 : public ClassTraitsBase<Herwig::DipoleSplittingGenerator> {
533 static string className() { return "Herwig::DipoleSplittingGenerator"; }
541 static string library() { return "HwDipoleShower.so"; }
542};
543
546}
547
548#endif /* HERWIG_DipoleSplittingGenerator_H */
DipoleSplittingGenerator is used by the dipole shower to sample splittings from a given dipole splitt...
Ptr< DipoleSplittingKernel >::tptr splittingKernel() const
Return the dipole splitting kernel.
void debugLastEvent(ostream &) const
Print debug information on the last generated event.
double evaluate(const vector< double > &)
Evalute the splitting kernel.
const vector< double > & parameterPoint() const
Return the parameter point associated to the splitting previously supplied through fixParameters.
vector< bool > theFlags
The sampling flags.
double splittingWeight() const
Return the weight associated to the currently generated splitting.
void resetVariations()
Reset the current variations to one.
Ptr< DipoleSplittingReweight >::tptr splittingReweight() const
Return the dipole splitting reweight.
void stopPresampling()
Indicate that presampling of this kernel is done until startPresampling() is called.
Ptr< DipoleSplittingKernel >::ptr theSplittingKernel
The dipole splitting kernel to sample splitting from.
static ClassDescription< DipoleSplittingGenerator > initDipoleSplittingGenerator
The static object used to initialize the description of this class.
void accept(const vector< double > &, double p, double r)
Indicate that an accept with the given kernel value and overestimate has occured.
double overestimate(const vector< double > &)
Return an overestimate to the sampled kernel.
void prepare(const DipoleSplittingInfo &)
Prepare to fill the given splitting.
void fixParameters(const DipoleSplittingInfo &, Energy optHardPt=ZERO)
Update parameters given a splitting.
Energy generate(const DipoleSplittingInfo &, map< string, double > &variations, Energy optHardPt=ZERO, Energy optCutoff=ZERO)
Fix parameters from the given DipoleSplittingInfo and generate the next splitting.
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
unsigned long freezeGrid() const
Return the number of accepted points after which the grid should be frozen.
void doCompensate(bool yes=true)
True, if sampler should apply compensation.
bool haveOverestimate() const
Return true, if this splitting generator is able to deliver an overestimate to the sampled kernel.
bool prepared
True, if prepared to sample splittings of a given kind.
void doPartialUnweighting(double wref)
Turn on partial unweighting and set the reference weight.
void startPresampling()
Indicate that presampling of this kernel will be performed in the next calls to evaluate until stopPr...
Ptr< DipoleSplittingGenerator >::ptr theOtherGenerator
Pointer to another generator to wrap around.
Ptr< DipoleSplittingReweight >::ptr theSplittingReweight
The dipole splitting reweight.
double theSplittingWeight
The weight associated to the currently generated splitting.
virtual IBPtr clone() const
Make a simple clone of this object.
unsigned long maxtry() const
Return the maximum number of trials to generate a splitting.
double wrappedSudakovExpansion(DipoleSplittingInfo &split, Energy down, Energy fixedScale)
wrapper for sudakovExpansion
double theSudakovAccuracy
Sudakov sampling accuracy.
double dosudakovExpansion(const DipoleSplittingInfo &, Energy down, Energy fixedScale)
do the actual calculation for the sudakov expansion.
bool wrapping() const
Return true, if this is actually a wrapper around another splitting generator.
Ptr< DipoleSplittingKinematics >::tptr splittingKinematics() const
Return the dipole splitting kinematics.
double sudakov(const DipoleSplittingInfo &, Energy down)
Sample the Sudakov in monte carlo fashion.
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
void doGenerate(map< string, double > &variations, Energy optCutoff=ZERO)
With the parameters previuosly supplied through fixParameters generate the next splitting.
double sudakovExpansion(const DipoleSplittingInfo &, Energy down, Energy fixedScale)
Sample the Sudakov exponent for sudakovExpansion weights.
bool theDoCompensate
True, if sampler should apply compensation.
Energy generateWrapped(DipoleSplittingInfo &, map< string, double > &variations, Energy optHardPt=ZERO, Energy optCutoff=ZERO)
Fix parameters from the fiven DipoleSplittingInfo and generate the next splitting.
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
Ptr< DipoleMCCheck >::ptr theMCCheck
Pointer to a check histogram object.
unsigned long presamplingPoints() const
Return the number of points to presample this splitting generator.
const vector< bool > & sampleFlags()
Flag, which variables are free variables.
void wrap(Ptr< DipoleSplittingGenerator >::ptr other)
Make a wrapper around another generator.
vector< std::tuple< Energy, double, bool > > theSplittingWeightVector
The scale, weight and a bool for all veto steps and the accept step.
map< string, double > currentWeights
The currently used weight map.
void completeSplitting(DipoleSplittingInfo &) const
Complete the given splitting.
pair< vector< double >, vector< double > > theSupport
The support.
void splittingReweight(Ptr< DipoleSplittingReweight >::tptr sp)
Set the dipole splitting reweight.
const pair< vector< double >, vector< double > > & support()
Return the support of the splitting kernel.
vector< double > parameters
The parameter point.
double wrappedSudakov(DipoleSplittingInfo &split, Energy down)
wrapper for sudakovExpansion for identical dipoles.
double detuning() const
Return the detuning factor applied to the sampling overestimate kernel.
void veto(const vector< double > &, double p, double r)
Indicate that a veto with the given kernel value and overestimate has occured.
vector< std::tuple< Energy, double, bool > > splittingWeightVector() const
Return the weight vector associated to the currently generated splitting.
double invertOverestimateIntegral(double) const
Invert the integral over the overestimate to equal the given value.
DipoleSplittingGenerator & operator=(const DipoleSplittingGenerator &)=delete
The assignment operator is private and must never be called.
void debugGenerator(ostream &) const
Print debug information on the splitting handled.
const DipoleSplittingInfo & lastSplitting() const
Return the last generated splitting.
bool partialUnweighting
Flag for partial unweighting.
bool presampling
Wether or not the kernel is currently being presampled.
DipoleSplittingGenerator()
The default constructor.
DipoleSplittingInfo generatedSplitting
The dipole splitting to be completed.
void splittingKernel(Ptr< DipoleSplittingKernel >::tptr sp)
Set the dipole splitting kernel.
double theReferenceWeight
Reference weight to improve convergence for subleading Nc corrections (by reducing time spent on even...
exsample::exponential_generator< DipoleSplittingGenerator, UseRandom > * theExponentialGenerator
Pointer to the exponential generator.
static void Init()
The standard Init function used to initialize the interfaces.
DipoleSplittingInfo presampledSplitting
A backup of the dipole splitting to be completed, if this generator is presampled.
virtual ~DipoleSplittingGenerator()
The destructor.
int nDim() const
Return the number of random numbers needed to sample this kernel.
double dosudakov(const DipoleSplittingInfo &, Energy down)
do the actiual calculation of the sudakov exponent.
DipoleSplittingInfo contains all parameters to generate a full dipole splitting.
The generator for sudakov-type distributions.
-*- C++ -*-
ThePEG::Ptr< InterfacedBase >::pointer IBPtr
constexpr ZeroUnit ZERO
static string className()
static string library()