Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // Cluster.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_Cluster_H
0010 #define HERWIG_Cluster_H
0011 
0012 #include <ThePEG/EventRecord/Particle.h>
0013 #include "Herwig/Utilities/EnumParticles.h"
0014 #include "CluHadConfig.h"
0015 #include "ClusterHadronizationHandler.fh"
0016 #include "Cluster.fh"
0017 #include "ThePEG/Utilities/ClassDescription.h"
0018 
0019 namespace Herwig {
0020 using namespace ThePEG;
0021  
0022 /** \ingroup Hadronization
0023  *  \class Cluster
0024  *  \brief This class describes a cluster object.
0025  *  \author Philip Stephens
0026  *  \author Alberto Ribon
0027  *
0028  *  This class represents a cluster, which is a colour singlet made usually
0029  *  of two components (quark-antiquark, quark-diquark, antiquark-antidiquark)
0030  *  or rarely by three components (quark-quark-quark, antiquark-antiquark-
0031  *  antiquark). A reference to the container with the pointers to its 
0032  *  Components is provided.
0033  *
0034  *  The class provides access to the pointers which point to:
0035  *
0036  *     - The cluster parent. In the case that the cluster it is a fission 
0037  *       product of a heavy cluster the parent is a cluster. If the cluster
0038  *       is formed from the perturbative partons then the parents will be
0039  *       the colour connected partons that formed the cluster.
0040  *     - The children (usually two). In the case the cluster is a
0041  *       heavy cluster that undergoes fission the children are clusters.
0042  *       Occasionally the cluster has been "redefined" (re-interpreted). For 
0043  *       example in the case that three quark or anti-quark components 
0044  *       have been redefined as two components (quark+diquark, or antiquark+
0045  *       antidiquark).
0046  *     - The (eventual) reshuffling partner, necessary for energy-momentum 
0047  *       conservation when light clusters are decayed into single hadron. Not
0048  *       all clusters will have a reshuffling partner.
0049  *  
0050  *  Notice that in order to determine the cluster position from the positions
0051  *  of the components, the Cluster class needs some parameters.
0052  *  Because the Cluster class is neither interfaced nor persistent, 
0053  *  a static pointer to the ClusterHadronizationHandler class instance, 
0054  *  where the parameters are, is used. This static pointer is 
0055  *  set via the method setPointerClusterHadHandler(), during the
0056  *  run initialization, doinitrun() of ClusterHadronizationHandler.
0057  *
0058  *  @see ClusterHadronizationHandler
0059  */ 
0060 class Cluster : public Particle {
0061   
0062 protected:
0063 
0064   /** @name Standard constructors and destructors. */
0065   //@{
0066   /**
0067    * Default constructor. Only used in PersistentIStream
0068    */
0069   Cluster();
0070 
0071   /**
0072    * The ClassTraits<Cluster> class must be a friend to be able to
0073    * use the private default constructor.
0074    */
0075   friend struct ClassTraits<Cluster>;
0076 
0077 public:
0078   /**
0079    * Constructor with a particleData pointer
0080    */
0081   Cluster(tcEventPDPtr);
0082   
0083   /**
0084    * This creates a cluster from 2 (or 3) partons.
0085    */
0086   Cluster(tPPtr part1, tPPtr part2, tPPtr part3 = tPPtr());    
0087   
0088   /**
0089    * Also a constructor where a particle is given not a cluster.
0090    */
0091   Cluster(const Particle &);
0092   //@}
0093   
0094   /**
0095    * Number of quark (diquark) constituents (normally two).    
0096    */
0097   unsigned int numComponents() const
0098   { return _numComp; }
0099   
0100   /**
0101    * Sum of the constituent masses of the components of the cluster.    
0102    */
0103   Energy sumConstituentMasses() const;
0104     
0105   /**
0106    * Returns the ith constituent.
0107    */
0108   tPPtr particle(int i) const;
0109 
0110   /**
0111    * Returns the ith original constituent.
0112    */
0113   tPPtr particleB(int i) const;
0114   
0115   /**
0116    * Returns the original constituent carrying colour
0117    */
0118   tPPtr colParticle(bool anti = false) const;
0119 
0120   /**
0121    * Returns the original constituent carrying anticolour
0122    */
0123   tPPtr antiColParticle() const;
0124   
0125   /**
0126    * Returns whether the ith constituent is from a perturbative process.
0127    */
0128   bool isPerturbative(int) const;
0129   
0130   /**
0131    * Indicates whether the ith constituent is a beam remnant.
0132    */
0133   bool isBeamRemnant(int) const;
0134   
0135   /**
0136    * Sets whether the ith constituent is a beam remnant.
0137    */
0138   void setBeamRemnant(int,bool);
0139   
0140   /**
0141    * Returns the clusters id, not the same as the PDG id.
0142    */
0143   int clusterId() const { return _id; }
0144 
0145 public:
0146 
0147   /**
0148    * Returns true when a constituent is a beam remnant.
0149    */
0150   bool isBeamCluster() const;
0151   
0152   /**
0153    * Set the pointer to the reshuffling partner cluster.
0154    */
0155   void flagAsReshuffled()
0156   { _hasReshuffled = true; }
0157 
0158   /**
0159    * Sets the component (if any) that points to "part" as a beam remnant.
0160    */
0161   void isBeamCluster(tPPtr part);
0162   
0163   /**
0164    * Returns true if this cluster is to be handled by the hadronization.
0165    */
0166   bool isAvailable() const
0167   { return _isAvailable; }
0168   
0169   /**
0170    * Sets the value of availability. 
0171    */
0172   void isAvailable(bool inputAvailable)
0173   { _isAvailable = inputAvailable; }
0174   
0175   /**
0176    * Return true if the cluster does not have cluster parent.
0177    */
0178   bool isStatusInitial() const
0179   { return parents().empty(); }
0180   
0181   /** 
0182    * Return true if the cluster does not have cluster children and 
0183    * it is not already decayed (i.e. it does not have hadron children)
0184    * (to be used only after the fission of heavy clusters).    
0185    */
0186    bool isReadyToDecay() const
0187   { return children().empty(); }
0188   
0189   /**
0190    * Return true if the cluster has one and only one cluster children
0191    * and no hadron children: that means either that its three quarks or 
0192    * anti-quarks components have been redefined as two components 
0193    * (quark+diquark, or antiquark+antidiquark), or that the cluster 
0194    * has been used as a partner for the momentum reshuffling necessary 
0195    * to conserve energy-momentum when a light cluster is decayed into
0196    * a single hadron (notice that this latter light cluster has 
0197    *  isRedefined()  false, because it has an hadron child).
0198    * In both cases, the unique cluster children is the new redefined 
0199    * cluster. The two cases can be distinguish by the next method.  
0200    */
0201   bool isRedefined() const { 
0202     return ( children().size() == 1 
0203          && children()[0]->id() == ParticleID::Cluster );
0204   }
0205   
0206   /**
0207    * Return true when it has a reshuffling partner.
0208    * Notice that a cluster can have  hasBeenReshuffled()  true but
0209    *  isRedefined()  false: this is the case of a light cluster
0210    * that decays into a single hadron.
0211    */
0212   bool hasBeenReshuffled() const
0213   { return _hasReshuffled; }
0214   
0215   /**
0216    * Return true if the cluster has hadron children.
0217    */
0218   bool isStatusFinal() const;
0219 
0220 public:
0221 
0222   /**
0223    * Calculate the 4-position vector of the cluster
0224    * Method made static so can be used in other places
0225    * Displacement of the ith constituent given by momentum \f$p_i\f$
0226    * vertex \f$x_i\f$ and mass \f$m_i\f$ is
0227    * \f[ D_i = -C \log(r) \frac{p_i}{\sqrt{(p_i^2 - m_i^2)^2 + v^4}} \f]
0228    * where \f$r\f$ is a random number [0,1],
0229    * \f$v\f$ is the minimum virtuality and \f$C\f$ is
0230    * a conversion factor from GeV to millimeters. We can then find the
0231    * difference in \f$s\f$ factors as
0232    * \f[ (s_1-s_2) = \frac{(\vec{p}_1 + \vec{p}_2) \cdot (\vec{x}_2 -
0233    *                 \vec{x}_1)}{(\vec{p}_1 + \vec{p}_2) \cdot \vec{D}_1}.
0234    * \f]
0235    * if \f$s_2>s_1\f$ then \f$s_1 = 1.0\f$ otherwise \f$s_2 = 1.0\f$.
0236    * These are then used to determine the value of the clusters vertex as
0237    * \f[ X = \frac{1}{2} ( x_1 +x_2 + s_1 D_1 + s_2 D_2). \f]
0238    */
0239   static LorentzPoint calculateX(tPPtr q1, tPPtr q2);
0240   
0241 protected:
0242   
0243   /** @name Clone Methods. */
0244   //@{
0245   /**
0246    * Make a simple clone of this object.
0247    * @return a pointer to the new object.
0248    */
0249   virtual PPtr clone() const;
0250 
0251   /** Make a clone of this object, possibly modifying the cloned object
0252    * to make it sane.
0253    * @return a pointer to the new object.
0254    */
0255   virtual PPtr fullclone() const;
0256   //@}
0257 
0258 public:
0259 
0260   /** @name Input and output functions. */
0261   //@{
0262   /**
0263    * Standard function for writing to a persistent stream.
0264    */
0265   void persistentOutput(PersistentOStream &) const;
0266 
0267   /**
0268    * Standard function for reading from a persistent stream.
0269    */
0270   void persistentInput(PersistentIStream &, int);
0271 
0272 private:   
0273   /**
0274    * Private and non-existent assignment operator.
0275    */
0276   Cluster & operator=(const Cluster &) = delete;
0277   
0278   /**
0279    * Calculate the 5-momentum vector of the cluster
0280    * The 5-momentum of the cluster is given by
0281    * \f[ P = \sum_i p_i \f]
0282    * and the mass of the cluster is \f$m^2 = P^2\f$
0283    */
0284   void calculateP();
0285   
0286   /**
0287    * Determines whether constituent p is perturbative or not.
0288    */
0289   bool initPerturbative(tPPtr p);
0290 
0291   /**
0292    * Describe an abstract base class with persistent data.
0293    */
0294   static ClassDescription<Cluster> initCluster; 
0295 
0296 
0297 
0298   bool        _isAvailable;        //!< Whether the cluster is hadronizing
0299   bool        _hasReshuffled;      //!< Whether the cluster has been reshuffled
0300   ParticleVector _component;       //!< The constituent partons
0301   tParticleVector _original;        //!< The original components
0302   vector<bool> _isBeamRemnant;     //!< Whether a parton is a beam remnant
0303   vector<bool> _isPerturbative;    //!< Whether a parton is perturbative
0304   unsigned int _numComp;                    //!< The number of constituents
0305   long _id;                        //!< The id of this cluster
0306 };
0307   
0308 } // end namespace Herwig  
0309 
0310 #include "ThePEG/Utilities/ClassTraits.h"
0311 
0312 namespace ThePEG {
0313 
0314 /** @cond TRAITSPECIALIZATIONS */
0315 
0316 /**
0317  * The following template specialization informs ThePEG about the
0318  * base class of Cluster.
0319  */
0320 template <>
0321 struct BaseClassTrait<Herwig::Cluster,1> {
0322   /** Typedef of the base class of Cluster. */
0323   typedef Particle NthBase;
0324 };
0325 
0326 /**
0327  * The following template specialization informs ThePEG about the
0328  * name of this class and the shared object where it is defined.
0329  */ 
0330 template <>
0331 struct ClassTraits<Herwig::Cluster>:
0332   public ClassTraitsBase<Herwig::Cluster> {
0333   /** Return the class name. */
0334   static string className() { return "Herwig::Cluster"; }
0335   /** Create a Particle object. */
0336   static TPtr create() { return TPtr::Create(Herwig::Cluster()); }
0337 };
0338 
0339 /** @endcond */
0340 
0341 }
0342 
0343 
0344 
0345 
0346 #endif // HERWIG_Cluster_H