CLHEP/HepPDT/ParticleDataT.hh

00001 // $Id: ParticleDataT.hh,v 1.7 2002/07/24 21:15:12 garren Exp $
00002 // ----------------------------------------------------------------------
00003 //
00004 // ParticleDataT.hh
00005 // Author: Lynn Garren
00006 //
00007 // This is a base class for particle data information
00008 // ----------------------------------------------------------------------
00009 #ifndef PARTICLEDATAT_HH
00010 #define PARTICLEDATAT_HH
00011 
00012 #include "CLHEP/config/CLHEP.h"
00013 #include <algorithm>    // swap()
00014 
00015 #include "CLHEP/HepPDT/ParticleID.hh"
00016 #include "CLHEP/HepPDT/Measurement.hh"
00017 #include "CLHEP/HepPDT/SpinState.hh"
00018 #include "CLHEP/HepPDT/ResonanceStructure.hh"
00019 #include "CLHEP/HepPDT/Constituent.hh"
00020 #include "CLHEP/HepPDT/TempParticleData.hh"
00021 #include "CLHEP/HepPDT/DecayChannelT.hh"
00022 
00023 namespace HepPDT {
00024 
00029 template< class Config >
00030 class ParticleDataT {
00031 
00032 public:
00033   // --- useful typedef's
00034   //
00035   typedef  typename Config::CPD          CPD;
00036   typedef  typename Config::PT           PT;
00037 
00038   typedef  typename Config::ParticleData ParticleData;
00039   typedef  typename Config::DecayData    DecayData;
00040   typedef  typename Config::DecayChannel DecayChannel;
00041 
00042   typedef  typename Config::CPDID        CPDID;
00043   typedef  typename Config::DDID         DDID;
00044 
00045   // ---  birth/death:
00046   //
00047   inline ParticleDataT( const CPDID & cpdid, const DDID & ddid );
00048   inline ~ParticleDataT();
00049 
00050   // ---  copying:
00051   //
00052   inline void  swap( ParticleDataT<Config> & other );
00053   inline ParticleDataT( const ParticleDataT<Config> & orig );
00054   inline ParticleDataT& operator = ( const ParticleDataT<Config> & rhs );
00055 
00056   // ---  ParticleData accessors:
00057   //
00058   const std::string &         name()        const { return itsCPDID->name();      }
00059   ParticleID                  ID()          const { return itsCPDID->ID();        }
00060   int                         pid( )        const { return itsCPDID->ID().pid(); }
00061   double                      charge()      const { return itsCPDID->charge();    }
00062   double                      color()       const { return itsCPDID->color();     }
00063   SpinState                   spin()        const { return itsCPDID->spin();      }
00064   Measurement                 mass()        const { return itsCPDID->mass(); }
00065   Measurement                 totalWidth()  const { return itsCPDID->totalWidth();  }
00066   Measurement                 lifetime()    const { return itsCPDID->lifetime();  }
00067   int                         numConstituents() const { return itsCPDID->numConstituents(); }
00068   inline Constituent          constituent( unsigned int i ) const 
00069                                            { return itsCPDID->constituent(i); }
00070   inline ParticleID           constituentParticle( unsigned int i ) const
00071                                             { return itsCPDID->constituentParticle(i); }
00072   ResonanceStructure const *  resonance()   const { return itsCPDID->resonance(); }
00073 
00074   // --- ParticleData booleans:
00075   //
00076   bool isMeson( )   const  { return itsCPDID->isMeson(); }
00077   bool isBaryon( )  const  { return itsCPDID->isBaryon(); }
00078   bool isDiQuark( ) const  { return itsCPDID->isDiQuark(); }
00079   bool isHadron( )  const  { return itsCPDID->isHadron(); }
00080   bool isLepton( )  const  { return itsCPDID->isLepton(); }
00081   bool isNucleus( ) const  { return itsCPDID->isNucleus(); }
00082   bool hasUp()      const  { return itsCPDID->hasUp();      }
00083   bool hasDown()    const  { return itsCPDID->hasDown();    }
00084   bool hasStrange() const  { return itsCPDID->hasStrange(); }
00085   bool hasCharm()   const  { return itsCPDID->hasCharm();   }
00086   bool hasBottom()  const  { return itsCPDID->hasBottom();  }
00087   bool hasTop()     const  { return itsCPDID->hasTop();     }
00088 
00089   // ---  ParticleData mutators:
00090   //
00091   void  setCharge( double chg )            { itsCPDID->setCharge(chg); }
00092   void  setColor( double col )             { itsCPDID->setColor(col); }
00093   void  setSpin( SpinState const & spin )  { itsCPDID->setSpin(spin); }
00094   void  addConstituent( Constituent c )    { itsCPDID->addConstituent(c); }
00095 
00096   // ---  DecayData accessors:
00097   //
00098   int                  numDecayChannels() const { return itsDDID->size(); }
00099   bool                 isStable()         const { return itsDDID->isStable(); }
00100   DecayChannelT<Config>  channel( int i )    const { return itsDDID->channel(i); }
00101 
00102   // ---  decay methods:
00103   //
00104   bool  decay( int i, const PT & parent, std::vector<PT> & daughters );
00105   bool  decay( double rdm, const PT & parent, std::vector<PT> & daughters );
00106 
00107   // ---  DecayData mutators:
00108   //
00109   void  appendMode( DecayChannel const & dcp)  { itsDDID->appendMode(dcp); }
00110 
00111   // ---  accessors:
00112   //
00113   DDID   getDecayData()            const { return itsDDID; }
00114   CPDID  getCommonParticleData()   const { return itsCPDID; }
00115   
00116   inline void write( std::ostream & os ) const;
00117 
00118   // ---  booleans:
00119   //
00120   //bool  operator <  ( ParticleDataT<Config> const & other ) const;
00121   //bool  operator == ( ParticleDataT<Config> const & other ) const;
00122   
00123   // ---  mutator:
00124   //
00125   void  setDecayData( DDID dd )  { itsDDID = dd; }
00126 
00127 private:
00128 
00129   // ---  class-specific data:
00130   //
00131   CPDID  itsCPDID;      // pointer/iterator to ParticleData
00132   DDID   itsDDID;       // pointer/iterator to DecayData
00133 
00134   // default constructor not allowed
00135   ParticleDataT( );
00136 
00137 };  // ParticleDataT
00138 
00139 template< class Config >
00140 inline
00141 void  swap( ParticleDataT<Config> & first, ParticleDataT<Config> & second ) {
00142   first.swap( second );
00143 }
00144 
00145 }       // HepPDT
00146 
00147 #include "CLHEP/HepPDT/ParticleDataT.icc"
00148 
00149 #endif // PARTICLEDATAT_HH

Class Library for High Energy Physics (version 1.8)