Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // ----------------------------------------------------------------------
0002 //
0003 // ParticleID.hh
0004 // Author:  Lynn Garren
0005 //
0006 //  various utilities to extract information from the particle ID
0007 //
0008 //  In the standard numbering scheme, the PID digits (base 10) are:
0009 //            +/- n nr nl nq1 nq2 nq3 nj
0010 //  It is expected that any 7 digit number used as a PID will adhere to 
0011 //  the Monte Carlo numbering scheme documented by the PDG.
0012 //  Note that many "new" particles not explicitly defined already 
0013 //  can be expressed within this numbering scheme. 
0014 //
0015 // ----------------------------------------------------------------------
0016 #ifndef PARTICLEID_HH
0017 #define PARTICLEID_HH
0018 
0019 #include <string>
0020 #include <algorithm>    // swap()
0021 
0022 // Particle names
0023 #include "HepPID/ParticleName.hh"
0024 // Translation free functions
0025 #include "HepPID/ParticleIDTranslations.hh"
0026 
0027 namespace HepPDT {
0028 
0029 /// convert from 2J+1 to the actual spin value 
0030 double spinitod( int js );
0031 /// convert an actual spin to 2J+1
0032 int spindtoi( double spin );
0033 
0034 ///  PID digits (base 10) are: n nr nl nq1 nq2 nq3 nj
0035 ///  The location enum provides a convenient index into the PID.
0036 enum location { nj=1, nq3, nq2, nq1, nl, nr, n, n8, n9, n10 };
0037 
0038 /// constituent quarks
0039 struct Quarks {
0040     // -- constructors
0041     //
0042     Quarks( ) : nq1(0), nq2(0), nq3(0)  {}
0043     Quarks( short q1, short q2, short q3) : nq1(q1), nq2(q2), nq3(q3)  {}
0044     // -- data members
0045     //
0046     short nq1;
0047     short nq2;
0048     short nq3;
0049 };
0050 
0051 //! The ParticleID has various utilities to extract information from the particle ID
0052 
0053 ///
0054 /// \class ParticleID
0055 /// \author Lynn Garren
0056 ///
0057 ///  In the standard numbering scheme, the PID digits (base 10) are:
0058 ///            +/- n nr nl nq1 nq2 nq3 nj
0059 ///  It is expected that any 7 digit number used as a PID will adhere to 
0060 ///  the Monte Carlo numbering scheme documented by the PDG.
0061 ///  Note that particles not already explicitly defined 
0062 ///  can be expressed within this numbering scheme. 
0063 ///
0064 class ParticleID {
0065 
0066 public:
0067 
0068   // ---  birth/death:
0069   //
0070   /// create from an integer ID
0071   ParticleID( int pid = 0 );
0072 
0073   // ---  copying:
0074   //
0075   ParticleID( const ParticleID & orig );
0076   ParticleID& operator=( const ParticleID & );
0077   void swap( ParticleID & other ); 
0078 
0079   bool  operator <  ( ParticleID const & other ) const;
0080   bool  operator == ( ParticleID const & other ) const;
0081 
0082   // ---  accessors:
0083   //
0084   /// get the integer ID
0085   int    pid( )        const { return itsPID; }
0086   /// get the absolute value
0087   int abspid( )        const;
0088 
0089   // ---  boolean methods:
0090   //
0091   /// is this a valid ID?
0092   bool isValid( )   const;
0093   /// is this a valid meson ID?
0094   bool isMeson( )   const;
0095   /// is this a valid baryon ID?
0096   bool isBaryon( )  const;
0097   /// is this a valid diquark ID?
0098   bool isDiQuark( ) const;
0099   /// is this a valid hadron ID?
0100   bool isHadron( )  const;
0101   /// is this a valid lepton ID?
0102   bool isLepton( )  const;
0103   /// is this a valid ion ID?
0104   bool isNucleus( ) const;
0105   /// is this a valid pentaquark ID?
0106   bool isPentaquark( ) const;
0107   /// is this a valid SUSY ID?
0108   bool isSUSY( ) const;
0109   /// is this a valid R-hadron ID?
0110   bool isRhadron( ) const;
0111   /// is this a valid Dyon (magnetic monopole) ID?
0112   bool isDyon( ) const;
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;
0116 
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 
0130   /// jSpin returns 2J+1, where J is the total spin
0131   int  jSpin( )        const;
0132   /// sSpin returns 2S+1, where S is the spin
0133   int  sSpin( )        const;
0134   /// lSpin returns 2L+1, where L is the orbital angular momentum
0135   int  lSpin( )        const;
0136   /// return the first two digits if this is a "fundamental" particle
0137   int fundamentalID( ) const;
0138   /// returns everything beyond the 7th digit 
0139   /// (e.g. outside the standard numbering scheme)
0140   int extraBits( ) const;
0141   /// returns a list of 3 constituent quarks
0142   Quarks quarks( ) const;
0143   /// this is mostly for use by functions like addPDGParticles that have to 
0144   /// figure out the charge from the PID
0145   int threeCharge( ) const;
0146   /// get the actual charge, which might be fractional
0147   double charge() const;
0148   /// if this is a nucleus (ion), get A
0149   int A( ) const;
0150   /// if this is a nucleus (ion), get Z
0151   int Z( ) const;
0152   /// if this is a nucleus (ion), get nLambda
0153   int lambda( ) const;
0154   /// return the digit at a named location in the PID
0155   unsigned short digit(location) const;
0156   /// standard particle name
0157   const std::string PDTname() const { return HepPID::particleName( itsPID ); }
0158 
0159 private:
0160 
0161   int itsPID;
0162 
0163 };  // ParticleID
0164 
0165 inline
0166 void swap( ParticleID & first, ParticleID & second ) { first.swap( second ); }
0167 
0168 } // HepPDT
0169 
0170 #include "HepPDT/ParticleID.icc"
0171 
0172 #endif // PARTICLEID_HH