The Gaudi Framework  master (902e3694)
Gaudi::ParticleID Class Referencefinal

#include </builds/gaudi/Gaudi/GaudiPartProp/include/Gaudi/ParticleID.h>

Public Types

enum  Location {
  nj = 1, nq3, nq2, nq1,
  nl, nr, n, n8,
  n9, n10
}
 PDG ID digits (base 10) are: n nr nl nq1 ne2 nq3 nj. More...
 
enum  Quark {
  down = 1, up, strange, charm,
  bottom, top, bottom_prime, top_prime,
  first = down, last = top_prime
}
 Quark PDG IDs. More...
 

Public Member Functions

 ParticleID (const int pid=0)
 Constructor with PDG code. More...
 
int pid () const
 Retrieve the PDG ID. More...
 
constexpr unsigned int abspid () const
 Absolute value of the PDG ID. More...
 
void setPid (const int pid)
 Update the PDG ID. More...
 
bool isValid () const
 Return if the PID is valid. More...
 
bool isSM () const
 Return if the PID is from the standard model. More...
 
bool isMeson () const
 Return if the PID is for a meson. More...
 
bool isBaryon () const
 Return if the PID is for a baryon. More...
 
bool isDiQuark () const
 Return if the PID is for a di-quark. More...
 
bool isHadron () const
 Return if the PID is for a hadron. More...
 
bool isLepton () const
 Return if the PID is for a lepton. More...
 
bool isNucleus () const
 Return if the PID is for a nucleus. More...
 
bool isQuark () const
 Return if the PID is for a bare quark. More...
 
bool hasQuarks () const
 Return if the PID is a particle with quarks, but not a nucleus. More...
 
bool hasQuark (const Quark &q) const
 Return if the PID is a particle containing a specified quark flavor. More...
 
bool hasDown () const
 Return if the PID is a particle with a down quark. More...
 
bool hasUp () const
 Return if the PID is a particle with an up quark. More...
 
bool hasStrange () const
 Return if the PID is a particle with a down quark. More...
 
bool hasCharm () const
 Return if the PID is a particle with a charm quark. More...
 
bool hasBottom () const
 Return if the PID is a particle with a bottom quark. More...
 
bool hasTop () const
 Return if the PID is a particle with a top quark. More...
 
bool hasBottomPrime () const
 Return if the PID is a particle with a bottom' quark. More...
 
bool hasTopPrime () const
 Return if the PID is a particle with a top' quark. More...
 
int threeCharge () const
 Return three times the charge, in units of e+, valid for all particles. More...
 
int jSpin () const
 Return 2J+1, where J is the total spin, valid for all particles. More...
 
int sSpin () const
 Return 2S+1, where S is the spin, valid only for mesons. More...
 
int lSpin () const
 Return 2L+1, where L is the orbital angular momentum, valid only for mesons. More...
 
int Z () const
 Return the atomic number for a nucleus. More...
 
int A () const
 Return the nucleon number for a nucleus. More...
 
int nLambda () const
 Return the number of strange quarks for a nucleus. More...
 
int fundamentalID () const
 Return the fundamental ID. More...
 
int extraBits () const
 Return everything beyond the 7th PDG ID digit. More...
 
constexpr unsigned short digit (const Location &loc) const
 Return the digit for a given PDG ID digit location. More...
 
bool operator== (const ParticleID &o) const
 Equality operator. More...
 
bool operator!= (const ParticleID &o) const
 Non-equality operator. More...
 
bool operator< (const ParticleID &o) const
 Comparison operator. More...
 
std::ostreamfillStream (std::ostream &s) const
 Fill a stream with the PID. More...
 
std::string toString () const
 Return the PID stream representation as a string. More...
 

Static Public Member Functions

static std::ostreamprintLocation (const long l, std::ostream &s)
 Fill a stream with the PID digit enumeration. More...
 
static std::string printLocation (const long l)
 Return the PID digit enumeration stream representation as a string. More...
 
static std::ostreamprintQuark (const long q, std::ostream &s)
 Fill a stream with the PID quark enumeration. More...
 
