Back to home page

EIC code displayed by LXR

 
 

    


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

0001 namespace Herwig {
0002 using namespace ThePEG;
0003 
0004 /** \ingroup Hadronization
0005    *  \class HadronInfo
0006    *  \brief Class used to store all the hadron information for easy access.
0007    *  \author Philip Stephens
0008    *
0009    *  Note that:
0010    *  - the hadrons in _table can be filled in any ordered
0011    *    w.r.t. the mass value, and flavours for different
0012    *    groups (for instance, (u,s) hadrons don't need to
0013    *    be placed after (d,s) or any other flavour), but
0014    *    all hadrons with the same flavours must be consecutive
0015    *    ( for instance you cannot alternate hadrons of type
0016    *    (d,s) with those of flavour (u,s) ).
0017    *    Furthermore, it is assumed that particle and antiparticle
0018    *    have the same weights, and therefore only one of them
0019    *    must be entered in the table: we have chosen to refer
0020    *    to the particle, defined as PDG id > 0, although if
0021    *    an anti-particle is provided in input it is automatically
0022    *    transform to its particle, simply by taking the modulus
0023    *    of its id.
0024    */
0025   class HadronInfo {
0026 
0027   public:
0028 
0029     /**
0030      *  Constructor
0031      * @param idin The PDG code of the hadron
0032      * @param datain The pointer to the ParticleData object
0033      * @param swtin  The singlet/decuplet/orbital factor
0034      * @param massin The mass of the hadron
0035      */
0036     HadronInfo(long idin=0, tPDPtr datain=tPDPtr(),
0037            double swtin=1., Energy massin=ZERO)
0038       : id(idin), ptrData(datain), swtef(swtin), wt(1.0), overallWeight(0.0),
0039     mass(massin)
0040     {}
0041 
0042     /**
0043      *  Comparision operator on mass
0044      */
0045      bool operator<(const HadronInfo &x) const {
0046       if(mass!=x.mass) return mass < x.mass;
0047       else return id < x.id;
0048     }
0049 
0050     /**
0051      * The hadrons id.
0052      */
0053     long  id;
0054 
0055     /**
0056      * pointer to ParticleData, to get the spin, etc...
0057      */
0058     tPDPtr ptrData;
0059 
0060     /**
0061      * singlet/decuplet/orbital factor
0062      */
0063     double swtef;
0064 
0065     /**
0066      * mixing factor
0067      */
0068     double wt;
0069 
0070     /**
0071      * (2*J+1)*wt*swtef
0072      */
0073     double overallWeight;
0074 
0075     /**
0076      * The hadrons mass
0077      */
0078     Energy mass;
0079 
0080     /**
0081      *  Rescale the weight for a given hadron
0082      */
0083     void rescale(double x) const {
0084       const_cast<HadronInfo*>(this)->overallWeight *= x;
0085     }
0086 
0087     /**
0088      * Friend method used to print the value of a table element.
0089      */
0090     friend PersistentOStream & operator<< (PersistentOStream & os,
0091                        const HadronInfo & hi ) {
0092       os << hi.id << hi.ptrData << hi.swtef << hi.wt
0093      << hi.overallWeight << ounit(hi.mass,GeV);
0094       return os;
0095     }
0096 
0097     /**
0098      * debug output
0099      */
0100     friend ostream & operator<< (ostream & os, const HadronInfo & hi ) {
0101       os << std::scientific << std::showpoint
0102      << std::setprecision(4)
0103      << setw(2)
0104      << hi.id << '\t'
0105      << hi.swtef << '\t'
0106      << hi.wt << '\t'
0107      << hi.overallWeight << '\t'
0108      << ounit(hi.mass,GeV);
0109       return os;
0110     }
0111 
0112     /**
0113      * Friend method used to read in the value of a table element.
0114      */
0115     friend PersistentIStream & operator>> (PersistentIStream & is,
0116                        HadronInfo & hi ) {
0117       is >> hi.id >> hi.ptrData >> hi.swtef >> hi.wt
0118      >> hi.overallWeight >> iunit(hi.mass,GeV);
0119       return is;
0120     }
0121   };
0122 
0123   /**
0124    *  Type defs 
0125    */
0126   //@{
0127   /**
0128    * The type is used to contain all the hadrons info of a given flavour.
0129    */
0130   typedef set<HadronInfo> KupcoData;
0131   //@}
0132 
0133   /**
0134    * The hadron table type.
0135    */
0136   typedef map<pair<long,long>,KupcoData> HadronTable;
0137 }