Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-09-28 07:02:51

0001 /**
0002  \file
0003  Implementation of class erhic::Pid.
0004  
0005  \author    Thomas Burton
0006  \date      2011-08-12
0007  \copyright 2011 Brookhaven National Lab
0008  */
0009 
0010 #include "eicsmear/erhic/Pid.h"
0011 
0012 #include <exception>
0013 #include <iostream>
0014 #include <limits>
0015 
0016 #include <TDatabasePDG.h>
0017 
0018 namespace erhic {
0019 
0020 Pid::Pid(Int_t code)
0021 : mCode(code) {
0022 }
0023 
0024 Pid::~Pid() {
0025 }
0026 
0027 /**
0028  TODO May need to cache TParticlePDG* if performance proves too slow with
0029  database lookup upon each call.
0030  */
0031 TParticlePDG* Pid::Info() const {
0032   try {
0033     return TDatabasePDG::Instance()->GetParticle(Code());
0034   }  // try
0035   catch(std::exception& e) {
0036     std::cerr
0037     << "Caught exception in Pid::Info(): " << e.what()
0038     << std::endl;
0039     return NULL;
0040   }  // catch
0041 }
0042 
0043 // CINT can't handle <limits> in header files so we hide it away here.
0044 Int_t Pid::InvalidCode() {
0045   return std::numeric_limits<Int_t>::max();
0046 }
0047 
0048 }  // namespace erhic