static std::string printQuark (const long q)
 Return the PID quark enumeration stream representation as a string. More...
 

Private Attributes

int m_pid { 0 }
 PDG ID. More...
 

Detailed Description

Holds PDG + LHCb extension particle code, following the PDG particle numbering scheme (pdg.lbl.gov/2017/reviews/rpp2017-rev-monte-carlo-numbering.pdf). Specific conventions followed by Pythia 8 for beyond the standard model physics and color-octet quarkonia have been introduced.

Nuclei with the PDG 2017 convention (following the 2006 Monte Carlo nuclear code scheme) have the numbering +/- 10LZZZAAAI. Where AAA is A - the total baryon number, ZZZ is Z - the total number of protons, L is the total number of strange quarks, and I is the isomer number where I = 0 corresponds to the ground state. Backwards compatibility with the old heavy ion scheme has also been kept.

Date
19/02/2002
Author
Gloria Corti
Date
22/03/2018
Author
Philip Ilten

Definition at line 43 of file ParticleID.h.

Member Enumeration Documentation

◆ Location

PDG ID digits (base 10) are: n nr nl nq1 ne2 nq3 nj.

Enumerator
nj 
nq3 
nq2 
nq1 
nl 
nr 
n8 
n9 
n10 

Definition at line 46 of file ParticleID.h.

46 { nj = 1, nq3, nq2, nq1, nl, nr, n, n8, n9, n10 };

◆ Quark

Quark PDG IDs.

Enumerator
down 
up 
strange 
charm 
bottom 
top 
bottom_prime 
top_prime 
first 
last 

Definition at line 48 of file ParticleID.h.

Constructor & Destructor Documentation

◆ ParticleID()

Gaudi::ParticleID::ParticleID ( const int  pid = 0)
inlineexplicit

Constructor with PDG code.

Definition at line 51 of file ParticleID.h.

51 { setPid( pid ); }

Member Function Documentation

◆ A()

int Gaudi::ParticleID::A ( ) const

Return the nucleon number for a nucleus.

Definition at line 416 of file ParticleID.cpp.

416  {
417  if ( extraBits() < 100 ) { return 0; }
418  //
419  DATA data = decode( *this );
420  const unsigned int m_nq1 = data[Gaudi::ParticleID::nq1];
421  const unsigned int m_nq2 = data[Gaudi::ParticleID::nq2];
422  const unsigned int m_nq3 = data[Gaudi::ParticleID::nq3];
423  //
424  return m_nq1 * 100 + m_nq2 * 10 + m_nq3;
425 }

◆ abspid()

constexpr unsigned int Gaudi::ParticleID::abspid ( ) const
inlineconstexpr

Absolute value of the PDG ID.

Definition at line 56 of file ParticleID.h.

56 { return 0 > m_pid ? -m_pid : m_pid; }

◆ digit()

constexpr unsigned short Gaudi::ParticleID::digit ( const Location loc) const
inlineconstexpr

Return the digit for a given PDG ID digit location.

Definition at line 125 of file ParticleID.h.

125  {
126  constexpr std::uint32_t pows[10] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000 };
127  return ( abspid() / pows[loc - 1] ) % 10;
128  }

◆ extraBits()

int Gaudi::ParticleID::extraBits ( ) const

Return everything beyond the 7th PDG ID digit.

Definition at line 158 of file ParticleID.cpp.

158  {
159  const unsigned int m_extra = abspid() / 10000000;
160  return 45 == m_extra ? 100u : 46 == m_extra ? 100u : 47 == m_extra ? 100u : 49 == m_extra ? 100u : m_extra;
161 }

◆ fillStream()

std::ostream & Gaudi::ParticleID::fillStream ( std::ostream s) const

Fill a stream with the PID.

Definition at line 432 of file ParticleID.cpp.

432  {
433  return s << "Gaudi.ParticleID(" << m_pid << ")";
434 }

◆ fundamentalID()

int Gaudi::ParticleID::fundamentalID ( ) const

Return the fundamental ID.

