Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-07-03 07:05:11

0001 /**
0002  \file
0003  Declaration of class erhic::Pid.
0004  
0005  \author    Thomas Burton
0006  \date      2011-08-12
0007  \copyright 2011 Brookhaven National Lab
0008  */
0009 
0010 #ifndef INCLUDE_EICSMEAR_ERHIC_PID_H_
0011 #define INCLUDE_EICSMEAR_ERHIC_PID_H_
0012 
0013 #include <Rtypes.h>
0014 
0015 class TParticlePDG;
0016 
0017 namespace erhic {
0018 
0019 /**
0020  Particle identity.
0021  */
0022 class Pid {
0023  public:
0024   /**
0025    Returns a code indicating 'not valid'.
0026    Use this value to consistently indicate particles without an ID number.
0027    */
0028   static Int_t InvalidCode();
0029 
0030   /**
0031    Constructor.
0032    @param [in] pdg The particle's PDG code, an integer
0033    */
0034   Pid(Int_t pdg = Pid::InvalidCode());
0035 
0036   /** Destructor */
0037   virtual ~Pid();
0038 
0039   /** Returns the PDG code, an integer. */
0040   Int_t Code() const;
0041 
0042   /**
0043    Sets the integer PDG code.
0044    @param [in] pdg The particle's PDG code, an integer
0045    */
0046   void Set(Int_t pdg);
0047 
0048   /**
0049    Returns the particle information object corresponding to this PDG code.
0050    From this, properties such as particle name, charge and mass
0051    can be accessed.
0052    */
0053   TParticlePDG* Info() const;
0054 
0055   /**
0056    Type conversion operator to integer PDG code.
0057    int i = Pid(211) is equivalent to int i = Pid(211).Code();
0058    */
0059   operator Int_t() const;
0060 
0061   /**
0062    Comparison operator with integer.
0063    Compares the argument with this object's integer PDG code.
0064    */
0065   bool operator==(Int_t i) const;
0066 
0067   /**
0068    Comparison operator with integer.
0069    Compares the argument with this object's integer PDG code.
0070    */
0071   bool operator<(Int_t i) const;
0072 
0073   /**
0074    Comparison operator with integer.
0075    Compares the argument with this object's integer PDG code.
0076    */
0077   bool operator>(Int_t i) const;
0078 
0079   /**
0080    Comparison operator with integer.
0081    Compares the argument with this object's integer PDG code.
0082    */
0083   bool operator!=(Int_t i) const;
0084 
0085   /**
0086    Comparison operator with integer.
0087    Compares the argument with this object's integer PDG code.
0088    */
0089   bool operator<=(Int_t i) const;
0090 
0091   /**
0092    Comparison operator with integer.
0093    Compares the argument with this object's integer PDG code.
0094    */
0095   bool operator>=(Int_t i) const;
0096 
0097  protected:
0098   Int_t mCode;  ///< The integer PDG code
0099 
0100   ClassDef(erhic::Pid, 1)
0101 };
0102 
0103 inline Pid::operator Int_t() const { return mCode; }
0104 
0105 inline Int_t Pid::Code() const { return mCode; }
0106 
0107 inline void Pid::Set(Int_t code) { mCode = code; }
0108 
0109 inline bool Pid::operator==(Int_t i) const { return mCode == i; }
0110 
0111 inline bool Pid::operator<(Int_t i) const { return mCode < i; }
0112 
0113 inline bool Pid::operator>(Int_t i) const { return mCode > i; }
0114 
0115 inline bool Pid::operator!=(Int_t i) const { return !operator==(i); }
0116 
0117 inline bool Pid::operator<=(Int_t i) const { return mCode <= i; }
0118 
0119 inline bool Pid::operator>=(Int_t i) const { return mCode >= i; }
0120 
0121 }  // namespace erhic
0122 
0123 #endif  // INCLUDE_EICSMEAR_ERHIC_PID_H_