CLHEP/HepPDT/Constituent.hh

00001 // $Id: Constituent.hh,v 1.4 2002/04/18 20:15:09 garren Exp $
00002 // ----------------------------------------------------------------------
00003 //
00004 // Constituent.hh
00005 //
00006 // Holds a particle constituent (e.g. ParticleID of the quark type)
00007 // ----------------------------------------------------------------------
00008 #ifndef CONSTITUENT_HH
00009 #define CONSTITUENT_HH
00010 
00011 #include "CLHEP/config/CLHEP.h"
00012 #include <algorithm>    // swap()
00013 
00014 #include "CLHEP/HepPDT/ParticleID.hh"
00015 
00016 namespace HepPDT {
00017 
00022 class Constituent  {
00023 
00024 public:
00025   // ---  birth/death:
00026   //
00027   Constituent( ParticleID p = ParticleID(0), int m = -1 )
00028     : itsPid(p), itsMultiplicity(m)  {}
00029     
00030   // ---  copying:
00031   //
00032   Constituent( Constituent const & orig )
00033     :  itsPid(orig.itsPid), itsMultiplicity(orig.itsMultiplicity)  {}
00034   Constituent &  operator = ( Constituent const & rhs ) {
00035     Constituent temp( rhs );
00036     swap( temp );
00037     return *this;
00038   }
00039   void swap( Constituent & other ) {
00040     std::swap(itsPid, other.itsPid );
00041     std::swap( itsMultiplicity, other.itsMultiplicity );
00042   }
00043 
00044   // ---  accessors:
00045   int         multiplicity() const  { return itsMultiplicity; }
00046   ParticleID  pid()          const  { return itsPid; }
00047 
00048   // ---  booleans:
00049   bool  isUp() const;
00050   bool  isDown() const;
00051   bool  isStrange() const;
00052   bool  isCharm() const;
00053   bool  isBottom() const;
00054   bool  isTop() const;
00055 
00056 private:
00057   // -- data members
00058   ParticleID  itsPid;
00059   int         itsMultiplicity;
00060 
00061 };  // Constituent
00062 
00063 
00064 inline
00065 void swap( Constituent & first, Constituent & second ) { first.swap( second ); }
00066 
00067 }       // HepPDT
00068 
00069 #endif // CONSTITUENT_HH

Class Library for High Energy Physics (version 1.8)