This is 0 for nuclei, mesons, baryons, and di-quarks. Otherwise, this is the first two digits of the PDG ID

Definition at line 166 of file ParticleID.cpp.

166  {
167  //
168  DATA data = decode( *this );
169  const unsigned int m_extra = data[0];
170  const unsigned int m_nl = data[Gaudi::ParticleID::nl];
171  const unsigned int m_nq1 = data[Gaudi::ParticleID::nq1];
172  const unsigned int m_nq2 = data[Gaudi::ParticleID::nq2];
173  const unsigned int m_nq3 = data[Gaudi::ParticleID::nq3];
174  const unsigned int m_nj = data[Gaudi::ParticleID::nj];
175  //
176  return !m_extra && !( m_nl + m_nq1 + m_nq2 ) ? 10 * m_nq3 + m_nj : 0;
177 }

◆ hasBottom()

bool Gaudi::ParticleID::hasBottom ( ) const
inline

Return if the PID is a particle with a bottom quark.

Definition at line 92 of file ParticleID.h.

92 { return hasQuark( bottom ); }

◆ hasBottomPrime()

bool Gaudi::ParticleID::hasBottomPrime ( ) const
inline

Return if the PID is a particle with a bottom' quark.

Definition at line 96 of file ParticleID.h.

96 { return hasQuark( bottom_prime ); }

◆ hasCharm()

bool Gaudi::ParticleID::hasCharm ( ) const
inline

Return if the PID is a particle with a charm quark.

Definition at line 90 of file ParticleID.h.

90 { return hasQuark( charm ); }

◆ hasDown()

bool Gaudi::ParticleID::hasDown ( ) const
inline

Return if the PID is a particle with a down quark.

Definition at line 84 of file ParticleID.h.

84 { return hasQuark( down ); }

◆ hasQuark()

bool Gaudi::ParticleID::hasQuark ( const Quark q) const

Return if the PID is a particle containing a specified quark flavor.

Definition at line 257 of file ParticleID.cpp.

257  {
258  if ( abspid() == q ) { return true; }
259  if ( !hasQuarks() ) { return false; }
260  //
261  DATA data = decode( *this );
262  const unsigned int m_nq1 = data[Gaudi::ParticleID::nq1];
263  const unsigned int m_nq2 = data[Gaudi::ParticleID::nq2];
264  const unsigned int m_nq3 = data[Gaudi::ParticleID::nq3];
265  //
266  return q == m_nq3 || q == m_nq2 || q == m_nq1;
267 }

◆ hasQuarks()

bool Gaudi::ParticleID::hasQuarks ( ) const

Return if the PID is a particle with quarks, but not a nucleus.

Definition at line 255 of file ParticleID.cpp.

255 { return !extraBits() && !fundamentalID(); }

◆ hasStrange()

bool Gaudi::ParticleID::hasStrange ( ) const
inline

Return if the PID is a particle with a down quark.

Definition at line 88 of file ParticleID.h.

88 { return hasQuark( strange ); }

◆ hasTop()

bool Gaudi::ParticleID::hasTop ( ) const
inline

Return if the PID is a particle with a top quark.

Definition at line 94 of file ParticleID.h.

94 { return hasQuark( top ); }

◆ hasTopPrime()

bool Gaudi::ParticleID::hasTopPrime ( ) const
inline

Return if the PID is a particle with a top' quark.

Definition at line 98 of file ParticleID.h.

98 { return hasQuark( top_prime ); }

◆ hasUp()

bool Gaudi::ParticleID::hasUp ( ) const
inline

Return if the PID is a particle with an up quark.

Definition at line 86 of file ParticleID.h.

86 { return hasQuark( up ); }

◆ isBaryon()

bool Gaudi::ParticleID::isBaryon ( ) const

Return if the PID is for a baryon.

Definition at line 215 of file ParticleID.cpp.

