Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // LastXCombInfo.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_LastXCombInfo_H
0010 #define ThePEG_LastXCombInfo_H
0011 // This is the declaration of the LastXCombInfo class.
0012 
0013 #include "ThePEG/Config/ThePEG.h"
0014 #include "ThePEG/Cuts/Cuts.fh"
0015 #include "XComb.h"
0016 
0017 namespace ThePEG {
0018 
0019 /**
0020  * LastXCombInfo is a templated class giving easy access to the
0021  * information in an XComb object. The default template argument is
0022  * the basic XComb class, but also subclasses of XComb can be
0023  * used. Classes which need to have easy access to the last selected
0024  * XComb object with information about the sub-process which is being
0025  * generated, should (possibly multiple) inherit from the
0026  * LastXCombInfo class. The LastXCombInfo is templated to enable
0027  * derived classes to only include dependencies necessary for the
0028  * access function which are actually used.
0029  * 
0030  */
0031 template <typename XC = XComb>
0032 class LastXCombInfo {
0033 
0034 public:
0035 
0036   ThePEG_DECLARE_TEMPLATE_POINTERS(XC,XCPtr);
0037 
0038 public:
0039 
0040   /** @name Acces to the actual XComb object. */
0041   //@{
0042   /**
0043    * Return a reference to the last selected XComb.
0044    */
0045   const XC & lastXComb() const { return *theLastXComb; }
0046 
0047   /**
0048    * Return a pointer to the last selected XComb.
0049    */
0050   tXCPtr lastXCombPtr() const { return theLastXComb; }
0051 
0052   /**
0053    * If the last selected XComb object belongs to a
0054    * group of XComb's return a reference to the head 
0055    * XComb object for this group.
0056    */
0057   const XC& lastHeadXComb() const { return *lastXComb().head(); }
0058 
0059   /**
0060    * If the last selected XComb object belongs to a
0061    * group of XComb's return a pointer to the head 
0062    * XComb object for this group.
0063    */
0064   tXCPtr lastHeadXCombPtr() const { return lastXComb().head(); }
0065   //@}
0066 
0067   /** @name Access the objects used by the XComb object. */
0068   //@{
0069   /**
0070    * Return a reference to the currently used EventHandler
0071    */
0072   const EventHandler & lastEventHandler() const { return lastXComb().eventHandler(); }
0073 
0074   /**
0075    * A pointer to the currently used parton extractor.
0076    */
0077   tPExtrPtr lastExtractor() const { return lastXComb().pExtractor(); }
0078 
0079   /**
0080    * Return the parton density used to extract the given parton. This
0081    * function is templated to avoid having to include the PDF.h and
0082    * all its dependencies in this header.
0083    */
0084   template <typename PDFT>
0085   PDFT pdf(tcPPtr parton) const {
0086     return PDFT(lastXComb().partonBinInstance(parton));
0087   }
0088 
0089   /**
0090    * A reference to the currently used kinematical cuts.
0091    */
0092   const Cuts & lastCuts() const { return *lastXComb().cuts(); }
0093 
0094   /**
0095    * A pointer to the currently used kinematical cuts.
0096    */
0097   tCutsPtr lastCutsPtr() const { return lastXComb().cuts(); }
0098 
0099   //@}
0100 
0101   /** @name Access information about the incoming particles and partons. */
0102   //@{
0103   /**
0104    * Return the pair of incoming parton instances.
0105    */
0106   const PPair & lastParticles() const { return lastXComb().lastParticles(); }
0107 
0108   /**
0109    * The last generated total energy squared of the incoming particles.
0110    */
0111   Energy2 lastS() const { return lastXComb().lastS(); }
0112 
0113   /**
0114    * Return the pair of incoming parton instances.
0115    */
0116   const PPair & lastPartons() const { return lastXComb().lastPartons(); }
0117 
0118   /**
0119    * The last used interval in total parton-parton energy squared
0120    */
0121   Energy2 lastSHat() const { return lastXComb().lastSHat(); }
0122 
0123   /**
0124    * Return lastSHat()/lastS().
0125    */
0126   double lastTau() const { return lastXComb().lastTau(); }
0127 
0128   /**
0129    * The generated rapidity of the hard scattering sub-system.
0130    */
0131   double lastY() const { return lastXComb().lastY(); }
0132 
0133   /**
0134    * Log of one over the momentum fraction of the first incoming
0135    * particle w.r.t. the maximum allowed energy.
0136    */
0137   double lastP1() const { return lastXComb().lastP1(); }
0138 
0139   /**
0140    * Log of one over the momentum fraction of the second incoming
0141    * particle w.r.t. the maximum allowed energy.
0142    */
0143   double lastP2() const { return lastXComb().lastP2(); }
0144 
0145   /**
0146    * Log of one over the first incoming parton momentum fraction w.r.t. the
0147    * first incoming particle.
0148    */
0149   double lastL1() const { return lastXComb().lastL1(); }
0150 
0151   /**
0152    * Log of one over the second incoming parton momentum fraction
0153    * w.r.t. the second incoming particle.
0154    */
0155   double lastL2() const { return lastXComb().lastL2(); }
0156 
0157   /**
0158    * The first incoming parton momentum fraction w.r.t. the
0159    * first incoming particle.
0160    */
0161   double lastX1() const { return lastXComb().lastX1(); }
0162 
0163   /**
0164    * The second incoming parton momentum fraction
0165    * w.r.t. the second incoming particle.
0166    */
0167   double lastX2() const { return lastXComb().lastX2(); }
0168 
0169   /**
0170    * Return 1-lastX1() to highest possible precision for
0171    * x \f$\rightarrow\f$ 1.
0172    */
0173   double lastE1() const { return lastXComb().lastE1(); }
0174 
0175   /**
0176    * Return 1-lastX2() to highest possible precision for
0177    * x\f$\rightarrow\f$ 1.
0178    */
0179   double lastE2() const { return lastXComb().lastE2(); }
0180 
0181   /**
0182    * The product of the parton density functions at the last generated
0183    * phase-space point.
0184    */
0185   double lastFL1L2() const { return lastXComb().lastFL1L2(); }
0186   //@}
0187 
0188   /** @name Access information of the hard sub-process. */
0189   //@{
0190   /**
0191    * The chosen scale of the hard scattering.
0192    */
0193   Energy2 lastScale() const { return lastXComb().lastScale(); }
0194 
0195   /**
0196    * Get the \f$\alpha_S\f$ used in the hard scattering. Is negative
0197    * if no value has been set.
0198    */
0199   double lastAlphaS() const { return lastXComb().lastAlphaS(); }
0200 
0201   /**
0202    * Get the \f$\alpha_{EM}\f$ used in the hard scattering. Is negative
0203    * if no value has been set.
0204    */
0205   double lastAlphaEM() const { return lastXComb().lastAlphaEM(); }
0206 
0207   /**
0208    * Return the momenta of the incoming and outgoing partons to be
0209    * used by the matrix element object, in the order specified by the
0210    * TreeDiagram objects given by the matrix element.
0211    */
0212   const vector<Lorentz5Momentum> & meMomenta() const { return lastXComb().meMomenta(); }
0213 
0214   /**
0215    * Return the matrix element squared as calculated
0216    * for the last phase space point. This may optionally
0217    * be used by a matrix element for caching.
0218    */
0219   double lastME2() const { return lastXComb().lastME2(); }
0220 
0221   /**
0222    * Return the last preweight factor
0223    */
0224   double lastPreweight() const { return lastXComb().lastPreweight(); }
0225 
0226   /**
0227    * Get the last jacobian obtained when generating the kinematics
0228    * for the call to dSigHatDR.
0229    */
0230   double jacobian() const { return lastXComb().jacobian(); }
0231 
0232   /**
0233    * Return the partonic cross section as calculated
0234    * for the last phase space point. This may optionally
0235    * be used by a matrix element for caching.
0236    */
0237   CrossSection lastMECrossSection() const { return lastXComb().lastMECrossSection(); }
0238 
0239   /**
0240    * Return the PDF weight as calculated
0241    * for the last phase space point, if the matrix
0242    * element does supply PDF weights. This may optionally
0243    * be used by a matrix element for caching.
0244    */
0245   double lastMEPDFWeight() const { return lastXComb().lastMEPDFWeight(); }
0246 
0247   /**
0248    * Return the coupling weight as calculated
0249    * for the last phase space point.
0250    */
0251   double lastMECouplings() const { return lastXComb().lastMECouplings(); }
0252 
0253   /**
0254    * Return the SubProcess object corresponding to the last generated
0255    * sub-process.
0256    */
0257   tSubProPtr subProcess() const { return lastXComb().subProcess(); }
0258 
0259   /**
0260    * Return the incoming and outgoing parton types to be used by the
0261    * matrix element object, in the order specified by the TreeDiagram
0262    * objects given by the matrix element.
0263    */
0264   const cPDVector & mePartonData() const { return lastXComb().mePartonData(); }
0265   //@}
0266 
0267 protected:
0268 
0269   /**
0270    * The pointer to the last selected XComb.
0271    */
0272   XCPtr theLastXComb;
0273 };
0274 
0275 }
0276 
0277 #endif /* ThePEG_LastXCombInfo_H */