File indexing completed on 2026-08-06 09:24:14
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef HERWIG_MatchboxPhasespace_H
0010 #define HERWIG_MatchboxPhasespace_H
0011
0012
0013
0014
0015 #include "ThePEG/Handlers/StandardXComb.h"
0016 #include "ThePEG/Handlers/HandlerBase.h"
0017 #include "ThePEG/MatrixElement/Tree2toNDiagram.h"
0018 #include "Herwig/MatrixElement/Matchbox/Utility/LastMatchboxXCombInfo.h"
0019 #include "Herwig/MatrixElement/Matchbox/Utility/ProcessData.fh"
0020 #include "Herwig/MatrixElement/Matchbox/MatchboxFactory.fh"
0021 #include "Herwig/MatrixElement/Matchbox/Phasespace/PhasespaceCouplings.h"
0022
0023 namespace Herwig {
0024
0025 using namespace ThePEG;
0026
0027
0028
0029
0030
0031
0032
0033
0034 struct StreamingRnd {
0035
0036
0037
0038
0039 const double* numbers;
0040
0041
0042
0043
0044 size_t nRnd;
0045
0046
0047
0048
0049 StreamingRnd()
0050 : numbers(0), nRnd(0) {}
0051
0052
0053
0054
0055 explicit StreamingRnd(const double* newNumbers,
0056 size_t n)
0057 : numbers(newNumbers), nRnd(n) {}
0058
0059
0060
0061
0062 inline double operator()() {
0063 assert(numbers && nRnd > 0);
0064 const double ret = numbers[0];
0065 ++numbers; --nRnd;
0066 return ret;
0067 }
0068
0069 };
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079 class MatchboxPhasespace:
0080 public HandlerBase,
0081 public LastXCombInfo<StandardXComb>,
0082 public LastMatchboxXCombInfo {
0083
0084 public:
0085
0086
0087
0088
0089 MatchboxPhasespace();
0090
0091 public:
0092
0093
0094
0095
0096
0097 virtual void setXComb(tStdXCombPtr xc) {
0098 theLastXComb = xc;
0099 lastMatchboxXComb(xc);
0100 }
0101
0102
0103
0104
0105 Ptr<MatchboxFactory>::tcptr factory() const;
0106
0107
0108
0109
0110 Ptr<ProcessData>::tptr processData() const;
0111
0112
0113
0114
0115 virtual double generateKinematics(const double* r,
0116 vector<Lorentz5Momentum>& momenta);
0117
0118
0119
0120
0121 virtual double generateTwoToNKinematics(const double*,
0122 vector<Lorentz5Momentum>& momenta) = 0;
0123
0124
0125
0126
0127 virtual double generateTwoToOneKinematics(const double*,
0128 vector<Lorentz5Momentum>& momenta);
0129
0130
0131
0132
0133
0134 virtual int nDim(const cPDVector&) const;
0135
0136
0137
0138
0139
0140 virtual int nDimPhasespace(int nFinal) const = 0;
0141
0142
0143
0144
0145
0146 virtual bool haveX1X2() const { return false; }
0147
0148
0149
0150
0151
0152 virtual bool wantCMS() const { return true; }
0153
0154
0155
0156
0157 bool useMassGenerators() const { return theUseMassGenerators; }
0158
0159
0160
0161
0162 virtual Selector<MEBase::DiagramIndex> selectDiagrams(const MEBase::DiagramVector&) const;
0163
0164
0165
0166
0167
0168 pair<double,Lorentz5Momentum> timeLikeWeight(const Tree2toNDiagram& diag,
0169 int branch, double flatCut) const;
0170
0171
0172
0173
0174
0175 double spaceLikeWeight(const Tree2toNDiagram& diag,
0176 const Lorentz5Momentum& incoming,
0177 int branch, double flatCut) const;
0178
0179
0180
0181
0182 double diagramWeight(const Tree2toNDiagram& diag) const {
0183 assert( !diagramWeights().empty() );
0184 return diagramWeights().find(diag.id())->second;
0185 }
0186
0187
0188
0189
0190 void fillDiagramWeights(double flatCut = 0.0);
0191
0192
0193
0194
0195 void clearDiagramWeights() {
0196 diagramWeights().clear();
0197 }
0198
0199
0200
0201
0202 Ptr<MatchboxPhasespace>::ptr cloneMe() const {
0203 return dynamic_ptr_cast<Ptr<MatchboxPhasespace>::ptr>(clone());
0204 }
0205
0206
0207
0208
0209 virtual void cloneDependencies(const std::string& prefix = "");
0210
0211 public:
0212
0213
0214
0215
0216 virtual bool isInvertible() const { return false; }
0217
0218
0219
0220
0221
0222 virtual double invertKinematics(const vector<Lorentz5Momentum>& momenta,
0223 double* r) const;
0224
0225
0226
0227
0228
0229 virtual double invertTwoToNKinematics(const vector<Lorentz5Momentum>&,
0230 double*) const {
0231 return 0.;
0232 }
0233
0234
0235
0236
0237
0238 virtual double invertTwoToOneKinematics(const vector<Lorentz5Momentum>&, double*) const;
0239
0240 public:
0241
0242
0243
0244
0245 void singularLimit(size_t i, size_t j) {
0246 if ( i > j )
0247 swap(i,j);
0248 singularLimits().insert(make_pair(i,j));
0249 }
0250
0251
0252
0253
0254 const pair<size_t,size_t>& lastSingularIndices() const {
0255 assert(lastSingularLimit() != singularLimits().end());
0256 return *lastSingularLimit();
0257 }
0258
0259
0260
0261
0262 bool matchConstraints(const vector<Lorentz5Momentum>& momenta);
0263
0264 protected:
0265
0266
0267
0268
0269
0270
0271 void setCoupling(long a, long b, long c,
0272 double coupling, bool includeCrossings = true);
0273
0274 public:
0275
0276
0277
0278
0279
0280
0281
0282 void persistentOutput(PersistentOStream & os) const;
0283
0284
0285
0286
0287
0288
0289 void persistentInput(PersistentIStream & is, int version);
0290
0291
0292 public:
0293
0294
0295
0296
0297
0298
0299
0300 static void Init();
0301
0302
0303
0304
0305
0306
0307 private:
0308
0309
0310
0311
0312 Energy singularCutoff;
0313
0314
0315
0316
0317 bool theUseMassGenerators;
0318
0319
0320
0321
0322 Ptr<PhasespaceCouplings>::ptr theCouplings;
0323
0324
0325
0326
0327 string doSetCoupling(string);
0328
0329
0330
0331
0332 string doSetPhysicalCoupling(string);
0333
0334
0335
0336
0337
0338
0339 int theLoopParticleIdMin;
0340
0341
0342
0343
0344
0345
0346 int theLoopParticleIdMax;
0347
0348
0349
0350
0351
0352 MatchboxPhasespace & operator=(const MatchboxPhasespace &) = delete;
0353
0354 };
0355
0356 }
0357
0358 #endif