215  {
216  //
217  if ( !isSM() ) { return false; }
218  //
219  DATA data = decode( *this );
220  const unsigned int m_nq1 = data[Gaudi::ParticleID::nq1];
221  const unsigned int m_nq2 = data[Gaudi::ParticleID::nq2];
222  const unsigned int m_nq3 = data[Gaudi::ParticleID::nq3];
223  const unsigned int m_nj = data[Gaudi::ParticleID::nj];
224  //
225  return m_nq1 != 0 && m_nq2 != 0 && m_nq3 != 0 && m_nj != 0;
226 }

◆ isDiQuark()

bool Gaudi::ParticleID::isDiQuark ( ) const

Return if the PID is for a di-quark.

Definition at line 228 of file ParticleID.cpp.

228  {
229  //
230  if ( !isSM() ) { return false; }
231  //
232  DATA data = decode( *this );
233  const unsigned int m_nq1 = data[Gaudi::ParticleID::nq1];
234  const unsigned int m_nq2 = data[Gaudi::ParticleID::nq2];
235  const unsigned int m_nq3 = data[Gaudi::ParticleID::nq3];
236  const unsigned int m_nj = data[Gaudi::ParticleID::nj];
237  //
238  return m_nq1 != 0 && m_nq2 != 0 && m_nq3 == 0 && m_nj != 0 && !( m_nj == 1 && m_nq1 == m_nq2 );
239 }

◆ isHadron()

bool Gaudi::ParticleID::isHadron ( ) const

Return if the PID is for a hadron.

Definition at line 241 of file ParticleID.cpp.

241 { return isMeson() || isBaryon(); }

◆ isLepton()

bool Gaudi::ParticleID::isLepton ( ) const

Return if the PID is for a lepton.

Definition at line 243 of file ParticleID.cpp.

243  {
244  const unsigned int apid = abspid();
245  return 11 <= apid && apid <= 18;
246 }

◆ isMeson()

bool Gaudi::ParticleID::isMeson ( ) const

Return if the PID is for a meson.

Definition at line 202 of file ParticleID.cpp.

202  {
203  //
204  if ( !isSM() ) { return false; }
205  //
206  DATA data = decode( *this );
207  const unsigned int m_nq1 = data[Gaudi::ParticleID::nq1];
208  const unsigned int m_nq2 = data[Gaudi::ParticleID::nq2];
209  const unsigned int m_nq3 = data[Gaudi::ParticleID::nq3];
210  const unsigned int m_nj = data[Gaudi::ParticleID::nj];
211  //
212  return m_nq1 == 0 && m_nq2 != 0 && m_nq3 != 0 && m_nj != 0 && !( pid() < 0 && m_nq2 == m_nq3 );
213 }

◆ isNucleus()

bool Gaudi::ParticleID::isNucleus ( ) const

Return if the PID is for a nucleus.

Definition at line 248 of file ParticleID.cpp.

248 { return 100 <= extraBits() && Z() <= A(); }

◆ isQuark()

bool Gaudi::ParticleID::isQuark ( ) const

Return if the PID is for a bare quark.

Definition at line 250 of file ParticleID.cpp.

250  {
251  const unsigned int apid = abspid();
252  return Gaudi::ParticleID::Quark::first <= apid && apid <= Gaudi::ParticleID::Quark::last;
253 }

◆ isSM()

bool Gaudi::ParticleID::isSM ( ) const

Return if the PID is from the standard model.

Definition at line 194 of file ParticleID.cpp.

194  {
195  DATA data = decode( *this );
196  const unsigned int m_n = data[Gaudi::ParticleID::n];
197  const unsigned int m_nr = data[Gaudi::ParticleID::nr];
198  //
199  return m_n < 1 || ( m_n == 9 && m_nr != 9 );
200 }

◆ isValid()

bool Gaudi::ParticleID::isValid ( ) const

Return if the PID is valid.

Definition at line 179 of file ParticleID.cpp.

179  {
180  // Nuclei, geantino, and intermediate.
181  if ( extraBits() ) {
182  return m_pid == 480000000 || m_pid == -990000000 || isNucleus();
183  }
184  // Standard model particles.
185  else if ( abspid() < 100 || isHadron() || isDiQuark() ) {
186  return true;
187  }
188  // Beyond the standard model particles.
189  else {
190  return !isSM();
191  }
192 }

