Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:38:29

0001 // -*- C++ -*-
0002 //
0003 // PDT.h is a part of ThePEG - Toolkit for HEP Event Generation
0004 // Copyright (C) 1999-2019 Leif Lonnblad
0005 //
0006 // ThePEG 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 ThePEG_PDT_H
0010 #define ThePEG_PDT_H
0011 // This is the declaration of the PDT class.
0012 
0013 #include "ThePEG/Config/ThePEG.h"
0014 
0015 namespace ThePEG {
0016 
0017 /**
0018  * PDT is a helper class implementing enumerations for charge, colour
0019  * and spin to be used by the ParticleData class. In addition, some
0020  * static utility functions are provided.
0021  *
0022  * @see ParticleData
0023  */
0024 class PDT {
0025 
0026 public:
0027 
0028   /**
0029    * Definition of enumerated values used for spin information. THe
0030    * integer values are given according to 2s+1.
0031    */
0032   enum Spin {
0033     SpinNA = -1,       /**< Spin is not applicable. */
0034     SpinUnknown = 0,   /**< Unknown spin */
0035     SpinUndefined = 0, /**< Undefined spin */
0036     Spin0 = 1,         /**< Spin zero. */
0037     Spin1Half = 2,     /**< Spin 1/2. */
0038     Spin1 = 3,         /**< Spin 1. */
0039     Spin3Half = 4,     /**< Spin 3/2. */
0040     Spin2 = 5,         /**< Spin 2. */
0041     Spin5Half = 6,     /**< Spin 5/2. */
0042     Spin3 = 7,         /**< Spin 4. */
0043     Spin7Half = 8,     /**< Spin 7/2. */
0044     Spin4 = 9          /**< Spin 5. */
0045   };
0046 
0047   /**
0048    * Definition of enumerated values used for charge information. The
0049    * integer values are given in units of e/3.
0050    */
0051   enum Charge {
0052     ChargeUnknown = -999999,   /**< Unknown charge. */
0053     ChargeUndefined = -999999, /**< Undefined charge. */
0054     Charged = 999990,          /**< Is charged. */ 
0055     Positive = 900000,         /**< Is positively charged. */ 
0056     Negative = -900000,        /**< Is negatively charged. */ 
0057     ChargeNeutral = 0,         /**< Uncharged. */ 
0058     Charge0 = 0,               /**< Uncharged. */ 
0059     Plus1Third = 1,            /**< e/3. */ 
0060     Plus2Third = 2,            /**< 2e/3. */ 
0061     Plus1 = 3,                 /**< e. */ 
0062     Minus1Third = -1,          /**< -e/3. */ 
0063     Minus2Third = -2,          /**< -2e/3. */ 
0064     Minus1 = -3,               /**< -e. */ 
0065     Plus4Third = 4,            /**< 4e/3. */ 
0066     Plus5Third = 5,            /**< 5e/3. */ 
0067     Plus2 = 6,                 /**< 2e. */ 
0068     Minus4Third = -4,          /**< -4e/3. */ 
0069     Minus5Third = -5,          /**< -5e/3. */ 
0070     Minus2 = -6,               /**< -3e. */ 
0071     Plus7Third = 7,            /**< 7e/3. */ 
0072     Plus8Third = 8,            /**< 8e/3. */ 
0073     Plus3 = 9,                 /**< 3e. */ 
0074     Minus7Third = -7,          /**< -7e/3. */ 
0075     Minus8Third = -8,          /**< -8e/3. */ 
0076     Minus3 = -9,               /**< -3e. */ 
0077     Plus4 = 12,                /**< 4e. */ 
0078     Plus5 = 15,                /**< 5e. */ 
0079     Plus6 = 18,                /**< 6e. */ 
0080     Plus7 = 21,                /**< 7e. */ 
0081     Plus8 = 24,                /**< 8e. */ 
0082     Minus4 = -12,              /**< -4e. */ 
0083     Minus5 = -15,              /**< -5e. */ 
0084     Minus6 = -18,              /**< -6e. */ 
0085     Minus7 = -21,              /**< -7e. */ 
0086     Minus8 = -24               /**< -8e. */ 
0087   };
0088 
0089   /**
0090    *Definition of enumerated values used for colour information.
0091    */
0092   enum Colour {
0093     ColourUnknown = -1,   /**< Unknown colour */
0094     ColourUndefined = -1, /**< Undefined colour */
0095     ColourNeutral = 0,    /**< Colour-singlet */
0096     Colour0 = 0,          /**< Colour-singlet */
0097     Coloured = 1,         /**< Coloured */
0098     Colour3 = 3,          /**< Colour-triplet */
0099     Colour3bar = -3,      /**< Colour-anti-triplet */
0100     Colour6 = 6,          /**< Colour-sextet */
0101     Colour6bar = -6,      /**< Colour-anti-sextet */
0102     Colour8 = 8           /**< Colour-octet */
0103   };
0104 
0105   /**
0106    * Define type of nonabelian interactions
0107    */
0108   enum ColouredInteraction {
0109     ColouredUnknown = -2,
0110     ColouredUndefined = -2,
0111     NotColoured = -1,
0112     ColouredQCD = 0
0113   };
0114 
0115   /**
0116    * True if the argument corresponds to a non-zero charge.
0117    */
0118   static bool charged(Charge c) {
0119     return c != ChargeNeutral && c != ChargeUndefined;
0120   }
0121 
0122   /**
0123    * True if the argument corresponds to a positive charge.
0124    */
0125   static bool positive(Charge c) {
0126     return c > ChargeNeutral && c != Charged;
0127   }
0128 
0129   /**
0130    * True if the argument corresponds to a negative charge.
0131    */
0132   static bool negative(Charge c) {
0133     return c < ChargeNeutral && c != ChargeUndefined;
0134   }
0135 
0136   /**
0137    * True if the argument corresponds to a non-zero colour charge.
0138    */
0139   static bool coloured(Colour c) {
0140     return c != ColourNeutral && c != ColourUnknown;
0141   }
0142 
0143   /**
0144    * Return the anti-colour of the specified colour.
0145    */
0146   static Colour antiColour(Colour c) {
0147     if ( c == Colour3 || c == Colour3bar ) return Colour(-c);
0148     if ( c == Colour6 || c == Colour6bar ) return Colour(-c);
0149     return c;
0150   }
0151 
0152   /**
0153    * Return the flavour content of the given particle. The flavours
0154    * will be given in decreasing mass with flavour before
0155    * anti-flavour.
0156    */
0157   static vector<long> flavourContent(long id);
0158 
0159   /**
0160    * Return the flavour content of the given particle. The flavours
0161    * will be given in decreasing mass with flavour before
0162    * anti-flavour.
0163    */
0164   static vector<long> flavourContent(tcPDPtr);
0165 
0166   /**
0167    * Return the flavour content of the given particle. The flavours
0168    * will be given in decreasing mass with flavour before
0169    * anti-flavour.
0170    */
0171   static vector<long> flavourContent(tcPPtr);
0172 
0173   /**
0174    * Return the flavour content of the given particle. The flavours
0175    * will be given in decreasing mass with flavour before
0176    * anti-flavour.
0177    */
0178   static vector<long> flavourContent(const ParticleData &);
0179 
0180   /**
0181    * Return the flavour content of the given particle. The flavours
0182    * will be given in decreasing mass with flavour before
0183    * anti-flavour.
0184    */
0185   static vector<long> flavourContent(const Particle &);
0186 
0187 };
0188 
0189 /** Input a colour from a stream. */
0190 template <typename IStream>
0191 IStream & operator>>(IStream & is, PDT::Colour & c) {
0192   int ci;
0193   is >> ci;
0194   c = PDT::Colour(ci);
0195   return is;
0196 }
0197 
0198 /** Input a charge from a stream. */
0199 template <typename IStream>
0200 IStream & operator>>(IStream & is, PDT::Charge & c) {
0201   int ci;
0202   is >> ci;
0203   c = PDT::Charge(ci);
0204   return is;
0205 }
0206 
0207 /** Input a spin from a stream. */
0208 template <typename IStream>
0209 IStream & operator>>(IStream & is, PDT::Spin & s) {
0210   int si;
0211   is >> si;
0212   s = PDT::Spin(si);
0213   return is;
0214 }
0215 
0216 /// Type traits for built-in types
0217 template <> 
0218 struct TypeTraits<PDT::Spin>
0219 {
0220   /** Enum for dimensions*/
0221   enum { hasDimension = false };
0222   /// Type switch set to standard type.
0223   typedef EnumT DimType;
0224   /// Base unit
0225   static constexpr PDT::Spin baseunit() { return PDT::Spin(1); }
0226 };
0227 
0228 /// Type traits for built-in types
0229 template <> 
0230 struct TypeTraits<PDT::Charge>
0231 {
0232   /** Enum for dimensions*/
0233   enum { hasDimension = false };
0234   /// Type switch set to standard type.
0235   typedef EnumT DimType;
0236   /// Base unit
0237   static constexpr PDT::Charge baseunit() { return PDT::Charge(1); }
0238 };
0239 
0240 /// Type traits for built-in types
0241 template <> 
0242 struct TypeTraits<PDT::Colour>
0243 {
0244   /** Enum for dimensions*/
0245   enum { hasDimension = false };
0246   /// Type switch set to standard type.
0247   typedef EnumT DimType;
0248   /// Base unit
0249   static constexpr PDT::Colour baseunit() { return PDT::Colour(3); }
0250 };
0251 
0252 }
0253 
0254 #endif /* ThePEG_PDT_H */