Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // HadronSelector.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_HadronSelector_H
0010 #define HERWIG_HadronSelector_H
0011 //
0012 // This is the declaration of the HadronSelector class.
0013 //
0014 
0015 #include "ThePEG/Interface/Interfaced.h"
0016 #include <ThePEG/Persistency/PersistentOStream.h>
0017 #include <ThePEG/Persistency/PersistentIStream.h>
0018 #include <ThePEG/PDT/ParticleData.h>
0019 #include <ThePEG/PDT/StandardMatchers.h>
0020 #include <ThePEG/Repository/EventGenerator.h>
0021 #include "HadronSelector.fh"
0022 #include "HadronInfo.h"
0023 #include "Kupco.h"
0024 #include <tuple>
0025 
0026 namespace Herwig {
0027 
0028 using namespace ThePEG;
0029 
0030 /**\ingroup Hadronization
0031  *  \class HadronSelector
0032  *  \brief This class selects the hadron flavours of a cluster decay.
0033  *  \author Philip Stephens
0034  *  \author Alberto Ribon
0035  *  \author Peter Richardson
0036  *
0037  *  This is the base class for the selection of either a pair of hadrons, or
0038  *  in some cases a single hadron. The different approaches which were
0039  *  previously implemented in this class are now implemented in the
0040  *  HwppSelector and Hw64Selector which inherit from this class.
0041  *
0042  *  This class implements a number of methods which are needed by all models
0043  *  and in addition contains the weights for the different meson multiplets and
0044  *  mixing of the light \f$I=0\f$ mesons.
0045  *
0046  * @see \ref HadronSelectorInterfaces "The interfaces"
0047  * defined for HadronSelector.
0048  * @see HwppSelector
0049  * @see Hw64Selector
0050  */
0051 class HadronSelector: public Interfaced {
0052 
0053 public:
0054 
0055   /**
0056    * The default constructor.
0057    */
0058   HadronSelector(unsigned int);
0059 
0060   /**
0061    * Method to return a pair of hadrons given the PDG codes of
0062    * two or three constituents
0063    * @param cluMass The mass of the cluster
0064    * @param par1 The first constituent
0065    * @param par2 The second constituent
0066    * @param par3 The third constituent
0067    */
0068   virtual tcPDPair chooseHadronPair(const Energy cluMass, 
0069                     tcPDPtr par1, tcPDPtr par2) const;
0070 
0071   /**
0072    * Select the single hadron for a cluster decay
0073    * return null pointer if not a single hadron decay
0074    * @param par1 1st constituent
0075    * @param par2 2nd constituent
0076    * @param mass Mass of the cluster
0077    */
0078   tcPDPtr chooseSingleHadron(tcPDPtr par1, tcPDPtr par2, Energy mass) const;
0079 
0080   /**
0081    * This returns the lightest pair of hadrons given by the flavours.
0082    *
0083    * Given the two (or three) constituents of a cluster, it returns
0084    * the two lightest hadrons with proper flavour numbers.
0085    * Furthermore, the first of the two hadrons must have the constituent with
0086    * par1, and the second must have the constituent with par2.
0087    * \todo At the moment it does *nothing* in the case that also par3 is present.
0088    *
0089    * The method is implemented by calling twice lightestHadron,
0090    * once with (par1,quarktopick->CC()) ,and once with (par2,quarktopick)
0091    * where quarktopick is either the pointer to
0092    * d or u quarks . In fact, the idea is that whatever the flavour of par1
0093    * and par2, no matter if (anti-)quark or (anti-)diquark, the lightest
0094    * pair of hadrons containing flavour par1 and par2 will have either
0095    * flavour d or u, being the lightest quarks.
0096    * The method returns the pair (PDPtr(),PDPtr()) if anything goes wrong.
0097    *
0098    * \todo The method assumes par3 == PDPtr() (otherwise we don't know how to proceed: a
0099    * possible, trivial way would be to randomly select two of the three
0100    * (anti-)quarks and treat them as a (anti-)diquark, reducing the problem
0101    * to two components as treated below.
0102    * In the normal (two components) situation, the strategy is the following:
0103    * treat in the same way the two possibilities:  (d dbar)  (i=0) and
0104    * (u ubar)  (i=1)  as the pair quark-antiquark necessary to form a
0105    * pair of hadrons containing the input flavour  par1  and  par2; finally,
0106    * select the one that produces the lightest pair of hadrons, compatible
0107    * with the charge conservation constraint.
0108    */
0109   tcPDPair lightestHadronPair(tcPDPtr ptr1, tcPDPtr ptr2) const;
0110 
0111   /**
0112    *  Returns the mass of the lightest pair of hadrons with the given particles
0113    * @param ptr1 is the first  constituent
0114    * @param ptr2 is the second constituent
0115    */
0116   Energy massLightestHadronPair(tcPDPtr ptr1, tcPDPtr ptr2) const  { 
0117     map<pair<long,long>,tcPDPair>::const_iterator lightest =
0118       lightestHadrons_.find(make_pair(abs(ptr1->id()),abs(ptr2->id())));
0119     if(lightest!=lightestHadrons_.end())
0120       return lightest->second.first->mass()+lightest->second.second->mass();
0121     else
0122       return ZERO;
0123   }
0124 
0125   /**
0126    * Returns the lightest hadron formed by the given particles.
0127    *
0128    * Given the id of two (or three) constituents of a cluster, it returns
0129    * the  lightest hadron with proper flavour numbers.
0130    * @param ptr1 is the first  constituent
0131    * @param ptr2 is the second constituent
0132    */
0133    tcPDPtr lightestHadron(tcPDPtr ptr1, tcPDPtr ptr2) const;
0134 
0135   /**
0136    * Returns the hadrons below the constituent mass threshold formed by the given particles,
0137    * together with their total weight
0138    *
0139    * Given the id of two (or three) constituents of a cluster, it returns
0140    * the  lightest hadron with proper flavour numbers.
0141    * @param threshold The theshold
0142    * @param ptr1 is the first  constituent
0143    * @param ptr2 is the second constituent
0144    */
0145   vector<pair<tcPDPtr,double> >
0146   hadronsBelowThreshold(Energy threshold,
0147             tcPDPtr ptr1, tcPDPtr ptr2) const;
0148 
0149   /**
0150    * Return the nominal mass of the hadron returned by lightestHadron()
0151    * @param ptr1 is the first  constituent
0152    * @param ptr2 is the second constituent
0153    */
0154    Energy massLightestHadron(tcPDPtr ptr1, tcPDPtr ptr2) const {
0155     // find entry in the table
0156     pair<long,long> ids(abs(ptr1->id()),abs(ptr2->id()));
0157     HadronTable::const_iterator tit=_table.find(ids);
0158     // throw exception if flavours wrong
0159     if(tit==_table.end()||tit->second.empty())
0160       throw Exception() <<  "HadronSelector::massLightestHadron "
0161             << "failed for particle" << ptr1->id()  << " "
0162             << ptr2->id()
0163             << Exception::eventerror;
0164     // return the mass
0165     return tit->second.begin()->mass;
0166   }
0167 
0168   /**
0169    *  Access the parton weights
0170    */
0171    double pwt(long pid) const {
0172     map<long,double>::const_iterator it = _pwt.find(abs(pid));
0173     assert( it != _pwt.end() );
0174     return it->second;
0175   }
0176 
0177   /**
0178    *  Force baryon/meson selection
0179    */
0180   virtual std::tuple<bool,bool,bool> selectBaryon(const Energy cluMass, tcPDPtr par1, tcPDPtr par2) const;
0181 
0182   /**
0183    *  Strange quark weight
0184    */
0185   virtual double strangeWeight(const Energy cluMass, tcPDPtr par1, tcPDPtr par2) const;
0186 
0187   /**
0188    * Return the particle data of the diquark (anti-diquark) made by the two
0189    * quarks (antiquarks) par1, par2.
0190    * @param par1 (anti-)quark data pointer
0191    * @param par2 (anti-)quark data pointer
0192    */
0193   virtual PDPtr makeDiquark(tcPDPtr par1, tcPDPtr par2);
0194   
0195 public:
0196 
0197   /** @name Functions used by the persistent I/O system. */
0198   //@{
0199   /**
0200    * Function used to write out object persistently.
0201    * @param os the persistent output stream written to.
0202    */
0203   void persistentOutput(PersistentOStream & os) const;
0204 
0205   /**
0206    * Function used to read in object persistently.
0207    * @param is the persistent input stream read from.
0208    * @param version the version number of the object when written.
0209    */
0210   void persistentInput(PersistentIStream & is, int version);
0211   //@}
0212 
0213   /**
0214    * The standard Init function used to initialize the interfaces.
0215    * Called exactly once for each class by the class description system
0216    * before the main function starts or
0217    * when this class is dynamically loaded.
0218    */
0219   static void Init();
0220 
0221 protected:
0222 
0223   /** @name Standard Interfaced functions. */
0224   //@{
0225   /**
0226    * Initialize this object after the setup phase before saving an
0227    * EventGenerator to disk.
0228    *
0229    *  The array _repwt is initialized using the interfaces to set different
0230    *  weights for different meson multiplets and the constructHadronTable()
0231    *  method called to complete the construction of the hadron tables.
0232    *
0233    * @throws InitException if object could not be initialized properly.
0234    */
0235   virtual void doinit();
0236   //@}
0237 
0238 protected:
0239 
0240   /**
0241    *  A sub-function of HadronSelector::constructHadronTable().
0242    *  It receives the information of a prospective Hadron and inserts it
0243    *  into the hadron table construct.
0244    *  @param particle is a particle data pointer to the hadron
0245    *  @param flav1 is the first  constituent of the hadron
0246    *  @param flav2 is the second constituent of the hadron
0247    */
0248   void insertToHadronTable(tPDPtr &particle, int flav1, int flav2);
0249 
0250   /**
0251    *  Construct the table of hadron data
0252    *  This is the main method to initialize the hadron data (mainly the
0253    *  weights associated to each hadron, taking into account its spin,
0254    *  eventual isoscalar-octect mixing, singlet-decuplet factor). This is
0255    *  the method that one should update when new or updated hadron data is
0256    *  available.
0257    *
0258    *  This class implements the construction of the basic table but can be
0259    *  overridden if needed in inheriting classes.
0260    *
0261    *  The rationale for factors used for diquarks involving different quarks can
0262    *  be can be explained by taking a prototype example that in the  exact SU(2) limit,
0263    *  in which:
0264    *  \f[m_u=m_d\f]
0265    *  \f[M_p=M_n=M_\Delta\f]
0266    *      and we will have equal numbers of u and d quarks produced.
0267    *      Suppose that we weight 1 the diquarks made of the same
0268    *      quark and 1/2 those made of different quarks, the fractions
0269    *      of u and d baryons (p, n, Delta) we get are the following:
0270    *        - \f$\Delta^{++}\f$: 1 possibility only  u uu  with weight 1
0271    *        - \f$\Delta^-   \f$: 1 possibility only  d dd  with weight 1
0272    *        - \f$p,\Delta^+ \f$: 2 possibilities     u ud  with weight 1/2
0273    *                                                 d uu  with weight 1
0274    *        - \f$n,\Delta^0 \f$: 2 possibilities     d ud  with weight 1/2
0275    *                                                 u dd  with weight 1
0276    *      In the latter two cases, we have to take into account the
0277    *      fact that  p  and  n  have spin 1/2 whereas  Delta+  and  Delta0
0278    *      have spin 3/2 therefore from phase space we get a double weight
0279    *      for  Delta+  and  Delta0  relative to  p  and  n  respectively.
0280    *      Therefore the relative amount of these baryons that is
0281    *      produced is the following:
0282    *       # p = # n = ( 1/2 + 1 ) * 1/3 = 1/2
0283    *       # Delta++ = # Delta- = 1 = ( 1/2 + 1) * 2/3 # Delta+ = # Delta0
0284    *      which is correct, and therefore the weight 1/2 for the
0285    *      diquarks of different types of quarks is justified (at least
0286    *      in this limit of exact SU(2) ).
0287    */
0288   virtual void constructHadronTable();
0289 
0290   /**
0291    *  Access to the table of hadrons
0292    */
0293   const HadronTable & table() const {
0294     return _table;
0295   }
0296 
0297   /**
0298    *  Access to the table of hadrons
0299    */
0300   HadronTable & table() {
0301     return _table;
0302   }
0303   
0304   /**
0305    *  Access to the list of partons
0306    */
0307   const vector<PDPtr> & partons() const {
0308     return _partons;
0309   }
0310   
0311   /**
0312    *  Access to the list of partons
0313    */
0314   vector<PDPtr> & partons() {
0315     return _partons;
0316   }
0317 
0318   /**
0319    *  Access the parton weights
0320    */
0321   map<long,double> & pwt() {
0322     return _pwt;
0323   }
0324 
0325   /**
0326    * Methods for the mixing of \f$I=0\f$ mesons
0327    */
0328   //@{
0329   /**
0330    * Return the probability of mixing for Octet-Singlet isoscalar mixing,
0331    * the probability of the
0332    * \f$\frac1{\sqrt{2}}(|u\bar{u}\rangle + |d\bar{d}\rangle)\f$ component
0333    * is returned.
0334    * @param angleMix The mixing angle in degrees (not radians)
0335    * @param order is 0 for no mixing, 1 for the first resonance of a pair,
0336    *                 2 for the second one.
0337    * The mixing is defined so that for example with \f$\eta-\eta'\f$ mixing where
0338    * the mixing angle is \f$\theta=-23^0$ with $\eta\f$ as the first particle
0339    * and \f$\eta'\f$ the second one.
0340    * The convention used is
0341    * \f[\eta  = \cos\theta|\eta_{\rm octet  }\rangle
0342    *           -\sin\theta|\eta_{\rm singlet}\rangle\f]
0343    * \f[\eta' = \sin\theta|\eta_{\rm octet  }\rangle
0344    *           -\cos\theta|\eta_{\rm singlet}\rangle\f]
0345    * with
0346    * \f[|\eta_{\rm singlet}\rangle = \frac1{\sqrt{3}}
0347    * \left[|u\bar{u}\rangle + |d\bar{d}\rangle +  |s\bar{s}\rangle\right]\f]
0348    * \f[|\eta_{\rm octet  }\rangle = \frac1{\sqrt{6}}
0349    * \left[|u\bar{u}\rangle + |d\bar{d}\rangle - 2|s\bar{s}\rangle\right]\f]
0350    */
0351    double probabilityMixing(const double angleMix,
0352                   const int order) const {
0353     static double convert=Constants::pi/180.0;
0354     if (order == 1)
0355       return sqr( cos( angleMix*convert + atan( sqrt(2.0) ) ) );
0356     else if (order == 2)
0357       return sqr( sin( angleMix*convert + atan( sqrt(2.0) ) ) );
0358     else
0359       return 1.;
0360   }
0361 
0362   /**
0363    * Returns the weight of given mixing state.
0364    * @param id The PDG code of the meson
0365    */
0366   virtual double mixingStateWeight(long id) const;
0367   //@}
0368 
0369   /**
0370    * Calculates a special weight specific to  a given hadron.
0371    * @param id The PDG code of the hadron
0372    */
0373   double specialWeight(long id) const {
0374     const int pspin = id % 10;
0375     // Only K0L and K0S have pspin == 0, should
0376     // not get them until Decay step
0377     assert( pspin != 0 );
0378     // Baryon : J = 1/2 or 3/2
0379     if(pspin%2==0)
0380       return baryonWeight(id);
0381     // Meson
0382     else 
0383       return mesonWeight(id); 
0384   }
0385   
0386   /**
0387    *  Weights for mesons
0388    */
0389   virtual double mesonWeight(long id) const;
0390 
0391   /**
0392    *  Weights for baryons
0393    */
0394   virtual double baryonWeight(long id) const = 0;
0395 
0396   /**
0397    * This method returns the proper sign ( > 0 hadron; < 0 anti-hadron )
0398    * for the input PDG id  idHad > 0, suppose to be made by the
0399    * two constituent particle pointers: ptr1 and ptr2 (both with proper sign).
0400    */
0401   int signHadron(tcPDPtr ptr1, tcPDPtr ptr2, tcPDPtr hadron) const;
0402 
0403   /**
0404    *   Insert a meson in the table
0405    */
0406   virtual void insertMeson(HadronInfo a, int flav1, int flav2);
0407 
0408   /**
0409    *   Insert a spin\f$\frac12\f$ baryon in the table
0410    */
0411   virtual void insertOneHalf(HadronInfo a, int flav1, int flav2);
0412 
0413   /**
0414    *   Insert a spin\f$\frac32\f$ baryon in the table
0415    */
0416   virtual void insertThreeHalf(HadronInfo a, int flav1, int flav2);
0417   
0418 private:
0419 
0420   /**
0421    * The assignment operator is private and must never be called.
0422    * In fact, it should not even be implemented.
0423    */
0424   HadronSelector & operator=(const HadronSelector &) = delete;
0425 
0426 private:
0427 
0428   /**
0429    *  The PDG codes of the constituent particles allowed
0430    */
0431   vector<PDPtr> _partons;
0432 
0433   /**
0434    *  The PDG codes of the hadrons which cannot be produced in the hadronization
0435    */
0436   vector<PDPtr> _forbidden;
0437 
0438   /**
0439    * Weights for quarks and diquarks.
0440    */
0441   map<long,double> _pwt;
0442 
0443   /**
0444    *  The mixing angles for the \f$I=0\f$ mesons containing light quarks
0445    */
0446   //@{
0447   /**
0448    *  The \f$\eta-\eta'\f$ mixing angle
0449    */
0450   double _etamix;
0451 
0452   /**
0453    *  The \f$\phi-\omega\f$ mixing angle
0454    */
0455   double _phimix;
0456 
0457   /**
0458    *  The \f$h_1'-h_1\f$ mixing angle
0459    */
0460   double _h1mix;
0461 
0462   /**
0463    *  The \f$f_0(1710)-f_0(1370)\f$ mixing angle
0464    */
0465   double _f0mix;
0466 
0467   /**
0468    *  The \f$f_1(1420)-f_1(1285)\f$ mixing angle
0469    */
0470   double _f1mix;
0471 
0472   /**
0473    *  The \f$f'_2-f_2\f$ mixing angle
0474    */
0475   double _f2mix;
0476 
0477   /**
0478    *  The \f$\eta_2(1870)-\eta_2(1645)\f$ mixing angle
0479    */
0480   double _eta2mix;
0481 
0482   /**
0483    *  The \f$\phi(???)-\omega(1650)\f$ mixing angle
0484    */
0485   double _omhmix;
0486 
0487   /**
0488    *  The \f$\phi_3-\omega_3\f$ mixing angle
0489    */
0490   double _ph3mix;
0491 
0492   /**
0493    *  The \f$\eta(1475)-\eta(1295)\f$ mixing angle
0494    */
0495   double _eta2Smix;
0496 
0497   /**
0498    *  The \f$\phi(1680)-\omega(1420)\f$ mixing angle
0499    */
0500   double _phi2Smix;
0501   //@}
0502 
0503   /**
0504    *  The weights for the various meson multiplets to be used to supress the
0505    * production of particular states
0506    */
0507   //@{
0508   /**
0509    *  The weights for the \f$\phantom{1}^1S_0\f$ multiplets
0510    */
0511   vector<double> _weight1S0;
0512 
0513   /**
0514    *  The weights for the \f$\phantom{1}^3S_1\f$ multiplets
0515    */
0516   vector<double> _weight3S1;
0517 
0518   /**
0519    *  The weights for the \f$\phantom{1}^1P_1\f$ multiplets
0520    */
0521   vector<double> _weight1P1;
0522 
0523   /**
0524    *  The weights for the \f$\phantom{1}^3P_0\f$ multiplets
0525    */
0526   vector<double> _weight3P0;
0527 
0528   /**
0529    *  The weights for the \f$\phantom{1}^3P_1\f$ multiplets
0530    */
0531   vector<double> _weight3P1;
0532 
0533   /**
0534    *  The weights for the \f$\phantom{1}^3P_2\f$ multiplets
0535    */
0536   vector<double> _weight3P2;
0537 
0538   /**
0539    *  The weights for the \f$\phantom{1}^1D_2\f$ multiplets
0540    */
0541   vector<double> _weight1D2;
0542 
0543   /**
0544    *  The weights for the \f$\phantom{1}^3D_1\f$ multiplets
0545    */
0546   vector<double> _weight3D1;
0547 
0548   /**
0549    *  The weights for the \f$\phantom{1}^3D_2\f$ multiplets
0550    */
0551   vector<double> _weight3D2;
0552 
0553   /**
0554    *  The weights for the \f$\phantom{1}^3D_3\f$ multiplets
0555    */
0556   vector<double> _weight3D3;
0557   //@}
0558 
0559   /**
0560    *  The weights for the excited meson multiplets
0561    */
0562   vector<vector<vector<double> > > _repwt;
0563 
0564   /**
0565    * The table of hadron data
0566    */
0567   HadronTable _table;
0568 
0569   /**
0570    * Enums so arrays can be statically allocated
0571    */
0572   //@{
0573   /**
0574    * Defines values for array sizes. L,J,N max values for excited mesons.
0575    */
0576   enum MesonMultiplets { Lmax = 3, Jmax = 4, Nmax = 4};
0577   //@}
0578 
0579   /**
0580    *  Option for the construction of the tables
0581    */
0582   unsigned int _topt;
0583 
0584   /**
0585    *  Which particles to produce for debugging purposes
0586    */
0587   unsigned int _trial;
0588 
0589   /**
0590    * @name A parameter used for determining when clusters are too light.
0591    *
0592    * This parameter is used for setting the lower threshold, \f$ t \f$ as
0593    * \f[ t' = t(1 + r B^1_{\rm lim}) \f]
0594    * where \f$ r \f$ is a random number [0,1].
0595    */
0596   //@{
0597   double _limBottom;
0598   double _limCharm;
0599   double _limExotic;
0600   //@}
0601 
0602   /**
0603    *  Option for the selection of hadrons below the pair threshold
0604    */
0605   unsigned int belowThreshold_;
0606   
0607   /**
0608    *  Caches of lightest pairs for speed
0609    */
0610   //@{
0611   /**
0612    * Masses of lightest hadron pair
0613    */
0614   map<pair<long,long>,tcPDPair> lightestHadrons_;
0615   //@}
0616 };
0617 
0618 
0619 }
0620 
0621 #endif /* HERWIG_HadronSelector_H */