◆ jSpin()

int Gaudi::ParticleID::jSpin ( ) const

Return 2J+1, where J is the total spin, valid for all particles.

Definition at line 313 of file ParticleID.cpp.

313  {
314  // Lookup table for spins. The Xu+ (43) and Xu0 (44) break the PDG
315  // conventions and are EvtGen specific. The c-hadron (84), b-hadron
316  // (85), t-hadron (86), b'-hadron (87), are LHCb specific but within
317  // the acceptable 81 - 100 range. A double charged Higgs is inserted
318  // as 9 and a gravintino is inserted as 10.
319  static const unsigned int j[101] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 1, 4, // 1 - 10.
320  2, 2, 2, 2, 2, 2, 2, 2, 0, 0, // 11 - 20.
321  3, 3, 3, 3, 1, 0, 0, 0, 0, 0, // 21 - 30.
322  0, 3, 3, 3, 1, 1, 1, 1, 5, 0, // 31 - 40.
323  3, 1, 0, 0, 1, 1, 0, 0, 0, 0, // 41 - 50.
324  1, 2, 3, 1, 3, 1, 1, 1, 1, 1, // 51 - 60.
325  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 61 - 70.
326  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 71 - 80.
327  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 81 - 90.
328  0, 0, 3, 0, 0, 0, 0, 0, 0, 0 }; // 91 - 100.
329  const unsigned int fid = fundamentalID();
330  int spin = 0;
331  //
332  DATA data = decode( *this );
333  const unsigned int m_n = data[Gaudi::ParticleID::n];
334  const unsigned int m_nq3 = data[Gaudi::ParticleID::nq3];
335  const unsigned int m_nj = data[Gaudi::ParticleID::nj];
336  //
337  // Fundamental particles from the spin table.
338  if ( fid ) {
339  // Supersymmetric particles.
340  if ( m_n == 1 || m_n == 2 || m_n == 3 ) {
341  spin = j[fid] % 2 + 1;
342  }
343  // Standard particles.
344  else {
345  spin = j[fid];
346  }
347  }
348  // Nuclei.
349  else if ( isNucleus() ) {
350  spin = m_nq3 % 2 + 1;
351  }
352  // Everything else.
353  else {
354  spin = m_nj;
355  }
356  //
357  return spin;
358 }

◆ lSpin()

int Gaudi::ParticleID::lSpin ( ) const

Return 2L+1, where L is the orbital angular momentum, valid only for mesons.

Definition at line 382 of file ParticleID.cpp.

382  {
383  //
384  if ( !isMeson() ) { return 0; }
385  //
386  DATA data = decode( *this );
387  const unsigned int m_n = data[Gaudi::ParticleID::n];
388  const unsigned int m_nl = data[Gaudi::ParticleID::nl];
389  const unsigned int m_nj = data[Gaudi::ParticleID::nj];
390  //
391  if ( m_n == 9 ) {
392  return 0;
393  } else if ( m_nj == 1 ) {
394  return m_nl;
395  } else if ( m_nl == 0 ) {
396  return ( m_nj - 3 ) / 2;
397  } else if ( m_nl == 3 ) {
398  return ( m_nj + 1 ) / 2;
399  } else {
400  return ( m_nj - 1 ) / 2;
401  }
402 }

◆ nLambda()

int Gaudi::ParticleID::nLambda ( ) const

Return the number of strange quarks for a nucleus.

Definition at line 427 of file ParticleID.cpp.

427  {
428  const unsigned int m_extra = extraBits();
429  return 100 <= m_extra ? m_extra - 100 : 0;
430 }

◆ operator!=()

bool Gaudi::ParticleID::operator!= ( const ParticleID o) const
inline

Non-equality operator.

Definition at line 133 of file ParticleID.h.

133 { return m_pid != o.m_pid; }

◆ operator<()

bool Gaudi::ParticleID::operator< ( const ParticleID o) const
inline

Comparison operator.

Definition at line 135 of file ParticleID.h.

