File indexing completed on 2026-08-06 09:24:06
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef HERWIG_GeneralDecayMatrixElement_H
0010 #define HERWIG_GeneralDecayMatrixElement_H
0011
0012
0013
0014 #include "DecayMatrixElement.h"
0015 #include "GeneralDecayMatrixElement.fh"
0016
0017 namespace Herwig {
0018
0019 using namespace ThePEG;
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 class GeneralDecayMatrixElement: public DecayMatrixElement {
0033
0034 public:
0035
0036
0037
0038
0039
0040
0041 GeneralDecayMatrixElement() : DecayMatrixElement(999) {}
0042
0043
0044
0045
0046
0047
0048
0049 GeneralDecayMatrixElement(PDT::Spin spinin,
0050 PDT::Spin outspin1,PDT::Spin outspin2)
0051 : DecayMatrixElement(2,spinin) {
0052 outspin().push_back(outspin1);
0053 outspin().push_back(outspin2);
0054 setMESize();
0055 }
0056
0057
0058
0059
0060
0061
0062
0063
0064 GeneralDecayMatrixElement(PDT::Spin spinin,PDT::Spin outspin1,
0065 PDT::Spin outspin2,PDT::Spin outspin3)
0066 : DecayMatrixElement(3,spinin) {
0067 outspin().push_back(outspin1);
0068 outspin().push_back(outspin2);
0069 outspin().push_back(outspin3);
0070 setMESize();
0071 }
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081 GeneralDecayMatrixElement(PDT::Spin spinin,PDT::Spin outspin1,PDT::Spin outspin2,
0082 PDT::Spin outspin3,PDT::Spin outspin4)
0083 : DecayMatrixElement(4,spinin) {
0084 outspin().push_back(outspin1);
0085 outspin().push_back(outspin2);
0086 outspin().push_back(outspin3);
0087 outspin().push_back(outspin4);
0088 setMESize();
0089 }
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100 GeneralDecayMatrixElement(PDT::Spin spinin,PDT::Spin outspin1,PDT::Spin outspin2,
0101 PDT::Spin outspin3,PDT::Spin outspin4,PDT::Spin outspin5)
0102 : DecayMatrixElement(5,spinin) {
0103 outspin().push_back(outspin1);
0104 outspin().push_back(outspin2);
0105 outspin().push_back(outspin3);
0106 outspin().push_back(outspin4);
0107 outspin().push_back(outspin5);
0108 setMESize();
0109 }
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121 GeneralDecayMatrixElement(PDT::Spin spinin,PDT::Spin outspin1,PDT::Spin outspin2,
0122 PDT::Spin outspin3,PDT::Spin outspin4,PDT::Spin outspin5,
0123 PDT::Spin outspin6)
0124 : DecayMatrixElement(6,spinin) {
0125 outspin().push_back(outspin1);
0126 outspin().push_back(outspin2);
0127 outspin().push_back(outspin3);
0128 outspin().push_back(outspin4);
0129 outspin().push_back(outspin5);
0130 outspin().push_back(outspin6);
0131 setMESize();
0132 }
0133
0134
0135
0136
0137
0138
0139 GeneralDecayMatrixElement(PDT::Spin spinin,vector<PDT::Spin> spinout)
0140 : DecayMatrixElement(spinout.size(),spinin) {
0141 outspin() = spinout;
0142 setMESize();
0143 }
0144
0145
0146
0147
0148
0149 GeneralDecayMatrixElement(vector<PDT::Spin> extspin)
0150 : DecayMatrixElement(int(extspin.size())-1,extspin[0]) {
0151 outspin() = vector<PDT::Spin>(extspin.begin()+1,extspin.end());
0152 setMESize();
0153 }
0154
0155
0156 public:
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166 RhoDMatrix calculateDMatrix(const vector<RhoDMatrix> & rhoout) const;
0167
0168
0169
0170
0171
0172
0173
0174 RhoDMatrix calculateRhoMatrix(int ipart,const RhoDMatrix & rhoin,
0175 const vector<RhoDMatrix> & rhoout) const;
0176
0177
0178
0179
0180
0181
0182 Complex contract(const RhoDMatrix & rhoin) const;
0183
0184
0185
0186
0187
0188
0189
0190 Complex contract(const GeneralDecayMatrixElement & con,
0191 const RhoDMatrix & rhoin);
0192
0193
0194 public:
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206 Complex operator () (unsigned int inhel,unsigned int outhel1,
0207 unsigned int outhel2) const {
0208 unsigned int iloc = inhel*constants_[1]+
0209 outhel1*constants_[2]+outhel2*constants_[3];
0210 assert(outspin().size()==2&&iloc<matrixElement_.size());
0211 return matrixElement_[iloc];
0212 }
0213
0214
0215
0216
0217
0218
0219
0220 Complex & operator () (unsigned int inhel,unsigned int outhel1,
0221 unsigned int outhel2) {
0222 unsigned int iloc = inhel*constants_[1]+
0223 outhel1*constants_[2]+outhel2*constants_[3];
0224 assert(outspin().size()==2&&iloc<matrixElement_.size());
0225 return matrixElement_[iloc];
0226 }
0227
0228
0229
0230
0231
0232
0233
0234
0235 Complex operator () (unsigned int inhel,unsigned int outhel1,
0236 unsigned int outhel2,unsigned int outhel3) const {
0237 unsigned int iloc = inhel*constants_[1]+outhel1*constants_[2]+
0238 outhel2*constants_[3]+outhel3*constants_[4];
0239 assert(outspin().size()==3&&iloc<matrixElement_.size());
0240 return matrixElement_[iloc];
0241 }
0242
0243
0244
0245
0246
0247
0248
0249
0250 Complex & operator () (unsigned int inhel,unsigned int outhel1,
0251 unsigned int outhel2,unsigned int outhel3) {
0252 unsigned int iloc = inhel*constants_[1]+outhel1*constants_[2]+
0253 outhel2*constants_[3]+outhel3*constants_[4];
0254 assert(outspin().size()==3&&iloc<matrixElement_.size());
0255 return matrixElement_[iloc];
0256 }
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266 Complex operator () (unsigned int inhel,unsigned int outhel1,
0267 unsigned int outhel2,unsigned int outhel3,
0268 unsigned int outhel4) const {
0269 vector<unsigned int> itemp(5);
0270 itemp[0]=inhel ; itemp[1]=outhel1;
0271 itemp[2]=outhel2; itemp[3]=outhel3;
0272 itemp[4]=outhel4 ;
0273 return (*this)(itemp);
0274 }
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284 Complex & operator () (unsigned int inhel,unsigned int outhel1,
0285 unsigned int outhel2,unsigned int outhel3,
0286 unsigned int outhel4) {
0287 vector<unsigned int> itemp(5);
0288 itemp[0]=inhel ; itemp[1]=outhel1;
0289 itemp[2]=outhel2; itemp[3]=outhel3;
0290 itemp[4]=outhel4;
0291 return (*this)(itemp);
0292 }
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303 Complex operator () (unsigned int inhel,unsigned int outhel1,
0304 unsigned int outhel2,unsigned int outhel3,
0305 unsigned int outhel4,unsigned int outhel5) const {
0306 vector<unsigned int> itemp(6);
0307 itemp[0]=inhel ; itemp[1]=outhel1;
0308 itemp[2]=outhel2; itemp[3]=outhel3;
0309 itemp[4]=outhel4 ;itemp[5]=outhel5;
0310 return (*this)(itemp);
0311 }
0312
0313
0314
0315
0316
0317
0318
0319
0320
0321
0322 Complex & operator () (unsigned int inhel,unsigned int outhel1,
0323 unsigned int outhel2,unsigned int outhel3,
0324 unsigned int outhel4,unsigned int outhel5) {
0325 vector<unsigned int> itemp(6);
0326 itemp[0]=inhel ; itemp[1]=outhel1;
0327 itemp[2]=outhel2; itemp[3]=outhel3;
0328 itemp[4]=outhel4; itemp[5]=outhel5;
0329 return (*this)(itemp);
0330 }
0331
0332
0333
0334
0335
0336
0337
0338
0339
0340
0341
0342 Complex operator () (unsigned int inhel,unsigned int outhel1,
0343 unsigned int outhel2,unsigned int outhel3,
0344 unsigned int outhel4,unsigned int outhel5,
0345 unsigned int outhel6) const {
0346 vector<unsigned int> itemp(7);
0347 itemp[0]=inhel ; itemp[1]=outhel1;
0348 itemp[2]=outhel2; itemp[3]=outhel3;
0349 itemp[4]=outhel4 ;itemp[5]=outhel5;
0350 itemp[6]=outhel6;
0351 return (*this)(itemp);
0352 }
0353
0354
0355
0356
0357
0358
0359
0360
0361
0362
0363
0364 Complex & operator () (unsigned int inhel,unsigned int outhel1,
0365 unsigned int outhel2,unsigned int outhel3,
0366 unsigned int outhel4,unsigned int outhel5,
0367 unsigned int outhel6) {
0368 vector<unsigned int> itemp(7);
0369 itemp[0]=inhel ; itemp[1]=outhel1;
0370 itemp[2]=outhel2; itemp[3]=outhel3;
0371 itemp[4]=outhel4; itemp[5]=outhel5;
0372 itemp[6]=outhel6;
0373 return (*this)(itemp);
0374 }
0375
0376
0377
0378
0379
0380 Complex operator () (const vector<unsigned int> & in) const {
0381 assert(in.size()==outspin().size()+1);
0382
0383 unsigned int iloc(in[0]*constants_[1]);
0384
0385 for(unsigned int ix=1;ix<in.size();++ix){iloc+=in[ix]*constants_[ix+1];}
0386 assert(iloc<matrixElement_.size());
0387 return matrixElement_[iloc];
0388 }
0389
0390
0391
0392
0393
0394 Complex & operator () (const vector<unsigned int> & in) {
0395 assert(in.size()==outspin().size()+1);
0396
0397 unsigned int iloc(in[0]*constants_[1]);
0398
0399 for(unsigned int ix=1;ix<in.size();++ix){iloc+=in[ix]*constants_[ix+1];}
0400 assert(iloc<matrixElement_.size());
0401 return matrixElement_[iloc];
0402 }
0403
0404
0405
0406
0407
0408 void zero() {
0409 for(unsigned int ix=0;ix<matrixElement_.size();++ix)
0410 matrixElement_[ix]=0.;
0411 }
0412
0413
0414
0415
0416 void setMESize() {
0417 int isize = inspin();
0418 for(unsigned int ix=0;ix<outspin().size();++ix) isize*=outspin()[ix];
0419 matrixElement_.resize(isize,0.);
0420
0421 constants_.resize(outspin().size()+2);
0422 int temp=1;
0423 for(unsigned int ix=outspin().size();ix>0;--ix) {
0424 temp*=outspin()[ix-1];constants_[ix]=temp;
0425 }
0426 temp *= inspin();
0427 constants_[0]=temp;
0428 constants_[outspin().size()+1]=1;
0429 }
0430
0431 private:
0432
0433
0434
0435
0436 mutable vector<Complex> matrixElement_;
0437
0438
0439
0440
0441 mutable vector<unsigned int> constants_;
0442
0443 };
0444
0445 }
0446
0447 #endif