17#include <boost/format.hpp>
42 const double mass,
const double tlife,
const double maxWidth,
43 const std::string& evtgen,
const int pythia )
66 const double mass,
const double tlife,
const double maxWidth )
82 typedef boost::format BF;
85 s << BF(
"%1$-14s %|16t| PDG:%2$9d," ) %
name() %
particleID().pid();
86#ifdef __INTEL_COMPILER
87# pragma warning( disable : 1572 )
88# pragma warning( push )
93 }
else if ( 1.0 ==
charge() ) {
95 }
else if ( -1.0 ==
charge() ) {
97 }
else if ( 2.0 ==
charge() ) {
99 }
else if ( -2.0 ==
charge() ) {
101 }
else if ( 0.3 ==
charge() ) {
103 }
else if ( -0.3 ==
charge() ) {
105 }
else if ( 0.7 ==
charge() ) {
107 }
else if ( -0.7 ==
charge() ) {
110 s << BF(
" Q:%|+3.1f|," ) % float(
charge() );
112#ifdef __INTEL_COMPILER
113# pragma warning( pop )
125 s <<
", lifetime: infinity ";
155 std::ostringstream s;
174 std::ostream& stream,
176 std::string fmt, hdr;
178 if ( 0 != service ) {
179 fmt +=
" | %|-4.4s| ";
180 hdr +=
" | %|-4.4s| ";
183 fmt +=
"| %|-18.18s|";
190 fmt +=
"| %|=10.4g| ";
191 fmt +=
"| %|=20.20s|";
192 fmt +=
" | %|=10d| |";
193 fmt +=
" %|=20.20d| |";
195 hdr +=
"| %|=18.18s|";
196 hdr +=
"| %|=12.12s| ";
197 hdr +=
"| %|=4.4s| ";
198 hdr +=
"| %|=18.18s|";
200 hdr +=
"| %|=18.18s|";
202 hdr +=
"| %|=10.10g| ";
203 hdr +=
"| %|=20.20s|";
204 hdr +=
" | %|=10.10s| |";
205 hdr +=
" %|=20.20d| |";
207 boost::format header( hdr );
208 header.exceptions( boost::io::all_error_bits ^ ( boost::io::too_many_args_bit | boost::io::too_few_args_bit ) );
210 if ( service ) { header %
"#"; }
211 header %
"Name" %
"PdgID" %
"Q" %
"Mass" %
"(c*)Tau/Gamma" %
"MaxWidth" %
"EvtGen" %
"PythiaID" %
"Antiparticle";
213 const std::string hdrLine = header.str();
214 const std::string dashes =
" " + std::string( hdrLine.size() - 1,
'-' );
215 stream << dashes << std::endl << hdrLine << std::endl << dashes << std::endl;
217 for (
auto ip = particles.begin(); particles.end() != ip; ++ip ) {
219 if ( 0 == pp ) {
continue; }
220 boost::format line( fmt );
221 line.exceptions( boost::io::all_error_bits ^ ( boost::io::too_many_args_bit | boost::io::too_few_args_bit ) );
223 if ( 0 != service ) {
233 % pp->particleID().pid();
235#ifdef __INTEL_COMPILER
236# pragma warning( disable : 1572 )
237# pragma warning( push )
239 if ( 0 == pp->charge() ) {
241 }
else if ( 0.3 == pp->charge() ) {
243 }
else if ( -0.3 == pp->charge() ) {
245 }
else if ( 0.7 == pp->charge() ) {
247 }
else if ( -0.7 == pp->charge() ) {
252#ifdef __INTEL_COMPILER
253# pragma warning( pop )
269 const double ctau = pp->ctau();
270 const double width = pp->width();
271 const double ltime = pp->lifetime();
273 line %
"stable" %
"";
296 line % pp->maxWidth() % pp->evtGen() % pp->pythia();
302 }
else if ( anti == pp ) {
308 stream << line << std::endl;
310 return stream << dashes << std::endl;
321 std::ostringstream s;
336 if ( stream.isActive() ) {
printAsTable_( particles, stream.stream(), service ); }
347 std::ostream& stream ) {
359 std::ostream& stream,
365 std::vector<const Gaudi::ParticleProperty*> props;
366 for ( std::vector<Gaudi::ParticleID>::const_iterator ipid = particles.begin(); particles.end() != ipid; ++ipid ) {
368 if ( 0 == pp ) {
continue; }
369 props.push_back( pp );
383 if ( stream.isActive() ) {
printAsTable_( particles, stream.stream(), service ); }
395 std::ostringstream s;
400 if ( 0 == p ) {
return 0; }
std::ostream & operator<<(std::ostream &stream, const Gaudi::ParticleProperty &pp)
standard output operator to the stream
implementation of various functions for streaming.
The abstract interface to Particle Property Service.
virtual const ParticleProperty * find(const std::string &name) const =0
Retrieve an object by name:
Holds PDG + LHCb extension particle code, following the PDG particle numbering scheme (pdg....
int pid() const
Retrieve the PDG ID.
A trivial class to hold information about a single particle properties.
bool selfcc() const
self-charge conjugated?
double charge() const
Get the particle charge.
std::string m_name
the name for the particle
double lifetime() const
Get the particle lifetime.
const std::string & evtGen() const
Get the EvtGen name.
const Gaudi::ParticleProperty * anti() const
get the pointer to the anti-particle
const Gaudi::ParticleID & particleID() const
get the particle ID
std::string toString() const
simple method for conversion into the string
double width() const
Get the particle natural width.
double m_charge
the charge for the particle
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 )
double maxWidth() const
Get the max width deviation.
double mass() const
Get the particle mass.
Gaudi::ParticleID m_pid
the PID for the particle
void setAntiParticle(const ParticleProperty *p)
set the pointer to the antiparticle
const Gaudi::ParticleID & pid() const
get the particle ID
const std::string & name() const
Get the particle name.
std::ostream & fillStream(std::ostream &s) const
the standard (a'la Gaudi) printout of the object
int pythia() const
Get the Pythia ID.
double m_tlife
the nominal proper lifetime for the particle
double m_mass
the nominal mass for the particle
double ctau() const
Get the particle proper lifetime in c*tau units.
int m_pythia
the ID for the particle used in Pythia generator
const Gaudi::ParticleProperty * m_anti
the pointer to the anti-particle
double m_maxWidth
The maximum width deviation.
std::string m_evtgen
the name of the particle for EvtGen program
double lifeTime() const
Get the particle lifetime.
Definition of the MsgStream class used to transmit messages.
size_t index(const Gaudi::ParticleProperty *property, const Gaudi::Interfaces::IParticlePropertySvc *service)
helper utility for mapping of Gaudi::ParticleProperty object into non-negative integral sequential id...
GAUDI_API std::string printAsTable(const std::vector< const Gaudi::ParticleProperty * > &particles, const Gaudi::Interfaces::IParticlePropertySvc *service=0)
print a list of properties in a form of the table
GAUDI_API std::ostream & printAsTable_(const std::vector< const Gaudi::ParticleProperty * > &particles, std::ostream &stream, const Gaudi::Interfaces::IParticlePropertySvc *service=0)
print a list of properties in a form of the table
constexpr double micrometer
std::ostream & toStream(ITERATOR first, ITERATOR last, std::ostream &s, const std::string &open, const std::string &close, const std::string &delim)
the helper function to print the sequence
Gaudi::ParticleID abs(const Gaudi::ParticleID &p)
Return the absolute value for a PID.