The Gaudi Framework  master (37c0b60a)
Gaudi::ParticleProperty Class Referencefinal

#include <Gaudi/ParticleProperty.h>

Collaboration diagram for Gaudi::ParticleProperty:

Classes

struct  Compare
 

Public Member Functions

 ParticleProperty (const std::string &name, const Gaudi::ParticleID &pid, const double charge, const double mass, const double tlife, const double maxWidth, const std::string &evtgen, const int pythia)
 full constructor, from all data (except the antiparticle ) More...
 
 ParticleProperty (const std::string &name, const Gaudi::ParticleID &pid, const double charge, const double mass, const double tlife, const double maxWidth)
 a bit simplified constructor, from all data (except the antiparticle ) More...
 
const std::stringparticle () const
 Get the particle name. More...
 
const std::stringname () const
 Get the particle name. More...
 
const Gaudi::ParticleIDparticleID () const
 get the particle ID More...
 
const Gaudi::ParticleIDpdgID () const
 get the particle ID More...
 
const Gaudi::ParticleIDpid () const
 get the particle ID More...
 
double charge () const
 Get the particle charge. More...
 
double mass () const
 Get the particle mass. More...
 
double lifetime () const
 Get the particle lifetime. More...
 
double lifeTime () const
 Get the particle lifetime. More...
 
double ctau () const
 Get the particle proper lifetime in c*tau units. More...
 
double width () const
 Get the particle natural width. More...
 
double maxWidth () const
 Get the max width deviation. More...
 
const Gaudi::ParticlePropertyantiParticle () const
 get the pointer to the anti-particle More...
 
const Gaudi::ParticlePropertyanti () const
 get the pointer to the anti-particle More...
 
bool selfcc () const
 self-charge conjugated? More...
 
int threeCharge () const
 Three times the charge (in positron charge units) More...
 
void setAntiParticle (const ParticleProperty *p)
 set the pointer to the antiparticle More...
 
const std::stringevtGenName () const
 Get the EvtGen name. More...
 
const std::stringevtGen () const
 Get the EvtGen name. More...
 
int pythiaID () const
 Get the Pythia ID. More...
 
int pythia () const
 Get the Pythia ID. More...
 
 operator const Gaudi::ParticleID & () const
 implicit conversion to ParticleID class More...
 
