|
|
|||
File indexing completed on 2026-08-06 09:38:27
0001 // -*- C++ -*- 0002 // 0003 // MEBase.h is a part of ThePEG - Toolkit for HEP Event Generation 0004 // Copyright (C) 1999-2019 Leif Lonnblad 0005 // 0006 // ThePEG is licenced under version 3 of the GPL, see COPYING for details. 0007 // Please respect the MCnet academic guidelines, see GUIDELINES for details. 0008 // 0009 #ifndef ThePEG_MEBase_H 0010 #define ThePEG_MEBase_H 0011 // This is the declaration of the MEBase class. 0012 0013 #include "ThePEG/Handlers/HandlerBase.h" 0014 #include "ThePEG/EventRecord/SubProcess.h" 0015 #include "ThePEG/MatrixElement/DiagramBase.h" 0016 #include "ThePEG/MatrixElement/ColourLines.h" 0017 #include "ThePEG/MatrixElement/Amplitude.h" 0018 #include "ThePEG/Handlers/LastXCombInfo.h" 0019 #include "ThePEG/Handlers/StandardXComb.fh" 0020 #include "ReweightBase.h" 0021 0022 #include "ThePEG/Handlers/EventHandler.fh" 0023 #include "ThePEG/Handlers/StandardEventHandler.fh" 0024 #include "ThePEG/Handlers/SubProcessHandler.fh" 0025 #include "ThePEG/PDF/PartonBin.fh" 0026 0027 #include "MEBase.fh" 0028 0029 namespace ThePEG { 0030 0031 /** 0032 * The MEBase class is the base class of all objects 0033 * representing hard matrix elements in ThePEG. There are three 0034 * methods which must be overridden by a concrete subclass:<BR> 0035 * 0036 * includedDiagrams(tcPDPair) should return a vector of DiagramBase 0037 * objects describing the diagrams used for this matrix element for 0038 * the given pair of incoming parton types. These DiagramBases are 0039 * used to identify the incoming and outgoing partons which can be 0040 * handled by the process generation scheme, and is also used to 0041 * cnstruct a corresponding SubProcess object. 0042 * 0043 * scale() should return the scale associated with the phase space 0044 * point set with the last call to setKinematics(...) or 0045 * generateKinematics(...). 0046 * 0047 * me() should return the the matrix element squared using the the 0048 * type and momentum of the incoming and outgoing partons, previously 0049 * set by the setKinematics(...) or generateKinematics(...) member 0050 * functions, accessible through the methods meMomenta() and 0051 * mePartonData() inherited from LastXCombInfo, and/or from 0052 * information stored by sub classes. The returned value should be 0053 * dimensionless suitable scaled by the total invariant mass squared 0054 * (accessible through the sHat() member function). Any user of this 0055 * method must make sure that the setKinematics(...) member function 0056 * has been appropriately called before. 0057 * 0058 * colourGeometries() should return a Selector with the possible 0059 * ColourLines objects weighted by their relative probabilities given 0060 * the information set by the last call to setKinematics(...) or 0061 * generateKinematics(...). 0062 * 0063 * There are other virtula functions which may be overridden as listed 0064 * below. 0065 * 0066 * @see \ref MEBaseInterfaces "The interfaces" 0067 * defined for MEBase. 0068 * @see DiagramBase 0069 * @see ColourLines 0070 * 0071 */ 0072 class MEBase: public HandlerBase, public LastXCombInfo<StandardXComb> { 0073 0074 public: 0075 0076 /** A vector of pointers to DiagramBase objects. */ 0077 typedef vector<DiagPtr> DiagramVector; 0078 /** The size_type used in the DiagramVector. */ 0079 typedef DiagramVector::size_type DiagramIndex; 0080 /** A vector of pointers to ReweightBase objects. */ 0081 typedef vector<ReweightPtr> ReweightVector; 0082 0083 public: 0084 0085 /** @name Standard constructors and destructors. */ 0086 //@{ 0087 /** 0088 * Default constructor. 0089 */ 0090 MEBase(); 0091 0092 /** 0093 * Destructor. 0094 */ 0095 virtual ~MEBase(); 0096 //@} 0097 0098 public: 0099 0100 /** @name Virtual functions to be overridden by sub-classes.. */ 0101 //@{ 0102 /** 0103 * Return the order in \f$\alpha_S\f$ in which this matrix element 0104 * is given. 0105 */ 0106 virtual unsigned int orderInAlphaS() const = 0; 0107 0108 /** 0109 * Return the order in \f$\alpha_{EM}\f$ in which this matrix 0110 * element is given. Returns 0. 0111 */ 0112 virtual unsigned int orderInAlphaEW() const = 0; 0113 0114 /** 0115 * Return the matrix element for the kinematical configuation 0116 * previously provided by the last call to setKinematics(), suitably 0117 * scaled by sHat() to give a dimension-less number. 0118 */ 0119 virtual double me2() const = 0; 0120 0121 /** 0122 * Return the scale associated with the phase space point provided 0123 * by the last call to setKinematics(). 0124 */ 0125 virtual Energy2 scale() const = 0; 0126 0127 /** 0128 * Return the value of \f$\alpha_S\f$ associated with the phase 0129 * space point provided by the last call to setKinematics(). This 0130 * versions returns SM().alphaS(scale()). 0131 */ 0132 virtual double alphaS() const; 0133 0134 /** 0135 * Return the value of \f$\alpha_EM\f$ associated with the phase 0136 * space point provided by the last call to setKinematics(). This 0137 * versions returns SM().alphaEM(scale()). 0138 */ 0139 virtual double alphaEM() const; 0140 0141 /** 0142 * Set the typed and momenta of the incoming and outgoing partons to 0143 * be used in subsequent calls to me() and colourGeometries(). 0144 */ 0145 void setKinematics(tPPair in, const PVector & out); 0146 0147 /** 0148 * Set the typed and momenta of the incoming and outgoing partons to 0149 * be used in subsequent calls to me() and colourGeometries() 0150 * according to the associated XComb object. If the function is 0151 * overridden in a sub class the new function must call the base 0152 * class one first. 0153 */ 0154 virtual void setKinematics() {} 0155 0156 /** 0157 * construct the spin information for the interaction 0158 */ 0159 virtual void constructVertex(tSubProPtr sub); 0160 0161 /** 0162 * construct the spin information for the interaction 0163 */ 0164 virtual void constructVertex(tSubProPtr sub, const ColourLines* cl); 0165 0166 /** 0167 * The number of internal degreed of freedom used in the matrix 0168 * element. This default version returns 0; 0169 */ 0170 virtual int nDim() const; 0171 0172 /** 0173 * Generate internal degrees of freedom given nDim() uniform random 0174 * numbers in the interval ]0,1[. To help the phase space generator, 0175 * the 'dSigHatDR' should be a smooth function of these numbers, 0176 * although this is not strictly necessary. The return value should 0177 * be true of the generation succeeded. If so the generated momenta 0178 * should be stored in the meMomenta() vector. 0179 */ 0180 virtual bool generateKinematics(const double * r) = 0; 0181 0182 /** 0183 * Return true, if this matrix element expects 0184 * the incoming partons in their center-of-mass system 0185 */ 0186 virtual bool wantCMS() const { return true; } 0187 0188 /** 0189 * If this is a dependent matrix element in a ME group, return true, 0190 * if cuts should be inherited from the head matrix element, i.e. no 0191 * cut is being applied to the dependent matrix element if the head 0192 * configuration has passed the cuts. 0193 */ 0194 virtual bool headCuts() const { return false; } 0195 0196 /** 0197 * If this is a dependent matrix element in a ME group, return true, 0198 * if cuts should be ignored. 0199 */ 0200 virtual bool ignoreCuts() const { return false; } 0201 0202 /** 0203 * If this is a dependent matrix element in a ME group, return true, 0204 * if it applies to the process set in lastXComb() 0205 */ 0206 virtual bool apply() const { return true; } 0207 0208 /** 0209 * Return the matrix element squared differential in the variables 0210 * given by the last call to generateKinematics(). 0211 */ 0212 virtual CrossSection dSigHatDR() const = 0; 0213 0214 /** 0215 * If variations are available for the subprocess handled, generate 0216 * and return a map of optional weights to be included for the 0217 * event. 0218 */ 0219 virtual map<string,double> generateOptionalWeights() { 0220 return map<string,double>(); 0221 } 0222 0223 /** 0224 * Return true, if this matrix element will generate momenta for the 0225 * incoming partons itself. The matrix element is required to store 0226 * the incoming parton momenta in meMomenta()[0,1]. No mapping in 0227 * tau and y is performed by the PartonExtractor object, if a 0228 * derived class returns true here. The phase space jacobian is to 0229 * include a factor 1/(x1 x2). 0230 */ 0231 virtual bool haveX1X2() const { return false; } 0232 0233 /** 0234 * Return true, if this matrix element provides the PDF 0235 * weight for the first incoming parton itself. 0236 */ 0237 virtual bool havePDFWeight1() const { return false; } 0238 0239 /** 0240 * Return true, if this matrix element provides the PDF 0241 * weight for the second incoming parton itself. 0242 */ 0243 virtual bool havePDFWeight2() const { return false; } 0244 0245 /** 0246 * Return true, if the XComb steering this matrix element 0247 * should keep track of the random numbers used to generate 0248 * the last phase space point 0249 */ 0250 virtual bool keepRandomNumbers() const { return false; } 0251 0252 /** 0253 * Comlete a SubProcess object using the internal degrees of freedom 0254 * generated in the last generateKinematics() (and possible other 0255 * degrees of freedom which was intergated over in dSigHatDR(). This 0256 * default version does nothing. Will be made purely virtual in the 0257 * future. 0258 */ 0259 virtual void generateSubCollision(SubProcess &); 0260 0261 /** 0262 * Clear the information previously provided by a call to 0263 * setKinematics(...). 0264 */ 0265 virtual void clearKinematics(); 0266 0267 /** 0268 * Add all possible diagrams with the add() function. 0269 */ 0270 virtual void getDiagrams() const = 0; 0271 0272 /** 0273 * Return true, if this matrix element does not want to 0274 * make use of mirroring processes; in this case all 0275 * possible partonic subprocesses with a fixed assignment 0276 * of incoming particles need to be provided through the diagrams 0277 * added with the add(...) method. 0278 */ 0279 virtual bool noMirror () const { return false; } 0280 0281 /** 0282 * Return all possible diagrams. 0283 */ 0284 const DiagramVector & diagrams() const { 0285 if ( theDiagrams.empty() ) getDiagrams(); 0286 return theDiagrams; 0287 } 0288 0289 /** 0290 * Return a Selector with possible colour geometries for the selected 0291 * diagram weighted by their relative probabilities. 0292 */ 0293 virtual Selector<const ColourLines *> 0294 colourGeometries(tcDiagPtr diag) const = 0; 0295 0296 /** 0297 * Select a ColpurLines geometry. The default version returns a 0298 * colour geometry selected among the ones returned from 0299 * colourGeometries(tcDiagPtr). 0300 */ 0301 virtual const ColourLines & 0302 selectColourGeometry(tcDiagPtr diag) const; 0303 0304 /** 0305 * With the information previously supplied with the 0306 * setKinematics(...) method, a derived class may optionally 0307 * override this method to weight the given diagrams with their 0308 * (although certainly not physical) relative probabilities. 0309 */ 0310 virtual Selector<DiagramIndex> diagrams(const DiagramVector &) const { 0311 return Selector<DiagramIndex>(); 0312 } 0313 0314 0315 /** 0316 * Select a diagram. Default version uses diagrams(const 0317 * DiagramVector &) to select a diagram according to the 0318 * weights. This is the only method used that should be outside of 0319 * MEBase. 0320 */ 0321 virtual DiagramIndex diagram(const DiagramVector &) const; 0322 0323 /** 0324 * Return true if this matrix element has associated (p)reWeight 0325 * objects assigned. 0326 */ 0327 inline bool reweighted() const { 0328 return reweights.size() > 0 || preweights.size() > 0; 0329 } 0330 0331 /** 0332 * With the information previously supplied with the 0333 * setKinematics(...) methods, return the combined effects of the 0334 * reweighters. 0335 */ 0336 double reWeight() const; 0337 0338 /** 0339 * With the information previously supplied with the 0340 * setKinematics(...) methods, return the comined effects of the 0341 * peweighters. 0342 */ 0343 double preWeight() const; 0344 0345 /** 0346 * Add objects to the list of reweighters. 0347 */ 0348 void addReweighter(tReweightPtr rw); 0349 0350 /** 0351 * Add objects to the list of preweighters. 0352 */ 0353 void addPreweighter(tReweightPtr rw); 0354 0355 /** 0356 * Return the amplitude associated with this matrix element. This 0357 * function is allowed to return the null pointer if the amplitude 0358 * is not available. 0359 */ 0360 Ptr<Amplitude>::pointer amplitude() const { return theAmplitude; } 0361 0362 /** 0363 * Set the amplitude associated with this matrix element. 0364 */ 0365 void amplitude(Ptr<Amplitude>::pointer amp) { theAmplitude = amp; } 0366 //@} 0367 0368 public: 0369 0370 /** @name Acces information about the last generated phase space point. */ 0371 //@{ 0372 /** 0373 * Return the last set invariant mass squared. 0374 */ 0375 Energy2 sHat() const { return lastSHat(); } 0376 0377 /** 0378 * Return the factor with which this matrix element was last 0379 * pre-weighted. 0380 */ 0381 double preweight() const { return lastPreweight(); } 0382 0383 /** 0384 * Inform this matrix element that a new phase space 0385 * point is about to be generated, so all caches should 0386 * be flushed. 0387 */ 0388 virtual void flushCaches() {} 0389 0390 /** 0391 * For the given event generation setup return a xcomb object 0392 * appropriate to this matrix element. 0393 */ 0394 virtual StdXCombPtr makeXComb(Energy newMaxEnergy, const cPDPair & inc, 0395 tEHPtr newEventHandler,tSubHdlPtr newSubProcessHandler, 0396 tPExtrPtr newExtractor, tCascHdlPtr newCKKW, 0397 const PBPair & newPartonBins, tCutsPtr newCuts, 0398 const DiagramVector & newDiagrams, bool mir, 0399 const PartonPairVec& allPBins, 0400 tStdXCombPtr newHead = tStdXCombPtr(), 0401 tMEPtr newME = tMEPtr()); 0402 0403 /** 0404 * For the given event generation setup return a dependent xcomb object 0405 * appropriate to this matrix element. 0406 */ 0407 virtual StdXCombPtr makeXComb(tStdXCombPtr newHead, 0408 const PBPair & newPartonBins, 0409 const DiagramVector & newDiagrams, 0410 tMEPtr newME = tMEPtr()); 0411 0412 /** 0413 * Fill the projectors object of xcombs to choose subprocesses 0414 * different than the one currently integrated. 0415 */ 0416 virtual void fillProjectors() { } 0417 0418 /** 0419 * Set the XComb object to be used in the next call to 0420 * generateKinematics() and dSigHatDR(). 0421 */ 0422 virtual void setXComb(tStdXCombPtr); 0423 0424 /** 0425 * Retrieve information obtained in the calculation of the cross 0426 * section to be used later when selecting diagrams and colour flow. 0427 */ 0428 const DVector & meInfo() const; 0429 0430 /** 0431 * Save information obtained in the calculation of the cross 0432 * section to be used later when selecting diagrams and colour flow. 0433 */ 0434 void meInfo(const DVector & info) const; 0435 0436 /** 0437 * If this matrix element is to be used together with others for 0438 * CKKW reweighting and veto, this should give the multiplicity of 0439 * outgoing particles in the highest multiplicity matrix element in 0440 * the group. 0441 */ 0442 virtual int maxMultCKKW() const { return theMaxMultCKKW; } 0443 0444 /** 0445 * If this matrix element is to be used together with others for 0446 * CKKW reweighting and veto, this should give the multiplicity of 0447 * outgoing particles in the lowest multiplicity matrix element in 0448 * the group. 0449 */ 0450 virtual int minMultCKKW() const { return theMinMultCKKW; } 0451 0452 /** 0453 * If this matrix element is to be used together with others for 0454 * CKKW reweighting and veto, this will set the multiplicity of 0455 * outgoing particles in the highest multiplicity matrix element in 0456 * the group. 0457 */ 0458 virtual void maxMultCKKW(int mult) { theMaxMultCKKW = mult; } 0459 0460 /** 0461 * If this matrix element is to be used together with others for 0462 * CKKW reweighting and veto, this will set the multiplicity of 0463 * outgoing particles in the lowest multiplicity matrix element in 0464 * the group. 0465 */ 0466 virtual void minMultCKKW(int mult) { theMinMultCKKW = mult; } 0467 0468 /** 0469 * Set veto scales on the particles at the given 0470 * SubProcess which has been generated using this 0471 * matrix element. 0472 */ 0473 virtual void setVetoScales(tSubProPtr) const {} 0474 //@} 0475 0476 public: 0477 0478 /** @name Functions used by the persistent I/O system. */ 0479 //@{ 0480 /** 0481 * Function used to write out object persistently. 0482 * @param os the persistent output stream written to. 0483 */ 0484 void persistentOutput(PersistentOStream & os) const; 0485 0486 /** 0487 * Function used to read in object persistently. 0488 * @param is the persistent input stream read from. 0489 * @param version the version number of the object when written. 0490 */ 0491 void persistentInput(PersistentIStream & is, int version); 0492 //@} 0493 0494 /** 0495 * Standard Init function used to initialize the interfaces. 0496 */ 0497 static void Init(); 0498 0499 protected: 0500 0501 /** 0502 * To be used by sub classes in the getDiagrams() method to add 0503 * included diagrams. 0504 */ 0505 void add(DiagPtr dp) const { theDiagrams.push_back(dp); } 0506 0507 /** 0508 * Access the momenta set by the last call to generateKinematics(). 0509 */ 0510 vector<Lorentz5Momentum> & meMomenta(); 0511 using LastXCombInfo<StandardXComb>::meMomenta; 0512 0513 /** 0514 * Set the matrix element squared as calculated 0515 * for the last phase space point. This may optionally 0516 * be used by a matrix element for caching. 0517 */ 0518 void lastME2(double v) const; 0519 using LastXCombInfo<StandardXComb>::lastME2; 0520 0521 /** 0522 * Set the last preweight factor 0523 */ 0524 void lastPreweight(double w) const; 0525 using LastXCombInfo<StandardXComb>::lastPreweight; 0526 0527 /** 0528 * Set the partonic cross section as calculated 0529 * for the last phase space point. This may optionally 0530 * be used by a matrix element for caching. 0531 */ 0532 void lastMECrossSection(CrossSection v) const; 0533 using LastXCombInfo<StandardXComb>::lastMECrossSection; 0534 0535 /** 0536 * Set the PDF weight as calculated 0537 * for the last phase space point, if the matrix 0538 * element does supply PDF weights. This may optionally 0539 * be used by a matrix element for caching. 0540 */ 0541 void lastMEPDFWeight(double v) const; 0542 using LastXCombInfo<StandardXComb>::lastMEPDFWeight; 0543 0544 /** 0545 * Set the coupling weight as calculated 0546 * for the last phase space point 0547 */ 0548 void lastMECouplings(double v) const; 0549 using LastXCombInfo<StandardXComb>::lastMECouplings; 0550 0551 /** 0552 * Set the last jacobian obtained when generating the kinematics for 0553 * the call to dSigHatDR. 0554 */ 0555 void jacobian(double j); 0556 using LastXCombInfo<StandardXComb>::jacobian; 0557 0558 /** 0559 * Initialize all member variables from another 0560 * MEBase object. 0561 * 0562 * @TODO remove? 0563 */ 0564 void use(tcMEPtr other); 0565 0566 /** 0567 * Initialize the diagrams from another MEBase object. 0568 */ 0569 void useDiagrams(tcMEPtr other) const; 0570 0571 protected: 0572 0573 /** @name Standard Interfaced functions. */ 0574 //@{ 0575 0576 /** 0577 * Initialize this object after the setup phase before saving an 0578 * EventGenerator to disk. 0579 * @throws InitException if object could not be initialized properly. 0580 */ 0581 virtual void doinit(); 0582 0583 /** 0584 * Initialize this object. Called in the run phase just before 0585 * a run begins. 0586 */ 0587 virtual void doinitrun(); 0588 //@} 0589 0590 private: 0591 0592 /** 0593 * The diagrams included for this matrix element. 0594 */ 0595 mutable DiagramVector theDiagrams; 0596 0597 /** 0598 * The reweight objects modifying this matrix element. 0599 */ 0600 ReweightVector reweights; 0601 0602 /** 0603 * The preweight objects modifying this matrix element. 0604 */ 0605 ReweightVector preweights; 0606 0607 /** 0608 * The amplitude associated with this matrix element. 0609 */ 0610 Ptr<Amplitude>::pointer theAmplitude; 0611 0612 /** 0613 * If this matrix element is to be used together with others for 0614 * CKKW reweighting and veto, this should give the multiplicity of 0615 * outgoing particles in the highest multiplicity matrix element in 0616 * the group. 0617 */ 0618 int theMaxMultCKKW; 0619 0620 /** 0621 * If this matrix element is to be used together with others for 0622 * CKKW reweighting and veto, this should give the multiplicity of 0623 * outgoing particles in the lowest multiplicity matrix element in 0624 * the group. 0625 */ 0626 int theMinMultCKKW; 0627 0628 private: 0629 0630 /** 0631 * Describe an abstract base class with persistent data. 0632 */ 0633 static AbstractClassDescription<MEBase> initMEBase; 0634 0635 /** 0636 * Private and non-existent assignment operator. 0637 */ 0638 MEBase & operator=(const MEBase &) = delete; 0639 0640 }; 0641 0642 } 0643 0644 0645 namespace ThePEG { 0646 0647 /** @cond TRAITSPECIALIZATIONS */ 0648 0649 /** 0650 * This template specialization informs ThePEG about the base class of 0651 * MEBase. 0652 */ 0653 template <> 0654 struct BaseClassTrait<MEBase,1>: public ClassTraitsType { 0655 /** Typedef of the base class of MEBase. */ 0656 typedef HandlerBase NthBase; 0657 }; 0658 0659 /** 0660 * This template specialization informs ThePEG about the name of the 0661 * MEBase class. 0662 */ 0663 template <> 0664 struct ClassTraits<MEBase>: public ClassTraitsBase<MEBase> { 0665 /** Return the class name. */ 0666 static string className() { return "ThePEG::MEBase"; } 0667 }; 0668 0669 /** @endcond */ 0670 0671 } 0672 0673 #include "ThePEG/Handlers/StandardXComb.h" 0674 0675 #endif /* ThePEG_MEBase_H */
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|