Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // ----------------------------------------------------------------------
0002 //
0003 // Constituent.hh
0004 // Author:  Lynn Garren
0005 //
0006 // Holds a particle constituent (e.g. ParticleID of the quark type)
0007 // ----------------------------------------------------------------------
0008 #ifndef CONSTITUENT_HH
0009 #define CONSTITUENT_HH
0010 
0011 #include <algorithm>    // swap()
0012 
0013 #include "HepPDT/ParticleID.hh"
0014 
0015 namespace HepPDT {
0016 
0017 //! The Constituent class has information about constituent particles.
0018 
0019 ///
0020 /// \class Constituent
0021 /// \author Lynn Garren
0022 ///
0023 /// Holds a particle constituent 
0024 /// (e.g. quark type and number of quarks of this type)
0025 ///
0026 class Constituent  {
0027 
0028 public:
0029   // ---  birth/death:
0030   //
0031   Constituent( ParticleID p = ParticleID(0), int m = -1 )
0032     : itsPid(p), itsMultiplicity(m)  {}
0033     
0034   // ---  copying:
0035   //
0036   Constituent( Constituent const & orig )
0037     :  itsPid(orig.itsPid), itsMultiplicity(orig.itsMultiplicity)  {}
0038   Constituent &  operator = ( Constituent const & rhs ) {
0039     Constituent temp( rhs );
0040     swap( temp );
0041     return *this;
0042   }
0043   void swap( Constituent & other ) {
0044     std::swap(itsPid, other.itsPid );
0045     std::swap( itsMultiplicity, other.itsMultiplicity );
0046   }
0047 
0048   // ---  accessors:
0049   /// how many of this constituent are there?
0050   int         multiplicity() const  { return itsMultiplicity; }
0051   /// ParticleID of this constituent
0052   ParticleID  pid()          const  { return itsPid; }
0053 
0054   // ---  booleans:
0055   /// is this an up quark?
0056   bool  isUp() const;
0057   /// is this a down quark?
0058   bool  isDown() const;
0059   /// is this a strange quark?
0060   bool  isStrange() const;
0061   /// is this a charm quark?
0062   bool  isCharm() const;
0063   /// is this a bottom quark?
0064   bool  isBottom() const;
0065   /// is this a top quark?
0066   bool  isTop() const;
0067 
0068 private:
0069   // -- data members
0070   ParticleID  itsPid;
0071   int         itsMultiplicity;
0072 
0073 };  // Constituent
0074 
0075 
0076 inline
0077 void swap( Constituent & first, Constituent & second ) { first.swap( second ); }
0078 
0079 }   // HepPDT
0080 
0081 #endif // CONSTITUENT_HH