The Gaudi Framework  master (37c0b60a)
Gaudi::ParticleProperties Namespace Reference

Functions

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 identifier More...
 
size_t index (const Gaudi::ParticleID &pid, const Gaudi::Interfaces::IParticlePropertySvc *service)
 helper utility for mapping of Gaudi::ParticleID object into non-negative integral sequential identifier More...
 
const Gaudi::ParticlePropertyparticle (const size_t index, const Gaudi::Interfaces::IParticlePropertySvc *service)
 the inverse mapping of the integer sequential number onto Gaudi::ParticleID object More...
 
const Gaudi::ParticleID particleID (const size_t index, const Gaudi::Interfaces::IParticlePropertySvc *service)
 the inverse mapping of the integer sequential number onto Gaudi::ParticleID object More...
 
const Gaudi::ParticlePropertybyPythiaID (const int pythia, const Gaudi::Interfaces::IParticlePropertySvc *svc)
 mapping by pythiaID More...
 
const Gaudi::ParticlePropertybyEvtGenName (const std::string &evtGen, const Gaudi::Interfaces::IParticlePropertySvc *svc)
 mapping by EvtGen-name More...
 
template<class INPUT , class PREDICATE , class OUTPUT >
OUTPUT get (INPUT first, INPUT last, const PREDICATE &cut, OUTPUT output)
 get all particle properties which satisfy the certain criteria More...
 
template<class PREDICATE , class OUTPUT >
OUTPUT get (const Gaudi::Interfaces::IParticlePropertySvc *service, const PREDICATE &cut, OUTPUT output)
 get all particle properties which satisfy the certain criteria More...
 
Gaudi::Interfaces::IParticlePropertySvc::ParticleProperties allProperties (const Gaudi::Interfaces::IParticlePropertySvc *service)
 get all the properties at once More...
 
