ATLAS Offline Software
Loading...
Searching...
No Matches
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
120
122 ok = c != Imp::m_badValue;
123 return c;
124}
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
static const double m_badValue
static std::map< int, double > m_particlePDGCodeToCharge
static const HepPDT::ParticleData * particleData(const int &pdgcode)

◆ particleData()

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

Definition at line 46 of file VP1ParticleData.cxx.

47{
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}
static void messageVerbose(const QString &)
Definition VP1Msg.cxx:84
static bool verbose()
Definition VP1Msg.h:31
static void message(const QString &, IVP1System *sys=0)
Definition VP1Msg.cxx:30
static const HepPDT::ParticleDataTable * m_particleDataTable
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses

◆ 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}
static std::map< int, double > m_particleAbsPDGCodeToMass

◆ 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}
static const QString m_badName
static std::map< int, QString > m_particleAbsPDGCodeToName

The documentation for this class was generated from the following files: