eic-smear  1.0.3
A collection of ROOT classes for Monte Carlo events and a fast-smearing code simulating detector effects for the Electron-Ion Collider task force
Pid.cxx
Go to the documentation of this file.
1 
10 #include "eicsmear/erhic/Pid.h"
11 
12 #include <exception>
13 #include <iostream>
14 #include <limits>
15 
16 #include <TDatabasePDG.h>
17 
18 namespace erhic {
19 
20 Pid::Pid(Int_t code)
21 : mCode(code) {
22 }
23 
25 }
26 
31 TParticlePDG* Pid::Info() const {
32  try {
33  return TDatabasePDG::Instance()->GetParticle(Code());
34  } // try
35  catch(std::exception& e) {
36  std::cerr
37  << "Caught exception in Pid::Info(): " << e.what()
38  << std::endl;
39  return NULL;
40  } // catch
41 }
42 
43 // CINT can't handle <limits> in header files so we hide it away here.
45  return std::numeric_limits<Int_t>::max();
46 }
47 
48 } // namespace erhic
Int_t Code() const
Definition: Pid.h:105
virtual ~Pid()
Definition: Pid.cxx:24
Pid(Int_t pdg=Pid::InvalidCode())
Definition: Pid.cxx:20
static Int_t InvalidCode()
Definition: Pid.cxx:44
TParticlePDG * Info() const
Definition: Pid.cxx:31