Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // SimpleBaryonRemnantDecayer.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_SimpleBaryonRemnantDecayer_H
0010 #define THEPEG_SimpleBaryonRemnantDecayer_H
0011 //
0012 // This is the declaration of the SimpleBaryonRemnantDecayer class.
0013 //
0014 
0015 #include "ThePEG/PDT/RemnantDecayer.h"
0016 #include "ThePEG/Handlers/ZGenerator.h"
0017 #include "ThePEG/Handlers/FlavourGenerator.h"
0018 #include "ThePEG/Utilities/VSelector.h"
0019 
0020 namespace ThePEG {
0021 
0022 /**
0023  * The SimpleBaryonRemnantDecayer class inherits from the
0024  * RemnantDecayer class and is able to decay RemnantParticles produced
0025  * by the SoftRemnantHandler class for the cases when a single parton
0026  * has been extracted from a baryon.
0027  *
0028  * @see \ref SimpleBaryonRemnantDecayerInterfaces "The interfaces"
0029  * defined for SimpleBaryonRemnantDecayer.
0030  */
0031 class SimpleBaryonRemnantDecayer: public RemnantDecayer {
0032 
0033 public:
0034 
0035   /** A pointer to a ZGenerator object. */
0036   typedef Ptr<ZGenerator>::pointer ZGPtr;
0037   /** A pointer to a FlavourGenerator object. */
0038   typedef Ptr<FlavourGenerator>::pointer FlGPtr;
0039 
0040 public:
0041 
0042   /** @name Standard constructors and destructors. */
0043   //@{
0044   /**
0045    * The default constructor.
0046    */
0047   SimpleBaryonRemnantDecayer()
0048     : theMargin(1.0*GeV), useSpecialValence(false) {}
0049 
0050   /**
0051    * The copy constructor.
0052    */
0053   SimpleBaryonRemnantDecayer(const SimpleBaryonRemnantDecayer & x)
0054     : RemnantDecayer(x), theZGenerator(x.theZGenerator),
0055       theFlavourGenerator(x.theFlavourGenerator), theMargin(x.theMargin),
0056       useSpecialValence(x.useSpecialValence) {}
0057   //@}
0058 
0059 public:
0060 
0061   /** @name Virtual functions required by the RemnantDecayer class. */
0062   //@{
0063   /**
0064    * Check if this decayer can perfom the decay specified by the
0065    * given decay mode.
0066    * @param dm the DecayMode describing the decay.
0067    * @return true if this decayer can handle the given mode, otherwise false.
0068    */
0069   virtual bool accept(const DecayMode & dm) const;
0070 
0071   /**
0072    * Perform a decay for a given DecayMode and a given Particle
0073    * instance. This version allows the decaying particle to borrow
0074    * energy/momentum from its sublings in the current step. This will
0075    * be called by the standard DecayHandler if the needsFullStep()
0076    * function returns true.
0077    *
0078    * @param dm   the DecayMode describing the decay.
0079    * @param p    the Particle instance to be decayed.
0080    * @param step the current step in which to find possible siblings to
0081    *             shuffle energy with.
0082    * @return a ParticleVector containing the decay products.
0083    */
0084   virtual ParticleVector decay(const DecayMode & dm, const Particle & p,
0085                    Step & step) const;
0086 
0087   /**
0088    * Return true if this decayer can handle the extraction of the \a
0089    * extracted parton from the given \a particle.
0090    */
0091   virtual bool canHandle(tcPDPtr parent, tcPDPtr extracted) const;
0092 
0093   /**
0094    * Return true if this decayer can handle the extraction of the \a
0095    * extracted parton instance from the given \a particle instance. \a
0096    * pnew is the momentum of the resulting remnant. The default
0097    * version simply checks if the energy is positive.
0098    */
0099   virtual bool checkExtract(tcPPtr parent, tcPPtr extracted,
0100                 const LorentzMomentum & pnew) const;
0101   //@}
0102 
0103 protected:
0104 
0105   /** @name Standard Interfaced functions. */
0106   //@{
0107   /**
0108    * Initialize this object after the setup phase before saving an
0109    * EventGenerator to disk.
0110    * @throws InitException if object could not be initialized properly.
0111    */
0112   virtual void doinit();
0113 
0114   /**
0115    * Return true if this object needs to be initialized before all
0116    * other objects because it needs to extract cuts from the event file.
0117    */
0118   virtual bool preInitialize() const;
0119   //@}
0120 
0121 public:
0122 
0123   /** @name Functions used by the persistent I/O system. */
0124   //@{
0125   /**
0126    * Function used to write out object persistently.
0127    * @param os the persistent output stream written to.
0128    */
0129   void persistentOutput(PersistentOStream & os) const;
0130 
0131   /**
0132    * Function used to read in object persistently.
0133    * @param is the persistent input stream read from.
0134    * @param version the version number of the object when written.
0135    */
0136   void persistentInput(PersistentIStream & is, int version);
0137   //@}
0138 
0139   /**
0140    * The standard Init function used to initialize the interfaces.
0141    * Called exactly once for each class by the class description system
0142    * before the main function starts or
0143    * when this class is dynamically loaded.
0144    */
0145   static void Init();
0146 
0147 public:
0148 
0149   /**
0150    * Warning Exception used when DIS kinematics was not respected.
0151    */
0152   struct NoDISRespect: public Exception {};
0153 
0154   /**
0155    * Exception thrown if the decay of a remnant was impossible.
0156    */
0157   struct DecayFailed: public Exception {};
0158 
0159 public:
0160 
0161   /**
0162    * Return a reference to the object responsible for generating
0163    * momentum fractions in case of more than one remnant.
0164    */
0165   ZGenerator & zGenerator() const { return *theZGenerator; }
0166 
0167   /**
0168    * Return a reference to the object responsible for handling the
0169    * flavour contents of a baryon.
0170    */
0171   FlavourGenerator & flavourGenerator() const { return *theFlavourGenerator; }
0172 
0173   /**
0174    * Return the energy margin to be added to the sum of the parent and
0175    * parton masses to determine if it is possible to construct the
0176    * remnants with the given (upper limit of the) virtuality of the
0177    * extracted parton.
0178    */
0179   Energy margin() const { return theMargin; }
0180 
0181   /**
0182    * If true an extracted valens quark will always give a di-quark remnant.
0183    */
0184   bool specialValence() const { return useSpecialValence; }
0185 
0186 protected:
0187 
0188   /** @name Clone Methods. */
0189   //@{
0190   /**
0191    * Make a simple clone of this object.
0192    * @return a pointer to the new object.
0193    */
0194   virtual IBPtr clone() const;
0195 
0196   /** Make a clone of this object, possibly modifying the cloned object
0197    * to make it sane.
0198    * @return a pointer to the new object.
0199    */
0200   virtual IBPtr fullclone() const;
0201   //@}
0202 
0203 public:
0204 
0205   /**
0206    * Simple struct to store info about baryon quark and di-quark
0207    * constituents.
0208    */
0209   struct BaryonContent {
0210     /** The valence flavours of the corresponding baryon. */
0211     vector<int> flav;
0212     /** Different divisions into quark-diquark weighted by their
0213     respective probabilities. */
0214     VSelector< pair<int,int> > flavsel;
0215     /** -1 if the particle is an anti-particle. +1 otherwise. */
0216     int sign;
0217   };
0218 
0219   /**
0220    * Return info about baryon quark and di-quark constituents.
0221    */
0222   const BaryonContent & getBaryonInfo(tcPDPtr baryon) const;    
0223 
0224 private:
0225 
0226   /**
0227    * The object responsible for generating momentum fractions in case
0228    * of more than one remnant.
0229    */
0230   ZGPtr theZGenerator;
0231 
0232   /**
0233    * The object responsible for handling the flavour contents of a
0234    * baryon.
0235    */
0236   FlGPtr theFlavourGenerator;
0237 
0238   /**
0239    * The energy margin to be added to the sum of the parent and parton
0240    * masses to determine if it is possible to construct the remnants
0241    * with the given (upper limit of the) virtuality of the extracted
0242    * parton.
0243    */
0244   Energy theMargin;
0245 
0246   /**
0247    * If true an extracted valens quark will always give a di-quark remnant.
0248    */
0249   bool useSpecialValence;
0250 
0251   /**
0252    * A map of info about baryon quark and di-quark constituents.
0253    */
0254   mutable map<tcPDPtr,BaryonContent> baryonmap;
0255 
0256 private:
0257 
0258   /**
0259    * The static object used to initialize the description of this class.
0260    * Indicates that this is a concrete class with persistent data.
0261    */
0262   static ClassDescription<SimpleBaryonRemnantDecayer>
0263   initSimpleBaryonRemnantDecayer;
0264 
0265   /**
0266    * The assignment operator is private and must never be called.
0267    * In fact, it should not even be implemented.
0268    */
0269   SimpleBaryonRemnantDecayer & operator=(const SimpleBaryonRemnantDecayer &) = delete;
0270 
0271 };
0272 
0273 }
0274 
0275 #include "ThePEG/Utilities/ClassTraits.h"
0276 
0277 namespace ThePEG {
0278 
0279 /** @cond TRAITSPECIALIZATIONS */
0280 
0281 /** This template specialization informs ThePEG about the
0282  *  base classes of SimpleBaryonRemnantDecayer. */
0283 template <>
0284 struct BaseClassTrait<SimpleBaryonRemnantDecayer,1> {
0285   /** Typedef of the first base class of SimpleBaryonRemnantDecayer. */
0286   typedef RemnantDecayer NthBase;
0287 };
0288 
0289 /** This template specialization informs ThePEG about the name of the
0290  *  SimpleBaryonRemnantDecayer class and the shared object where it is
0291  *  defined. */
0292 template <>
0293 struct ClassTraits<SimpleBaryonRemnantDecayer>
0294   : public ClassTraitsBase<SimpleBaryonRemnantDecayer> {
0295   /** Return a platform-independent class name */
0296   static string className() { return "ThePEG::SimpleBaryonRemnantDecayer"; }
0297 };
0298 
0299 /** @endcond */
0300 
0301 }
0302 
0303 #endif /* THEPEG_SimpleBaryonRemnantDecayer_H */