std::ostreamfillStream (std::ostream &s) const
 the standard (a'la Gaudi) printout of the object More...
 
std::string toString () const
 simple method for conversion into the string More...
 

Private Attributes

std::string m_name
 the name for the particle More...
 
Gaudi::ParticleID m_pid
 the PID for the particle More...
 
double m_charge
 the charge for the particle More...
 
double m_mass
 the nominal mass for the particle More...
 
double m_tlife
 the nominal proper lifetime for the particle More...
 
double m_maxWidth
 The maximum width deviation. More...
 
std::string m_evtgen
 the name of the particle for EvtGen program More...
 
int m_pythia
 the ID for the particle used in Pythia generator More...
 
const Gaudi::ParticlePropertym_anti
 the pointer to the anti-particle More...
 

Friends

bool operator< (const ParticleProperty &lhs, const ParticleProperty &rhs)
 comparison/ordering operator ( "strict-less-by-PID&Name" ) More...
 

Detailed Description

A trivial class to hold information about a single particle properties. All particle properties are accessible through accessor functions

Author
Iain Last,G.Corti
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@n.nosp@m.ikhe.nosp@m.f.nl

Definition at line 37 of file ParticleProperty.h.

Constructor & Destructor Documentation

◆ ParticleProperty() [1/2]

Gaudi::ParticleProperty::ParticleProperty ( const std::string name,
const Gaudi::ParticleID pid,
const double  charge,
const double  mass,
const double  tlife,
const double  maxWidth,
const std::string evtgen,
const int  pythia 
)

full constructor, from all data (except the antiparticle )

Parameters
namethe name for the particle
pidthe PID for the particle
chargethe charge of the particle
massthe nominal mass of the particle
tlifethe nominal lifetime of the particle
maxWidththe maximal width of the particle (used in generator)
evtgenthe name of particle in EvtGen program
pythiathe ID for the particle used in Pythia generator

Definition at line 41 of file ParticleProperty.cpp.

44  : m_name( name )
45  , m_pid( pid )
46  , m_charge( charge )
47  , m_mass( mass )
48  , m_tlife( tlife )
49  , m_maxWidth( maxWidth )
50  , m_evtgen( evtgen )
51  , m_pythia( pythia )
52  , m_anti( 0 ) {}

◆ ParticleProperty() [2/2]

Gaudi::ParticleProperty::ParticleProperty ( const std::string name,
const Gaudi::ParticleID pid,
const double  charge,
const double  mass,
const double  tlife,
const double  maxWidth 
)

a bit simplified constructor, from all data (except the antiparticle )

  • "evtGenName" is set from the regular "name"
  • pythiaID is set from the regular PID
Parameters
namethe name for the particle
pidthe PID for the particle
chargethe charge of the particle
massthe nominal mass of the particle
tlifethe nominal lifetime of the particle
maxWidththe maximal width of the particle (used in generator)

Definition at line 65 of file ParticleProperty.cpp.

67  : m_name( name )
68  , m_pid( pid )
69  , m_charge( charge )
70  , m_mass( mass )
71  , m_tlife( tlife )
72  , m_maxWidth( maxWidth )
73  , m_evtgen( name )
74  , m_pythia( pid.pid() )
75  , m_anti( 0 ) {}

Member Function Documentation

◆ anti()

const Gaudi::ParticleProperty* Gaudi::ParticleProperty::anti ( ) const
inline

get the pointer to the anti-particle

Definition at line 106 of file ParticleProperty.h.

106 { return m_anti; }

◆ antiParticle()

const Gaudi::ParticleProperty* Gaudi::ParticleProperty::antiParticle ( ) const
inline

get the pointer to the anti-particle

Definition at line 104 of file ParticleProperty.h.

104 { return anti(); }

◆ charge()

double Gaudi::ParticleProperty::charge ( ) const
inline

Get the particle charge.

Definition at line 88 of file ParticleProperty.h.

88 { return m_charge; }

◆ ctau()

double Gaudi::ParticleProperty::ctau ( ) const
inline

Get the particle proper lifetime in c*tau units.

Definition at line 96 of file ParticleProperty.h.

96 { return Gaudi::Units::c_light * lifeTime(); }

◆ evtGen()

const std::string& Gaudi::ParticleProperty::evtGen ( ) const
inline

Get the EvtGen name.

Definition at line 123 of file ParticleProperty.h.

123 { return m_evtgen; }

◆ evtGenName()

const std::string& Gaudi::ParticleProperty::evtGenName ( ) const
inline

Get the EvtGen name.

Definition at line 121 of file ParticleProperty.h.

121 { return m_evtgen; }

◆ fillStream()

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

the standard (a'la Gaudi) printout of the object

Parameters
sreference to the output stream
Returns
reference to the output stream

Definition at line 80 of file ParticleProperty.cpp.

80  {
81  //
82  typedef boost::format BF;
83  //
84  // name & code
85  s << BF( "%1$-14s %|16t| PDG:%2$9d," ) % name() % particleID().pid();
86 #ifdef __INTEL_COMPILER // Disable ICC remark
87 # pragma warning( disable : 1572 ) // Floating-point equality and inequality comparisons are unreliable
88 # pragma warning( push )
89 #endif
90  // charge
91  if ( 0 == charge() ) {
92  s << " Q: 0";
93  } else if ( 1.0 == charge() ) {
94  s << " Q: +1";
95  } else if ( -1.0 == charge() ) {
96  s << " Q: -1";
97  } else if ( 2.0 == charge() ) {
98  s << " Q: +2";
99  } else if ( -2.0 == charge() ) {
100  s << " Q: -2";
101  } else if ( 0.3 == charge() ) {
102  s << " Q:+1/3";
103  } else if ( -0.3 == charge() ) {
104  s << " Q:-1/3";
105  } else if ( 0.7 == charge() ) {
106  s << " Q:+2/3";
107  } else if ( -0.7 == charge() ) {
108  s << " Q:-2/3";
109  } else {
110  s << BF( " Q:%|+3.1f|," ) % float( charge() );
111  }
112 #ifdef __INTEL_COMPILER // Re-enable ICC remark
113 # pragma warning( pop )
114 #endif
115  // mass
116  if ( mass() < 1 * Gaudi::Units::MeV ) {
117  s << BF( ", mass:%|9.6g| keV" ) % ( mass() / Gaudi::Units::keV );
118  } else if ( mass() < 1 * Gaudi::Units::GeV ) {
119  s << BF( ", mass:%|9.6g| MeV" ) % ( mass() / Gaudi::Units::MeV );
120  } else {
121  s << BF( ", mass:%|9.6g| GeV" ) % ( mass() / Gaudi::Units::GeV );
122  }
123  // lifetime
124  if ( 1 * Gaudi::Units::km < ctau() ) {
125  s << ", lifetime: infinity ";
126  } else if ( 0 == lifeTime() ) {
127  } // ATTENTION!!
128  else if ( 1 * Gaudi::Units::meter < ctau() ) {
129  s << BF( ", ctau:%|12.6g| m" ) % ( ctau() / Gaudi::Units::meter );
130  } else if ( 1 * Gaudi::Units::cm < ctau() ) {
131  s << BF( ", ctau:%|11.6g| cm" ) % ( ctau() / Gaudi::Units::cm );
132  } else if ( 0.5 * Gaudi::Units::mm < ctau() ) {
133  s << BF( ", ctau:%|11.6g| mm" ) % ( ctau() / Gaudi::Units::mm );
134  } else if ( 0.1 * Gaudi::Units::micrometer < ctau() ) {
135  s << BF( ", ctau:%|11.6g| um" ) % ( ctau() / Gaudi::Units::micrometer );
136  } else if ( 1 * Gaudi::Units::GeV <= width() ) {
137  s << BF( ", width:%|10.6g| GeV" ) % ( width() / Gaudi::Units::GeV );
138  } else if ( 1 * Gaudi::Units::MeV <= width() ) {
139  s << BF( ", width:%|10.6g| MeV" ) % ( width() / Gaudi::Units::MeV );
140  } else if ( 1 * Gaudi::Units::keV <= width() ) {
141  s << BF( ", width:%|10.6g| keV" ) % ( width() / Gaudi::Units::keV );
142  } else if ( 1 * Gaudi::Units::eV <= width() ) {
143  s << BF( ", width:%|10.6g| eV" ) % ( width() / Gaudi::Units::eV );
144  } else {
145  s << BF( ", ltime:%|12.6g| ns" ) % ( lifetime() / Gaudi::Units::ns );
146  }
147  // Evt Gen name
148  if ( evtGen() != name() ) { s << BF( ", EvtGen: %|-10s|" ) % evtGen(); }
149  // pythia ID
150  if ( m_pid.pid() != pythia() ) { s << BF( ", Pythia: %|-9d|" ) % pythia(); }
151  return s;
152 }

◆ lifetime()

double Gaudi::ParticleProperty::lifetime ( ) const
inline

Get the particle lifetime.

Definition at line 92 of file ParticleProperty.h.

92 { return m_tlife; }

◆ lifeTime()

double Gaudi::ParticleProperty::lifeTime ( ) const
inline

Get the particle lifetime.

Definition at line 94 of file ParticleProperty.h.

94 { return m_tlife; }

◆ mass()

double Gaudi::ParticleProperty::mass ( ) const
inline

Get the particle mass.

Definition at line 90 of file ParticleProperty.h.

90 { return m_mass; }

◆ maxWidth()

double Gaudi::ParticleProperty::maxWidth ( ) const
inline

Get the max width deviation.

Definition at line 102 of file ParticleProperty.h.

102 { return m_maxWidth; } // max-width

◆ name()

const std::string& Gaudi::ParticleProperty::name ( ) const
inline

Get the particle name.

Definition at line 80 of file ParticleProperty.h.

80 { return m_name; }

◆ operator const Gaudi::ParticleID &()

Gaudi::ParticleProperty::operator const Gaudi::ParticleID & ( ) const
inline

implicit conversion to ParticleID class

Definition at line 135 of file ParticleProperty.h.

135 { return m_pid; }

◆ particle()

const std::string& Gaudi::ParticleProperty::particle ( ) const
inline

Get the particle name.

Definition at line 78 of file ParticleProperty.h.

78 { return m_name; }

◆ particleID()

const Gaudi::ParticleID& Gaudi::ParticleProperty::particleID ( ) const
inline

get the particle ID

Definition at line 82 of file ParticleProperty.h.

82 { return m_pid; }

◆ pdgID()

const Gaudi::ParticleID& Gaudi::ParticleProperty::pdgID ( ) const
inline

get the particle ID

Definition at line 84 of file ParticleProperty.h.

84 { return m_pid; }

◆ pid()

const Gaudi::ParticleID& Gaudi::ParticleProperty::pid ( ) const
inline

get the particle ID

Definition at line 86 of file ParticleProperty.h.

86 { return m_pid; }

◆ pythia()

int Gaudi::ParticleProperty::pythia ( ) const
inline

Get the Pythia ID.

Definition at line 127 of file ParticleProperty.h.

127 { return m_pythia; }

◆ pythiaID()

int Gaudi::ParticleProperty::pythiaID ( ) const
inline

Get the Pythia ID.

Definition at line 125 of file ParticleProperty.h.

125 { return m_pythia; }

◆ selfcc()

bool Gaudi::ParticleProperty::selfcc ( ) const
inline

self-charge conjugated?

Definition at line 109 of file ParticleProperty.h.

109 { return m_anti == this; }

◆ setAntiParticle()

void Gaudi::ParticleProperty::setAntiParticle ( const ParticleProperty p)

set the pointer to the antiparticle

Attention
it is the only one "setter"
Parameters
ppointer to anti-particle

Definition at line 163 of file ParticleProperty.cpp.

163 { m_anti = p; }

◆ threeCharge()

int Gaudi::ParticleProperty::threeCharge ( ) const
inline

Three times the charge (in positron charge units)

Definition at line 112 of file ParticleProperty.h.

112 { return m_pid.threeCharge(); }

◆ toString()

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

simple method for conversion into the string

Definition at line 154 of file ParticleProperty.cpp.

154  {
156  fillStream( s );
157  return s.str();
158 }

◆ width()

double Gaudi::ParticleProperty::width ( ) const
inline

Get the particle natural width.

Definition at line 98 of file ParticleProperty.h.

98  {
100  }

Friends And Related Function Documentation

◆ operator<

bool operator< ( const ParticleProperty lhs,
const ParticleProperty rhs 
)
friend

comparison/ordering operator ( "strict-less-by-PID&Name" )

Definition at line 130 of file ParticleProperty.h.

130  {
131  return std::tie( lhs.m_pid, lhs.m_name ) < std::tie( rhs.m_pid, rhs.m_name );
132  }

Member Data Documentation

◆ m_anti

const Gaudi::ParticleProperty* Gaudi::ParticleProperty::m_anti
private

the pointer to the anti-particle

Definition at line 163 of file ParticleProperty.h.

◆ m_charge

double Gaudi::ParticleProperty::m_charge
private

the charge for the particle

Definition at line 151 of file ParticleProperty.h.

◆ m_evtgen

std::string Gaudi::ParticleProperty::m_evtgen
private

the name of the particle for EvtGen program

Definition at line 159 of file ParticleProperty.h.

◆ m_mass

double Gaudi::ParticleProperty::m_mass
private

the nominal mass for the particle

Definition at line 153 of file ParticleProperty.h.

◆ m_maxWidth

double Gaudi::ParticleProperty::m_maxWidth
private

The maximum width deviation.

Definition at line 157 of file ParticleProperty.h.

◆ m_name

std::string Gaudi::ParticleProperty::m_name
private

the name for the particle

Definition at line 147 of file ParticleProperty.h.

◆ m_pid

Gaudi::ParticleID Gaudi::ParticleProperty::m_pid
private

the PID for the particle

Definition at line 149 of file ParticleProperty.h.

◆ m_pythia

int Gaudi::ParticleProperty::m_pythia
private

the ID for the particle used in Pythia generator

Definition at line 161 of file ParticleProperty.h.

◆ m_tlife

double Gaudi::ParticleProperty::m_tlife
private

the nominal proper lifetime for the particle

Definition at line 155 of file ParticleProperty.h.


The documentation for this class was generated from the following files:
Gaudi::Units::hbarc
constexpr double hbarc
Definition: PhysicalConstants.h:76
Gaudi::ParticleProperty::m_pythia
int m_pythia
the ID for the particle used in Pythia generator
Definition: ParticleProperty.h:161
Gaudi::ParticleProperty::pythia
int pythia() const
Get the Pythia ID.
Definition: ParticleProperty.h:127
Gaudi::Units::keV
constexpr double keV
Definition: SystemOfUnits.h:178
Gaudi::ParticleProperty::pid
const Gaudi::ParticleID & pid() const
get the particle ID
Definition: ParticleProperty.h:86
gaudirun.s
string s
Definition: gaudirun.py:346
Gaudi::ParticleProperty::m_name
std::string m_name
the name for the particle
Definition: ParticleProperty.h:147
Gaudi::Units::GeV
constexpr double GeV
Definition: SystemOfUnits.h:179
Gaudi::ParticleProperty::width
double width() const
Get the particle natural width.
Definition: ParticleProperty.h:98
Gaudi::ParticleProperty::lifeTime
double lifeTime() const
Get the particle lifetime.
Definition: ParticleProperty.h:94
Gaudi::ParticleProperty::name
const std::string & name() const
Get the particle name.
Definition: ParticleProperty.h:80
Gaudi::Units::meter
constexpr double meter
Definition: SystemOfUnits.h:69
Gaudi::ParticleProperty::m_maxWidth
double m_maxWidth
The maximum width deviation.
Definition: ParticleProperty.h:157
Gaudi::ParticleProperty::m_anti
const Gaudi::ParticleProperty * m_anti
the pointer to the anti-particle
Definition: ParticleProperty.h:163
Gaudi::ParticleProperty::anti
const Gaudi::ParticleProperty * anti() const
get the pointer to the anti-particle
Definition: ParticleProperty.h:106
std::abs
Gaudi::ParticleID abs(const Gaudi::ParticleID &p)
Return the absolute value for a PID.
Definition: ParticleID.h:191
Gaudi::ParticleProperty::fillStream
std::ostream & fillStream(std::ostream &s) const
the standard (a'la Gaudi) printout of the object
Definition: ParticleProperty.cpp:80
Gaudi::Units::mm
constexpr double mm
Definition: SystemOfUnits.h:100
Gaudi::ParticleProperty::maxWidth
double maxWidth() const
Get the max width deviation.
Definition: ParticleProperty.h:102
std::tie
T tie(T... args)
Gaudi::ParticleProperty::ctau
double ctau() const
Get the particle proper lifetime in c*tau units.
Definition: ParticleProperty.h:96
Gaudi::ParticleProperty::mass
double mass() const
Get the particle mass.
Definition: ParticleProperty.h:90
Gaudi::Units::ns
constexpr double ns
Definition: SystemOfUnits.h:152
Gaudi::ParticleProperty::m_charge
double m_charge
the charge for the particle
Definition: ParticleProperty.h:151
Gaudi::Units::micrometer
constexpr double micrometer
Definition: SystemOfUnits.h:79
Gaudi::ParticleProperty::m_pid
Gaudi::ParticleID m_pid
the PID for the particle
Definition: ParticleProperty.h:149
Gaudi::Units::c_light
constexpr double c_light
Definition: PhysicalConstants.h:66
format
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:119
Gaudi::ParticleProperty::m_mass
double m_mass
the nominal mass for the particle
Definition: ParticleProperty.h:153
std::numeric_limits::epsilon
T epsilon(T... args)
std::ostringstream
STL class.
Gaudi::ParticleProperty::m_tlife
double m_tlife
the nominal proper lifetime for the particle
Definition: ParticleProperty.h:155
Gaudi::ParticleProperty::m_evtgen
std::string m_evtgen
the name of the particle for EvtGen program
Definition: ParticleProperty.h:159
Gaudi::ParticleProperty::particleID
const Gaudi::ParticleID & particleID() const
get the particle ID
Definition: ParticleProperty.h:82
Gaudi::Units::cm
constexpr double cm
Definition: SystemOfUnits.h:104
Gaudi::ParticleID::pid
int pid() const
Retrieve the PDG ID.
Definition: ParticleID.h:54
Gaudi::ParticleProperty::charge
double charge() const
Get the particle charge.
Definition: ParticleProperty.h:88
Gaudi::Units::km
constexpr double km
Definition: SystemOfUnits.h:112
Gaudi::ParticleProperty::lifetime
double lifetime() const
Get the particle lifetime.
Definition: ParticleProperty.h:92
Gaudi::ParticleProperty::evtGen
const std::string & evtGen() const
Get the EvtGen name.
Definition: ParticleProperty.h:123
Gaudi::Units::eV
constexpr double eV
Definition: SystemOfUnits.h:177
Gaudi::Units::MeV
constexpr double MeV
Definition: SystemOfUnits.h:176
Gaudi::ParticleID::threeCharge
int threeCharge() const
Return three times the charge, in units of e+, valid for all particles.
Definition: ParticleID.cpp:269