4 #pragma warning(disable:1572)
14 #include "HepPDT/HeavyIonUnknownID.hh"
18 #include <boost/tokenizer.hpp>
19 #include <boost/algorithm/string/case_conv.hpp>
39 error() <<
"Could not initialize main svc" <<
endmsg;
46 typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
47 boost::char_separator<char> sep(
", ");
48 boost::char_separator<char> sep_eq(
"=");
50 tokenizer tokens(key, sep);
51 for (
auto it = tokens.begin(); it != tokens.end(); ++it) {
53 tokenizer tok2(*it, sep_eq);
54 int nToks(distance(tok2.begin(), tok2.end()));
56 auto it2 = tok2.begin();
60 info() <<
"No table format type specified for \"" << fname
61 <<
"\". Assuming PDG" <<
endmsg;
71 error() <<
"Could not find PDT file: \"" << fname
72 <<
"\" in $DATAPATH" <<
endmsg;
79 error() <<
"Could not open PDT file: \"" << rfile
84 std::string FMT = boost::algorithm::to_upper_copy(fmt);
91 <<
"Could not determine Particle Property table type: \""
92 << FMT <<
"\" for file \"" << fname <<
"\"" <<
endmsg;
96 debug() <<
"Adding PDT file \"" << rfile <<
"\" type "
124 debug() <<
"Service finalised successfully" <<
endmsg;
135 static const auto table = {
std::make_pair(
"PDG" , &HepPDT::addPDGParticles ),
143 {
return typ == p.first; } );
145 error() <<
"Unknown Particle Data file type: \""
160 "Default Heavy Ion Handler");
166 HepPDT::TableBuilder tb( *
m_pdt );
169 const auto& f = itr.first;
170 const auto& pF = itr.second;
172 debug() <<
"Reading PDT file \"" << f <<
"\""
177 if ( ! pF(pdfile,tb) ) {
178 error() <<
"Error reading PDT file: \"" << f
191 HepPDT::ParticleDataTable*
197 fatal() <<
"Could not create ParticleDataTable" <<
endmsg;
211 error() <<
"not setting Unknown Particle Handler \"" << n
212 <<
"\" as ParticleDataTable already instantiated" <<
endmsg;
216 debug() <<
"setting Unknown Particle Handler \"" << n
217 <<
"\" at " << puid <<
endmsg;
221 <<
"overriding previously selected Unknown Particle Handler \""
StatusCode initialize() override
StatusCode initialize() override
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
StatusCode finalize() override
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
inputFunPtr parseTableType(const std::string &)
bool isSuccess() const
Test for a status code of SUCCESS.
std::unique_ptr< HepPDT::ParticleDataTable > m_pdt
bool isFailure() const
Test for a status code of FAILURE.
PartPropSvc(const std::string &name, ISvcLocator *svc)
#define DECLARE_COMPONENT(type)
StatusCode finalize() override
HepPDT::ProcessUnknownID * m_upid
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.
bool(*)(std::istream &, HepPDT::TableBuilder &) inputFunPtr
static std::string find_file(const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
const TYPE & value() const
explicit conversion
HepPDT::ParticleDataTable * PDT() override
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
std::vector< std::pair< std::string, inputFunPtr > > m_inputs
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
void setUnknownParticleHandler(HepPDT::ProcessUnknownID *, const std::string &) override
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
StringProperty m_pdtFiles