Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:38:27

0001 // -*- C++ -*-
0002 //
0003 // MEGroup.h is a part of ThePEG - Toolkit for HEP Event Generation
0004 // Copyright (C) 1999-2019 Leif Lonnblad
0005 // Copyright (C) 2009-2019 Simon Platzer
0006 //
0007 // ThePEG is licenced under version 3 of the GPL, see COPYING for details.
0008 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
0009 //
0010 #ifndef ThePEG_MEGroup_H
0011 #define ThePEG_MEGroup_H
0012 // This is the declaration of the MEGroup class.
0013 
0014 #include "ThePEG/MatrixElement/MEBase.h"
0015 #include "ThePEG/Cuts/Cuts.fh"
0016 #include "MEGroup.fh"
0017 
0018 namespace ThePEG {
0019 
0020 /**
0021  * The MEGroup class represents a 'head' matrix element
0022  * in association with a group of dependent matrix elements.
0023  * It basically acts as a wrapper around its head matrix element
0024  * however supplying additional information to the corresponding
0025  * StdXCombGroup object.
0026  *
0027  * @see StdXCombGroup
0028  * 
0029  */
0030 class MEGroup: public MEBase {
0031 
0032 public:
0033 
0034   /** @name Standard constructors and destructors. */
0035   //@{
0036   /**
0037    * Default constructor.
0038    */
0039   MEGroup();
0040 
0041   /**
0042    * Destructor.
0043    */
0044   virtual ~MEGroup();
0045   //@}
0046 
0047 public:
0048 
0049   /** @name Virtual functions from MEBase. */
0050   //@{
0051   /**
0052    * Return the order in \f$\alpha_S\f$ in which this matrix element
0053    * is given.
0054    */
0055   virtual unsigned int orderInAlphaS() const { return head()->orderInAlphaS(); }
0056 
0057   /**
0058    * Return the order in \f$\alpha_{EM}\f$ in which this matrix
0059    * element is given. Returns 0.
0060    */
0061   virtual unsigned int orderInAlphaEW() const { return head()->orderInAlphaEW(); }
0062 
0063   /**
0064    * Return the matrix element for the kinematical configuation
0065    * previously provided by the last call to setKinematics(), suitably
0066    * scaled by sHat() to give a dimension-less number.
0067    */
0068   virtual double me2() const { return head()->me2(); }
0069 
0070   /**
0071    * Return the scale associated with the phase space point provided
0072    * by the last call to setKinematics().
0073    */
0074   virtual Energy2 scale() const { return head()->scale(); }
0075 
0076   /**
0077    * Return the value of \f$\alpha_S\f$ associated with the phase
0078    * space point provided by the last call to setKinematics(). This
0079    * versions returns SM().alphaS(scale()).
0080    */
0081   virtual double alphaS() const { return head()->alphaS(); }
0082 
0083   /**
0084    * Return the value of \f$\alpha_EM\f$ associated with the phase
0085    * space point provided by the last call to setKinematics(). This
0086    * versions returns SM().alphaEM(scale()).
0087    */
0088   virtual double alphaEM() const { return head()->alphaEM(); }
0089 
0090   /**
0091    * Set the typed and momenta of the incoming and outgoing partons to
0092    * be used in subsequent calls to me() and colourGeometries()
0093    * according to the associated XComb object. If the function is
0094    * overridden in a sub class the new function must call the base
0095    * class one first.
0096    */
0097   virtual void setKinematics() {
0098     MEBase::setKinematics();
0099     head()->setKinematics();
0100   }
0101 
0102   /**
0103    * construct the spin information for the interaction
0104    */
0105   virtual void constructVertex(tSubProPtr sub) { head()->constructVertex(sub); }
0106 
0107   /**
0108    * construct the spin information for the interaction
0109    */
0110   virtual void constructVertex(tSubProPtr sub, const ColourLines* cl) {
0111     head()->constructVertex(sub,cl);
0112   }
0113 
0114   /**
0115    * The number of internal degreed of freedom used in the matrix
0116    * element. This default version returns 0;
0117    */
0118   virtual int nDim() const { return theNDim; }
0119 
0120   /**
0121    * Generate internal degrees of freedom given nDim() uniform random
0122    * numbers in the interval ]0,1[. To help the phase space generator,
0123    * the 'dSigHatDR' should be a smooth function of these numbers,
0124    * although this is not strictly necessary. The return value should
0125    * be true of the generation succeeded. If so the generated momenta
0126    * should be stored in the meMomenta() vector.
0127    */
0128   virtual bool generateKinematics(const double * r);
0129 
0130   /**
0131    * Return true, if this matrix element expects
0132    * the incoming partons in their center-of-mass system
0133    */
0134   virtual bool wantCMS () const { return head()->wantCMS(); }
0135 
0136   /**
0137    * Return the matrix element squared differential in the variables
0138    * given by the last call to generateKinematics().
0139    */
0140   virtual CrossSection dSigHatDR() const { return head()->dSigHatDR(); }
0141 
0142   /**
0143    * Return true, if this matrix element will generate momenta for the
0144    * incoming partons itself.  The matrix element is required to store
0145    * the incoming parton momenta in meMomenta()[0,1]. No mapping in
0146    * tau and y is performed by the PartonExtractor object, if a
0147    * derived class returns true here. The phase space jacobian is to
0148    * include a factor 1/(x1 x2).
0149    */
0150   virtual bool haveX1X2() const { return head()->haveX1X2(); }
0151 
0152   /**
0153    * Return true, if this matrix element provides the PDF
0154    * weight for the first incoming parton itself.
0155    */
0156   virtual bool havePDFWeight1 () const { return head()->havePDFWeight1(); }
0157 
0158   /**
0159    * Return true, if this matrix element provides the PDF
0160    * weight for the second incoming parton itself.
0161    */
0162   virtual bool havePDFWeight2 () const { return head()->havePDFWeight2(); }
0163 
0164   /**
0165    * Return true, if the XComb steering this matrix element
0166    * should keep track of the random numbers used to generate
0167    * the last phase space point
0168    */
0169   virtual bool keepRandomNumbers() const { return head()->keepRandomNumbers(); }
0170 
0171   /**
0172    * Comlete a SubProcess object using the internal degrees of freedom
0173    * generated in the last generateKinematics() (and possible other
0174    * degrees of freedom which was intergated over in dSigHatDR(). This
0175    * default version does nothing. Will be made purely virtual in the
0176    * future.
0177    */
0178   virtual void generateSubCollision(SubProcess & sub) { head()->generateSubCollision(sub); }
0179 
0180   /**
0181    * Clear the information previously provided by a call to
0182    * setKinematics(...).
0183    */
0184   virtual void clearKinematics();
0185 
0186   /**
0187    * Add all possible diagrams with the add() function.
0188    */
0189   virtual void getDiagrams() const {
0190     head()->diagrams();
0191     useDiagrams(head());
0192   }
0193 
0194   /**
0195    * Return true, if this matrix element does not want to
0196    * make use of mirroring processes; in this case all
0197    * possible partonic subprocesses with a fixed assignment
0198    * of incoming particles need to be provided through the diagrams
0199    * added with the add(...) method.
0200    */
0201   virtual bool noMirror () const { return head()->noMirror(); }
0202 
0203   /**
0204    * Return a Selector with possible colour geometries for the selected
0205    * diagram weighted by their relative probabilities.
0206    */
0207   virtual Selector<const ColourLines *>
0208   colourGeometries(tcDiagPtr diag) const { return head()->colourGeometries(diag); }
0209 
0210   /**
0211    * Select a ColpurLines geometry. The default version returns a
0212    * colour geometry selected among the ones returned from
0213    * colourGeometries(tcDiagPtr).
0214    */
0215   virtual const ColourLines &
0216   selectColourGeometry(tcDiagPtr diag) const { return head()->selectColourGeometry(diag); }
0217 
0218   /**
0219    * With the information previously supplied with the
0220    * setKinematics(...) method, a derived class may optionally
0221    * override this method to weight the given diagrams with their
0222    * (although certainly not physical) relative probabilities.
0223    */
0224   virtual Selector<DiagramIndex> diagrams(const DiagramVector & dv) const  { 
0225     return head()->diagrams(dv); 
0226   }
0227 
0228   /**
0229    * Select a diagram. Default version uses diagrams(const
0230    * DiagramVector &) to select a diagram according to the
0231    * weights. This is the only method used that should be outside of
0232    * MEBase.
0233    */
0234   virtual DiagramIndex diagram(const DiagramVector & dv) const {
0235     DiagramIndex res = head()->diagram(dv); 
0236     return res;
0237   }
0238 
0239   /**
0240    * Set the XComb object to be used in the next call to
0241    * generateKinematics() and dSigHatDR().
0242    */
0243   virtual void setXComb(tStdXCombPtr xc) {
0244     MEBase::setXComb(xc);
0245     head()->setXComb(xc);
0246   }
0247 
0248   /**
0249    * If this matrix element is to be used together with others for
0250    * CKKW reweighting and veto, this should give the multiplicity of
0251    * outgoing particles in the highest multiplicity matrix element in
0252    * the group.
0253    */
0254   virtual int maxMultCKKW() const { return head()->maxMultCKKW(); }
0255 
0256   /**
0257    * If this matrix element is to be used together with others for
0258    * CKKW reweighting and veto, this should give the multiplicity of
0259    * outgoing particles in the lowest multiplicity matrix element in
0260    * the group.
0261    */
0262   virtual int minMultCKKW() const { return head()->minMultCKKW(); }
0263 
0264   /**
0265    * If this matrix element is to be used together with others for
0266    * CKKW reweighting and veto, this will set the multiplicity of
0267    * outgoing particles in the highest multiplicity matrix element in
0268    * the group.
0269    */
0270   virtual void maxMultCKKW(int mult) { head()->maxMultCKKW(mult); }
0271 
0272   /**
0273    * If this matrix element is to be used together with others for
0274    * CKKW reweighting and veto, this will set the multiplicity of
0275    * outgoing particles in the lowest multiplicity matrix element in
0276    * the group.
0277    */
0278   virtual void minMultCKKW(int mult) { head()->minMultCKKW(mult); }
0279 
0280   /**
0281    * Inform this matrix element that a new phase space
0282    * point is about to be generated, so all caches should
0283    * be flushed.
0284    */
0285   virtual void flushCaches() { head()->flushCaches(); }
0286 
0287   /**
0288    * Collect information on the last evaluated phasespace
0289    * point for verification or debugging purposes. This
0290    * only called, if the StdXCombGroup did accumulate
0291    * a non-zero cross section from this ME group.
0292    */
0293   virtual void lastEventStatistics() {}
0294 
0295   /**
0296    * Return true, if this configuration of cross sections should not
0297    * be included due to their relative magnitude. Arguments are head
0298    * cross section and dependent cross section, including all
0299    * reweights.
0300    */
0301   virtual bool discard(const CrossSection&, const CrossSection&) const { return false; }
0302   //@}
0303 
0304 public:
0305 
0306   /**
0307    * Return the head matrix element.
0308    */
0309   tMEPtr head() const { return theHead; }
0310 
0311   /**
0312    * Visit the dependent matrix elements
0313    */
0314   const MEVector& dependent() const { return theDependent; }
0315 
0316   /**
0317    * Set the head matrix element.
0318    */
0319   void head(tMEPtr me) { theHead = me; }
0320 
0321   /**
0322    * Access the dependent matrix elements
0323    */
0324   MEVector& dependent() { return theDependent; }
0325 
0326   /**
0327    * Return the random number offset to access the random
0328    * numbers provided for the given matrix element to generate
0329    * dependent kinematics.
0330    */
0331   int dependentOffset(tMEPtr dep) const;
0332 
0333   /**
0334    * For the given event generation setup return an xcomb object
0335    * appropriate to this matrix element.
0336    */
0337   virtual StdXCombPtr makeXComb(Energy newMaxEnergy, const cPDPair & inc,
0338                 tEHPtr newEventHandler,tSubHdlPtr newSubProcessHandler,
0339                 tPExtrPtr newExtractor, tCascHdlPtr newCKKW,
0340                 const PBPair & newPartonBins, tCutsPtr newCuts,
0341                 const DiagramVector & newDiagrams, bool mir,
0342                 const PartonPairVec& allPBins,
0343                 tStdXCombPtr newHead = tStdXCombPtr(),
0344                 tMEPtr newME = tMEPtr());
0345 
0346   /**
0347    * Create a dependent xcomb object to be used
0348    * for the given process steered bythe head object and 
0349    * dependent matrix element.
0350    */
0351   virtual vector<StdXCombPtr> makeDependentXCombs(tStdXCombPtr xcHead,
0352                           const cPDVector& proc,
0353                           tMEPtr depME,
0354                           const PartonPairVec& allPBins) const;
0355 
0356   /**
0357    * Fill the projectors object of xcombs to choose subprocesses
0358    * different than the one currently integrated.
0359    */
0360   virtual void fillProjectors() { head()->fillProjectors(); }
0361 
0362   /**
0363    * Return true, if projectors will be used
0364    */
0365   virtual bool willProject() const { return false; }
0366 
0367   /**
0368    * Return true, if this MEGroup will reweight the contributing cross
0369    * sections.
0370    */
0371   virtual bool groupReweighted() const { return false; }
0372 
0373   /**
0374    * Reweight the head cross section
0375    */
0376   virtual double reweightHead(const vector<tStdXCombPtr>&) { return 1.; }
0377 
0378   /**
0379    * Reweight the dependent cross section
0380    */
0381   virtual double reweightDependent(tStdXCombPtr, const vector<tStdXCombPtr>&) { return 1.; }
0382 
0383   /**
0384    * Return true, if SubProcessGroups should be
0385    * setup from this MEGroup. If not, a single SubProcess
0386    * is constructed from the data provided by the
0387    * head matrix element.
0388    */
0389   virtual bool subProcessGroups() const { return true; }
0390 
0391 public:
0392 
0393   /**
0394    * Return true, if the same additional random numbers
0395    * should be presented to any of the dependent
0396    * matrix elements.
0397    */
0398   virtual bool uniformAdditional() const = 0;
0399 
0400   /**
0401    * Given a process from the head matrix element,
0402    * return a list of diagrams which should be considered for
0403    * the given dependent matrix element.
0404    */
0405   virtual MEBase::DiagramVector dependentDiagrams(const cPDVector& proc,
0406                           tMEPtr depME) const = 0;
0407 
0408 public:
0409 
0410   /** @name Functions used by the persistent I/O system. */
0411   //@{
0412   /**
0413    * Function used to write out object persistently.
0414    * @param os the persistent output stream written to.
0415    */
0416   void persistentOutput(PersistentOStream & os) const;
0417 
0418   /**
0419    * Function used to read in object persistently.
0420    * @param is the persistent input stream read from.
0421    * @param version the version number of the object when written.
0422    */
0423   void persistentInput(PersistentIStream & is, int version);
0424   //@}
0425 
0426   /**
0427    * Standard Init function used to initialize the interfaces.
0428    */
0429   static void Init();
0430 
0431 protected:
0432 
0433   /** @name Standard Interfaced functions. */
0434   //@{
0435   /**
0436    * Initialize this object after the setup phase before saving an
0437    * EventGenerator to disk.
0438    * @throws InitException if object could not be initialized properly.
0439    */
0440   virtual void doinit();
0441 
0442   /**
0443    * Initialize this object. Called in the run phase just before
0444    * a run begins.
0445    */
0446   virtual void doinitrun();
0447 
0448   /**
0449    * Rebind pointer to other Interfaced objects. Called in the setup phase
0450    * after all objects used in an EventGenerator has been cloned so that
0451    * the pointers will refer to the cloned objects afterwards.
0452    * @param trans a TranslationMap relating the original objects to
0453    * their respective clones.
0454    * @throws RebindException if no cloned object was found for a given
0455    * pointer.
0456    */
0457   virtual void rebind(const TranslationMap & trans);
0458 
0459   /**
0460    * Return a vector of all pointers to Interfaced objects used in this
0461    * object.
0462    * @return a vector of pointers.
0463    */
0464   virtual IVector getReferences();
0465   //@}
0466 
0467 private:
0468 
0469   /**
0470    * The head matrix element.
0471    */
0472   MEPtr theHead;
0473 
0474   /**
0475    * The dependent matrix elements.
0476    */
0477   MEVector theDependent;
0478 
0479   /**
0480    * Offsets to access additional random numbers
0481    * required by the dependent matrix elements.
0482    */
0483   map<tMEPtr,int> theNDimMap;
0484 
0485   /**
0486    * The total number of random numbers required.
0487    */
0488   int theNDim;
0489 
0490 private:
0491 
0492   /**
0493    * Describe a class with persistent data.
0494    */
0495   static AbstractClassDescription<MEGroup> initMEGroup;
0496 
0497   /**
0498    *  Private and non-existent assignment operator.
0499    */
0500   MEGroup & operator=(const MEGroup &) = delete;
0501 
0502 };
0503 
0504 }
0505 
0506 
0507 namespace ThePEG {
0508 
0509 /** @cond TRAITSPECIALIZATIONS */
0510 
0511 /**
0512  * This template specialization informs ThePEG about the base class of
0513  * MEGroup.
0514  */
0515 template <>
0516 struct BaseClassTrait<MEGroup,1> {
0517   /** Typedef of the base class of MEGroup. */
0518   typedef MEBase NthBase;
0519 };
0520 
0521 /**
0522  * This template specialization informs ThePEG about the name of the
0523  * MEGroup class.
0524  */
0525 template <>
0526 struct ClassTraits<MEGroup>: public ClassTraitsBase<MEGroup> {
0527   /** Return the class name. */
0528   static string className() { return "ThePEG::MEGroup"; }
0529 };
0530 
0531 /** @endcond */
0532 
0533 }
0534 
0535 #endif /* ThePEG_MEGroup_H */