Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // ClusterHadronizationHandler.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_ClusterHadronizationHandler_H
0010 #define HERWIG_ClusterHadronizationHandler_H
0011 
0012 #include <ThePEG/Handlers/HadronizationHandler.h>
0013 #include "PartonSplitter.h"
0014 #include "ClusterFinder.h"
0015 #include "ColourReconnector.h"
0016 #include "ClusterFissioner.h"
0017 #include "LightClusterDecayer.h"
0018 #include "ClusterDecayer.h"
0019 #include "ClusterHadronizationHandler.fh"
0020 #include "Herwig/Utilities/Reshuffler.h"
0021 #include "GluonMassGenerator.h"
0022 
0023 namespace Herwig {
0024 using namespace ThePEG;
0025 
0026 
0027 /** \ingroup Hadronization
0028  *  \class ClusterHadronizationHandler
0029  *  \brief Class that controls the cluster hadronization algorithm.
0030  *  \author Philip Stephens  //  cerr << *ch.currentEvent() << '\n';
0031   cerr << finalHadrons.size() << '\n';
0032 
0033   cerr << "Finished hadronizing \n";
0034 
0035  *  \author Alberto Ribon
0036  *
0037  *  This class is the main driver of the cluster hadronization: it is 
0038  *  responsible for the proper handling of all other specific collaborating
0039  *  classes PartonSplitter, ClusterFinder, ColourReconnector, ClusterFissioner, 
0040  *  LightClusterDecayer, ClusterDecayer; 
0041  *  and for the storing of the produced particles in the Event record.
0042  *
0043  *  @see PartonSplitter
0044  *  @see ClusterFinder
0045  *  @see ColourReconnector
0046  *  @see ClusterFissioner
0047  *  @see LightClusterDecayer
0048  *  @see ClusterDecayer
0049  *  @see Cluster 
0050  * @see \ref ClusterHadronizationHandlerInterfaces "The interfaces"
0051  * defined for ClusterHadronizationHandler.
0052  */ 
0053 class ClusterHadronizationHandler: 
0054     public HadronizationHandler, public Reshuffler {
0055 
0056 public:
0057 
0058   /**
0059    * The main method which manages the all cluster hadronization.
0060    *
0061    * This routine directs "traffic". It determines which function is called
0062    * and on which particles/clusters. This function also handles the 
0063    * situation of vetos on the hadronization.
0064    */
0065   virtual void handle(EventHandler & ch, const tPVector & tagged,
0066               const Hint & hint);
0067 
0068   /**
0069    * It returns minimum virtuality^2 of partons to use in calculating 
0070    * distances. It is used both in the Showering and Hadronization.
0071    */
0072   Energy2 minVirtuality2() const
0073   { return _minVirtuality2; }
0074 
0075   /**
0076    * It returns the maximum displacement that is allowed for a particle
0077    * (used to determine the position of a cluster with two components).
0078    */
0079   Length maxDisplacement() const
0080   { return _maxDisplacement; }
0081 
0082   /**
0083    * It returns true/false according if the soft underlying model
0084    * is switched on/off. 
0085    */
0086   bool isSoftUnderlyingEventON() const
0087   { return _underlyingEventHandler; }
0088   
0089   /**
0090    *  pointer to "this", the current HadronizationHandler.
0091    */
0092   static const ClusterHadronizationHandler * currentHandler() {
0093     if(!currentHandler_){
0094       cerr<< " \nCreating new ClusterHadronizationHandler without input from infiles.";
0095       cerr<< " \nWhen using for example the string model ";
0096       cerr<< " hadronic decays are still treated by the Cluster model\n";
0097       currentHandler_=new ClusterHadronizationHandler();;
0098     }
0099     return currentHandler_;
0100   }
0101 
0102   /**
0103    * A pointer to a gluon mass generator for the reshuffling
0104    */
0105   Ptr<GluonMassGenerator>::tptr gluonMassGenerator() const {
0106     return gluonMassGenerator_;
0107   }
0108 
0109 public:
0110 
0111   /** @name Functions used by the persistent I/O system. */
0112   //@{
0113   /**
0114    * Function used to write out object persistently.
0115    * @param os the persistent output stream written to.
0116    */
0117   void persistentOutput(PersistentOStream & os) const;
0118 
0119   /**
0120    * Function used to read in object persistently.
0121    * @param is the persistent input stream read from.
0122    * @param version the version number of the object when written.
0123    */
0124   void persistentInput(PersistentIStream & is, int version);
0125   //@}
0126 
0127   /**
0128    * Standard Init function used to initialize the interfaces.
0129    */
0130   static void Init();
0131 
0132 protected:
0133 
0134   /** @name Clone Methods. */
0135   //@{
0136   /**
0137    * Make a simple clone of this object.
0138    * @return a pointer to the new object.
0139    */
0140   virtual IBPtr clone() const;
0141 
0142   /** Make a clone of this object, possibly modifying the cloned object
0143    * to make it sane.
0144    * @return a pointer to the new object.
0145    */
0146   virtual IBPtr fullclone() const;
0147   //@}
0148 
0149 private:
0150 
0151   /**
0152    * Private and non-existent assignment operator.
0153    */
0154   ClusterHadronizationHandler & operator=(const ClusterHadronizationHandler &) = delete;
0155 
0156   /**
0157    * This is a pointer to a Herwig::PartonSplitter object.
0158    */
0159   PartonSplitterPtr      _partonSplitter;
0160 
0161   /**
0162    * This is a pointer to a Herwig::ClusterFinder object.
0163    */
0164   ClusterFinderPtr       _clusterFinder;
0165 
0166   /**
0167    * This is a pointer to a Herwig::ColourReconnector object.
0168    */
0169   ColourReconnectorPtr   _colourReconnector;
0170 
0171   /**
0172    * This is a pointer to a Herwig::ClusterFissioner object.
0173    */
0174   ClusterFissionerPtr    _clusterFissioner;
0175 
0176   /**
0177    * This is a pointer to a Herwig::LightClusterDecayer object.
0178    */
0179   LightClusterDecayerPtr _lightClusterDecayer;
0180 
0181   /**
0182    * This is a pointer to a Herwig::ClusterDecayer object.
0183    */
0184   ClusterDecayerPtr      _clusterDecayer; 
0185 
0186   /**
0187    * Perform reshuffling to constituent masses.
0188    */
0189   bool reshuffle_ = false;
0190   
0191   /**
0192    *  Which type of reshuffling (global (default) or colour connected) is used
0193    */
0194   int reshuffleMode_ = 0;
0195   
0196   /**
0197    * A pointer to a gluon mass generator for the reshuffling
0198    */
0199   Ptr<GluonMassGenerator>::ptr gluonMassGenerator_;
0200 
0201   /**
0202    * The minimum virtuality^2 of partons to use in calculating 
0203    * distances.
0204    */
0205   Energy2 _minVirtuality2 = 0.1_GeV2;
0206 
0207   /**
0208    * The maximum displacement that is allowed for a particle
0209    * (used to determine the position of a cluster with two components).
0210    */
0211   Length _maxDisplacement = 1.0e-10_mm;
0212 
0213   /**
0214    * The pointer to the Underlying Event handler. 
0215    */
0216   StepHdlPtr _underlyingEventHandler;
0217 
0218   /**
0219    *  How to handle baryon-number clusters
0220    */
0221   bool _reduceToTwoComponents = true;
0222 
0223   /**
0224    * Tag the constituents of the clusters as their parents
0225    */
0226   void _setChildren(const ClusterVector & clusters) const;
0227 
0228    
0229    /**
0230     * Split the list of partons into colour connected sub-lists before reshuffling
0231     */
0232    void splitIntoColourSinglets(PVector thelist,
0233                 vector<PVector>& reshufflelists);
0234 
0235   
0236   /**
0237    *  pointer to "this", the current HadronizationHandler.
0238    */
0239   static ClusterHadronizationHandler * currentHandler_;
0240 
0241 
0242 };
0243 
0244 
0245 }
0246 
0247 #endif /* HERWIG_ClusterHadronizationHandler_H */