CLHEP/HepPDT/ParticleID.hh

00001 // $Id: ParticleID.hh,v 1.3 2002/04/12 15:02:43 evc Exp $
00002 // ----------------------------------------------------------------------
00003 //
00004 // ParticleID.hh
00005 //
00006 //  various utilities to extract information from the particle ID
00007 //
00008 //  In the standard numbering scheme, the PID digits (base 10) are:
00009 //            +/- n nr nl nq1 nq2 nq3 nj
00010 //  It is expected that any 7 digit number used as a PID will adhere to 
00011 //  the Monte Carlo numbering scheme documented by the PDG.
00012 //  Note that many "new" particles not explicitly defined already 
00013 //  can be expressed within this numbering scheme. 
00014 //
00015 // ----------------------------------------------------------------------
00016 #ifndef PARTICLEID_HH
00017 #define PARTICLEID_HH
00018 
00019 #include "CLHEP/config/CLHEP.h"
00020 #include <algorithm>    // swap()
00021 
00022 namespace HepPDT {
00023 
00024 // convert from 2J+1 to the actual spin value 
00025 double spinitod( int js );
00026 int spindtoi( double spin );
00027 
00028 // translate between generator ID's and standard numbering scheme
00029 int translatePythiatoPDT( const int pythiaID );
00030 int translateIsajettoPDT( const int isajetID );
00031 int translateHerwigtoPDT( const int herwigID);
00032 int translateQQtoPDT( const int qqID);
00033 int translateGeanttoPDT( const int geantID);
00034 int translatePDGtabletoPDT( const int pdgID);
00035 int translateEvtGentoPDT( const int evtGenID );
00036 
00037 int translatePDTtoPythia( const int pid );
00038 int translatePDTtoIsajet( const int pid );
00039 int translatePDTtoHerwig( const int pid );
00040 int translatePDTtoQQ( const int pid );
00041 int translatePDTtoGeant( const int pid );
00042 int translatePDTtoPDGtable( const int pid );
00043 int translatePDTtoEvtGen( const int pid );
00044 
00045 //  PID digits (base 10) are: n nr nl nq1 nq2 nq3 nj
00046 //  the location enum provides a convenient index into the PID
00047 enum location { nj=1, nq3, nq2, nq1, nl, nr, n, n8, n9, n10 };
00048 
00049 // constituent quarks
00054 struct Quarks {
00055     // -- constructors
00056     //
00057     Quarks( ) : nq1(0), nq2(0), nq3(0)  {}
00058     Quarks( short q1, short q2, short q3) : nq1(q1), nq2(q2), nq3(q3)  {}
00059     // -- data members
00060     //
00061     short nq1;
00062     short nq2;
00063     short nq3;
00064 };
00065 
00070 class ParticleID {
00071 
00072 public:
00073 
00074   // ---  birth/death:
00075   //
00076   inline ParticleID( int pid = 0 );
00077 
00078   // ---  copying:
00079   //
00080   inline ParticleID( const ParticleID & orig );
00081   inline ParticleID& operator=( const ParticleID & );
00082   inline void swap( ParticleID & other ); 
00083 
00084   inline bool  operator <  ( ParticleID const & other ) const;
00085   inline bool  operator == ( ParticleID const & other ) const;
00086 
00087   // ---  accessors:
00088   //
00089   int    pid( )        const { return itsPID; }
00090   inline int abspid( )        const;
00091 
00092   // ---  boolean methods:
00093   //
00094   bool isValid( )   const;
00095   bool isMeson( )   const;
00096   bool isBaryon( )  const;
00097   bool isDiQuark( ) const;
00098   bool isHadron( )  const;
00099   bool isLepton( )  const;
00100   bool isNucleus( ) const;
00101   //
00102   inline bool hasUp( )      const;
00103   inline bool hasDown( )    const;
00104   inline bool hasStrange( ) const;
00105   inline bool hasCharm( )   const;
00106   inline bool hasBottom( )  const;
00107   inline bool hasTop( )     const;
00108 
00109   // jSpin returns 2J+1, where J is the total spin
00110   int  jSpin( )        const;
00111   // sSpin returns 2S+1, where S is the spin
00112   int  sSpin( )        const;
00113   // lSpin returns 2L+1, where L is the orbital angular momentum
00114   int  lSpin( )        const;
00115   // return the first two digits if this is a "fundamental" particle
00116   int fundamentalID( ) const;
00117   // returns everything beyond the 7th digit (e.g. outside the numbering scheme)
00118   int extraBits( ) const;
00119   // returns a list of 3 constituent quarks
00120   Quarks quarks( ) const;
00121   // this is mostly for use by functions like addPDGParticles that have to 
00122   // figure out the charge from the PID
00123   int threeCharge( ) const;
00124   // if this is a nucleus, get A and Z
00125   int A( ) const;
00126   int Z( ) const;
00127   // digit returns the digit at a named location in the PID
00128   unsigned short digit(location) const;
00129 
00130 private:
00131 
00132   int itsPID;
00133 
00134 };  // ParticleID
00135 
00136 inline
00137 void swap( ParticleID & first, ParticleID & second ) { first.swap( second ); }
00138 
00139 } // HepPDT
00140 
00141 #include "CLHEP/HepPDT/ParticleID.icc"
00142 
00143 #endif // PARTICLEID_HH

Class Library for High Energy Physics (version 1.8)