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)

Private Member Functions

 VP1ParticleData ()
 ~VP1ParticleData ()

Detailed Description

Definition at line 23 of file VP1ParticleData.h.

Constructor & Destructor Documentation

◆ VP1ParticleData()

VP1ParticleData::VP1ParticleData ( )
inlineprivate

Definition at line 33 of file VP1ParticleData.h.

33{}

◆ ~VP1ParticleData()

VP1ParticleData::~VP1ParticleData ( )
inlineprivate

Definition at line 34 of file VP1ParticleData.h.

34{}

Member Function Documentation

◆ particleCharge()

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

Definition at line 59 of file VP1ParticleData.cxx.

60{
61 if (pdgcode==22) {
62 ok = true;
63 return 0.0;
64 }
65 std::map<int,double>::const_iterator it = Imp::m_particlePDGCodeToCharge.find(pdgcode);
67 ok = it->second != Imp::m_badValue;
68 return ok ? it->second : 0;
69 }
70 const double c = MC::isValid(pdgcode) ? MC::charge(pdgcode) : Imp::m_badValue;
71 if (c == Imp::m_badValue && VP1Msg::verbose()) {
72 VP1Msg::messageVerbose("VP1ParticleData WARNING: Invalid PDG code for charge lookup pdgcode="+QString::number(pdgcode));
73 }
74
76 ok = c != Imp::m_badValue;
77 return c;
78}
static void messageVerbose(const QString &)
Definition VP1Msg.cxx:84
static bool verbose()
Definition VP1Msg.h:31
static const double m_badValue
static std::map< int, double > m_particlePDGCodeToCharge
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
double charge(const T &p)

◆ particleMass()

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

Definition at line 42 of file VP1ParticleData.cxx.

43{
44 const int absPdgCode = std::abs(pdgcode);
45 std::map<int,double>::const_iterator it = Imp::m_particleAbsPDGCodeToMass.find(absPdgCode);
47 ok = it->second != Imp::m_badValue;
48 return ok ? it->second : 0;
49 }
50 const auto mOpt = Imp::m_genData.particleMass(absPdgCode);
51 const double m = mOpt.value_or(Imp::m_badValue);
52
54 ok = m != Imp::m_badValue;
55 return m;
56}
static std::map< int, double > m_particleAbsPDGCodeToMass

◆ particleName()

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

Definition at line 81 of file VP1ParticleData.cxx.

82{
83 std::map<int,QString>::const_iterator it = Imp::m_particleAbsPDGCodeToName.find(pdgcode);
85 ok = (it->second != Imp::m_badName);
86 return ok ? it->second : "";
87 }
88
89 QString name;
90 switch (pdgcode) {
91 case 21: name = "gluon"; break;
92 case 22: name = "photon"; break;
93 case -11: name = "e+"; break;
94 case 11: name = "e-"; break;
95 case -13: name = "mu+"; break;
96 case 13: name = "mu-"; break;
97 case -15: name = "tau+"; break;
98 case 15: name = "tau-"; break;
99 case -211: name = "pi-"; break;
100 case 211: name = "pi+"; break;
101 case 1: name = "d" ; break;
102 case 2: name = "u" ; break;
103 case 3: name = "s" ; break;
104 case 4: name = "c" ; break;
105 case 5: name = "b" ; break;
106 case 6: name = "t" ; break;
107 case -1: name = "dbar" ; break;
108 case -2: name = "ubar" ; break;
109 case -3: name = "sbar" ; break;
110 case -4: name = "cbar" ; break;
111 case -5: name = "bbar" ; break;
112 case -6: name = "tbar" ; break;
113 case 92: name = "frag string" ; break;
114 default:
115 break;
116 }
117
118 if (name.isEmpty()) {
119 const auto nameOpt = Imp::m_genData.particleName(std::abs(pdgcode));
120 if (nameOpt)
121 name = (pdgcode<0?"anti-":"")+QString::fromStdString(*nameOpt);//fixme: anything [[:alpha:]](+|-) we
122 // change + and -
123 else
125 }
126
128 ok = (name != Imp::m_badName);
129 return name;
130}
static const QString m_badName
static std::map< int, QString > m_particleAbsPDGCodeToName

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