File indexing completed on 2026-08-06 09:24:15
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef HERWIG_MatchboxFactory_H
0010 #define HERWIG_MatchboxFactory_H
0011
0012
0013
0014
0015 #include "ThePEG/Handlers/SubProcessHandler.h"
0016
0017 #include "Herwig/MatrixElement/Matchbox/Base/MatchboxAmplitude.h"
0018 #include "Herwig/MatrixElement/Matchbox/Utility/Tree2toNGenerator.h"
0019 #include "Herwig/MatrixElement/Matchbox/Utility/ProcessData.h"
0020 #include "Herwig/MatrixElement/Matchbox/Utility/MatchboxScaleChoice.h"
0021 #include "Herwig/MatrixElement/Matchbox/Phasespace/MatchboxPhasespace.h"
0022 #include "Herwig/MatrixElement/Matchbox/Base/MatchboxMEBase.h"
0023 #include "Herwig/MatrixElement/Matchbox/Base/SubtractedME.h"
0024 #include "Herwig/MatrixElement/Matchbox/MatchboxFactory.fh"
0025
0026 namespace Herwig {
0027
0028 using namespace ThePEG;
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040 class MatchboxFactory: public SubProcessHandler {
0041
0042 public:
0043
0044
0045
0046
0047 MatchboxFactory();
0048
0049 public:
0050
0051
0052
0053
0054 static const Ptr<MatchboxFactory>::tptr currentFactory() {
0055 assert(theCurrentFactory);
0056 return theCurrentFactory;
0057 }
0058
0059 private:
0060
0061
0062
0063
0064 static Ptr<MatchboxFactory>::tptr theCurrentFactory;
0065
0066 public:
0067
0068
0069
0070
0071 static bool isMatchboxRun() {
0072 return theIsMatchboxRun();
0073 }
0074
0075
0076
0077
0078
0079
0080
0081 Ptr<Tree2toNGenerator>::tptr diagramGenerator() const { return theDiagramGenerator; }
0082
0083
0084
0085
0086 void diagramGenerator(Ptr<Tree2toNGenerator>::ptr dg) { theDiagramGenerator = dg; }
0087
0088
0089
0090
0091 Ptr<ProcessData>::tptr processData() const { return theProcessData; }
0092
0093
0094
0095
0096 void processData(Ptr<ProcessData>::ptr pd) { theProcessData = pd; }
0097
0098
0099
0100
0101
0102 unsigned int nLight() const { return theNLight; }
0103
0104
0105
0106
0107
0108 void nLight(unsigned int n) { theNLight = n; }
0109
0110
0111
0112
0113
0114
0115 vector<long> nLightJetVec() const { return theNLightJetVec; }
0116
0117
0118
0119
0120
0121
0122 void nLightJetVec(long n) { theNLightJetVec.push_back(n); }
0123
0124
0125
0126
0127
0128
0129 vector<long> nHeavyJetVec() const { return theNHeavyJetVec; }
0130
0131
0132
0133
0134
0135
0136 void nHeavyJetVec(long n) { theNHeavyJetVec.push_back(n); }
0137
0138
0139
0140
0141
0142
0143 vector<long> nLightProtonVec() const { return theNLightProtonVec; }
0144
0145
0146
0147
0148
0149
0150 void nLightProtonVec(long n) { theNLightProtonVec.push_back(n); }
0151
0152
0153
0154
0155 unsigned int orderInAlphaS() const { return theOrderInAlphaS; }
0156
0157
0158
0159
0160 void orderInAlphaS(unsigned int o) { theOrderInAlphaS = o; }
0161
0162
0163
0164
0165 unsigned int orderInAlphaEW() const { return theOrderInAlphaEW; }
0166
0167
0168
0169
0170 void orderInAlphaEW(unsigned int o) { theOrderInAlphaEW = o; }
0171
0172
0173
0174
0175 size_t highestVirt() const {return theHighestVirtualSize;}
0176
0177
0178
0179
0180 void setHighestVirt(size_t n){theHighestVirtualSize=n;}
0181
0182
0183
0184
0185 const vector<vector<string> > getProcesses() const {return processes;}
0186
0187
0188
0189
0190 bool allProcesses() const { return theAllProcesses; }
0191
0192
0193
0194
0195 void setAllProcesses(bool on = true) { theAllProcesses = on; }
0196
0197
0198
0199
0200 bool bornContributions() const { return theBornContributions; }
0201
0202
0203
0204
0205 void setBornContributions(bool on = true) { theBornContributions = on; }
0206
0207
0208
0209
0210 bool virtualContributions() const { return theVirtualContributions; }
0211
0212
0213
0214
0215 void setVirtualContributions(bool on = true) { theVirtualContributions = on; }
0216
0217
0218
0219
0220 bool meCorrectionsOnly() const { return theMECorrectionsOnly; }
0221
0222
0223
0224
0225 void setMECorrectionsOnly(bool on = true) { theMECorrectionsOnly = on; }
0226
0227
0228
0229
0230 bool loopSimCorrections() const { return theLoopSimCorrections; }
0231
0232
0233
0234
0235 void setLoopSimCorrections(bool on = true) { theLoopSimCorrections = on; }
0236
0237
0238
0239
0240 bool realContributions() const { return theRealContributions; }
0241
0242
0243
0244
0245 void setRealContributions(bool on = true) { theRealContributions = on; }
0246
0247
0248
0249
0250 bool independentVirtuals() const { return theIndependentVirtuals; }
0251
0252
0253
0254
0255 void setIndependentVirtuals(bool on = true) { theIndependentVirtuals = on; }
0256
0257
0258
0259
0260 bool independentPKs() const { return theIndependentPKs; }
0261
0262
0263
0264
0265 void setIndependentPKs(bool on = true) { theIndependentPKs = on; }
0266
0267
0268
0269
0270
0271
0272
0273 virtual bool subProcessGroups() const { return !showerApproximation(); }
0274
0275
0276
0277
0278 bool realEmissionScales() const { return theRealEmissionScales; }
0279
0280
0281
0282
0283 void setRealEmissionScales(bool on = true) { theRealEmissionScales = on; }
0284
0285
0286
0287
0288 void showerApproximation(Ptr<ShowerApproximation>::tptr app) { theShowerApproximation = app; }
0289
0290
0291
0292
0293 Ptr<ShowerApproximation>::tptr showerApproximation() const { return theShowerApproximation; }
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303 Ptr<MatchboxPhasespace>::tptr phasespace() const { return thePhasespace; }
0304
0305
0306
0307
0308 void phasespace(Ptr<MatchboxPhasespace>::ptr ps) { thePhasespace = ps; }
0309
0310
0311
0312
0313 void scaleChoice(Ptr<MatchboxScaleChoice>::ptr sc) { theScaleChoice = sc; }
0314
0315
0316
0317
0318 Ptr<MatchboxScaleChoice>::tptr scaleChoice() const { return theScaleChoice; }
0319
0320
0321
0322
0323 double factorizationScaleFactor() const { return theFactorizationScaleFactor; }
0324
0325
0326
0327
0328 void factorizationScaleFactor(double f) { theFactorizationScaleFactor = f; }
0329
0330
0331
0332
0333 double renormalizationScaleFactor() const { return theRenormalizationScaleFactor; }
0334
0335
0336
0337
0338 void renormalizationScaleFactor(double f) { theRenormalizationScaleFactor = f; }
0339
0340
0341
0342
0343 bool fixedCouplings() const { return theFixedCouplings; }
0344
0345
0346
0347
0348 void setFixedCouplings(bool on = true) { theFixedCouplings = on; }
0349
0350
0351
0352
0353 bool fixedQEDCouplings() const { return theFixedQEDCouplings; }
0354
0355
0356
0357
0358 void setFixedQEDCouplings(bool on = true) { theFixedQEDCouplings = on; }
0359
0360
0361
0362
0363
0364 bool vetoScales() const { return theVetoScales; }
0365
0366
0367
0368
0369 void doVetoScales() { theVetoScales = true; }
0370
0371
0372
0373
0374 void noVetoScales() { theVetoScales = true; }
0375
0376
0377
0378
0379
0380
0381
0382
0383
0384 const vector<Ptr<MatchboxAmplitude>::ptr>& amplitudes() const { return theAmplitudes; }
0385
0386
0387
0388
0389 vector<Ptr<MatchboxAmplitude>::ptr>& amplitudes() { return theAmplitudes; }
0390
0391
0392
0393
0394
0395
0396
0397
0398
0399 const vector<Ptr<MatchboxMEBase>::ptr>& bornMEs() const { return theBornMEs; }
0400
0401
0402
0403
0404 vector<Ptr<MatchboxMEBase>::ptr>& bornMEs() { return theBornMEs; }
0405
0406
0407
0408
0409 const vector<Ptr<MatchboxMEBase>::ptr>& loopInducedMEs() const { return theLoopInducedMEs; }
0410
0411
0412
0413
0414 vector<Ptr<MatchboxMEBase>::ptr>& loopInducedMEs() { return theLoopInducedMEs; }
0415
0416
0417
0418
0419 const map<Ptr<MatchboxAmplitude>::tptr,
0420 map<pair<Process,int>,int> >&
0421 olpProcesses() const { return theOLPProcesses; }
0422
0423
0424
0425
0426 map<Ptr<MatchboxAmplitude>::tptr,
0427 map<pair<Process,int>,int> >&
0428 olpProcesses() { return theOLPProcesses; }
0429
0430
0431
0432
0433 int orderOLPProcess(const Process& p,
0434 Ptr<MatchboxAmplitude>::tptr amp,
0435 int type);
0436
0437
0438
0439
0440 const set<Ptr<MatchboxAmplitude>::tptr>& externalAmplitudes() const {
0441 return theExternalAmplitudes;
0442 }
0443
0444
0445
0446
0447 set<Ptr<MatchboxAmplitude>::tptr>& externalAmplitudes() {
0448 return theExternalAmplitudes;
0449 }
0450
0451
0452
0453
0454 const vector<Ptr<MatchboxInsertionOperator>::ptr>& virtuals() const { return theVirtuals; }
0455
0456
0457
0458
0459 vector<Ptr<MatchboxInsertionOperator>::ptr>& virtuals() { return theVirtuals; }
0460
0461
0462
0463
0464 const vector<Ptr<MatchboxMEBase>::ptr>& bornVirtualMEs() const { return theBornVirtualMEs; }
0465
0466
0467
0468
0469 vector<Ptr<MatchboxMEBase>::ptr>& bornVirtualMEs() { return theBornVirtualMEs; }
0470
0471
0472
0473
0474 const vector<Ptr<MatchboxMEBase>::ptr>& realEmissionMEs() const { return theRealEmissionMEs; }
0475
0476
0477
0478
0479 vector<Ptr<MatchboxMEBase>::ptr>& realEmissionMEs() { return theRealEmissionMEs; }
0480
0481
0482
0483
0484 int dipoleSet() const { return theDipoleSet; }
0485
0486
0487
0488
0489 void dipoleSet(int s) { theDipoleSet = s; }
0490
0491
0492
0493
0494 const vector<Ptr<SubtractedME>::ptr>& subtractedMEs() const { return theSubtractedMEs; }
0495
0496
0497
0498
0499 vector<Ptr<SubtractedME>::ptr>& subtractedMEs() { return theSubtractedMEs; }
0500
0501
0502
0503
0504 const vector<Ptr<MatchboxMEBase>::ptr>& finiteRealMEs() const { return theFiniteRealMEs; }
0505
0506
0507
0508
0509 vector<Ptr<MatchboxMEBase>::ptr>& finiteRealMEs() { return theFiniteRealMEs; }
0510
0511
0512
0513
0514 const map<cPDVector,set<Ptr<SubtractionDipole>::ptr> >& splittingDipoles() const {
0515 return theSplittingDipoles;
0516 }
0517
0518
0519
0520
0521 struct SplittingChannel {
0522
0523
0524
0525
0526 StdXCombPtr bornXComb;
0527
0528
0529
0530
0531 StdXCombPtr realXComb;
0532
0533
0534
0535
0536 vector<StdXCombPtr> tildeXCombs;
0537
0538
0539
0540
0541 Ptr<SubtractionDipole>::ptr dipole;
0542
0543
0544
0545
0546 void print(ostream&) const;
0547
0548 };
0549
0550
0551
0552
0553
0554 list<SplittingChannel> getSplittingChannels(tStdXCombPtr xc) const;
0555
0556
0557
0558
0559 const vector<ReweightPtr>& reweighters() const { return theReweighters; }
0560
0561
0562
0563
0564 vector<ReweightPtr>& reweighters() { return theReweighters; }
0565
0566
0567
0568
0569 const vector<ReweightPtr>& preweighters() const { return thePreweighters; }
0570
0571
0572
0573
0574 vector<ReweightPtr>& preweighters() { return thePreweighters; }
0575
0576
0577
0578
0579
0580
0581
0582
0583
0584
0585
0586
0587 virtual bool preInitialize() const { return true; }
0588
0589
0590
0591
0592 void prepareME(Ptr<MatchboxMEBase>::ptr);
0593
0594
0595
0596
0597 virtual void productionMode();
0598
0599
0600
0601
0602 virtual void setup();
0603
0604
0605
0606
0607
0608 size_t highestVirt(){return theHighestVirtualsize;}
0609
0610
0611
0612
0613
0614
0615
0616
0617
0618 bool verbose() const { return theVerbose; }
0619
0620
0621
0622
0623 void setVerbose(bool on = true) { theVerbose = on; }
0624
0625
0626
0627
0628 bool initVerbose() const { return theInitVerbose || verbose(); }
0629
0630
0631
0632
0633 void setInitVerbose(bool on = true) { theInitVerbose = on; }
0634
0635
0636
0637
0638 void print(ostream&) const;
0639
0640
0641
0642
0643 const string& subtractionData() const { return theSubtractionData; }
0644
0645
0646
0647
0648 void subtractionData(const string& s) { theSubtractionData = s; }
0649
0650
0651
0652
0653 const int& subtractionPlotType() const { return theSubtractionPlotType; }
0654
0655
0656
0657
0658 void subtractionPlotType(const int& t) { theSubtractionPlotType = t; }
0659
0660
0661
0662
0663 const bool& subtractionScatterPlot() const { return theSubtractionScatterPlot; }
0664
0665
0666
0667
0668 void subtractionScatterPlot(const bool& s) { theSubtractionScatterPlot = s; }
0669
0670
0671
0672
0673 const string& poleData() const { return thePoleData; }
0674
0675
0676
0677
0678 void poleData(const string& s) { thePoleData = s; }
0679
0680
0681
0682
0683 bool checkPoles() const { return poleData() != ""; }
0684
0685
0686
0687
0688
0689
0690
0691
0692
0693 const map<string,PDVector>& particleGroups() const { return theParticleGroups; }
0694
0695
0696
0697
0698 map<string,PDVector>& particleGroups() { return theParticleGroups; }
0699
0700
0701
0702
0703 bool isIncoming(cPDPtr p) const {
0704 return theIncoming.find(p->id()) != theIncoming.end();
0705 }
0706
0707
0708
0709
0710 bool spinCorrelations() const { return theSpinCorrelations; }
0711
0712
0713
0714
0715 void setSpinCorrelations(bool yes) { theSpinCorrelations = yes; }
0716
0717
0718
0719
0720
0721
0722
0723
0724
0725 tSubProPtr hardTreeSubprocess() { return theHardtreeSubprocess; }
0726
0727
0728
0729
0730 void setHardTreeSubprocess(tSubProPtr hardTree) { theHardtreeSubprocess = hardTree; }
0731
0732
0733
0734
0735 int hardTreeEmitter() { return theHardtreeEmitter; }
0736
0737
0738
0739
0740 void setHardTreeEmitter(int emitter) { theHardtreeEmitter = emitter; }
0741
0742
0743
0744
0745 int hardTreeSpectator() { return theHardtreeSpectator; }
0746
0747
0748
0749
0750 void setHardTreeSpectator(int spectator) { theHardtreeSpectator = spectator; }
0751
0752
0753
0754
0755
0756
0757
0758
0759
0760 const string& buildStorage();
0761
0762
0763
0764
0765
0766 const string& runStorage();
0767
0768
0769
0770
0771
0772 double alphaParameter() const { return theAlphaParameter; }
0773
0774
0775
0776
0777 void setAlphaParameter(double a)const { theAlphaParameter = a; }
0778
0779
0780
0781 public:
0782
0783
0784
0785
0786 void summary(ostream&) const;
0787
0788 public:
0789
0790
0791
0792
0793
0794
0795
0796 void persistentOutput(PersistentOStream & os) const;
0797
0798
0799
0800
0801
0802
0803 void persistentInput(PersistentIStream & is, int version);
0804
0805
0806
0807
0808
0809
0810
0811
0812 static void Init();
0813
0814 protected:
0815
0816
0817
0818
0819
0820
0821
0822 virtual IBPtr clone() const;
0823
0824
0825
0826
0827
0828 virtual IBPtr fullclone() const;
0829
0830
0831 protected:
0832
0833
0834
0835
0836
0837
0838
0839
0840 virtual void doinit();
0841
0842
0843
0844
0845
0846 virtual void doinitrun();
0847
0848
0849 private:
0850
0851
0852
0853
0854 static bool& theIsMatchboxRun();
0855
0856
0857
0858
0859 Ptr<Tree2toNGenerator>::ptr theDiagramGenerator;
0860
0861
0862
0863
0864 Ptr<ProcessData>::ptr theProcessData;
0865
0866
0867
0868
0869
0870 unsigned int theNLight;
0871
0872
0873
0874
0875
0876 vector<long> theNLightJetVec;
0877
0878
0879
0880
0881
0882 vector<long> theNHeavyJetVec;
0883
0884
0885
0886
0887
0888 vector<long> theNLightProtonVec;
0889
0890
0891
0892
0893 unsigned int theOrderInAlphaS;
0894
0895
0896
0897
0898 unsigned int theOrderInAlphaEW;
0899
0900
0901
0902
0903 unsigned int theHighestVirtualSize;
0904
0905
0906
0907
0908 bool theBornContributions;
0909
0910
0911
0912
0913 bool theVirtualContributions;
0914
0915
0916
0917
0918 bool theRealContributions;
0919
0920
0921
0922
0923 bool theIndependentVirtuals;
0924
0925
0926
0927
0928 bool theIndependentPKs;
0929
0930
0931
0932
0933 Ptr<MatchboxPhasespace>::ptr thePhasespace;
0934
0935
0936
0937
0938 Ptr<MatchboxScaleChoice>::ptr theScaleChoice;
0939
0940
0941
0942
0943 double theFactorizationScaleFactor;
0944
0945
0946
0947
0948 double theRenormalizationScaleFactor;
0949
0950
0951
0952
0953 bool theFixedCouplings;
0954
0955
0956
0957
0958 bool theFixedQEDCouplings;
0959
0960
0961
0962
0963
0964 bool theVetoScales;
0965
0966
0967
0968
0969 vector<Ptr<MatchboxAmplitude>::ptr> theAmplitudes;
0970
0971
0972
0973
0974 vector<Ptr<MatchboxMEBase>::ptr> theBornMEs;
0975
0976
0977
0978
0979 vector<Ptr<MatchboxMEBase>::ptr> theLoopInducedMEs;
0980
0981
0982
0983
0984 vector<Ptr<MatchboxInsertionOperator>::ptr> theVirtuals;
0985
0986
0987
0988
0989 vector<Ptr<MatchboxMEBase>::ptr> theRealEmissionMEs;
0990
0991
0992
0993
0994 vector<Ptr<MatchboxMEBase>::ptr> theBornVirtualMEs;
0995
0996
0997
0998
0999 vector<Ptr<SubtractedME>::ptr> theSubtractedMEs;
1000
1001
1002
1003
1004 vector<Ptr<MatchboxMEBase>::ptr> theFiniteRealMEs;
1005
1006
1007
1008
1009 int theDipoleSet;
1010
1011
1012
1013
1014 bool theVerbose;
1015
1016
1017
1018
1019 bool theInitVerbose;
1020
1021
1022
1023
1024 string theSubtractionData;
1025
1026
1027
1028
1029 int theSubtractionPlotType;
1030
1031
1032
1033
1034 bool theSubtractionScatterPlot;
1035
1036
1037
1038
1039 string thePoleData;
1040
1041
1042
1043
1044 string doSingleRealProcess(string);
1045
1046
1047
1048
1049
1050 vector<vector<string> > realEmissionProcesses;
1051
1052
1053
1054
1055 map<string,PDVector> theParticleGroups;
1056
1057
1058
1059
1060 string startParticleGroup(string);
1061
1062
1063
1064
1065 string particleGroupName;
1066
1067
1068
1069
1070 PDVector particleGroup;
1071
1072
1073
1074
1075 string endParticleGroup(string);
1076
1077 protected:
1078
1079
1080
1081
1082 virtual vector<string> parseProcess(string);
1083
1084 private:
1085
1086
1087
1088
1089 string doProcess(string);
1090
1091
1092
1093
1094 string doLoopInducedProcess(string);
1095
1096
1097
1098
1099 vector<vector<string> > processes;
1100
1101
1102
1103
1104 vector<vector<string> > loopInducedProcesses;
1105
1106
1107
1108
1109 set<PDVector> makeSubProcesses(const vector<string>&) const;
1110
1111
1112 public:
1113
1114
1115
1116
1117 vector<Ptr<MatchboxMEBase>::ptr> makeMEs(const vector<string>&,
1118 unsigned int orderas,
1119 bool virt);
1120
1121
1122 private:
1123
1124
1125
1126 Ptr<ShowerApproximation>::ptr theShowerApproximation;
1127
1128
1129
1130
1131 map<cPDVector,set<Ptr<SubtractionDipole>::ptr> > theSplittingDipoles;
1132
1133
1134
1135
1136 bool theRealEmissionScales;
1137
1138
1139
1140
1141
1142 bool theAllProcesses;
1143
1144
1145
1146
1147 map<Ptr<MatchboxAmplitude>::tptr,map<pair<Process,int>,int> > theOLPProcesses;
1148
1149
1150
1151
1152 set<Ptr<MatchboxAmplitude>::tptr> theExternalAmplitudes;
1153
1154
1155
1156
1157 vector<Ptr<MatchboxAmplitude>::ptr> theSelectedAmplitudes;
1158
1159
1160
1161
1162 vector<Ptr<MatchboxAmplitude>::ptr> theDeselectedAmplitudes;
1163
1164
1165
1166
1167 vector<ReweightPtr> theReweighters;
1168
1169
1170
1171
1172 vector<ReweightPtr> thePreweighters;
1173
1174
1175
1176
1177 bool theMECorrectionsOnly;
1178
1179
1180
1181
1182 int theHighestVirtualsize;
1183
1184
1185
1186
1187 bool theLoopSimCorrections;
1188
1189
1190
1191
1192 bool ranSetup;
1193
1194
1195
1196
1197 set<long> theIncoming;
1198
1199
1200
1201
1202 bool theFirstPerturbativePDF;
1203
1204
1205
1206
1207 bool theSecondPerturbativePDF;
1208
1209
1210
1211
1212 bool inProductionMode;
1213
1214
1215
1216
1217
1218 tSubProPtr theHardtreeSubprocess;
1219
1220
1221
1222
1223
1224 int theHardtreeEmitter;
1225
1226
1227
1228
1229
1230 int theHardtreeSpectator;
1231
1232
1233
1234
1235 bool theSpinCorrelations;
1236
1237
1238
1239
1240
1241
1242 mutable double theAlphaParameter;
1243
1244
1245
1246
1247
1248 bool theEnforceChargeConservation;
1249
1250
1251
1252
1253
1254 bool theEnforceColourConservation;
1255
1256
1257
1258
1259
1260 bool theEnforceLeptonNumberConservation;
1261
1262
1263
1264
1265
1266 bool theEnforceQuarkNumberConservation;
1267
1268
1269
1270
1271 bool theLeptonFlavourDiagonal;
1272
1273
1274
1275
1276 bool theQuarkFlavourDiagonal;
1277
1278
1279
1280
1281 string doProductionMode(string) {
1282 productionMode(); return "";
1283 }
1284
1285 private:
1286
1287
1288
1289
1290
1291 MatchboxFactory & operator=(const MatchboxFactory &) = delete;
1292
1293 };
1294
1295 }
1296
1297 #endif