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
Pid.h
erhic
Definition: EventDis.cxx:14
erhic::Pid::Info
TParticlePDG * Info() const
Returns the particle information object corresponding to this PDG code.
Definition: Pid.cxx:31
erhic::Pid::Pid
Pid(Int_t pdg=Pid::InvalidCode())
Constructor.
Definition: Pid.cxx:20
erhic::Pid::Code
Int_t Code() const
Returns the PDG code, an integer.
Definition: Pid.h:105
erhic::Pid::InvalidCode
static Int_t InvalidCode()
Returns a code indicating 'not valid'.
Definition: Pid.cxx:44
erhic::Pid::~Pid
virtual ~Pid()
Destructor.
Definition: Pid.cxx:24