Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // CascadeHandler.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_CascadeHandler_H
0010 #define ThePEG_CascadeHandler_H
0011 // This is the declaration of the CascadeHandler class.
0012 
0013 #include "StepHandler.h"
0014 #include "ThePEG/Handlers/LastXCombInfo.h"
0015 #include "ThePEG/PDF/PDF.h"
0016 
0017 namespace ThePEG {
0018 
0019 
0020 /**
0021  * The CascadeHandler is the base class of all handlers implementing
0022  * perturbative partonic cascade models. It is derived from the more
0023  * general StepHandler class, and implements the handle() function to
0024  * do some standard initialization before calling the main cascade()
0025  * function.
0026  *
0027  * @see \ref CascadeHandlerInterfaces "The interfaces"
0028  * defined for CascadeHandler.
0029  * @see StepHandler
0030  * @see EventHandler
0031  * @see SubProcessHandler
0032  */
0033 class CascadeHandler: public StepHandler, public LastXCombInfo<> {
0034 
0035 public:
0036 
0037   /** @name Standard constructors and destructors. */
0038   //@{
0039   /**
0040    * The destructor.
0041    */
0042   virtual ~CascadeHandler();
0043   //@}
0044 
0045 public:
0046 
0047   /** @name Virtual functions required by the StepHandler class. */
0048   //@{
0049   /**
0050     * The main function called by the EventHandler class to
0051     * perform a step.
0052     * @param eh the EventHandler in charge of the Event generation.
0053     * @param tagged if not empty these are the only particles which should
0054     * be considered by the StepHandler.
0055     * @param hint a Hint object with possible information from previously
0056     * performed steps.
0057     * @throws Veto if the StepHandler requires the current step to be
0058     * discarded.
0059     * @throws Stop if the generation of the current Event should be stopped
0060     * after this call.
0061     * @throws Exception if something goes wrong.
0062     */
0063   virtual void handle(EventHandler & eh, const tPVector & tagged,
0064               const Hint & hint);
0065   //@}
0066 
0067   /**
0068    * The main function to be overwritten by sub-classes. It is called
0069    * by handle() after storing some information which is then
0070    * available through simple access functions.
0071    */
0072   virtual void cascade() = 0;
0073 
0074   /**
0075    * The CascadeHandler can be used inside the process generation to
0076    * do so-called CKKW reweighting of the hard sub-process. In this
0077    * case this function is called after information about the
0078    * sub-process is made available through the LastXCombInfo base
0079    * class. Only the function belonging to the primary CascadeHandler
0080    * for the event to be generated is called. Sub-classes may
0081    * implement it to give a suitable weight in return. The
0082    * CascadeHandler may store information about the generated
0083    * sub-process to be used in the subsequent cascade. It is however
0084    * not guaranteed that the reweightCKKW() will have been called for
0085    * the subprocess handed to the handle() function. This default
0086    * implementation of the function simply return one. The current
0087    * sub-process is mixed together with other processes with a
0088    * multiplicity of outgoing particles between \a minMult and \a
0089    * maxMult.
0090    */
0091   virtual double reweightCKKW(int minMult, int maxMult);
0092 
0093 public:
0094 
0095   /** @name Access information stored by the handle() function. */
0096   //@{
0097   /**
0098    * Return the vector of tagged particles which should be
0099    * showered. It the vector is empty, the patons from the current
0100    * sub-process is supposed to be showered.
0101    */
0102   const tPVector & tagged() const { return *theTagged; }
0103 
0104   /**
0105    * Return the int provided in the current call to handle().
0106    */
0107   const Hint & hint() const { return *theHint; }
0108 
0109   /**
0110    * Return references to the PDF used by the first incoming particle.
0111    */
0112   const PDF & firstPDF() const { return pdfs().first; }
0113 
0114   /**
0115    * Return references to the PDF used by the first incoming particle.
0116    */
0117   const PDF & secondPDF() const { return pdfs().second; }
0118 
0119   /**
0120    * Return references to the currently used PDF's.
0121    */
0122   const pair<PDF,PDF> & pdfs() const { return thePDFs; }
0123 
0124   /**
0125    * Set alternative PDFBase objects to be used for cascade.
0126    */
0127   void resetPDFs(const pair<tcPDFPtr,tcPDFPtr> & pdfpair);
0128 
0129   /**
0130    * Set alternative PDFBase objects to be used for cascade.
0131    */
0132   void resetPDFs(const pair<tcPDFPtr,tcPDFPtr> & pdfpair, PBPair ppair);
0133 
0134   /**
0135    * Set the XComb object with information about the sub-process
0136    * generation.
0137    */
0138   void setXComb(tXCombPtr xc);
0139 
0140   /**
0141    * Return true, if this cascade handler will perform reshuffling from hard
0142    * process masses.
0143    */
0144   virtual bool isReshuffling() const { return false; }
0145   
0146   /**
0147    * For multiple cascade calls, this flag tells
0148    * if cascade was called before.
0149    */
0150   bool didRunCascade() const {return theDidRunCascade;}
0151   
0152   /**
0153    * Set the flag to inform if prior cascades had been called.
0154    */
0155   static void setDidRunCascade(bool c){theDidRunCascade=c;}
0156 
0157   //@}
0158 
0159 public:
0160 
0161   /**
0162    * Standard Init function used to initialize the interface.
0163    */
0164   static void Init();
0165 
0166 private:
0167 
0168   /**
0169    * Store the tagged argument given to handle().
0170    */
0171   const tPVector * theTagged;
0172 
0173   /**
0174    * Store the Hint arguments given to handle().
0175    */
0176   const Hint * theHint;
0177 
0178   /**
0179    * The pdfs used to extract the incoming partons.
0180    */
0181   pair<PDF,PDF> thePDFs;
0182   
0183   /**
0184    * If there are multiple cascade calls, this flag tells
0185    * if cascade was called before.
0186    */
0187   static bool theDidRunCascade;
0188   
0189 
0190 private:
0191 
0192   /**
0193    * The static object used to initialize the description of this class.
0194    * Indicates that this is an abstract class without persistent data.
0195    */
0196   static AbstractNoPIOClassDescription<CascadeHandler> initCascadeHandler;
0197 
0198   /**
0199    *  Private and non-existent assignment operator.
0200    */
0201   CascadeHandler & operator=(const CascadeHandler &) = delete;
0202 
0203 };
0204 
0205 /** @cond TRAITSPECIALIZATIONS */
0206 
0207 /** This template specialization informs ThePEG about the
0208  *  base classes of CascadeHandler. */
0209 template <>
0210 struct BaseClassTrait<CascadeHandler,1>: public ClassTraitsType {
0211   /** Typedef of the first base class of CascadeHandler. */
0212   typedef StepHandler NthBase;
0213 };
0214 
0215 /** This template specialization informs ThePEG about the name of
0216  *  the CascadeHandler class and the shared object where it is defined. */
0217 template <>
0218 struct ClassTraits<CascadeHandler>: public ClassTraitsBase<CascadeHandler> {
0219   /** Return a platform-independent class name */
0220   static string className() { return "ThePEG::CascadeHandler"; }
0221 };
0222 
0223 /** @endcond */
0224 
0225 }
0226 
0227 #endif /* ThePEG_CascadeHandler_H */