File indexing completed on 2026-08-06 09:24:23
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef HERWIG_DipoleSplittingGenerator_H
0010 #define HERWIG_DipoleSplittingGenerator_H
0011
0012
0013
0014
0015 #include "ThePEG/Handlers/HandlerBase.h"
0016
0017 #include "Herwig/Shower/Dipole/Kernels/DipoleSplittingKernel.h"
0018 #include "DipoleSplittingReweight.h"
0019 #include "Herwig/Shower/Dipole/Utility/DipoleMCCheck.h"
0020 #include "Herwig/Sampling/exsample/exponential_generator.h"
0021
0022 #include <tuple>
0023
0024 namespace Herwig {
0025
0026 using namespace ThePEG;
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 class DipoleSplittingGenerator: public HandlerBase {
0039
0040 public:
0041
0042
0043
0044
0045
0046
0047 DipoleSplittingGenerator();
0048
0049
0050
0051
0052 virtual ~DipoleSplittingGenerator();
0053
0054
0055 public:
0056
0057
0058
0059
0060 Ptr<DipoleSplittingKernel>::tptr splittingKernel() const;
0061
0062
0063
0064
0065 Ptr<DipoleSplittingReweight>::tptr splittingReweight() const;
0066
0067
0068
0069
0070 Ptr<DipoleSplittingKinematics>::tptr splittingKinematics() const;
0071
0072
0073
0074
0075 void splittingKernel(Ptr<DipoleSplittingKernel>::tptr sp);
0076
0077
0078
0079
0080 void splittingReweight(Ptr<DipoleSplittingReweight>::tptr sp);
0081
0082
0083
0084
0085 void wrap(Ptr<DipoleSplittingGenerator>::ptr other);
0086
0087
0088
0089
0090
0091 bool wrapping() const { return theOtherGenerator; }
0092
0093 public:
0094
0095
0096
0097
0098 void resetVariations();
0099
0100
0101
0102
0103 void prepare(const DipoleSplittingInfo&);
0104
0105
0106
0107
0108
0109
0110 Energy generate(const DipoleSplittingInfo&,
0111 map<string,double>& variations,
0112 Energy optHardPt = ZERO,
0113 Energy optCutoff = ZERO);
0114
0115
0116
0117
0118
0119
0120
0121 Energy generateWrapped(DipoleSplittingInfo&,
0122 map<string,double>& variations,
0123 Energy optHardPt = ZERO,
0124 Energy optCutoff = ZERO);
0125
0126
0127
0128
0129 void completeSplitting(DipoleSplittingInfo&) const;
0130
0131
0132
0133
0134 const DipoleSplittingInfo& lastSplitting() const { return generatedSplitting; }
0135
0136
0137
0138 double sudakov(const DipoleSplittingInfo&,Energy down);
0139
0140 double dosudakov(const DipoleSplittingInfo&,Energy down);
0141
0142 double wrappedSudakov(DipoleSplittingInfo& split,Energy down);
0143
0144 double sudakovExpansion(const DipoleSplittingInfo&,Energy down,Energy fixedScale);
0145
0146 double dosudakovExpansion(const DipoleSplittingInfo&,Energy down,Energy fixedScale);
0147
0148 double wrappedSudakovExpansion(DipoleSplittingInfo& split,Energy down,Energy fixedScale);
0149
0150
0151
0152
0153 void doPartialUnweighting(double wref) {
0154 partialUnweighting = true;
0155 theReferenceWeight = wref;
0156 }
0157
0158 public:
0159
0160
0161
0162
0163
0164 void debugGenerator(ostream&) const;
0165
0166
0167
0168
0169
0170 void debugLastEvent(ostream&) const;
0171
0172 protected:
0173
0174
0175
0176
0177 void fixParameters(const DipoleSplittingInfo&,
0178 Energy optHardPt = ZERO);
0179
0180
0181
0182
0183
0184
0185 void doGenerate(map<string,double>& variations,
0186 Energy optCutoff = ZERO);
0187
0188 public:
0189
0190
0191
0192
0193
0194 int nDim() const;
0195
0196
0197
0198
0199 const vector<bool>& sampleFlags();
0200
0201
0202
0203
0204
0205
0206
0207 const pair<vector<double>,vector<double> >& support();
0208
0209
0210
0211
0212
0213 const vector<double>& parameterPoint() const { return parameters; }
0214
0215
0216
0217
0218
0219
0220 void startPresampling();
0221
0222
0223
0224
0225
0226 void stopPresampling();
0227
0228
0229
0230
0231
0232 unsigned long presamplingPoints() const { return splittingKernel()->presamplingPoints(); }
0233
0234
0235
0236
0237
0238 unsigned long maxtry() const { return splittingKernel()->maxtry(); }
0239
0240
0241
0242
0243
0244 unsigned long freezeGrid() const { return splittingKernel()->freezeGrid(); }
0245
0246
0247
0248
0249 double detuning() const { return splittingKernel()->detuning(); }
0250
0251
0252
0253
0254
0255
0256 bool haveOverestimate() const;
0257
0258
0259
0260
0261 double overestimate(const vector<double>&);
0262
0263
0264
0265
0266
0267 double invertOverestimateIntegral(double) const;
0268
0269
0270
0271
0272 double evaluate(const vector<double>&);
0273
0274
0275
0276
0277 void veto(const vector<double>&, double p, double r);
0278
0279
0280
0281
0282 void accept(const vector<double>&, double p, double r);
0283
0284
0285
0286
0287 double splittingWeight() const {
0288 if ( wrapping() )
0289 return theOtherGenerator->splittingWeight();
0290 return theSplittingWeight;
0291 }
0292
0293
0294
0295
0296 void doCompensate(bool yes = true) { theDoCompensate = yes; }
0297
0298
0299
0300
0301 vector<std::tuple<Energy,double,bool> > splittingWeightVector() const {
0302 if ( wrapping() )
0303 return theOtherGenerator->splittingWeightVector();
0304 return theSplittingWeightVector;
0305 }
0306
0307 public:
0308
0309
0310
0311
0312 inline const vector<bool>& variable_flags () {
0313 return sampleFlags();
0314 }
0315
0316 inline size_t evolution_variable () const { return 0; }
0317
0318 inline double evolution_cutoff () { return support().first[0]; }
0319
0320 inline const vector<double>& parameter_point () const {
0321 return parameterPoint();
0322 }
0323
0324 inline void start_presampling () {
0325 startPresampling();
0326 }
0327
0328 inline void stop_presampling () {
0329 stopPresampling();
0330 }
0331
0332 inline size_t dimension () const {
0333 return nDim();
0334 }
0335
0336 inline unsigned long presampling_points () const {
0337 return presamplingPoints();
0338 }
0339
0340
0341
0342 public:
0343
0344
0345
0346
0347
0348
0349
0350 void persistentOutput(PersistentOStream & os) const;
0351
0352
0353
0354
0355
0356
0357 void persistentInput(PersistentIStream & is, int version);
0358
0359
0360
0361
0362
0363
0364
0365
0366 static void Init();
0367
0368 protected:
0369
0370
0371
0372
0373
0374
0375
0376 virtual IBPtr clone() const;
0377
0378
0379
0380
0381
0382 virtual IBPtr fullclone() const;
0383
0384
0385
0386
0387
0388
0389 private:
0390
0391
0392
0393
0394 Ptr<DipoleSplittingGenerator>::ptr theOtherGenerator;
0395
0396
0397
0398
0399
0400 Ptr<DipoleSplittingKernel>::ptr theSplittingKernel;
0401
0402
0403
0404
0405 Ptr<DipoleSplittingReweight>::ptr theSplittingReweight;
0406
0407
0408
0409
0410 exsample::exponential_generator<DipoleSplittingGenerator,UseRandom>*
0411 theExponentialGenerator;
0412
0413
0414
0415
0416 DipoleSplittingInfo generatedSplitting;
0417
0418
0419
0420
0421
0422 DipoleSplittingInfo presampledSplitting;
0423
0424
0425
0426
0427
0428 bool prepared;
0429
0430
0431
0432
0433
0434 bool presampling;
0435
0436
0437
0438
0439 vector<double> parameters;
0440
0441
0442
0443
0444 vector<bool> theFlags;
0445
0446
0447
0448
0449 pair<vector<double>,vector<double> > theSupport;
0450
0451
0452
0453
0454 Ptr<DipoleMCCheck>::ptr theMCCheck;
0455
0456
0457
0458
0459 bool theDoCompensate;
0460
0461
0462
0463
0464 map<string,double> currentWeights;
0465
0466
0467
0468
0469 double theSplittingWeight;
0470
0471
0472
0473
0474
0475 double theSudakovAccuracy=0.05;
0476
0477
0478
0479
0480
0481
0482 double theReferenceWeight;
0483
0484
0485
0486
0487 bool partialUnweighting = false;
0488
0489
0490
0491
0492
0493 vector<std::tuple<Energy,double,bool> > theSplittingWeightVector;
0494
0495 private:
0496
0497
0498
0499
0500
0501 static ClassDescription<DipoleSplittingGenerator> initDipoleSplittingGenerator;
0502
0503
0504
0505
0506
0507 DipoleSplittingGenerator & operator=(const DipoleSplittingGenerator &) = delete;
0508
0509 };
0510
0511 }
0512
0513 #include "ThePEG/Utilities/ClassTraits.h"
0514
0515 namespace ThePEG {
0516
0517
0518
0519
0520
0521 template <>
0522 struct BaseClassTrait<Herwig::DipoleSplittingGenerator,1> {
0523
0524 typedef HandlerBase NthBase;
0525 };
0526
0527
0528
0529 template <>
0530 struct ClassTraits<Herwig::DipoleSplittingGenerator>
0531 : public ClassTraitsBase<Herwig::DipoleSplittingGenerator> {
0532
0533 static string className() { return "Herwig::DipoleSplittingGenerator"; }
0534
0535
0536
0537
0538
0539
0540
0541 static string library() { return "HwDipoleShower.so"; }
0542 };
0543
0544
0545
0546 }
0547
0548 #endif