ATLAS Offline Software
Classes | Static Public Member Functions | Private Member Functions | List of all members
VP1ParticleData Class Reference

#include <VP1ParticleData.h>

Collaboration diagram for VP1ParticleData:

Classes

class  Imp
 

Static Public Member Functions

static double particleMass (const int &pdgcode, bool &ok)
 
static double particleCharge (const int &pdgcode, bool &ok)
 
static QString particleName (const int &pdgcode, bool &ok)
 
static const HepPDT::ParticleData * particleData (const int &pdgcode)
 

Private Member Functions

 VP1ParticleData ()
 
 ~VP1ParticleData ()
 

Detailed Description

Definition at line 24 of file VP1ParticleData.h.

Constructor & Destructor Documentation

◆ VP1ParticleData()

VP1ParticleData::VP1ParticleData ( )
inlineprivate

Definition at line 37 of file VP1ParticleData.h.

37 {}

◆ ~VP1ParticleData()

VP1ParticleData::~VP1ParticleData ( )
inlineprivate

Definition at line 38 of file VP1ParticleData.h.

38 {}

Member Function Documentation

◆ particleCharge()

double VP1ParticleData::particleCharge ( const int &  pdgcode,
bool &  ok 
)
static

Definition at line 103 of file VP1ParticleData.cxx.

104 {
105  if (pdgcode==22) {
106  ok = true;
107  return 0.0;
108  }
109  std::map<int,double>::const_iterator it = Imp::m_particlePDGCodeToCharge.find(pdgcode);
111  ok = it->second != Imp::m_badValue;
112  return ok ? it->second : 0;
113  }
114  const HepPDT::ParticleData * data = particleData( abs(pdgcode) );
115  double c;
116  if (data)
117  c = pdgcode >= 0 ? data->charge() : - data->charge();
118  else
119  c = Imp::m_badValue;
120 
122  ok = c != Imp::m_badValue;
123  return c;
124 }

◆ particleData()

const HepPDT::ParticleData * VP1ParticleData::particleData ( const int &  pdgcode)
static

Definition at line 46 of file VP1ParticleData.cxx.

47 {
48  if (Imp::m_badInit)
49  return 0;
51  //init
52  ISvcLocator* svcLocator = Gaudi::svcLocator();
53  if (!svcLocator) {
54  VP1Msg::message("VP1ParticleData ERROR: Could not get svcLocator.");
55  Imp::m_badInit = true;
56  return 0;
57  }
58 
59  SmartIF<IPartPropSvc> partPropSvc{svcLocator->service( "PartPropSvc" )};
60  if(!partPropSvc) {
61  VP1Msg::message("VP1ParticleData ERROR: Could not get particle property service.");
62  Imp::m_badInit = true;
63  return 0;
64  }
65  const HepPDT::ParticleDataTable* tab = partPropSvc->PDT();
67  if (!tab) {
68  VP1Msg::message("VP1ParticleData ERROR: Could not get particle data table from particle property service.");
69  Imp::m_badInit = true;
70  return 0;
71  }
72  }
73 
74  const HepPDT::ParticleData* particle =
75  Imp::m_particleDataTable->particle(HepPDT::ParticleID(pdgcode));
76  if (!particle&&VP1Msg::verbose())
77  VP1Msg::messageVerbose("VP1ParticleData WARNING: Could not get particle data table for pdgcode="+QString::number(pdgcode));
78 
79  return particle;
80 }

◆ particleMass()

double VP1ParticleData::particleMass ( const int &  pdgcode,
bool &  ok 
)
static

Definition at line 83 of file VP1ParticleData.cxx.

84 {
85  std::map<int,double>::const_iterator it = Imp::m_particleAbsPDGCodeToMass.find(abs(pdgcode));
87  ok = it->second != Imp::m_badValue;
88  return ok ? it->second : 0;
89  }
90  const HepPDT::ParticleData * data = particleData( abs(pdgcode) );
91  double m;
92  if (data)
93  m = data->mass().value();
94  else
96 
97  Imp::m_particleAbsPDGCodeToMass[abs(pdgcode)] = m;
98  ok = m != Imp::m_badValue;
99  return m;
100 }