135  {
136  const unsigned int i1( abspid() ), i2( o.abspid() );
137  return std::tie( i1, m_pid ) < std::tie( i2, o.m_pid );
138  }

◆ operator==()

bool Gaudi::ParticleID::operator== ( const ParticleID o) const
inline

Equality operator.

Definition at line 131 of file ParticleID.h.

131 { return m_pid == o.m_pid; }

◆ pid()

int Gaudi::ParticleID::pid ( ) const
inline

Retrieve the PDG ID.

Definition at line 54 of file ParticleID.h.

54 { return m_pid; }

◆ printLocation() [1/2]

std::string Gaudi::ParticleID::printLocation ( const long  l)
static

Return the PID digit enumeration stream representation as a string.

Definition at line 471 of file ParticleID.cpp.

471  {
473  printLocation( l, s );
474  return s.str();
475 }

◆ printLocation() [2/2]

std::ostream & Gaudi::ParticleID::printLocation ( const long  l,
std::ostream s 
)
static

Fill a stream with the PID digit enumeration.

Definition at line 443 of file ParticleID.cpp.

443  {
444  switch ( l ) {
446  return s << "Gaudi.ParticleID.nj";
448  return s << "Gaudi.ParticleID.nq3";
450  return s << "Gaudi.ParticleID.nq2";
452  return s << "Gaudi.ParticleID.nq1";
454  return s << "Gaudi.ParticleID.nl";
456  return s << "Gaudi.ParticleID.nr";
458  return s << "Gaudi.ParticleID.n";
460  return s << "Gaudi.ParticleID.n8";
462  return s << "Gaudi.ParticleID.n9";
464  return s << "Gaudi.ParticleID.n10";
465  default:;
466  }
467  return s << "Gaudi.ParticleID.Location(" << l << ")";
468 }

◆ printQuark() [1/2]

std::string Gaudi::ParticleID::printQuark ( const long  q)
static

Return the PID quark enumeration stream representation as a string.

Definition at line 502 of file ParticleID.cpp.

502  {
504  printQuark( q, s );
505  return s.str();
506 }

◆ printQuark() [2/2]

std::ostream & Gaudi::ParticleID::printQuark ( const long  q,
std::ostream s 
)
static

Fill a stream with the PID quark enumeration.

Definition at line 478 of file ParticleID.cpp.

478  {
479  switch ( q ) {
481  return s << "Gaudi.ParticleID.down";
483  return s << "Gaudi.ParticleID.up";
485  return s << "Gaudi.ParticleID.strange";
487  return s << "Gaudi.ParticleID.charm";
489  return s << "Gaudi.ParticleID.bottom";
491  return s << "Gaudi.ParticleID.top";
493  return s << "Gaudi.ParticleID.bottom_prime";
495  return s << "Gaudi.ParticleID.top_prime";
496  default:;
497  }
498  return s << "Gaudi.ParticleID.Quark(" << q << ")";
499 }

◆ setPid()

void Gaudi::ParticleID::setPid ( const int  pid)
inline

Update the PDG ID.

Definition at line 58 of file ParticleID.h.

58 { m_pid = pid; }

◆ sSpin()

int Gaudi::ParticleID::sSpin ( ) const

Return 2S+1, where S is the spin, valid only for mesons.

Definition at line 361 of file ParticleID.cpp.

361  {
362  //
363  if ( !isMeson() ) { return 0; }
364  //
365  DATA data = decode( *this );
366  const unsigned int m_n = data[Gaudi::ParticleID::n];
367  const unsigned int m_nl = data[Gaudi::ParticleID::nl];
368  const unsigned int m_nj = data[Gaudi::ParticleID::nj];
369  //
370  if ( m_n == 9 ) {
371  return 0;
372  } else if ( m_nj == 1 ) {
373  return m_nl;
374  } else if ( m_nl == 1 ) {
375  return 0;
376  } else {
377  return 1;
378  }
379 }

◆ threeCharge()

int Gaudi::ParticleID::threeCharge ( ) const

Return three times the charge, in units of e+, valid for all particles.

Definition at line 269 of file ParticleID.cpp.

