File indexing completed on 2026-08-06 09:24:13
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef Herwig_ShowerApproximationKernel_H
0010 #define Herwig_ShowerApproximationKernel_H
0011
0012
0013
0014
0015 #include "ThePEG/Handlers/HandlerBase.h"
0016 #include "ThePEG/Handlers/StandardXComb.h"
0017 #include "Herwig/MatrixElement/Matchbox/Matching/ShowerApproximation.h"
0018 #include "Herwig/MatrixElement/Matchbox/Phasespace/InvertedTildeKinematics.h"
0019 #include "Herwig/MatrixElement/Matchbox/Dipoles/SubtractionDipole.h"
0020 #include "Herwig/Sampling/exsample/exponential_generator.h"
0021
0022 namespace Herwig {
0023
0024 using namespace ThePEG;
0025
0026 class ShowerApproximationGenerator;
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 class ShowerApproximationKernel: public HandlerBase {
0037
0038 public:
0039
0040
0041
0042
0043 struct MaxTryException {};
0044
0045 public:
0046
0047
0048
0049
0050 ShowerApproximationKernel();
0051
0052 public:
0053
0054
0055
0056
0057 void setBornXComb(tStdXCombPtr xc) { theBornXComb = xc; }
0058
0059
0060
0061
0062 tcStdXCombPtr bornCXComb() const { return theBornXComb; }
0063
0064
0065
0066
0067 tStdXCombPtr bornXComb() const { return theBornXComb; }
0068
0069
0070
0071
0072 void setRealXComb(tStdXCombPtr xc) { theRealXComb = xc; }
0073
0074
0075
0076
0077 tcStdXCombPtr realCXComb() const { return theRealXComb; }
0078
0079
0080
0081
0082 tStdXCombPtr realXComb() const { return theRealXComb; }
0083
0084
0085
0086
0087 void setTildeXCombs(const vector<StdXCombPtr>& xc) { theTildeXCombs = xc; }
0088
0089
0090
0091
0092 const vector<StdXCombPtr>& tildeXCombs() const { return theTildeXCombs; }
0093
0094
0095
0096
0097 void setDipole(Ptr<SubtractionDipole>::tptr dip) { theDipole = dip; }
0098
0099
0100
0101
0102 Ptr<SubtractionDipole>::tptr dipole() const { return theDipole; }
0103
0104
0105
0106
0107 void showerApproximation(Ptr<ShowerApproximation>::tptr app) { theShowerApproximation = app; }
0108
0109
0110
0111
0112 Ptr<ShowerApproximation>::tptr showerApproximation() const { return theShowerApproximation; }
0113
0114
0115
0116
0117 void showerApproximationGenerator(Ptr<ShowerApproximationGenerator>::tptr);
0118
0119
0120
0121
0122 Ptr<ShowerApproximationGenerator>::tptr showerApproximationGenerator() const;
0123
0124
0125
0126
0127 double generate();
0128
0129 public:
0130
0131
0132
0133
0134 void ptCut(Energy pt) { dipole()->ptCut(pt); }
0135
0136
0137
0138
0139
0140 int nDim() const {
0141 return
0142 nDimBorn() +
0143 dipole()->nDimRadiation();
0144 }
0145
0146
0147
0148
0149
0150 int nDimBorn() const {
0151 return bornCXComb()->lastRandomNumbers().size();
0152 }
0153
0154
0155
0156
0157 const vector<bool>& sampleFlags();
0158
0159
0160
0161
0162
0163
0164
0165 const pair<vector<double>,vector<double> >& support();
0166
0167
0168
0169
0170
0171 const vector<double>& parameterPoint();
0172
0173
0174
0175
0176
0177
0178 void startPresampling();
0179
0180
0181
0182
0183
0184 void stopPresampling();
0185
0186
0187
0188
0189 void veto(const vector<double>&, double, double) {
0190
0191
0192 }
0193
0194
0195
0196
0197 void accept(const vector<double>&, double, double) {
0198
0199
0200 }
0201
0202
0203
0204
0205 bool presampling() const { return thePresampling; }
0206
0207
0208
0209
0210
0211 unsigned long presamplingPoints() const { return thePresamplingPoints; }
0212
0213
0214
0215
0216
0217 unsigned long maxtry() const { return theMaxTry; }
0218
0219
0220
0221
0222
0223 unsigned long freezeGrid() const { return theFreezeGrid; }
0224
0225
0226
0227
0228
0229 void presamplingPoints(unsigned long p) { thePresamplingPoints = p; }
0230
0231
0232
0233
0234
0235 void maxtry(unsigned long p) { theMaxTry = p; }
0236
0237
0238
0239
0240
0241 void freezeGrid(unsigned long n) { theFreezeGrid = n; }
0242
0243
0244
0245
0246 double evaluate(const vector<double>&);
0247
0248
0249
0250
0251
0252 int evolutionVariable() const {
0253 return
0254 nDimBorn() +
0255 (showerApproximation()->showerInvertedTildeKinematics() ?
0256 showerApproximation()->showerInvertedTildeKinematics()->evolutionVariable() :
0257 dipole()->invertedTildeKinematics()->evolutionVariable());
0258 }
0259
0260
0261
0262
0263
0264 double evolutionCutoff() const {
0265 return
0266 showerApproximation()->showerInvertedTildeKinematics() ?
0267 showerApproximation()->showerInvertedTildeKinematics()->evolutionCutoff() :
0268 dipole()->invertedTildeKinematics()->evolutionCutoff();
0269 }
0270
0271
0272
0273
0274 void doCompensate(bool yes = true) { theDoCompensate = yes; }
0275
0276 public:
0277
0278
0279
0280
0281 inline const vector<bool>& variable_flags () {
0282 return sampleFlags();
0283 }
0284
0285 inline size_t evolution_variable () const { return evolutionVariable(); }
0286
0287 inline double evolution_cutoff () const {
0288 return evolutionCutoff();
0289 }
0290
0291 inline const vector<double>& parameter_point () {
0292 return parameterPoint();
0293 }
0294
0295 inline void start_presampling () {
0296 startPresampling();
0297 }
0298
0299 inline void stop_presampling () {
0300 stopPresampling();
0301 }
0302
0303 inline size_t dimension () const {
0304 return nDim();
0305 }
0306
0307 inline unsigned long presampling_points () const {
0308 return presamplingPoints();
0309 }
0310
0311
0312
0313 public:
0314
0315
0316
0317
0318
0319
0320
0321 void persistentOutput(PersistentOStream & os) const;
0322
0323
0324
0325
0326
0327
0328 void persistentInput(PersistentIStream & is, int version);
0329
0330
0331
0332
0333
0334
0335
0336
0337 static void Init();
0338
0339 protected:
0340
0341
0342
0343
0344
0345
0346
0347 virtual IBPtr clone() const;
0348
0349
0350
0351
0352
0353 virtual IBPtr fullclone() const;
0354
0355
0356
0357
0358
0359
0360
0361 private:
0362
0363
0364
0365
0366 Ptr<SubtractionDipole>::ptr theDipole;
0367
0368
0369
0370
0371 Ptr<ShowerApproximation>::ptr theShowerApproximation;
0372
0373
0374
0375
0376 StdXCombPtr theBornXComb;
0377
0378
0379
0380
0381 StdXCombPtr theRealXComb;
0382
0383
0384
0385
0386 vector<StdXCombPtr> theTildeXCombs;
0387
0388
0389
0390
0391 bool thePresampling;
0392
0393
0394
0395
0396
0397 unsigned long thePresamplingPoints;
0398
0399
0400
0401
0402
0403 unsigned long theMaxTry;
0404
0405
0406
0407
0408
0409 unsigned long theFreezeGrid;
0410
0411
0412
0413
0414 vector<bool> theFlags;
0415
0416
0417
0418
0419 pair<vector<double>,vector<double> > theSupport;
0420
0421
0422
0423
0424 Ptr<ShowerApproximationGenerator>::tptr theShowerApproximationGenerator;
0425
0426
0427
0428
0429 vector<double> theLastParameterPoint;
0430
0431
0432
0433
0434 vector<double> theLastBornPoint;
0435
0436
0437
0438
0439 typedef
0440 exsample::exponential_generator<ShowerApproximationKernel,UseRandom>
0441 ExponentialGenerator;
0442
0443
0444
0445
0446 typedef
0447 exsample::exponential_generator<ShowerApproximationKernel,UseRandom>*
0448 ExponentialGeneratorPtr;
0449
0450
0451
0452
0453 ExponentialGeneratorPtr sampler;
0454
0455
0456
0457
0458 bool theDoCompensate;
0459
0460
0461
0462
0463
0464 ShowerApproximationKernel & operator=(const ShowerApproximationKernel &) = delete;
0465
0466 };
0467
0468 }
0469
0470 #endif