Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:11:34

0001 // ----------------------------------------------------------------------
0002 //
0003 // CommonParticleData.hh
0004 // Author: Lynn Garren
0005 //
0006 // This is a base class for particle data information
0007 // ----------------------------------------------------------------------
0008 #ifndef COMMONPARTICLEDATA_HH
0009 #define COMMONPARTICLEDATA_HH
0010 
0011 #include <string>
0012 #include <vector>
0013 
0014 #include "HepPDT/ParticleID.hh"
0015 #include "HepPDT/SpinState.hh"
0016 #include "HepPDT/Constituent.hh"
0017 #include "HepPDT/ResonanceStructure.hh"
0018 #include "HepPDT/TempParticleData.hh"
0019 
0020 namespace HepPDT {
0021 
0022 //! The CommonParticleData class holds basic particle data
0023 
0024 ///
0025 /// \class CommonParticleData
0026 /// \author Lynn Garren
0027 ///
0028 /// This class holds the basic paritcle data - name, ID, spin, etc.
0029 /// Methods are provided to get various information about the particle.
0030 ///
0031 class CommonParticleData  {
0032 
0033 public:
0034 
0035   // ---  birth/death:
0036   //
0037   /// create CommonParticleData from the temporary information
0038   CommonParticleData( const TempParticleData & tpd );
0039   ~CommonParticleData();
0040 
0041   // ---  copying:
0042   //
0043   void  swap ( CommonParticleData & rhs );
0044   CommonParticleData( const CommonParticleData & orig );
0045   CommonParticleData & operator = ( const CommonParticleData & rhs );
0046 
0047   // ---  accessors:
0048   //
0049   /// return particle name as defined by user input
0050   const std::string &         name()        const { return itsParticleName; }
0051   /// return PDG particle name
0052   const std::string           PDTname()     const { return itsID.PDTname(); }
0053   /// the name of the input source
0054   const std::string &         source()      const { return itsSource; }
0055   /// return the ParticleID
0056   ParticleID                  ID()          const { return itsID; }
0057   /// return the integer ID
0058   int                         pid( )        const { return itsID.pid(); }
0059   /// return untranslated integer ID
0060   int                         originalID( ) const { return itsOriginalID; }
0061   /// return charge
0062   double                      charge()      const { return itsCharge; }
0063   /// color information
0064   double                      color()       const { return itsColorCharge; }
0065   /// spin information
0066   SpinState                   spin()        const { return itsSpin; }
0067   /// mass
0068   Measurement                 mass()        const { return itsResonance.mass(); }
0069   /// return the total width
0070   Measurement                 totalWidth()  const { return itsResonance.totalWidth(); }
0071   /// lower cutoff of allowed width values
0072   double                      lowerCutoff() const { return itsResonance.lowerCutoff(); }
0073   /// upper cutoff of allowed width values
0074   double                      upperCutoff() const { return itsResonance.upperCutoff(); }
0075   /// calculate the lifetime
0076   Measurement          lifetime()    const { return itsResonance.lifetime(); }
0077   /// number of constituent particles (e.g., quarks)
0078   int                         numConstituents() const { return itsQuarks.size(); }
0079   /// constituent information
0080   Constituent          constituent( unsigned int i ) const;
0081   /// ParticleID for a constituent particle
0082   ParticleID           constituentParticle( unsigned int i ) const;
0083   /// resonance (width) information
0084   ResonanceStructure const    resonance()   const { return itsResonance; }
0085   
0086   /// output information about this particle
0087   void write( std::ostream & os ) const;
0088   /// output the translation information for this particle
0089   void writeTranslation( std::ostream & os ) const;
0090  
0091   // --- booleans:
0092   //
0093   /// is this a valid meson?
0094   bool isMeson( )   const { return itsID.isMeson(); }
0095   /// is this a valid baryon?
0096   bool isBaryon( )  const { return itsID.isBaryon(); }
0097   /// is this a valid diquark?
0098   bool isDiQuark( ) const { return itsID.isDiQuark(); }
0099   /// is this a valid hadron?
0100   bool isHadron( )  const { return itsID.isHadron(); }
0101   /// is this a valid lepton?
0102   bool isLepton( )  const { return itsID.isLepton(); }
0103   /// is this a valid ion?
0104   bool isNucleus( ) const { return itsID.isNucleus(); }
0105   /// is this a valid pentaquark ID?
0106   bool isPentaquark( ) const { return itsID.isPentaquark(); }
0107   /// is this a valid SUSY ID?
0108   bool isSUSY( ) const { return itsID.isSUSY(); }
0109   /// is this a valid R-hadron ID?
0110   bool isRhadron( ) const { return itsID.isRhadron(); }
0111   /// is this a valid Dyon (magnetic monopole) ID?
0112   bool isDyon( ) const { return itsID.isDyon(); }
0113   /// Check for QBall or any exotic particle with electric charge beyond the qqq scheme
0114   /// Ad-hoc numbering for such particles is 100xxxx0, where xxxx is the charge in tenths. 
0115   bool isQBall( ) const { return itsID.isQBall(); }
0116   // has methods look at Constituents, not PID
0117   /// does this particle contain an up quark?
0118   bool hasUp()      const;
0119   /// does this particle contain a down quark?
0120   bool hasDown()    const;
0121   /// does this particle contain a strange quark?
0122   bool hasStrange() const;
0123   /// does this particle contain a charm quark?
0124   bool hasCharm()   const;
0125   /// does this particle contain a bottom quark?
0126   bool hasBottom()  const;
0127   /// does this particle contain a top quark?
0128   bool hasTop()     const;
0129   /// compare masses
0130   bool operator <  ( const CommonParticleData & other ) const;
0131   /// use PID and ignore everything else
0132   bool operator == ( const CommonParticleData & other ) const;
0133 
0134   // ---  mutators:
0135   //
0136   /// change the charge
0137   void  setCharge( double chg )            { itsCharge = chg; }
0138   /// change color information
0139   void  setColor( double col )             { itsColorCharge = col; }
0140   /// change spin information
0141   void  setSpin( const SpinState & spin )  { itsSpin = spin; }
0142   /// add a constituent particle
0143   void  addConstituent( Constituent c )    { itsQuarks.push_back( c ); }
0144   /// change the mass
0145   void  setMass( Measurement const & mass )        {  itsResonance.setMass(mass); }
0146   /// change the total width
0147   void  setTotalWidth( Measurement const & width ) {  itsResonance.setTotalWidth(width); }
0148   /// change the total width using a lifetime
0149   void  setTotalWidthFromLifetime( Measurement const & lt ) {  itsResonance.setTotalWidthFromLifetime(lt); }
0150   /// change the total width lower cutoff
0151   void  setLowerCutoff( double cut )               {  itsResonance.setLowerCutoff(cut); }
0152   /// change the total width upper cutoff
0153   void  setUpperCutoff( double cut )               {  itsResonance.setUpperCutoff(cut); }
0154 
0155 private:
0156 
0157   // default constructor not allowed
0158   CommonParticleData();
0159  
0160   // ---  class-specific data:
0161   //
0162   ParticleID                itsID;
0163   std::string               itsParticleName;
0164   std::string               itsSource;
0165   int                       itsOriginalID;
0166   double                    itsCharge;
0167   double                    itsColorCharge;
0168   SpinState                 itsSpin;
0169   std::vector<Constituent>  itsQuarks;
0170   ResonanceStructure        itsResonance;
0171 
0172   /// helper method
0173   void getConstituentsFromPID( );
0174 
0175 };  // CommonParticleData
0176 
0177 inline void swap( CommonParticleData & first, CommonParticleData & second ) {
0178   first.swap( second );
0179 }
0180 
0181 }   // HepPDT
0182 
0183 #include "HepPDT/CommonParticleData.icc"
0184 
0185 #endif // COMMONPARTICLEDATA_HH