Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // RemnantDecayer.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_RemnantDecayer_H
0010 #define THEPEG_RemnantDecayer_H
0011 //
0012 // This is the declaration of the RemnantDecayer class.
0013 //
0014 
0015 #include "ThePEG/PDT/Decayer.h"
0016 #include "RemnantDecayer.fh"
0017 #include "ThePEG/PDT/RemnantData.h"
0018 #include "ThePEG/EventRecord/RemnantParticle.h"
0019 #include "ThePEG/Handlers/PtGenerator.h"
0020 
0021 namespace ThePEG {
0022 
0023 /**
0024  * The RemnantDecayer class is the base class to be used for all
0025  * decayers capable of decaying a RemnantParticle object produced by a
0026  * SoftRemnantHandler object. A derived class must implement the
0027  * decay(const DecayMode &, const Particle &, Step &) function, while
0028  * the decay(const DecayMode &, const Particle &) function should
0029  * never be called.
0030  *
0031  * @see \ref RemnantDecayerInterfaces "The interfaces"
0032  * defined for RemnantDecayer.
0033  */
0034 class RemnantDecayer: public Decayer {
0035 
0036 public:
0037 
0038   /** A pointer to a PtGenerator object. */
0039   typedef Ptr<PtGenerator>::pointer PtGPtr;
0040 
0041 public:
0042 
0043   /**
0044    * Enumerate the options for how to distribute recoils in the hard
0045    * subsystem when taking energy to produce remnants.
0046    */
0047   enum RecoilOption {
0048     boostAll,   /**< Boost all particles in the hard subsystem. */
0049     boostFinal, /**< Boost only final state particles in hard subsystem. */
0050     copyFinal   /**< Boost copies of final state particles in hard subsystem. */
0051   };
0052 
0053 public:
0054 
0055   /** @name Standard constructors and destructors. */
0056   //@{
0057   /**
0058    * The default constructor.
0059    */
0060   RemnantDecayer() : respectDIS(2), theRecoilOption(copyFinal) {}
0061 
0062   /**
0063    * The destructor.
0064    */
0065   virtual ~RemnantDecayer();
0066   //@}
0067 
0068 public:
0069 
0070   /** @name Virtual functions required by the Decayer class. */
0071   //@{
0072   /**
0073    * Check if this decayer can perfom the decay specified by the
0074    * given decay mode.
0075    * @param dm the DecayMode describing the decay.
0076    * @return true if this decayer can handle the given mode, otherwise false.
0077    */
0078   virtual bool accept(const DecayMode & dm) const;
0079 
0080   /**
0081    * Return true if this Decayer need to access the full current step
0082    * when a particle is decayed. If true is returned the standard
0083    * Decay Handler will call the decay(const DecayMode&,const
0084    * Particle&,Step&) function rather than the decay(const
0085    * DecayMode&,const Particle&) function.
0086    */
0087   virtual bool needsFullStep() const;
0088 
0089   /**
0090    * Perform a decay for a given DecayMode and a given Particle
0091    * instance. This version allows the decaying particle to borrow
0092    * energy/momentum from its sublings in the current step. This will
0093    * be called by the standard DecayHandler if the needsFullStep()
0094    * function returns true.
0095    *
0096    * @param dm   the DecayMode describing the decay.
0097    * @param p    the Particle instance to be decayed.
0098    * @param step the current step in which to find possible siblings to
0099    *             shuffle energy with.
0100    * @return a ParticleVector containing the decay products.
0101    */
0102   virtual ParticleVector decay(const DecayMode & dm, const Particle & p,
0103                    Step & step) const = 0;
0104 
0105   /**
0106    * Perform a decay for a given DecayMode and a given Particle instance.
0107    * @param dm the DecayMode describing the decay.
0108    * @param p the Particle instance to be decayed.
0109    * @return a ParticleVector containing the decay products.
0110    */
0111   virtual ParticleVector decay(const DecayMode & dm, const Particle & p) const;
0112   //@}
0113 
0114   /**
0115    * Return true if this decayer can handle the extraction of the \a
0116    * extracted parton from the given \a particle.
0117    */
0118   virtual bool canHandle(tcPDPtr parent, tcPDPtr extracted) const;
0119 
0120   /**
0121    * Return true if this decayer can handle the extraction of the \a
0122    * extracted parton instance from the given \a particle instance. \a
0123    * pnew is the momentum of the resulting remnant. The default
0124    * version simply checks if the energy is positive.
0125    */
0126   virtual bool checkExtract(tcPPtr parent, tcPPtr extracted,
0127                 const LorentzMomentum & pnew) const;
0128 
0129   /**
0130    * Return true if this decayed can extract more than one parton from
0131    * a particle.
0132    */
0133   virtual bool multiCapable() const;
0134 
0135   /**
0136    * The option for how to distribute recoils in the hard subsystem
0137    * when taking energy to produce remnants.
0138    */
0139   RecoilOption recoilOption() const { return theRecoilOption; }
0140 
0141   /**
0142    * If true, do not boost a scattered lepton (and possible radiated
0143    * photons) in a DIS event, to ensure that \f$x\f$ and \f$Q^2\f$ is
0144    * unmodified.
0145    */
0146   int respectDISKinematics() const { return respectDIS; }
0147 
0148   /**
0149    * An object capable of generating an intrinsic transverse momentum
0150    * of the created remnants.
0151    */
0152   PtGPtr pTGenerator() const { return thePTGenerator; }
0153 
0154   /**
0155    * Static function to decay al remnants among the given \a
0156    * particles. The decay products are inserted in the \a step
0157    * provided.
0158    * @return a vector of the non-remnant particles together with the
0159    * remnant decay products.
0160    */
0161   static tPVector decayRemnants(const tPVector & particles, Step & step);
0162 
0163 protected:
0164 
0165   /**
0166    * Access the RemnantData object of a \a remnant.
0167    */
0168   tRemPDPtr data(tcRemPPtr remnant) const { return remnant->remData; }
0169 
0170   /**
0171    * Access the parent  of a \a remnant.
0172    */
0173   tcPPtr parent(tcRemPPtr remnant) const { return remnant->parent; }
0174 
0175   /**
0176    * Access the vector of extracted particles of a \a remnant.
0177    */
0178   const PVector & extracted(tcRemPPtr remnant) const {
0179     return remnant->extracted();
0180   }
0181 
0182   /**
0183    * Recursively find all particles produced from an extracted parton.
0184    */
0185   virtual void fillSubSystem(tPPtr p, set<tPPtr> & sub) const;
0186 
0187   /**
0188    * Return the system of particles from the hard subsystem which may
0189    * be used to shuffle momenta to get the remnants on-shell. In this
0190    * version the particles are ordered in rapidity with the ones
0191    * closest to the remnant direction comes first. Other orderings can
0192    * be enforced by sub-classes.
0193    */
0194   virtual tPVector getSubSystem(tcPPtr parent, tPPtr parton) const;
0195 
0196   /**
0197    * Return a small boost along the z-axis. To cure rounding errors
0198    * when making large boosts it is sometimes necessary to correct the
0199    * plus (or minus) lightcone component with a small boost along the
0200    * z-axis. The resulting boost is constructed so that the momentum
0201    * \a p0 would be transformed to have the sam z-value as the
0202    * momentum \a p.
0203    */
0204   static LorentzRotation getZBoost(const LorentzMomentum & p0,
0205                    const LorentzMomentum & p);
0206 
0207 public:
0208 
0209   /**
0210    * Exception used if getSubSystem fails.
0211    */
0212   struct SubSystemFail: public Exception {};
0213 
0214 protected:
0215 
0216   /** @name Standard Interfaced functions. */
0217   //@{
0218   /**
0219    * Initialize this object after the setup phase before saving an
0220    * EventGenerator to disk.
0221    * @throws InitException if object could not be initialized properly.
0222    */
0223   virtual void doinit();
0224 
0225   /**
0226    * Return true if this object needs to be initialized before all
0227    * other objects because it needs to extract cuts from the event file.
0228    */
0229   virtual bool preInitialize() const;
0230   //@}
0231 
0232 public:
0233 
0234   /** @name Functions used by the persistent I/O system. */
0235   //@{
0236   /**
0237    * Function used to write out object persistently.
0238    * @param os the persistent output stream written to.
0239    */
0240   void persistentOutput(PersistentOStream & os) const;
0241 
0242   /**
0243    * Function used to read in object persistently.
0244    * @param is the persistent input stream read from.
0245    * @param version the version number of the object when written.
0246    */
0247   void persistentInput(PersistentIStream & is, int version);
0248   //@}
0249 
0250   /**
0251    * The standard Init function used to initialize the interfaces.
0252    * Called exactly once for each class by the class description system
0253    * before the main function starts or
0254    * when this class is dynamically loaded.
0255    */
0256   static void Init();
0257 
0258 protected:
0259   /**
0260    * If true, do not boost a scattered lepton (and possible radiated
0261    * photons) in a DIS event, to ensure that \f$x\f$ and \f$Q^2\f$ is
0262    * unmodified.
0263    */
0264   mutable int respectDIS;
0265 
0266 private:
0267 
0268   /**
0269    * The option for how to distribute recoils in the hard subsystem
0270    * when taking energy to produce remnants.
0271    */
0272   RecoilOption theRecoilOption;
0273 
0274   /**
0275    * An object capable of generating an intrinsic transverse momentum
0276    * of the created remnants.
0277    */
0278   PtGPtr thePTGenerator;
0279 
0280 private:
0281 
0282   /**
0283    * The static object used to initialize the description of this class.
0284    * Indicates that this is a concrete class with persistent data.
0285    */
0286   static AbstractClassDescription<RemnantDecayer> initRemnantDecayer;
0287 
0288   /**
0289    * The assignment operator is private and must never be called.
0290    * In fact, it should not even be implemented.
0291    */
0292   RemnantDecayer & operator=(const RemnantDecayer &) = delete;
0293 
0294 };
0295 
0296 }
0297 
0298 #include "ThePEG/Utilities/ClassTraits.h"
0299 
0300 namespace ThePEG {
0301 
0302 /** @cond TRAITSPECIALIZATIONS */
0303 
0304 /** This template specialization informs ThePEG about the
0305  *  base classes of RemnantDecayer. */
0306 template <>
0307 struct BaseClassTrait<RemnantDecayer,1> {
0308   /** Typedef of the first base class of RemnantDecayer. */
0309   typedef Decayer NthBase;
0310 };
0311 
0312 /** This template specialization informs ThePEG about the name of
0313  *  the RemnantDecayer class and the shared object where it is defined. */
0314 template <>
0315 struct ClassTraits<RemnantDecayer>
0316   : public ClassTraitsBase<RemnantDecayer> {
0317   /** Return a platform-independent class name */
0318   static string className() { return "ThePEG::RemnantDecayer"; }
0319 };
0320 
0321 /** @endcond */
0322 
0323 }
0324 
0325 #endif /* THEPEG_RemnantDecayer_H */