Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // SoftRemnantHandler.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_SoftRemnantHandler_H
0010 #define ThePEG_SoftRemnantHandler_H
0011 // This is the declaration of the SoftRemnantHandler class.
0012 
0013 #include "ThePEG/PDF/RemnantHandler.h"
0014 #include "ThePEG/PDT/RemnantDecayer.fh"
0015 
0016 namespace ThePEG {
0017 
0018 /**
0019  * SoftRemnantHandler inherits from the RemnantHandler and implements
0020  * the generation of a single collinear RemnantParticle when anything
0021  * is extracted from anything else. Such a RemnantParticle needs to be
0022  * decayed by a special RemnantDecayer and the SoftRemnantHandler
0023  * needs to be assign such a decayer to work properly.
0024  *
0025  * @see \ref SoftRemnantHandlerInterfaces "The interfaces"
0026  * defined for SoftRemnantHandler.
0027  */
0028 class SoftRemnantHandler: public RemnantHandler {
0029 
0030 public:
0031 
0032   /** @name Virtual functions mandated by the RemnantHandler base class. */
0033   //@{
0034   /**
0035    * Return true if this remnant handler can handle extracting all
0036    * specified \a partons form the given \a particle.
0037    */
0038   virtual bool canHandle(tcPDPtr particle, const cPDVector & partons) const;
0039 
0040   /**
0041    * Generate momenta. Generates the momenta of the extracted parton
0042    * in the particle cms (but with the parton \f$x\f$ still the
0043    * positive light-cone fraction) as given by the last argument, \a
0044    * p. If the particle is space-like the positive and negative
0045    * light-cone momenta are \f$\sqrt{-m^2}\f$ and \f$-sqrt{-m^2}\f$
0046    * respectively. If the \a scale is negative, it means that the \a
0047    * doScale in the previous call to nDim() was true, otherwise the
0048    * given scale should be the virtuality of the extracted
0049    * parton. Generated quantities which are not returned in the
0050    * momentum may be saved in the PartonBin, \a pb, for later use. In
0051    * particular, if the nDim() random numbers, \a r, are not enough to
0052    * generate with weight one, the resulting weight should be stored
0053    * with the remnantWeight() method of the parton bin.
0054    */
0055   virtual Lorentz5Momentum generate(PartonBinInstance & pb, const double * r,
0056                     Energy2 scale,
0057                     const LorentzMomentum & p,
0058                     bool fixedPartonMomentum = false) const;
0059 
0060   /**
0061    * Generate the momentum of the extracted parton with the \a parent
0062    * momentum given by the last argument. If the \a scale is negative,
0063    * it means that the doScale in the previous call to nDim() was
0064    * true, otherwise the given \a scale should be the virtuality of
0065    * the extracted parton. \a shat is the total invariant mass squared
0066    * of the hard sub-system produced by the extracted parton and the
0067    * primary parton entering from the other side. Generated quantities
0068    * which are not returned in the momentum may be saved in the
0069    * PartonBinInstance, \a pb, for later use. In particular, if the
0070    * nDim() random numbers, \a r, are not enough to generate with
0071    * weight one, the resulting weight should be stored with the
0072    * remnantWeight() method of the parton bin.
0073    */
0074   virtual Lorentz5Momentum generate(PartonBinInstance & pb, const double * r,
0075                     Energy2 scale, Energy2 shat,
0076                     const LorentzMomentum & parent,
0077                     bool fixedPartonMomentum = false) const;
0078 
0079   /**
0080    * Redo the remnant generation for the given particle bin, \a pb. If
0081    * \a oldp is non-null it corresponds to the previously extracted
0082    * parton which should be replaced by \a newp. If \a oldp is null it
0083    * means \a newp should be extracted in addition to the previously
0084    * extracted ones available in \a prev. 
0085    * @return false if the generation failed.
0086    */
0087   virtual bool recreateRemnants(PartonBinInstance & pb, tPPtr oldp, tPPtr newp,
0088                 double newl, Energy2 scale,
0089                 const LorentzMomentum & p,
0090                 const PVector & prev = PVector()) const;
0091   /**
0092    * Redo the remnant generation for the given particle bin, \a pb. If
0093    * \a oldp is non-null it corresponds to the previously extracted
0094    * parton which should be replaced by \a newp. If \a oldp is null it
0095    * means \a newp should be extracted in addition to the previously
0096    * extracted ones available in \a prev. In either case \a shat is
0097    * the total invariant mass squared of the hard sub-system produced
0098    * by the extracted parton and the primary parton entering from the other
0099    * side. 
0100    *
0101    * @return false if the generation failed.
0102    */
0103   virtual bool recreateRemnants(PartonBinInstance & pb, tPPtr oldp, tPPtr newp,
0104                 double newl, Energy2 scale,
0105                 Energy2 shat, const LorentzMomentum & p,
0106                 const PVector & prev = PVector()) const;
0107   //@}
0108 
0109 public:
0110 
0111   /** @name Functions used by the persistent I/O system. */
0112   //@{
0113   /**
0114    * Function used to write out object persistently.
0115    * @param os the persistent output stream written to.
0116    */
0117   void persistentOutput(PersistentOStream & os) const;
0118 
0119   /**
0120    * Function used to read in object persistently.
0121    * @param is the persistent input stream read from.
0122    * @param version the version number of the object when written.
0123    */
0124   void persistentInput(PersistentIStream & is, int version);
0125   //@}
0126 
0127   /**
0128    * Standard Init function used to initialize the interface.
0129    */
0130   static void Init();
0131 
0132 protected:
0133 
0134   /** @name Clone Methods. */
0135   //@{
0136   /**
0137    * Make a simple clone of this object.
0138    * @return a pointer to the new object.
0139    */
0140   virtual IBPtr clone() const;
0141 
0142   /** Make a clone of this object, possibly modifying the cloned object
0143    * to make it sane.
0144    * @return a pointer to the new object.
0145    */
0146   virtual IBPtr fullclone() const;
0147   //@}
0148 
0149 private:
0150 
0151   /**
0152    * A pointer to a RemnantDecayer object which is able to decay the
0153    * produced RemnantParticle objects.
0154    */
0155   RemDecPtr remdec;
0156 
0157   /**
0158    * Utility function for the interface.
0159    */
0160   void setDecayer(RemDecPtr rd);
0161 
0162 
0163 private:
0164 
0165   /**
0166    * Describe a concrete class with persistent data.
0167    */
0168   static ClassDescription<SoftRemnantHandler> initSoftRemnantHandler;
0169 
0170   /**
0171    *  Private and non-existent assignment operator.
0172    */
0173   SoftRemnantHandler & operator=(const SoftRemnantHandler &) = delete;
0174 
0175 };
0176 
0177 /** @cond TRAITSPECIALIZATIONS */
0178 
0179 /** This template specialization informs ThePEG about the
0180  *  base classes of SoftRemnantHandler. */
0181 template <>
0182 struct BaseClassTrait<SoftRemnantHandler,1>: public ClassTraitsType {
0183   /** Typedef of the first base class of SoftRemnantHandler. */
0184   typedef RemnantHandler NthBase;
0185 };
0186 
0187 /** This template specialization informs ThePEG about the name of the
0188  *  SoftRemnantHandler class and the shared object where it is
0189  *  defined. */
0190 template <>
0191 struct ClassTraits<SoftRemnantHandler>:
0192     public ClassTraitsBase<SoftRemnantHandler> {
0193   /** Return a platform-independent class name */
0194   static string className() { return "ThePEG::SoftRemnantHandler"; }
0195 };
0196 
0197 /** @endcond */
0198 
0199 }
0200 
0201 #endif /* ThePEG_SoftRemnantHandler_H */