◆ particleName()

QString VP1ParticleData::particleName ( const int &  pdgcode,
bool &  ok 
)
static

Definition at line 127 of file VP1ParticleData.cxx.

128 {
129  std::map<int,QString>::const_iterator it = Imp::m_particleAbsPDGCodeToName.find(pdgcode);
131  ok = (it->second != Imp::m_badName);
132  return ok ? it->second : "";
133  }
134 
135  QString name;
136  switch (pdgcode) {
137  case 21: name = "gluon"; break;
138  case 22: name = "photon"; break;
139  case -11: name = "e+"; break;
140  case 11: name = "e-"; break;
141  case -13: name = "mu+"; break;
142  case 13: name = "mu-"; break;
143  case -15: name = "tau+"; break;
144  case 15: name = "tau-"; break;
145  case -211: name = "M_PI-"; break;
146  case 211: name = "M_PI+"; break;
147  case 1: name = "d" ; break;
148  case 2: name = "u" ; break;
149  case 3: name = "s" ; break;
150  case 4: name = "c" ; break;
151  case 5: name = "b" ; break;
152  case 6: name = "t" ; break;
153  case -1: name = "dbar" ; break;
154  case -2: name = "ubar" ; break;
155  case -3: name = "sbar" ; break;
156  case -4: name = "cbar" ; break;
157  case -5: name = "bbar" ; break;
158  case -6: name = "tbar" ; break;
159  case 92: name = "frag string" ; break;
160  default:
161  break;
162  }
163 
164  if (name.isEmpty()) {
165  const HepPDT::ParticleData * data = particleData( abs(pdgcode) );
166  if (data)
167  name = (pdgcode<0?"anti-":"")+QString(data->name().c_str());//fixme: anything [[:alpha:]](+|-) we
168  // change + and -
169  else
171  }
172 
174  ok = (name != Imp::m_badName);
175  return name;
176 }

The documentation for this class was generated from the following files:
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
VP1ParticleData::Imp::m_badInit
static bool m_badInit
Definition: VP1ParticleData.cxx:28
VP1ParticleData::Imp::m_particleAbsPDGCodeToMass
static std::map< int, double > m_particleAbsPDGCodeToMass
Definition: VP1ParticleData.cxx:30
skel.it
it
Definition: skel.GENtoEVGEN.py:396
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
VP1ParticleData::Imp::m_badValue
static const double m_badValue
Definition: VP1ParticleData.cxx:33
VP1ParticleData::Imp::m_particleAbsPDGCodeToName
static std::map< int, QString > m_particleAbsPDGCodeToName
Definition: VP1ParticleData.cxx:32
jobOptions.ParticleID
ParticleID
Definition: jobOptions.decayer.py:85
VP1ParticleData::Imp::m_badName
static const QString m_badName
Definition: VP1ParticleData.cxx:34
python.selection.number
number
Definition: selection.py:20
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
VP1ParticleData::Imp::m_particlePDGCodeToCharge
static std::map< int, double > m_particlePDGCodeToCharge
Definition: VP1ParticleData.cxx:31
VP1Msg::messageVerbose
static void messageVerbose(const QString &)
Definition: VP1Msg.cxx:84
VP1ParticleData::Imp::m_particleDataTable
static const HepPDT::ParticleDataTable * m_particleDataTable
Definition: VP1ParticleData.cxx:29
VP1Msg::message
static void message(const QString &, IVP1System *sys=0)
Definition: VP1Msg.cxx:30
VP1Msg::verbose
static bool verbose()
Definition: VP1Msg.h:31
VP1ParticleData::particleData
static const HepPDT::ParticleData * particleData(const int &pdgcode)
Definition: VP1ParticleData.cxx:46
python.compressB64.c
def c
Definition: compressB64.py:93