Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:24:23

0001 // -*- C++ -*-
0002 //
0003 // DipoleSplittingReweight.h is a part of Herwig - A multi-purpose Monte Carlo event generator
0004 // Copyright (C) 2002-2019 The Herwig Collaboration
0005 //
0006 // Herwig 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 HERWIG_DipoleSplittingReweight_H
0010 #define HERWIG_DipoleSplittingReweight_H
0011 //
0012 // This is the declaration of the DipoleSplittingReweight class.
0013 //
0014 
0015 #include "ThePEG/Handlers/HandlerBase.h"
0016 #include "DipoleSplittingInfo.h"
0017 
0018 #include "Herwig/Shower/Dipole/DipoleShowerHandler.fh"
0019 
0020 namespace Herwig {
0021 
0022 using namespace ThePEG;
0023 
0024 /**
0025  * \ingroup DipoleShower
0026  * \author Simon Platzer
0027  *
0028  * \brief DipoleSplittingReweight is used by the dipole shower
0029  * to reweight splittings from a given dipole splitting kernel.
0030  *
0031  * @see \ref DipoleSplittingReweightInterfaces "The interfaces"
0032  * defined for DipoleSplittingReweight.
0033  */
0034 class DipoleSplittingReweight: public HandlerBase {
0035 
0036 public:
0037 
0038   /** @name Standard constructors and destructors. */
0039   //@{
0040   /**
0041    * The default constructor.
0042    */
0043   DipoleSplittingReweight();
0044 
0045   /**
0046    * The destructor.
0047    */
0048   virtual ~DipoleSplittingReweight();
0049   //@}
0050 
0051 public:
0052 
0053   /**
0054    * Return true, if the reweighting should be applied to the first
0055    * interaction
0056    */
0057   virtual bool firstInteraction() const { return true; }
0058 
0059   /**
0060    * Return true, if the reweighting should be applied to the secondary
0061    * interactions
0062    */
0063   virtual bool secondaryInteractions() const { return false; }
0064 
0065   /**
0066    * Update the pointer to the currently active dipole shower handler object.
0067    */
0068   void updateCurrentHandler();
0069 
0070   /**
0071    * Return the pointer to the currently active dipole shower handler object.
0072    */
0073   Ptr<DipoleShowerHandler>::tptr currentHandler() const;
0074 
0075   /**
0076    * Return the reweighting factor for the given splitting type.
0077    */
0078   virtual double evaluate(const DipoleSplittingInfo&) const = 0;
0079 
0080   /**
0081    * Return an enhancement hint for the sampling of the un-reweighted
0082    * splitting kernel
0083    */
0084   virtual double hint(const DipoleSplittingInfo&) const {
0085     return 1.;
0086   }
0087 
0088   /**
0089    * Return true, if the reweight can be entirely absorbed into the hint. A
0090    * possible detuning will be switched off.
0091    */
0092   virtual bool hintOnly(const DipoleSplittingInfo&) const {
0093     return false;
0094   }
0095 
0096   /**
0097    * Set the factor in front of enhance used by the veto algorithm.
0098    */
0099   virtual void reweightFactor(const double) {
0100     return;
0101   }
0102 
0103   /**
0104    * Scaling factor for negative reweights.
0105    */
0106   virtual void negativeScaling(const double) {
0107     return;
0108   }
0109 
0110 public:
0111 
0112   /** @name Functions used by the persistent I/O system. */
0113   //@{
0114   /**
0115    * Function used to write out object persistently.
0116    * @param os the persistent output stream written to.
0117    */
0118   void persistentOutput(PersistentOStream & os) const;
0119 
0120   /**
0121    * Function used to read in object persistently.
0122    * @param is the persistent input stream read from.
0123    * @param version the version number of the object when written.
0124    */
0125   void persistentInput(PersistentIStream & is, int version);
0126   //@}
0127 
0128   /**
0129    * The standard Init function used to initialize the interfaces.
0130    * Called exactly once for each class by the class description system
0131    * before the main function starts or
0132    * when this class is dynamically loaded.
0133    */
0134   static void Init();
0135 
0136 // If needed, insert declarations of virtual function defined in the
0137 // InterfacedBase class here (using ThePEG-interfaced-decl in Emacs).
0138 
0139 private:
0140 
0141   /**
0142    * The static object used to initialize the description of this class.
0143    * Indicates that this is a concrete class with persistent data.
0144    */
0145   static AbstractClassDescription<DipoleSplittingReweight> initDipoleSplittingReweight;
0146 
0147   /**
0148    * The assignment operator is private and must never be called.
0149    * In fact, it should not even be implemented.
0150    */
0151   DipoleSplittingReweight & operator=(const DipoleSplittingReweight &) = delete;
0152 
0153   /**
0154    * A pointer to the currently active dipole shower handler object.
0155    */
0156   Ptr<DipoleShowerHandler>::tptr theCurrentHandler;
0157 
0158 };
0159 
0160 }
0161 
0162 #include "ThePEG/Utilities/ClassTraits.h"
0163 
0164 namespace ThePEG {
0165 
0166 /** @cond TRAITSPECIALIZATIONS */
0167 
0168 /** This template specialization informs ThePEG about the
0169  *  base classes of DipoleSplittingReweight. */
0170 template <>
0171 struct BaseClassTrait<Herwig::DipoleSplittingReweight,1> {
0172   /** Typedef of the first base class of DipoleSplittingReweight. */
0173   typedef HandlerBase NthBase;
0174 };
0175 
0176 /** This template specialization informs ThePEG about the name of
0177  *  the DipoleSplittingReweight class and the shared object where it is defined. */
0178 template <>
0179 struct ClassTraits<Herwig::DipoleSplittingReweight>
0180   : public ClassTraitsBase<Herwig::DipoleSplittingReweight> {
0181   /** Return a platform-independent class name */
0182   static string className() { return "Herwig::DipoleSplittingReweight"; }
0183   /**
0184    * The name of a file containing the dynamic library where the class
0185    * DipoleSplittingReweight is implemented. It may also include several, space-separated,
0186    * libraries if the class DipoleSplittingReweight depends on other classes (base classes
0187    * excepted). In this case the listed libraries will be dynamically
0188    * linked in the order they are specified.
0189    */
0190   static string library() { return "HwDipoleShower.so"; }
0191 };
0192 
0193 /** @endcond */
0194 
0195 }
0196 
0197 #endif /* HERWIG_DipoleSplittingReweight_H */