GAUDI_API std::ostreamprintAsTable_ (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 More...
 
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 More...
 
GAUDI_API MsgStreamprintAsTable (const std::vector< const Gaudi::ParticleProperty * > &particles, MsgStream &stream, const Gaudi::Interfaces::IParticlePropertySvc *service=0)
 print a list of properties in a form of the table More...
 
GAUDI_API std::ostreamprintAsTable_ (const std::vector< Gaudi::ParticleID > &particles, std::ostream &stream, const Gaudi::Interfaces::IParticlePropertySvc *service=0)
 print properties in a form of the table More...
 
template<class C_ , class A_ >
std::ostreamprintAsTable_ (const std::set< Gaudi::ParticleID, C_, A_ > &particles, std::ostream &stream, const Gaudi::Interfaces::IParticlePropertySvc *service=0)
 
GAUDI_API std::string printAsTable (const std::vector< Gaudi::ParticleID > &particles, const Gaudi::Interfaces::IParticlePropertySvc *service=0)
 print properties in a form of the table More...
 
template<class C_ , class A_ >
std::string printAsTable (const std::set< Gaudi::ParticleID, C_, A_ > &particles, const Gaudi::Interfaces::IParticlePropertySvc *service=0)
 
GAUDI_API MsgStreamprintAsTable (const std::vector< Gaudi::ParticleID > &particles, MsgStream &stream, const Gaudi::Interfaces::IParticlePropertySvc *service=0)
 print properties in a form of the table More...
 
template<class C_ , class A_ >
MsgStreamprintAsTable (const std::set< Gaudi::ParticleID, C_, A_ > &particles, MsgStream &stream, const Gaudi::Interfaces::IParticlePropertySvc *service=0)
 

Function Documentation

◆ allProperties()

get all the properties at once

Author
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@n.nosp@m.ikhe.nosp@m.f.nl
Date
2008-08-03

Definition at line 201 of file IParticlePropertySvc.cpp.

201  {
202  return service ? Gaudi::Interfaces::IParticlePropertySvc::ParticleProperties( service->begin(), service->end() )
203  : Gaudi::Interfaces::IParticlePropertySvc::ParticleProperties();
204 }

◆ byEvtGenName()

const Gaudi::ParticleProperty * Gaudi::ParticleProperties::byEvtGenName ( const std::string evtGen,
const Gaudi::Interfaces::IParticlePropertySvc svc 
)

mapping by EvtGen-name

const std::string& evtGen
const Gaudi::ParticleProperty* pp = byEvtGenName ( pythiaID , svc ) ;
Attention
the method is not very efficient and should not be abused
See also
Gaudi::ParticleProperties::particle
Parameters
evtGenthe particle naem in EvtGen-generator
svcpointer to particle property service
Returns
the particle property for the given EvtGen-name
Author
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@n.nosp@m.ikhe.nosp@m.f.nl
Date
2008-08-03

Definition at line 180 of file IParticlePropertySvc.cpp.

181  {
182  if ( !svc ) { return nullptr; }
183  // to be more efficient:
184  // 1) try to use the regular name (fast, logarithmic search)
185  const Gaudi::ParticleProperty* pp = svc->find( evtGen );
186  // 2) check the proper evtgen name
187  if ( pp && evtGen == pp->evtGen() ) { return pp; }
188  // 3) use the regular (linear search)
189  auto begin = svc->begin();
190  auto end = svc->end();
191  auto found = std::find_if( begin, end, [&]( const Gaudi::ParticleProperty* pp ) { return pp->evtGen() == evtGen; } );
192  //
193  return found != end ? *found : nullptr;
194 }

◆ byPythiaID()

const Gaudi::ParticleProperty * Gaudi::ParticleProperties::byPythiaID ( const int  pythia,
const Gaudi::Interfaces::IParticlePropertySvc svc 
)

mapping by pythiaID

const int pythiaID = ... ;
const Gaudi::ParticleProeprty* pp = byPythiaID( pythiaID , svc ) ;
Attention
the method is not very efficient and should not be abused
See also
Gaudi::ParticleProperties::particle
Parameters
pythiapythia identifier
svcpointer to particle property service
Returns
the particle property for the given pythia ID
Author
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@n.nosp@m.ikhe.nosp@m.f.nl
Date
2008-08-03

Definition at line 144 of file IParticlePropertySvc.cpp.

144  {
145  if ( !svc ) { return nullptr; }
146  // to be efficient
147  // 1) try to use PDG-ID (fast, logarithmic search)
148  const Gaudi::ParticleProperty* pp = svc->find( Gaudi::ParticleID( pythia ) );
149  // 2) check the proper pythia ID
150  if ( pp && pythia == pp->pythiaID() ) { return pp; }
151  // 3) use the regular (linear search)
152  auto begin = svc->begin();
153  auto end = svc->end();
154  auto found =
155  std::find_if( begin, end, [&]( const Gaudi::ParticleProperty* pp ) { return pp->pythiaID() == pythia; } );
156  return found != end ? *found : nullptr;
157 }

◆ get() [1/2]

template<class PREDICATE , class OUTPUT >
OUTPUT Gaudi::ParticleProperties::get ( const Gaudi::Interfaces::IParticlePropertySvc service,
const PREDICATE &  cut,
OUTPUT  output 
)

get all particle properties which satisfy the certain criteria

e.g. select all particles with 'invalid' Pythia ID = 0 :

#include "boost/lambda/lambda.hpp"
#include "boost/lambda/bind.hpp"
using namespace boost::lambda ;
// create the output vector:
// use the function
( svc ,
bind ( &Gaudi::ParticleProperty::pythiaID , _1 ) == 0 , // predicate
std::back_inserter( output ) ) ; // output

or select all particles with 'invalid' EvtGen = "unknown" :

#include "boost/lambda/lambda.hpp"
#include "boost/lambda/bind.hpp"
using namespace boost::lambda ;
// create the output vector:
// use the function
( svc ,
bind ( &Gaudi::ParticleProperty::evtGen , _1 ) == "unknown" , // predicate
std::back_inserter( output ) ) ; // output

Select all leptons:

#include "boost/lambda/lambda.hpp"
#include "boost/lambda/bind.hpp"
using namespace boost::lambda ;
// create the output vector:
Vector leptons ;
// use the function
( svc ,
std::back_inserter ( leptons ) ) ; // output
Parameters
firstbegin-iterator of input sequence of particle properties
endend-iterator of input sequence of particle properties
cutthe predicate
outputthe output iterator
Returns
the updated position of output iterator
Author
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@n.nosp@m.ikhe.nosp@m.f.nl
Date
2008-08-03

Definition at line 476 of file IParticlePropertySvc.h.

476  {
477  if ( 0 == service ) { return output; }
478  return service->get( cut, output );
479  }

◆ get() [2/2]

template<class INPUT , class PREDICATE , class OUTPUT >
OUTPUT Gaudi::ParticleProperties::get ( INPUT  first,
INPUT  last,
const PREDICATE &  cut,
OUTPUT  output 
)

get all particle properties which satisfy the certain criteria

e.g. select all particles with 'invalid' Pythia ID = 0 :

#include "boost/lambda/lambda.hpp"
#include "boost/lambda/bind.hpp"
using namespace boost::lambda ;
// create the output vector:
// use the function
( svc->begin() , // begin-sequence
svc->end () , // end-sequence
bind ( &Gaudi::ParticleProperty::pythiaID , _1 ) == 0 , // predicate
std::back_inserter( output ) ) ; // output

or select all particles with 'invalid' EvtGen = "unknown" :

#include "boost/lambda/lambda.hpp"
#include "boost/lambda/bind.hpp"
using namespace boost::lambda ;
// create the output vector:
// use the function
( svc->begin() , // begin-sequence
svc->end () , // end-sequence
bind ( &Gaudi::ParticleProperty::evtGen , _1 ) == "unknown" , // predicate
std::back_inserter( output ) ) ; // output

select leptons:

#include "boost/lambda/lambda.hpp"
#include "boost/lambda/bind.hpp"
...
...
using namespace boost::lambda ;
// create the output vector:
Vector leptons ;
// use the function
( svc->begin() , // begin-sequence
svc->end () , // end-sequence
std::back_inserter ( lepton ) ) ; // output

Essentially it is just a missing std::copy_if STL-algorithm

Parameters
firstbegin-iterator of input sequence of particle properties
lastend-iterator of input sequence of particle properties
cutthe predicate
outputthe output iterator
Returns
the updated position of output iterator
Author
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@n.nosp@m.ikhe.nosp@m.f.nl
Date
2008-08-03

Definition at line 388 of file IParticlePropertySvc.h.

388  {
389  for ( ; first != last; ++first ) {
390  if ( cut( *first ) ) {
391  *output = *first;
392  ++output;
393  }
394  }
395  return output;
396  }

◆ index() [1/2]

size_t Gaudi::ParticleProperties::index ( const Gaudi::ParticleID pid,
const Gaudi::Interfaces::IParticlePropertySvc service 
)

helper utility for mapping of Gaudi::ParticleID object into non-negative integral sequential identifier

const Gaudi::ParticlePropertySvc* svc = ... ;
const Gaudi::ParticleID& pid = ... ;
size_t index = index ( pid , svc ) ;
if ( !index )
{
// error here: conversion is not possible
}

This appears to be useful operation, but since it is "pure technical" it does not appear as interface method.

For invalid/missing PID and/or service 0 is returned. The valid result is always satisfy the condition: index <= service->size()

Parameters
pidthe object to be mapped
servicethe service
Returns
the sequential non-negative index
Author
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@n.nosp@m.ikhe.nosp@m.f.nl
Date
2008-08-03

Definition at line 67 of file IParticlePropertySvc.cpp.

68  {
69  if ( !service ) { return 0; }
70  const Gaudi::ParticleProperty* pp = service->find( pid );
71  return pp ? Gaudi::ParticleProperties::index( pp, service ) : 0;
72 }

◆ index() [2/2]

size_t Gaudi::ParticleProperties::index ( const Gaudi::ParticleProperty property,
const Gaudi::Interfaces::IParticlePropertySvc service 
)

helper utility for mapping of Gaudi::ParticleProperty object into non-negative integral sequential identifier

const Gaudi::ParticlePropertySvc* svc = ... ;
size_t index = index ( pp , svc ) ;
if ( !index )
{
// error here: conversion is not possible
}

This appears to be useful operation, but since it is "pure technical" it does not appear as interface method.

For invalid/missing property and/or service 0 is returned. The valid result is always satisfy the condition: index <= service->size()

Parameters
propertythe property to be mapped
servicethe service
Returns
the sequential non-negative index
Author
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@n.nosp@m.ikhe.nosp@m.f.nl
Date
2008-08-03

Definition at line 39 of file IParticlePropertySvc.cpp.

40  {
41  if ( !property || !service ) { return 0; }
42 
43  auto first = service->begin();
44  auto last = service->end();
45  // start the binary_search
46  static constexpr auto cmp = Gaudi::ParticleProperty::Compare();
47  auto ifind = std::lower_bound( first, last, property, cmp );
48  return last != ifind && !cmp( *ifind, property ) ? ( ifind - first + 1 ) : 0;
49 }

◆ particle()

const Gaudi::ParticleProperty * Gaudi::ParticleProperties::particle ( const size_t  index,
const Gaudi::Interfaces::IParticlePropertySvc service 
)

the inverse mapping of the integer sequential number onto Gaudi::ParticleID object

const Gaudi::ParticlePropertySvc* svc = ... ;
const size_t index = ...
if ( !pp )
{
// error here: conversion is not possible
}

This appears to be useful operation, but since it is "pure technical" it does not appear as interface method.

For invalid/missing PID and/or service NULL is returned.

Parameters
pidthe object to be mapped
servicethe service
Returns
the sequential non-negative index
Author
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@n.nosp@m.ikhe.nosp@m.f.nl
Date
2008-08-03

Definition at line 90 of file IParticlePropertySvc.cpp.

90  {
91  if ( 0 == index || !service ) { return nullptr; }
92  // get the iterators from the service
93  auto first = service->begin();
94  auto last = service->end();
95  if ( index > (size_t)std::distance( first, last ) ) { return 0; }
96  std::advance( first, index - 1 );
97  return *first;
98 }

◆ particleID()

const Gaudi::ParticleID Gaudi::ParticleProperties::particleID ( const size_t  index,
const Gaudi::Interfaces::IParticlePropertySvc service 
)

the inverse mapping of the integer sequential number onto Gaudi::ParticleID object

const Gaudi::ParticlePropertySvc* svc = ... ;
const size_t index = ...
const Gaudi::ParticleID pid = particleID ( index , svc ) ;
if ( Gaudi::ParticleID() == pid )
{
// error here: conversion is not possible
}

This appears to be useful operation, but since it is "pure technical" it does not appear as interface method.

For invalid/missing index and/or service Gaudi::ParticleID() is returned.

Parameters
pidthe object to be mapped
servicethe service
Returns
the sequential non-negative index
Author
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@n.nosp@m.ikhe.nosp@m.f.nl
Date
2008-08-03

Definition at line 117 of file IParticlePropertySvc.cpp.

117  {
118  if ( 0 == index || !service ) { return Gaudi::ParticleID(); }
120  return pp ? pp->particleID() : Gaudi::ParticleID();
121 }

◆ printAsTable() [1/6]

template<class C_ , class A_ >
std::string Gaudi::ParticleProperties::printAsTable ( const std::set< Gaudi::ParticleID, C_, A_ > &  particles,
const Gaudi::Interfaces::IParticlePropertySvc service = 0 
)
inline

Definition at line 376 of file ParticleProperty.h.

377  {
378  return printAsTable( std::vector<Gaudi::ParticleID>( particles.begin(), particles.end() ), service );
379  }

◆ printAsTable() [2/6]

template<class C_ , class A_ >
MsgStream& Gaudi::ParticleProperties::printAsTable ( const std::set< Gaudi::ParticleID, C_, A_ > &  particles,
MsgStream stream,
const Gaudi::Interfaces::IParticlePropertySvc service = 0 
)
inline

Definition at line 394 of file ParticleProperty.h.

395  {
396  return printAsTable( std::vector<Gaudi::ParticleID>( particles.begin(), particles.end() ), stream, service );
397  }

◆ printAsTable() [3/6]

std::string Gaudi::ParticleProperties::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

The utility is easy to use in conjunction with Gaudi::ParticleProperties:;get utilities: e.g. get all leptons from the service and print them as table:

#include "boost/lambda/lambda.hpp"
#include "boost/lambda/bind.hpp"
// create the output vector:
Vector leptons ;
// use the function
( svc ,
// create the predicate:
boost::lambda::bind ( &Gaudi::ParticleID::isLepton ,
boost::lambda::bind ( &Gaudi::ParticleProperty::particleID , boost::lambda::_1 ) ) ,
std::back_inserter ( leptons ) ) ; // output
// print the leptons:
std::cout << "LEPTONS"
<< std::endl ;
See also
Gaudi::ParticleProperty
Gaudi::Interfaces::IParticlePropertySvc
Gaudi::ParticleProperties::get
Parameters
particlesthe list of particle properties
servicethe service to extract global information
Returns
the string output
Author
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@n.nosp@m.ikhe.nosp@m.f.nl
Date
2008-08-03

Definition at line 319 of file ParticleProperty.cpp.

320  {
322  printAsTable_( particles, s, service );
323  return s.str();
324 }

◆ printAsTable() [4/6]

MsgStream & Gaudi::ParticleProperties::printAsTable ( const std::vector< const Gaudi::ParticleProperty * > &  particles,
MsgStream stream,
const Gaudi::Interfaces::IParticlePropertySvc service = 0 
)

print a list of properties in a form of the table

The utility is easy to use in conjunction with Gaudi::ParticleProperties:;get utilities: e.g. get all leptons from the service and print them as table:

#include "boost/lambda/lambda.hpp"
#include "boost/lambda/bind.hpp"
// create the output vector:
Vector leptons ;
// use the function
( svc ,
// create the predicate:
boost::lambda::bind ( &Gaudi::ParticleID::isLepton ,
boost::lambda::bind ( &Gaudi::ParticleProperty::particleID , boost::lambda::_1 ) ) ,
std::back_inserter ( leptons ) ) ; // output
// print the leptons:
MsgStream& log = ... ;
log << "LEPTONS" << std::endl ;
log << endmsg ;
See also
Gaudi::ParticleProperty
Gaudi::Interfaces::IParticlePropertySvc
Gaudi::ParticleProperties::get
Parameters
particlesthe list of particle properties
streamthe reference to the output stream
servicethe service to extract global information
Author
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@n.nosp@m.ikhe.nosp@m.f.nl
Date
2008-08-03

Definition at line 333 of file ParticleProperty.cpp.

335  {
336  if ( stream.isActive() ) { printAsTable_( particles, stream.stream(), service ); }
337  return stream;
338 }

◆ printAsTable() [5/6]

std::string Gaudi::ParticleProperties::printAsTable ( const std::vector< Gaudi::ParticleID > &  particles,
const Gaudi::Interfaces::IParticlePropertySvc service = 0 
)

print properties in a form of the table

Parameters
particles(INPUT) list of particles
service(INPUT) pointer to particle property service
Returns
string-representation
Author
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@i.nosp@m.tep..nosp@m.ru
Date
2010-01-04

Definition at line 393 of file ParticleProperty.cpp.

394  {
396  printAsTable_( particles, s, service );
397  return s.str();
398 }

◆ printAsTable() [6/6]

MsgStream & Gaudi::ParticleProperties::printAsTable ( const std::vector< Gaudi::ParticleID > &  particles,
MsgStream stream,
const Gaudi::Interfaces::IParticlePropertySvc service = 0 
)

print properties in a form of the table

Parameters
particles(INPUT) list of particles
stream(UPDATE) the stream
service(INPUT) pointer to particle property service
Returns
the stream
Author
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@i.nosp@m.tep..nosp@m.ru
Date
2010-01-04

Definition at line 381 of file ParticleProperty.cpp.

382  {
383  if ( stream.isActive() ) { printAsTable_( particles, stream.stream(), service ); }
384  return stream;
385 }

◆ printAsTable_() [1/3]

template<class C_ , class A_ >
std::ostream& Gaudi::ParticleProperties::printAsTable_ ( const std::set< Gaudi::ParticleID, C_, A_ > &  particles,
std::ostream stream,
const Gaudi::Interfaces::IParticlePropertySvc service = 0 
)
inline

Definition at line 359 of file ParticleProperty.h.

360  {
361  return printAsTable_( std::vector<Gaudi::ParticleID>( particles.begin(), particles.end() ), stream, service );
362  }

◆ printAsTable_() [2/3]

std::ostream & Gaudi::ParticleProperties::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

The utility is easy to use in conjunction with Gaudi::ParticleProperties:;get utilities: e.g. get all leptons from the service and print them as table:

#include "boost/lambda/lambda.hpp"
#include "boost/lambda/bind.hpp"
// create the output vector:
Vector leptons ;
// use the function
( svc ,
// create the predicate:
boost::lambda::bind ( &Gaudi::ParticleID::isLepton ,
boost::lambda::bind ( &Gaudi::ParticleProperty::particleID , boost::lambda::_1 ) ) ,
std::back_inserter ( leptons ) ) ; // output
// print the leptons:
std::cout << "LEPTONS" << std::endl ;
See also
Gaudi::ParticleProperty
Gaudi::Interfaces::IParticlePropertySvc
Gaudi::ParticleProperties::get
Parameters
particlesthe list of particle properties
streamthe reference to the output stream
servicethe service to extract global information
Author
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@n.nosp@m.ikhe.nosp@m.f.nl
Date
2008-08-03

Definition at line 173 of file ParticleProperty.cpp.

175  {
176  std::string fmt, hdr;
177  //
178  if ( 0 != service ) {
179  fmt += " | %|-4.4s| "; // index
180  hdr += " | %|-4.4s| "; // index
181  }
182  //
183  fmt += "| %|-18.18s|"; // the name
184  fmt += "| %|12d| "; // PDGID
185  fmt += "| %|=4s| "; // charge
186  fmt += "| %|13.8g|"; // mass
187  fmt += " %|-3s| "; // unit
188  fmt += "| %|13.8g|"; // lifetime/gamma/ctau
189  fmt += " %|-3s| "; // unit
190  fmt += "| %|=10.4g| "; // maxwidth
191  fmt += "| %|=20.20s|"; // evtgen name
192  fmt += " | %|=10d| |"; // pythia ID
193  fmt += " %|=20.20d| |"; // antiparticle
194  //
195  hdr += "| %|=18.18s|"; // the name
196  hdr += "| %|=12.12s| "; // PDGID
197  hdr += "| %|=4.4s| "; // charge
198  hdr += "| %|=18.18s|"; // mass
199  // hdr += "%|=5.5s|" ; // unit
200  hdr += "| %|=18.18s|"; // lifetime/gamma/ctau
201  // hdr += "%|=5.5s|" ; // unit
202  hdr += "| %|=10.10g| "; // maxwidth
203  hdr += "| %|=20.20s|"; // evtgen name
204  hdr += " | %|=10.10s| |"; // pythia ID
205  hdr += " %|=20.20d| |"; // antiparticle
206 
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 ) );
209 
210  if ( service ) { header % "#"; }
211  header % "Name" % "PdgID" % "Q" % "Mass" % "(c*)Tau/Gamma" % "MaxWidth" % "EvtGen" % "PythiaID" % "Antiparticle";
212 
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;
216 
217  for ( auto ip = particles.begin(); particles.end() != ip; ++ip ) {
218  const Gaudi::ParticleProperty* pp = *ip;
219  if ( 0 == pp ) { continue; }
221  line.exceptions( boost::io::all_error_bits ^ ( boost::io::too_many_args_bit | boost::io::too_few_args_bit ) );
222  //
223  if ( 0 != service ) {
224  size_t index = Gaudi::ParticleProperties::index( pp, service );
225  if ( 0 == index ) {
226  line % "?";
227  } else {
228  line % index;
229  }
230  }
231  //
232  line % pp->name() // name
233  % pp->particleID().pid(); // PDG-ID
234  //
235 #ifdef __INTEL_COMPILER // Disable ICC remark
236 # pragma warning( disable : 1572 ) // Floating-point equality and inequality comparisons are unreliable
237 # pragma warning( push )
238 #endif
239  if ( 0 == pp->charge() ) {
240  line % "0";
241  } else if ( 0.3 == pp->charge() ) {
242  line % "+1/3";
243  } else if ( -0.3 == pp->charge() ) {
244  line % "-1/3";
245  } else if ( 0.7 == pp->charge() ) {
246  line % "+2/3";
247  } else if ( -0.7 == pp->charge() ) {
248  line % "-2/3";
249  } else {
250  line % pp->charge();
251  }
252 #ifdef __INTEL_COMPILER // Re-enable ICC remark
253 # pragma warning( pop )
254 #endif
255  //
256  // mass
257  if ( pp->mass() < 1 * Gaudi::Units::keV ) {
258  line % ( pp->mass() / Gaudi::Units::eV ) % "eV";
259  } else if ( pp->mass() < 1 * Gaudi::Units::MeV ) {
260  line % ( pp->mass() / Gaudi::Units::keV ) % "keV";
261  } else if ( pp->mass() < 1 * Gaudi::Units::GeV ) {
262  line % ( pp->mass() / Gaudi::Units::MeV ) % "MeV";
263  } else if ( pp->mass() < 1 * Gaudi::Units::TeV ) {
264  line % ( pp->mass() / Gaudi::Units::GeV ) % "GeV";
265  } else {
266  line % ( pp->mass() / Gaudi::Units::TeV ) % "TeV";
267  }
268  // lifetime/width/ctau
269  const double ctau = pp->ctau();
270  const double width = pp->width();
271  const double ltime = pp->lifetime();
272  if ( 3600 * Gaudi::Units::second < ltime ) {
273  line % "stable" % "";
274  } else if ( 1 * Gaudi::Units::second < ltime ) {
275  line % ( ltime / Gaudi::Units::second ) % "s";
276  } else if ( 1 * Gaudi::Units::meter < ctau ) {
277  line % ( ctau / Gaudi::Units::meter ) % "m";
278  } else if ( 1 * Gaudi::Units::cm < ctau ) {
279  line % ( ctau / Gaudi::Units::cm ) % "cm";
280  } else if ( 0.5 * Gaudi::Units::mm < ctau ) {
281  line % ( ctau / Gaudi::Units::mm ) % "mm";
282  } else if ( 0.1 * Gaudi::Units::micrometer < ctau ) {
283  line % ( ctau / Gaudi::Units::micrometer ) % "um";
284  } else if ( 1 * Gaudi::Units::GeV < width ) {
285  line % ( width / Gaudi::Units::GeV ) % "GeV";
286  } else if ( 1 * Gaudi::Units::MeV < width ) {
287  line % ( width / Gaudi::Units::MeV ) % "MeV";
288  } else if ( 1 * Gaudi::Units::keV < width ) {
289  line % ( width / Gaudi::Units::keV ) % "keV";
290  } else if ( 1 * Gaudi::Units::eV < width ) {
291  line % ( width / Gaudi::Units::eV ) % "eV";
292  } else {
293  line % ( ltime / Gaudi::Units::ns ) % "ns";
294  }
295  //
296  line % pp->maxWidth() % pp->evtGen() % pp->pythia();
297  //
298  const Gaudi::ParticleProperty* const anti = pp->antiParticle();
299  //
300  if ( 0 == anti ) {
301  line % "-";
302  } else if ( anti == pp ) {
303  line % "self-cc";
304  } else {
305  line % anti->name();
306  }
307  //
308  stream << line << std::endl;
309  }
310  return stream << dashes << std::endl;
311 }

◆ printAsTable_() [3/3]

std::ostream & Gaudi::ParticleProperties::printAsTable_ ( const std::vector< Gaudi::ParticleID > &  particles,
std::ostream stream,
const Gaudi::Interfaces::IParticlePropertySvc service = 0 
)

print properties in a form of the table

Parameters
particles(INPUT) list of particles
stream(UPDATE) the stream
service(INPUT) pointer to particle property service
Returns
the stream
Author
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@i.nosp@m.tep..nosp@m.ru
Date
2010-01-04

Definition at line 358 of file ParticleProperty.cpp.

360  {
361  //
362  if ( 0 == service ) { return Gaudi::Utils::toStream( particles, stream ); }
363 
364  // convert list of ParticleIDs to list fo Particle properties:
366  for ( std::vector<Gaudi::ParticleID>::const_iterator ipid = particles.begin(); particles.end() != ipid; ++ipid ) {
367  const Gaudi::ParticleProperty* pp = service->find( *ipid );
368  if ( 0 == pp ) { continue; }
369  props.push_back( pp );
370  }
371  return printAsTable_( props, stream, service );
372 }
Gaudi::Interfaces::IParticlePropertySvc::end
virtual iterator end() const =0
get the end-iterator for the container of particle properties It is assumed that the container is pro...
Write.stream
stream
Definition: Write.py:32
std::bind
T bind(T... args)
std::string
STL class.
Gaudi.Configuration.log
log
Definition: Configuration.py:28
Gaudi::ParticleID::isLepton
bool isLepton() const
Return if the PID is for a lepton.
Definition: ParticleID.cpp:243
Gaudi::ParticleProperties::get
OUTPUT get(INPUT first, INPUT last, const PREDICATE &cut, OUTPUT output)
get all particle properties which satisfy the certain criteria
Definition: IParticlePropertySvc.h:388
Gaudi::Units::keV
constexpr double keV
Definition: SystemOfUnits.h:178
gaudirun.s
string s
Definition: gaudirun.py:346
std::vector
STL class.
std::find_if
T find_if(T... args)
std::string::size
T size(T... args)
check_ParticleID.props
props
Definition: check_ParticleID.py:21
Gaudi::Units::GeV
constexpr double GeV
Definition: SystemOfUnits.h:179
std::back_inserter
T back_inserter(T... args)
Gaudi::Interfaces::IParticlePropertySvc
Definition: IParticlePropertySvc.h:29
Gaudi::Utils::Histos::Formats::header
GAUDI_API std::string header(const int ID=Default)
get the recommended header by enum
Definition: HistoTableFormat.cpp:186
Gaudi::ParticleProperty::name
const std::string & name() const
Get the particle name.
Definition: ParticleProperty.h:80
Gaudi::Units::TeV
constexpr double TeV
Definition: SystemOfUnits.h:180
Gaudi::Units::meter
constexpr double meter
Definition: SystemOfUnits.h:69
std::distance
T distance(T... args)
Gaudi::Units::second
constexpr double second
Definition: SystemOfUnits.h:139
gaudirun.output
output
Definition: gaudirun.py:521
Gaudi::Units::mm
constexpr double mm
Definition: SystemOfUnits.h:100
Gaudi::ParticlePropertySvc
Definition: ParticlePropertySvc.cpp:92
Gaudi::ParticleProperties::printAsTable
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
Definition: ParticleProperty.cpp:319
Gaudi::Utils::begin
AttribStringParser::Iterator begin(const AttribStringParser &parser)
Definition: AttribStringParser.h:136
Gaudi::ParticleProperties::particle
const Gaudi::ParticleProperty * particle(const size_t index, const Gaudi::Interfaces::IParticlePropertySvc *service)
the inverse mapping of the integer sequential number onto Gaudi::ParticleID object
Definition: IParticlePropertySvc.cpp:90
Gaudi::ParticleProperties::byPythiaID
const Gaudi::ParticleProperty * byPythiaID(const int pythia, const Gaudi::Interfaces::IParticlePropertySvc *svc)
mapping by pythiaID
Definition: IParticlePropertySvc.cpp:144
std::cout
Gaudi::Interfaces::IParticlePropertySvc::ParticleProperties
std::vector< const Gaudi::ParticleProperty * > ParticleProperties
the actual type of (ordered) container of particle properties
Definition: IParticlePropertySvc.h:34
Gaudi::Units::ns
constexpr double ns
Definition: SystemOfUnits.h:152
Gaudi::ParticleProperties::printAsTable_
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
Definition: ParticleProperty.cpp:173
Gaudi::ParticleProperties::byEvtGenName
const Gaudi::ParticleProperty * byEvtGenName(const std::string &evtGen, const Gaudi::Interfaces::IParticlePropertySvc *svc)
mapping by EvtGen-name
Definition: IParticlePropertySvc.cpp:180
Gaudi::Units::micrometer
constexpr double micrometer
Definition: SystemOfUnits.h:79
Gaudi::ParticleProperty::pythiaID
int pythiaID() const
Get the Pythia ID.
Definition: ParticleProperty.h:125
format
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:119
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
Gaudi::ParticleProperty
Definition: ParticleProperty.h:37
MsgStream
Definition: MsgStream.h:33
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition: __init__.py:1
Gaudi::ParticleProperties::printAsTable_
std::ostream & printAsTable_(const std::set< Gaudi::ParticleID, C_, A_ > &particles, std::ostream &stream, const Gaudi::Interfaces::IParticlePropertySvc *service=0)
Definition: ParticleProperty.h:359
std::advance
T advance(T... args)
std::ostringstream
STL class.
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
std::lower_bound
T lower_bound(T... args)
std::endl
T endl(T... args)
std::set::begin
T begin(T... args)
Gaudi::ParticleProperties::particleID
const Gaudi::ParticleID particleID(const size_t index, const Gaudi::Interfaces::IParticlePropertySvc *service)
the inverse mapping of the integer sequential number onto Gaudi::ParticleID object
Definition: IParticlePropertySvc.cpp:117
Gaudi::Utils::toStream
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
Definition: ToStream.h:299
fmt
Gaudi::Interfaces::IParticlePropertySvc::get
OUTPUT get(const PREDICATE &cut, OUTPUT output) const
get the properties according to some criteria
Definition: IParticlePropertySvc.h:492
Gaudi::Interfaces::IParticlePropertySvc::find
virtual const ParticleProperty * find(const std::string &name) const =0
Retrieve an object by name:
Gaudi::ParticleID
Definition: ParticleID.h:43
plotSpeedupsPyRoot.line
line
Definition: plotSpeedupsPyRoot.py:198
Gaudi::ParticleProperty::evtGen
const std::string & evtGen() const
Get the EvtGen name.
Definition: ParticleProperty.h:123
Gaudi::ParticleProperty::Compare
Definition: ParticleProperty.h:44
std::set::end
T end(T... args)
IOTest.end
end
Definition: IOTest.py:125
Gaudi::Units::eV
constexpr double eV
Definition: SystemOfUnits.h:177
Gaudi::Units::MeV
constexpr double MeV
Definition: SystemOfUnits.h:176
compareOutputFiles.pp
pp
Definition: compareOutputFiles.py:507
Gaudi::Interfaces::IParticlePropertySvc::begin
virtual iterator begin() const =0
get the begin-iterator for the container of particle properties It is assumed that the container is p...
Containers::Vector
KeyedObjectManager< vector > Vector
Forward declaration of specialized std::vector-like object manager.
Definition: KeyedObjectManager.h:109
Gaudi::ParticleProperties::index
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...
Definition: IParticlePropertySvc.cpp:39
Gaudi::ParticleProperties::printAsTable
MsgStream & printAsTable(const std::set< Gaudi::ParticleID, C_, A_ > &particles, MsgStream &stream, const Gaudi::Interfaces::IParticlePropertySvc *service=0)
Definition: ParticleProperty.h:394