4 #pragma warning(disable:1572)
8 #include "GaudiKernel/ISvcLocator.h"
9 #include "GaudiKernel/MsgStream.h"
10 #include "GaudiKernel/PathResolver.h"
14 #include "HepPDT/HeavyIonUnknownID.hh"
18 #include <boost/tokenizer.hpp>
19 #include <boost/algorithm/string/case_conv.hpp>
28 declareProperty(
"InputFile",
m_pdtFiles=
"PDGTABLE.MeV");
48 typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
49 boost::char_separator<char> sep(
", ");
50 boost::char_separator<char> sep_eq(
"=");
52 tokenizer tokens(key, sep);
53 for (
auto it = tokens.begin(); it != tokens.end(); ++it) {
55 tokenizer tok2(*it, sep_eq);
56 int nToks(distance(tok2.begin(), tok2.end()));
58 auto it2 = tok2.begin();
59 const std::string fname = *it2;
62 m_log <<
MSG::INFO <<
"No table format type specified for \"" << fname
63 <<
"\". Assuming PDG" <<
endmsg;
74 <<
"\" in $DATAPATH" <<
endmsg;
79 std::ifstream pdfile{ rfile };
86 std::string FMT = boost::algorithm::to_upper_copy(fmt);
93 <<
"Could not determine Particle Property table type: \""
94 << FMT <<
"\" for file \"" << fname <<
"\"" <<
endmsg;
138 static const auto table = { std::make_pair(
"PDG" , &HepPDT::addPDGParticles ),
139 std::make_pair(
"PYTHIA" , &HepPDT::addPythiaParticles ),
140 std::make_pair(
"EVTGEN" , &HepPDT::addEvtGenParticles ),
141 std::make_pair(
"HERWIG" , &HepPDT::addHerwigParticles ),
142 std::make_pair(
"ISAJET" , &HepPDT::addIsajetParticles ),
143 std::make_pair(
"QQ" , &HepPDT::addQQParticles ) };
145 [&](
const std::pair<const char*,inputFunPtr>& p)
146 {
return typ == p.first; } );
150 throw std::runtime_error(
"error parsing particle table type");
163 "Default Heavy Ion Handler");
169 HepPDT::TableBuilder tb( *
m_pdt );
172 const auto& f = itr.first;
173 const auto& pF = itr.second;
178 std::ifstream pdfile{ f };
180 if ( ! pF(pdfile,tb) ) {
194 HepPDT::ParticleDataTable*
201 m_pdt.reset(
nullptr);
212 const std::string&
n) {
215 <<
"\" as ParticleDataTable already instantiated" <<
endmsg;
220 <<
"\" at " << puid <<
endmsg;
224 <<
"overriding previously selected Unknown Particle Handler \""
Definition of the MsgStream class used to transmit messages.
StatusCode initialize() override
StatusCode initialize() override
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
StatusCode finalize() override
inputFunPtr parseTableType(const std::string &)
bool isSuccess() const
Test for a status code of SUCCESS.
auto begin(reverse_wrapper< T > &w)
std::unique_ptr< HepPDT::ParticleDataTable > m_pdt
bool isFailure() const
Test for a status code of FAILURE.
PartPropSvc(const std::string &name, ISvcLocator *svc)
StatusCode finalize() override
HepPDT::ProcessUnknownID * m_upid
auto end(reverse_wrapper< T > &w)
This class is used for returning status codes from appropriate routines.
#define DECLARE_COMPONENT(type)
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
Base class used to extend a class implementing other interfaces.
void setLevel(int level)
Update outputlevel.
std::vector< std::pair< std::string, inputFunPtr > > m_inputs
void setUnknownParticleHandler(HepPDT::ProcessUnknownID *, const std::string &) override
StringProperty m_pdtFiles