Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // ConstituentReshuffler.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_ConstituentReshuffler_H
0010 #define HERWIG_ConstituentReshuffler_H
0011 //
0012 // This is the declaration of the ConstituentReshuffler class.
0013 //
0014 
0015 #include "ThePEG/Handlers/HandlerBase.h"
0016 #include "ThePEG/Utilities/Exception.h"
0017 #include "Herwig/Shower/PerturbativeProcess.h"
0018 #include "Herwig/Utilities/Reshuffler.h"
0019 
0020 namespace Herwig {
0021 
0022 using namespace ThePEG;
0023 
0024 /**
0025  * \ingroup DipoleShower
0026  * \author Simon Platzer, Stephen Webster
0027  * 
0028  * \brief The ConstituentReshuffler class implements reshuffling
0029  * of partons on their nominal mass shell to their constituent 
0030  * mass shells.
0031  *
0032  */
0033 class ConstituentReshuffler: public HandlerBase, public Reshuffler {
0034 
0035 public:
0036 
0037   /**
0038    * Reshuffle the outgoing partons to constituent
0039    * masses. Optionally, incoming partons are given
0040    * to absorb recoils. Add the non-reshuffled partons
0041    * to the intermediates list. Throw ConstituentReshufflerProblem
0042    * if a numerical problem prevents the solution of
0043    * the reshuffling equation.
0044    */
0045   void reshuffle(PList& out,
0046          PPair& in,
0047          PList& intermediates,
0048          const bool decay,
0049          PList& decayPartons,
0050          PList& decayRecoilers);
0051 
0052   /**
0053    * Reshuffle the outgoing partons to constituent
0054    * masses. Optionally, incoming partons are given
0055    * to absorb recoils. Add the non-reshuffled partons
0056    * to the intermediates list. Throw ConstituentReshufflerProblem
0057    * if a numerical problem prevents the solution of
0058    * the reshuffling equation.
0059    */
0060   void reshuffle(PList& out,
0061          PPair& in,
0062          PList& intermediates,
0063          const bool decay=false) {
0064 
0065     PList decayPartons;
0066     PList decayRecoilers;
0067 
0068     reshuffle(out,
0069           in,
0070           intermediates,
0071           decay,
0072           decayPartons,
0073           decayRecoilers);
0074   }
0075 
0076 
0077   /**
0078    * Reshuffle the outgoing partons following the showering
0079    * of the initial hard interaction to constituent masses,
0080    * for the case of outgoing decaying particles.
0081    * Throw ConstituentReshufflerProblem
0082    * if a numerical problem prevents the solution of
0083    * the reshuffling equation.
0084    */
0085   void hardProcDecayReshuffle(PList& decaying,
0086                   PList& eventOutgoing,
0087                   PList& eventHard,
0088                   PPair& eventIncoming,
0089                   PList& eventIntermediates) ;
0090 
0091   /**
0092    * Reshuffle the outgoing partons following the showering
0093    * of a particle decay to constituent masses. 
0094    * Throw ConstituentReshufflerProblem
0095    * if a numerical problem prevents the solution of
0096    * the reshuffling equation.
0097    */
0098   void decayReshuffle(PerturbativeProcessPtr& decayProc,
0099               PList& eventOutgoing,
0100               PList& eventHard,
0101               PList& eventIntermediates) ;
0102 
0103   /**
0104    * Update the dipole event record and, if appropriate,
0105    * the relevant decay process.
0106    **/
0107   void updateEvent( PList& intermediates,
0108             PList& eventIntermediates,
0109             PList& out,
0110             PList& eventOutgoing,
0111             PList& eventHard,
0112             PerturbativeProcessPtr decayProc = PerturbativeProcessPtr() ) ;
0113 
0114 
0115   /** 
0116    * Update the spinInfo of a particle following reshuffling 
0117    * to take account of the change in momentum.
0118    * Used only for unstable particles that need to be dealt with.
0119    **/
0120   void updateSpinInfo( PPtr& oldPart,
0121                        PPtr& newPart ) ;
0122   
0123 protected:
0124 
0125   /**
0126    * The function object defining the equation
0127    * to be solved in the case of separate recoilers
0128    * TODO - refine the whole implementation of separate partons and recoilers
0129    */
0130   struct DecayReshuffleEquation {
0131 
0132     DecayReshuffleEquation (Energy q,
0133                 PList::iterator m_begin,
0134                 PList::iterator m_end,
0135                 PList::iterator n_begin,
0136                 PList::iterator n_end)
0137       : w(q), p_begin(m_begin), p_end(m_end), r_begin(n_begin), r_end(n_end) {}
0138 
0139     typedef double ArgType;
0140     typedef double ValType;
0141 
0142     static double aUnit() { return 1.; }
0143     static double vUnit() { return 1.; }
0144 
0145     Energy w;
0146 
0147     PList::iterator p_begin;
0148     PList::iterator p_end;
0149 
0150     PList::iterator r_begin;
0151     PList::iterator r_end;
0152 
0153     double operator() (double xi) const {
0154 
0155       double r = - w/GeV;
0156       
0157       for (PList::iterator pIt = p_begin; pIt != p_end; ++pIt) {
0158     r += sqrt(sqr((**pIt).dataPtr()->constituentMass()) +
0159           xi*xi*(sqr((**pIt).momentum().t())-sqr((**pIt).dataPtr()->mass()))) / GeV;
0160       }
0161       
0162       for (PList::iterator rIt = r_begin; rIt != r_end; ++rIt) {
0163     r +=  sqrt(sqr((**rIt).momentum().m()) +
0164            xi*xi*(sqr((**rIt).momentum().t())-sqr((**rIt).momentum().m()))) / GeV;
0165       }
0166       
0167       return r;  
0168     }
0169 
0170   };
0171 
0172 
0173 
0174 public:
0175 
0176   /** @name Functions used by the persistent I/O system. */
0177   //@{
0178   /**
0179    * Function used to write out object persistently.
0180    * @param os the persistent output stream written to.
0181    */
0182   void persistentOutput(PersistentOStream & os) const;
0183 
0184   /**
0185    * Function used to read in object persistently.
0186    * @param is the persistent input stream read from.
0187    * @param version the version number of the object when written.
0188    */
0189   void persistentInput(PersistentIStream & is, int version);
0190   //@}
0191 
0192   /**
0193    * The standard Init function used to initialize the interfaces.
0194    * Called exactly once for each class by the class description system
0195    * before the main function starts or
0196    * when this class is dynamically loaded.
0197    */
0198   static void Init();
0199 
0200 protected:
0201 
0202   /** @name Clone Methods. */
0203   //@{
0204   /**
0205    * Make a simple clone of this object.
0206    * @return a pointer to the new object.
0207    */
0208   virtual IBPtr clone() const;
0209 
0210   /** Make a clone of this object, possibly modifying the cloned object
0211    * to make it sane.
0212    * @return a pointer to the new object.
0213    */
0214   virtual IBPtr fullclone() const;
0215   //@}
0216 
0217 
0218 // If needed, insert declarations of virtual function defined in the
0219 // InterfacedBase class here (using ThePEG-interfaced-decl in Emacs).
0220 
0221 
0222 private:
0223 
0224   /**
0225    * The static object used to initialize the description of this class.
0226    * Indicates that this is a concrete class with persistent data.
0227    */
0228   static ClassDescription<ConstituentReshuffler> initConstituentReshuffler;
0229 
0230   /**
0231    * The assignment operator is private and must never be called.
0232    * In fact, it should not even be implemented.
0233    */
0234   ConstituentReshuffler & operator=(const ConstituentReshuffler &) = delete;
0235 
0236 };
0237 
0238 }
0239 
0240 #include "ThePEG/Utilities/ClassTraits.h"
0241 
0242 namespace ThePEG {
0243 
0244 /** @cond TRAITSPECIALIZATIONS */
0245 
0246 /** This template specialization informs ThePEG about the
0247  *  base classes of ConstituentReshuffler. */
0248 template <>
0249 struct BaseClassTrait<Herwig::ConstituentReshuffler,1> {
0250   /** Typedef of the first base class of ConstituentReshuffler. */
0251   typedef HandlerBase NthBase;
0252 };
0253 
0254 /** This template specialization informs ThePEG about the name of
0255  *  the ConstituentReshuffler class and the shared object where it is defined. */
0256 template <>
0257 struct ClassTraits<Herwig::ConstituentReshuffler>
0258   : public ClassTraitsBase<Herwig::ConstituentReshuffler> {
0259   /** Return a platform-independent class name */
0260   static string className() { return "Herwig::ConstituentReshuffler"; }
0261   /**
0262    * The name of a file containing the dynamic library where the class
0263    * ConstituentReshuffler is implemented. It may also include several, space-separated,
0264    * libraries if the class ConstituentReshuffler depends on other classes (base classes
0265    * excepted). In this case the listed libraries will be dynamically
0266    * linked in the order they are specified.
0267    */
0268   static string library() { return "HwDipoleShower.so"; }
0269 };
0270 
0271 /** @endcond */
0272 
0273 }
0274 
0275 #endif /* HERWIG_ConstituentReshuffler_H */