CLHEP/HepPDT/CommonParticleData.hh

00001 // $Id: CommonParticleData.hh,v 1.5 2002/04/18 20:15:06 garren Exp $
00002 // ----------------------------------------------------------------------
00003 //
00004 // CommonParticleData.hh
00005 // Author: Lynn Garren
00006 //
00007 // This is a base class for particle data information
00008 // ----------------------------------------------------------------------
00009 #ifndef COMMONPARTICLEDATA_HH
00010 #define COMMONPARTICLEDATA_HH
00011 
00012 #include "CLHEP/config/CLHEP.h"
00013 #include <string>
00014 #include <vector>
00015 
00016 #include "CLHEP/HepPDT/ParticleID.hh"
00017 #include "CLHEP/HepPDT/SpinState.hh"
00018 #include "CLHEP/HepPDT/Constituent.hh"
00019 #include "CLHEP/HepPDT/ResonanceStructure.hh"
00020 #include "CLHEP/HepPDT/TempParticleData.hh"
00021 
00022 namespace HepPDT {
00023 
00028 class CommonParticleData  {
00029 
00030 public:
00031 
00032   // ---  birth/death:
00033   //
00034   inline CommonParticleData( const TempParticleData & tpd );
00035   inline ~CommonParticleData();
00036 
00037   // ---  copying:
00038   //
00039   inline void  swap ( CommonParticleData & rhs );
00040   inline CommonParticleData( const CommonParticleData & orig );
00041   inline CommonParticleData & operator = ( const CommonParticleData & rhs );
00042 
00043   // ---  accessors:
00044   //
00045   const std::string &         name()        const { return itsParticleName; }
00046   ParticleID                  ID()          const { return itsID; }
00047   int                         pid( )        const { return itsID.pid(); }
00048   double                      charge()      const { return itsCharge; }
00049   double                      color()       const { return itsColorCharge; }
00050   SpinState                   spin()        const { return itsSpin; }
00051   Measurement                 mass()        const { return itsResonance->mass(); }
00052   Measurement                 totalWidth()  const { return itsResonance->totalWidth(); }
00053   inline Measurement          lifetime()    const;
00054   int                         numConstituents() const { return itsQuarks.size(); }
00055   inline Constituent          constituent( unsigned int i ) const;
00056   inline ParticleID           constituentParticle( unsigned int i ) const;
00057   ResonanceStructure const *  resonance()   const { return itsResonance; }
00058   
00059   void write( std::ostream & os ) const;
00060  
00061   // --- booleans:
00062   //
00063   bool isMeson( )   const { return itsID.isMeson(); }
00064   bool isBaryon( )  const { return itsID.isBaryon(); }
00065   bool isDiQuark( ) const { return itsID.isDiQuark(); }
00066   bool isHadron( )  const { return itsID.isHadron(); }
00067   bool isLepton( )  const { return itsID.isLepton(); }
00068   bool isNucleus( ) const { return itsID.isNucleus(); }
00069   // has methods look at Constituents, not PID
00070   bool hasUp()      const;
00071   bool hasDown()    const;
00072   bool hasStrange() const;
00073   bool hasCharm()   const;
00074   bool hasBottom()  const;
00075   bool hasTop()     const;
00076   // compare masses
00077   inline bool operator <  ( const CommonParticleData & other ) const;
00078   // use PID and ignore everything else
00079   inline bool operator == ( const CommonParticleData & other ) const;
00080 
00081   // ---  mutators:
00082   //
00083   void  setCharge( double chg )            { itsCharge = chg; }
00084   void  setColor( double col )             { itsColorCharge = col; }
00085   void  setSpin( const SpinState & spin )  { itsSpin = spin; }
00086   void  addConstituent( Constituent c )    { itsQuarks.push_back( c ); }
00087 
00088 private:
00089 
00090   // default constructor not allowed
00091   CommonParticleData();
00092  
00093   // ---  class-specific data:
00094   //
00095   ParticleID                itsID;
00096   std::string               itsParticleName;
00097   double                    itsCharge;
00098   double                    itsColorCharge;
00099   SpinState                 itsSpin;
00100   std::vector<Constituent>  itsQuarks;
00101   ResonanceStructure *      itsResonance;
00102 
00103   // helper method
00104   inline void getConstituentsFromPID( );
00105 
00106 };  // CommonParticleData
00107 
00108 inline void swap( CommonParticleData & first, CommonParticleData & second ) {
00109   first.swap( second );
00110 }
00111 
00112 }       // HepPDT
00113 
00114 #include "CLHEP/HepPDT/CommonParticleData.icc"
00115 
00116 #endif // COMMONPARTICLEDATA_HH

Class Library for High Energy Physics (version 1.8)