269  {
270  // Lookup table for charges. The Xu+ (43) and Xu0 (44) break the PDG
271  // conventions and are EvtGen specific. The c-hadron (84), b-hadron
272  // (85), t-hadron (86), b'-hadron (87), are LHCb specific but within
273  // the acceptable 81 - 100 range. A double charged Higgs is inserted
274  // as 9 and a gravintino as 10.
275  static const int q[101] = { 0, -1, 2, -1, 2, -1, 2, -1, 2, 6, 0, // 1 - 10.
276  -3, 0, -3, 0, -3, 0, -3, 0, 0, 0, // 11 - 20.
277  0, 0, 0, 3, 0, 0, 0, 0, 0, 0, // 21 - 30.
278  0, 0, 0, 3, 0, 0, 3, 0, 0, 0, // 31 - 40.
279  0, -1, 0, 3, 0, 0, 0, 0, 0, 0, // 41 - 50.
280  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 51 - 60.
281  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 61 - 70.
282  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 71 - 80.
283  0, 0, 0, 2, -1, 2, -1, 0, 0, 0, // 81 - 90.
284  0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // 91 - 100.
285  const unsigned int fid = fundamentalID();
286  int charge = 0;
287  //
288  DATA data = decode( *this );
289  const unsigned int m_nq1 = data[Gaudi::ParticleID::nq1];
290  const unsigned int m_nq2 = data[Gaudi::ParticleID::nq2];
291  const unsigned int m_nq3 = data[Gaudi::ParticleID::nq3];
292 
293  // Nuclei.
294  if ( isNucleus() ) {
295  charge = 3 * Z();
296  }
297  // Fundamental particles from the charge table.
298  else if ( fid ) {
299  charge = q[fid];
300  }
301  // Mesons.
302  else if ( !m_nq1 ) {
303  charge = abs( q[m_nq2] - q[m_nq3] );
304  }
305  // Everything else.
306  else {
307  charge = q[m_nq3] + q[m_nq2] + q[m_nq1];
308  }
309 
310  return ( pid() < 0 ? -1 : 1 ) * charge;
311 }

◆ toString()

std::string Gaudi::ParticleID::toString ( ) const

Return the PID stream representation as a string.

Definition at line 436 of file ParticleID.cpp.

436  {
438  fillStream( s );
439  return s.str();
440 }

◆ Z()

int Gaudi::ParticleID::Z ( ) const

Return the atomic number for a nucleus.

Definition at line 404 of file ParticleID.cpp.

404  {
405  if ( extraBits() < 100 ) { return 0; }
406  //
407  DATA data = decode( *this );
408  //
409  const unsigned int m_n = data[Gaudi::ParticleID::n];
410  const unsigned int m_nr = data[Gaudi::ParticleID::nr];
411  const unsigned int m_nl = data[Gaudi::ParticleID::nl];
412  //
413  return m_n * 100 + m_nr * 10 + m_nl;
414 }

Member Data Documentation

◆ m_pid

int Gaudi::ParticleID::m_pid { 0 }
private

PDG ID.

Definition at line 155 of file ParticleID.h.


The documentation for this class was generated from the following files:
Gaudi::ParticleID::top_prime
@ top_prime
Definition: ParticleID.h:48
Gaudi::ParticleID::nq2
@ nq2
Definition: ParticleID.h:46
Gaudi::ParticleID::bottom_prime
@ bottom_prime
Definition: ParticleID.h:48
Gaudi::ParticleID::setPid
void setPid(const int pid)
Update the PDG ID.
Definition: ParticleID.h:58
Gaudi::ParticleID::extraBits
int extraBits() const
Return everything beyond the 7th PDG ID digit.
Definition: ParticleID.cpp:158
Gaudi::ParticleID::nq1
@ nq1
Definition: ParticleID.h:46
gaudirun.s
string s
Definition: gaudirun.py:346
Gaudi::ParticleID::nr
@ nr
Definition: ParticleID.h:46
Gaudi::ParticleID::isHadron
bool isHadron() const
Return if the PID is for a hadron.
Definition: ParticleID.cpp:241
Gaudi::ParticleID::n10
@ n10
Definition: ParticleID.h:46
Gaudi::ParticleID::bottom
@ bottom
Definition: ParticleID.h:48
std::abs
Gaudi::ParticleID abs(const Gaudi::ParticleID &p)
Return the absolute value for a PID.
Definition: ParticleID.h:191
Gaudi::ParticleID::last
@ last
Definition: ParticleID.h:48
Gaudi::ParticleID::isMeson
bool isMeson() const
Return if the PID is for a meson.
Definition: ParticleID.cpp:202
Gaudi::ParticleID::printLocation
static std::ostream & printLocation(const long l, std::ostream &s)
Fill a stream with the PID digit enumeration.
Definition: ParticleID.cpp:443
Gaudi::ParticleID::up
@ up
Definition: ParticleID.h:48
Gaudi::ParticleID::Z
int Z() const
Return the atomic number for a nucleus.
Definition: ParticleID.cpp:404
Gaudi::ParticleID::fillStream
std::ostream & fillStream(std::ostream &s) const
Fill a stream with the PID.
Definition: ParticleID.cpp:432
Gaudi::ParticleID::first
@ first
Definition: ParticleID.h:48
std::tie
T tie(T... args)
Gaudi::ParticleID::m_pid
int m_pid
PDG ID.
Definition: ParticleID.h:155
Gaudi::ParticleID::hasQuarks
bool hasQuarks() const
Return if the PID is a particle with quarks, but not a nucleus.
Definition: ParticleID.cpp:255
ProduceConsume.j
j
Definition: ProduceConsume.py:104
Gaudi::ParticleID::down
@ down
Definition: ParticleID.h:48
Gaudi::ParticleID::isNucleus
bool isNucleus() const
Return if the PID is for a nucleus.
Definition: ParticleID.cpp:248
Gaudi::ParticleID::isDiQuark
bool isDiQuark() const
Return if the PID is for a di-quark.
Definition: ParticleID.cpp:228
Gaudi::ParticleID::strange
@ strange
Definition: ParticleID.h:48
std::uint32_t
Gaudi::ParticleID::n9
@ n9
Definition: ParticleID.h:46
Gaudi::ParticleID::nl
@ nl
Definition: ParticleID.h:46
Gaudi::ParticleID::A
int A() const
Return the nucleon number for a nucleus.
Definition: ParticleID.cpp:416
Gaudi::ParticleID::isBaryon
bool isBaryon() const
Return if the PID is for a baryon.
Definition: ParticleID.cpp:215
std::ostringstream
STL class.
Gaudi::ParticleID::nj
@ nj
Definition: ParticleID.h:46
Gaudi::ParticleID::abspid
constexpr unsigned int abspid() const
Absolute value of the PDG ID.
Definition: ParticleID.h:56
Gaudi::ParticleID::printQuark
static std::ostream & printQuark(const long q, std::ostream &s)
Fill a stream with the PID quark enumeration.
Definition: ParticleID.cpp:478
Gaudi::ParticleID::pid
int pid() const
Retrieve the PDG ID.
Definition: ParticleID.h:54
gaudirun.l
dictionary l
Definition: gaudirun.py:583
Gaudi::ParticleID::charm
@ charm
Definition: ParticleID.h:48
Gaudi::ParticleID::n
@ n
Definition: ParticleID.h:46
Gaudi::ParticleID::fundamentalID
int fundamentalID() const
Return the fundamental ID.
Definition: ParticleID.cpp:166
Gaudi::ParticleID::top
@ top
Definition: ParticleID.h:48
Gaudi::ParticleID::isSM
bool isSM() const
Return if the PID is from the standard model.
Definition: ParticleID.cpp:194
Gaudi::ParticleID::hasQuark
bool hasQuark(const Quark &q) const
Return if the PID is a particle containing a specified quark flavor.
Definition: ParticleID.cpp:257
Gaudi::ParticleID::nq3
@ nq3
Definition: ParticleID.h:46
Gaudi::ParticleID::n8
@ n8
Definition: ParticleID.h:46