Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // RemnantHandler.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_RemnantHandler_H
0010 #define ThePEG_RemnantHandler_H
0011 // This is the declaration of the RemnantHandler class.
0012 
0013 #include "ThePEG/Handlers/HandlerBase.h"
0014 #include "ThePEG/PDF/PartonBin.h"
0015 #include "ThePEG/PDF/PartonBinInstance.h"
0016 #include "ThePEG/Vectors/Transverse.h"
0017 #include "RemnantHandler.xh"
0018 
0019 namespace ThePEG {
0020 
0021 /**
0022  * RemnantHandler is an abstract base class for implementing classes
0023  * used to generate remnants when partons are extracted from
0024  * particles.
0025  *
0026  * @see \ref RemnantHandlerInterfaces "The interfaces"
0027  * defined for RemnantHandler.
0028  * @see PartonExtractor
0029  * @see PDFBase
0030  */
0031 class RemnantHandler: public HandlerBase {
0032 
0033 public:
0034 
0035   /** @name Standard constructors and destructors. */
0036   //@{
0037   /**
0038    * Default constructor. If \a multi is true the derived class can be
0039    * used to extract more than one parton.
0040    */
0041   RemnantHandler(bool multi = false);
0042   //@}
0043 
0044 public:
0045 
0046   /** @name Virtual functions to be overridden by sub-classes. */
0047   //@{
0048   /**
0049    * Return true if this remnant handler can handle extracting all
0050    * specified \a partons from the given \a particle.
0051    */
0052   virtual bool canHandle(tcPDPtr particle,
0053              const cPDVector & partons) const = 0;
0054 
0055   /**
0056    * If the generation of remnants is expected to influence the actual
0057    * cross section of the hard sub process, the degrees of freedom
0058    * generated by this remnant handler may be included in the general
0059    * phase space sampling for the subprocess. In this case this
0060    * function should be overridden to return the number of degrees of
0061    * freedom used in the generation. If \a doScale is false, it means
0062    * that the actual virtuality of the extracted parton will be
0063    * obtained from another source.
0064    */
0065   virtual int nDim(const PartonBin & pb, bool doScale) const;
0066 
0067   /**
0068    * Generate the momentum of the extracted parton with the \a parent
0069    * momentum given by the last argument. If the \a scale is negative,
0070    * it means that the doScale in the previous call to nDim() was
0071    * true, otherwise the given \a scale should be the virtuality of
0072    * the extracted parton. Generated quantities which are not returned
0073    * in the momentum may be saved in the PartonBinInstance, \a pb, for
0074    * later use. In particular, if the nDim() random numbers, \a r, are
0075    * not enough to generate with weight one, the resulting weight
0076    * should be stored with the remnantWeight() method of the parton
0077    * bin.
0078    */
0079   virtual Lorentz5Momentum generate(PartonBinInstance & pb, const double * r,
0080                     Energy2 scale,
0081                     const LorentzMomentum & parent,
0082                     bool fixedPartonMomentum = false) const = 0;
0083 
0084   /**
0085    * Generate the momentum of the extracted parton with the \a parent
0086    * momentum given by the last argument. If the \a scale is negative,
0087    * it means that the doScale in the previous call to nDim() was
0088    * true, otherwise the given \a scale should be the virtuality of
0089    * the extracted parton. \a shat is the total invariant mass squared
0090    * of the hard sub-system produced by the extracted parton and the
0091    * primary parton entering from the other side. Generated quantities
0092    * which are not returned in the momentum may be saved in the
0093    * PartonBinInstance, \a pb, for later use. In particular, if the
0094    * nDim() random numbers, \a r, are not enough to generate with
0095    * weight one, the resulting weight should be stored with the
0096    * remnantWeight() method of the parton bin.
0097    */
0098   virtual Lorentz5Momentum generate(PartonBinInstance & pb, const double * r,
0099                     Energy2 scale, Energy2 shat,
0100                     const LorentzMomentum & parent,
0101                     bool fixedPartonMomentum = false) const = 0;
0102 
0103   /**
0104    * Boost the generated remnants to the proper momentum given the
0105    * information in the parton bin, \a pb.
0106    */
0107   virtual void boostRemnants(PartonBinInstance & pb) const;
0108 
0109   /**
0110    * Redo the remnant generation for the given particle bin, \a pb. If
0111    * \a oldp is non-null it corresponds to the previously extracted
0112    * parton which should be replaced by \a newp. If \a oldp is null it
0113    * means \a newp should be extracted in addition to the previously
0114    * extracted ones available in \a prev. 
0115    * @return false if the generation failed.
0116    */
0117   virtual bool recreateRemnants(PartonBinInstance & pb, tPPtr oldp, tPPtr newp,
0118                 double newl, Energy2 scale,
0119                 const LorentzMomentum & p,
0120                 const PVector & prev = PVector()) const;
0121   /**
0122    * Redo the remnant generation for the given particle bin, \a pb. If
0123    * \a oldp is non-null it corresponds to the previously extracted
0124    * parton which should be replaced by \a newp. If \a oldp is null it
0125    * means \a newp should be extracted in addition to the previously
0126    * extracted ones available in \a prev. In either case \a shat is
0127    * the total invariant mass squared of the hard sub-system produced
0128    * by the extracted parton and the primary parton entering from the other
0129    * side. 
0130    *
0131    * @return false if the generation failed.
0132    */
0133   virtual bool recreateRemnants(PartonBinInstance & pb, tPPtr oldp, tPPtr newp,
0134                 double newl, Energy2 scale,
0135                 Energy2 shat, const LorentzMomentum & p,
0136                 const PVector & prev = PVector()) const;
0137   //@}
0138 
0139   /**
0140    * Return true if this remnant handler is able to handle multiple
0141    * extractions of partons from the same particle.
0142    */
0143   bool multiCapable() const { return isMultiCapable; }
0144 
0145 public:
0146 
0147   /** @name Functions used by the persistent I/O system. */
0148   //@{
0149   /**
0150    * Function used to write out object persistently.
0151    * @param os the persistent output stream written to.
0152    */
0153   void persistentOutput(PersistentOStream & os) const;
0154 
0155   /**
0156    * Function used to read in object persistently.
0157    * @param is the persistent input stream read from.
0158    * @param version the version number of the object when written.
0159    */
0160   void persistentInput(PersistentIStream & is, int version);
0161   //@}
0162 
0163   /**
0164    * Standard Init function used to initialize the interface.
0165    */
0166   static void Init();
0167 
0168 protected:
0169 
0170   /**
0171    * True if this handler can generate remnants also if several
0172    * partons have been extracted.
0173    */
0174   bool isMultiCapable;
0175 
0176 private:
0177 
0178   /**
0179    * The static object used to initialize the description of this class.
0180    * Indicates that this is an abstract class with persistent data.
0181    */
0182   static AbstractClassDescription<RemnantHandler> initRemnantHandler;
0183 
0184   /**
0185    *  Private and non-existent assignment operator.
0186    */
0187   RemnantHandler & operator=(const RemnantHandler &) = delete;
0188 
0189 };
0190 
0191 /** @cond TRAITSPECIALIZATIONS */
0192 
0193 /** This template specialization informs ThePEG about the base classes
0194  *  of RemnantHandler. */
0195 template <>
0196 struct BaseClassTrait<RemnantHandler,1>: public ClassTraitsType {
0197   /** Typedef of the first base class of RemnantHandler. */
0198   typedef HandlerBase NthBase;
0199 };
0200 
0201 /** This template specialization informs ThePEG about the name of the
0202  *  RemnantHandler class. */
0203 template <>
0204 struct ClassTraits<RemnantHandler>: public ClassTraitsBase<RemnantHandler> {
0205   /** Return a platform-independent class name */
0206   static string className() { return "ThePEG::RemnantHandler"; }
0207 };
0208 
0209 /** @endcond */
0210 
0211 }
0212 
0213 #endif /* ThePEG_RemnantHandler_H */