The Gaudi Framework  master (bb95dfce)
Loading...
Searching...
No Matches
ParticleProperty Class Referencefinal

A trivial class to hold information about a single particle properties. More...

#include <Gaudi/ParticleProperty.h>

Collaboration diagram for ParticleProperty:

Classes

struct  Compare
 The comparison criteria for particle properties. More...

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 )
 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 )
const std::string & particle () const
 Get the particle name.
const std::string & name () const
 Get the particle name.
const Gaudi::ParticleIDparticleID () const
 get the particle ID
const Gaudi::ParticleIDpdgID () const
 get the particle ID
const Gaudi::ParticleIDpid () const
 get the particle ID
double charge () const
 Get the particle charge.
double mass () const
 Get the particle mass.
double lifetime () const
 Get the particle lifetime.
double lifeTime () const
 Get the particle lifetime.
double ctau () const
 Get the particle proper lifetime in c*tau units.
double width () const
 Get the particle natural width.
double maxWidth () const
 Get the max width deviation.
const Gaudi::ParticlePropertyantiParticle () const
 get the pointer to the anti-particle
const Gaudi::ParticlePropertyanti () const
 get the pointer to the anti-particle
bool selfcc () const
 self-charge conjugated?
int threeCharge () const
 Three times the charge (in positron charge units).
void setAntiParticle (const ParticleProperty *p)
 set the pointer to the antiparticle
const std::string & evtGenName () const
 Get the EvtGen name.
const std::string & evtGen () const
 Get the EvtGen name.
int pythiaID () const
 Get the Pythia ID.
int pythia () const
 Get the Pythia ID.
 operator const Gaudi::ParticleID & () const
 implicit conversion to ParticleID class
std::ostream & fillStream (std::ostream &s) const
 the standard (a'la Gaudi) printout of the object
std::string toString () const
 simple method for conversion into the string

Private Attributes

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

Friends

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

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 ) {}
double charge() const
Get the particle charge.
double maxWidth() const
Get the max width deviation.
double mass() const
Get the particle mass.
const std::string & name() const
Get the particle name.
int pythia() const
Get the Pythia ID.

◆ 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 ) {}
int pid() const
Retrieve the PDG ID.
Definition ParticleID.h:54

Member Function Documentation

◆ anti()

get the pointer to the anti-particle

Definition at line 106 of file ParticleProperty.h.

106{ return m_anti; }

◆ antiParticle()

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(); }
constexpr double c_light

◆ 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}
double lifetime() const
Get the particle lifetime.
const std::string & evtGen() const
Get the EvtGen name.
double width() const
Get the particle natural width.
Gaudi::ParticleID m_pid
the PID for the particle
double ctau() const
Get the particle proper lifetime in c*tau units.
double lifeTime() const
Get the particle lifetime.
constexpr double eV
constexpr double micrometer
constexpr double MeV
constexpr double meter
constexpr double keV
constexpr double km
constexpr double mm
constexpr double cm
constexpr double ns
constexpr double GeV

◆ lifeTime()

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

Get the particle lifetime.

Definition at line 94 of file ParticleProperty.h.

94{ return m_tlife; }

◆ lifetime()

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

Get the particle lifetime.

Definition at line 92 of file ParticleProperty.h.

92{ 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()

get the particle ID

Definition at line 82 of file ParticleProperty.h.

82{ return m_pid; }

◆ pdgID()

get the particle ID

Definition at line 84 of file ParticleProperty.h.

84{ return m_pid; }

◆ pid()

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()

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()

Three times the charge (in positron charge units).

Definition at line 112 of file ParticleProperty.h.

112{ return m_pid.threeCharge(); }
int threeCharge() const
Return three times the charge, in units of e+, valid for all particles.

◆ toString()

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

simple method for conversion into the string

Definition at line 154 of file ParticleProperty.cpp.

154 {
155 std::ostringstream s;
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 {
99 return std::abs( ctau() ) < std::numeric_limits<double>::epsilon() ? 0.0 : Gaudi::Units::hbarc / ctau();
100 }
constexpr double hbarc
Gaudi::ParticleID abs(const Gaudi::ParticleID &p)
Return the absolute value for a PID.
Definition ParticleID.h:191

◆ 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 }
std::string m_name
the name for the particle
Gaudi::ParticleID m_pid
the PID for the particle

Member Data Documentation

◆ m_anti

the pointer to the anti-particle

Definition at line 163 of file ParticleProperty.h.

◆ m_charge

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

the nominal mass for the particle

Definition at line 153 of file ParticleProperty.h.

◆ m_maxWidth

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

the PID for the particle

Definition at line 149 of file ParticleProperty.h.

◆ m_pythia

the ID for the particle used in Pythia generator

Definition at line 161 of file ParticleProperty.h.

◆ m_tlife

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: