Go to the documentation of this file.
16 #include "boost/algorithm/string/classification.hpp"
17 #include "boost/algorithm/string/split.hpp"
18 #include "boost/algorithm/string/trim.hpp"
21 namespace ba = boost::algorithm;
59 if (
System::getEnv(
"PARAMFILESROOT", m_filename.value() ) ) { m_filename.value() +=
"/data/ParticleTable.txt"; }
70 error() <<
" Cannot retrieve the VFS service " <<
endmsg;
76 error() <<
" Could not parse the file " <<
endmsg;
82 error() <<
" Could not treat particles! " <<
endmsg;
86 debug() <<
"ParticleProperties parsed successfully" <<
endmsg;
88 debug() <<
"Access properties" <<
endmsg;
100 info() <<
"Properties have been redefined for " <<
m_replaced.
size()
115 always() <<
"Properties have been redefined for " <<
m_replaced.
size()
128 double mass,
double tlife,
const std::string& evtName,
int pythiaId,
131 auto&
pp =
m_owned.
emplace_back( particle, geantId, jetsetId, charge, mass, tlife, evtName, pythiaId, maxWidth );
141 const int ID =
pp->geantID();
145 diff( ifind->second,
pp );
157 diff( ifind->second,
pp );
166 if ( 0 !=
pp->jetsetID() &&
"Tcherenkov" !=
pp->particle() ) {
167 const int ID =
pp->jetsetID();
171 diff( ifind->second,
pp );
180 if ( 0 !=
pp->pythiaID() && 0 !=
pp->jetsetID() &&
"Tcherenkov" !=
pp->particle() ) {
182 const int ID =
pp->pythiaID();
186 diff( ifind->second,
pp );
201 auto i =
std::find_if(
m.begin(),
m.end(), [&](
typename MAP::const_reference i ) { return i.second == pp; } );
202 if ( i !=
m.end() ) {
m.erase( i ); }
234 error() <<
"Format of input file inconsistent with what expected"
235 <<
" - Check you are using ParticleData.txt" <<
endmsg;
245 error() <<
"Unable to open properties file : " << file <<
endmsg;
250 info() <<
"Opened particle properties file : " << file <<
endmsg;
258 if (
line.front() ==
'#' )
continue;
261 ba::trim_left_if(
line, ba::is_space() );
262 ba::split( tokens,
line, ba::is_space(), boost::token_compress_on );
263 if ( tokens.
size() != 9 )
continue;
268 if ( jid == 0 ) jid = 10000000 * gid;
276 error() <<
"Error from ParticlePropertySvc::push_back for particle='" << tokens[0] <<
"'" <<
endmsg;
289 if ( !
pp ) {
return nullptr; }
290 const int ID =
pp->pdgID();
291 const int antiID = -1 * ID;
293 if ( ap && antiID == ap->pdgID() ) {
return ap; }
307 if ( !
pp ) {
continue; }
309 if ( ap ) {
pp->setAntiParticle( ap ); }
318 template <
typename MAP,
typename SET>
319 void _load_( MAP&
m,
SET& result ) {
320 for (
auto i =
m.begin();
m.end() != i; ++i ) { result.insert( i->second ); }
354 if ( input >> p_name >> p_geant >> p_jetset >> p_charge >> p_mass >> p_ltime >> p_evtgen >> p_pythia >>
356 always() <<
" Add/Modify the particle: "
357 <<
" name='" << p_name <<
"'"
358 <<
" geant=" << p_geant <<
" jetset=" << p_jetset <<
" charge=" << p_charge <<
" mass=" << p_mass
359 <<
" ltime=" << p_ltime <<
" evtgen='" << p_evtgen <<
"'"
360 <<
" pythia=" << p_pythia <<
" maxwid=" << p_maxwid <<
endmsg;
366 error() <<
" could not parse '" << item <<
"'" <<
endmsg;
377 # pragma warning( push )
378 # pragma warning( disable : 1572 )
382 if ( o ==
n ) {
return false; }
384 auto&
log = msgStream();
394 log <<
" Name:'" << o->
particle() <<
"'/'" <<
n->particle() <<
"'";
396 if ( o->
geantID() !=
n->geantID() ) {
398 log <<
" G3ID:" << o->
geantID() <<
"/" <<
n->geantID() <<
"'";
400 if ( o->
pdgID() !=
n->pdgID() ) {
402 log <<
" PDGID:" << o->
pdgID() <<
"/" <<
n->pdgID() <<
"'";
406 log <<
" PYID:" << o->
pythiaID() <<
"/" <<
n->pythiaID() <<
"'";
408 if ( o->
charge() !=
n->charge() ) {
410 log <<
" Q:" << o->
charge() <<
"/" <<
n->charge() <<
"'";
412 if ( o->
mass() !=
n->mass() ) {
414 log <<
" M:" << o->
mass() <<
"/" <<
n->mass() <<
"'";
418 log <<
" T:" << o->
lifetime() <<
"/" <<
n->lifetime() <<
"'";
422 log <<
" EvtGen:" << o->
evtGenName() <<
"/" <<
n->evtGenName() <<
"'";
426 log <<
" WMAX:" << o->
maxWidth() <<
"/" <<
n->maxWidth() <<
"'";
435 # pragma warning( pop )
double charge() const
Get the particle charge.
StatusCode initialize() override
StatusCode setAntiParticles()
helper (protected) function to set the valid particle<-->antiparticle relations
SmartIF< IFileAccess > m_fileAccess
MapID m_idmap
Map for geant IDs.
MapStdHepID m_stdhepidmap
Map for StdHep Ids.
StatusCode erase(int geantId) override
Erase a property by geant3 id.
const std::string & evtGenName() const
Get the EvtGen name.
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
StatusCode parse()
Parses the file and fill all the maps.
T back_inserter(T... args)
MapName m_namemap
Map for particle names.
Gaudi::Property< std::string > m_filename
int pythiaID() const
Get the Pythia ID.
StatusCode finalize() override
Finalise the service.
StatusCode finalize() override
const std::string & particle() const
Get the particle name.
MapPythiaID m_pythiaidmap
Map for Pythia Ids.
const ParticleProperty * anti(const ParticleProperty *pp) const
helper (protected) function to find an antiparticle for the given particle ID (StdHepID)
StatusCode rebuild()
rebuild "the linear container" from the map
int pdgID() const
Get the PDG (= JETSET) ID.
bool diff(const ParticleProperty *o, const ParticleProperty *n, const MSG::Level l=MSG::DEBUG) const
double mass() const
Get the particle mass.
Gaudi::Property< std::vector< std::string > > m_particles
double maxWidth() const
Get the max width deviation.
double lifetime() const
Get the particle lifetime.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Header file for std:chrono::duration-based Counters.
int geantID() const
Get the GEANT3 ID.
StatusCode addParticles()
StatusCode push_back(const std::string &particle, int geantId, int jetsetId, double charge, double mass, double tlife, const std::string &evtName, int pythiaId, double maxWidth) override
Create a new particle property.
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
std::deque< ParticleProperty > m_owned
T emplace_back(T... args)
Gaudi::Property< std::vector< std::string > > m_other
constexpr static const auto SUCCESS
#define DECLARE_COMPONENT(type)
StatusCode initialize() override
Initialise the service.
std::set< std::string > m_replaced
VectPP m_vectpp
Vector of all particle properties.
constexpr static const auto FAILURE
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.