4 #pragma warning( disable : 1572 ) 14 #include "HepPDT/HeavyIonUnknownID.hh" 18 #include <boost/algorithm/string/case_conv.hpp> 19 #include <boost/tokenizer.hpp> 28 error() <<
"Could not initialize main svc" <<
endmsg;
34 typedef boost::tokenizer<boost::char_separator<char>> tokenizer;
35 boost::char_separator<char> sep(
", " );
36 boost::char_separator<char> sep_eq(
"=" );
38 tokenizer tokens( key, sep );
39 for (
auto it = tokens.begin(); it != tokens.end(); ++it ) {
41 tokenizer tok2( *it, sep_eq );
42 int nToks( distance( tok2.begin(), tok2.end() ) );
44 auto it2 = tok2.begin();
48 info() <<
"No table format type specified for \"" << fname <<
"\". Assuming PDG" <<
endmsg;
57 if ( rfile.
empty() ) {
58 error() <<
"Could not find PDT file: \"" << fname <<
"\" in $DATAPATH" <<
endmsg;
65 error() <<
"Could not open PDT file: \"" << rfile <<
"\"" <<
endmsg;
69 std::string FMT = boost::algorithm::to_upper_copy( fmt );
75 error() <<
"Could not determine Particle Property table type: \"" << FMT <<
"\" for file \"" << fname <<
"\"" 80 debug() <<
"Adding PDT file \"" << rfile <<
"\" type " << FMT <<
endmsg;
105 debug() <<
"Service finalised successfully" <<
endmsg;
115 static const auto table = {
122 error() <<
"Unknown Particle Data file type: \"" << typ <<
"\"" <<
endmsg;
141 HepPDT::TableBuilder tb( *
m_pdt );
143 for (
const auto& itr :
m_inputs ) {
144 const auto& f = itr.first;
145 const auto& pF = itr.second;
147 debug() <<
"Reading PDT file \"" << f <<
"\"" <<
endmsg;
151 if ( !pF( pdfile, tb ) ) {
152 error() <<
"Error reading PDT file: \"" << f <<
"\"" <<
endmsg;
168 fatal() <<
"Could not create ParticleDataTable" <<
endmsg;
173 return m_pdt.get_ptr();
181 error() <<
"not setting Unknown Particle Handler \"" << n <<
"\" as ParticleDataTable already instantiated" 186 debug() <<
"setting Unknown Particle Handler \"" << n <<
"\" at " << puid <<
endmsg;
189 warning() <<
"overriding previously selected Unknown Particle Handler \"" <<
m_upid_name <<
"\" with \"" << n
constexpr static const auto FAILURE
StatusCode initialize() override
boost::optional< HepPDT::ParticleDataTable > m_pdt
StatusCode initialize() override
StatusCode finalize() override
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
inputFunPtr parseTableType(const std::string &)
bool(*)(std::istream &, HepPDT::TableBuilder &) inputFunPtr
Gaudi::Property< std::string > m_pdtFiles
std::vector< std::pair< std::string, inputFunPtr > > m_inputs
StatusCode finalize() override
HepPDT::ProcessUnknownID * m_upid
#define DECLARE_COMPONENT(type)
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
This class is used for returning status codes from appropriate routines.
static std::string find_file(const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
constexpr static const auto SUCCESS
HepPDT::ParticleDataTable * PDT() override
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
void setUnknownParticleHandler(HepPDT::ProcessUnknownID *, const std::string &) override
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.