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/regex.hpp>
19 #include <boost/algorithm/string/case_conv.hpp>
28 declareProperty(
"InputFile",
m_pdtFiles=
"PDGTABLE.MeV");
48 static const boost::regex exp{
"[[:space:]]*([^[:space:]]+)[[:space:]]*=[[:space:]]*([^[:space:]]+)"};
49 static const auto tok_end = boost::sregex_iterator();
50 for (
auto tok_iter = boost::sregex_iterator(
begin(key),
end(key), exp);
51 tok_iter != tok_end; ++tok_iter)
53 const std::string fname = (*tok_iter)[1];
59 <<
"\" in $DATAPATH" <<
endmsg;
64 std::ifstream pdfile{ rfile };
71 std::string val = (*tok_iter)[1];
72 std::string VAL = boost::algorithm::to_upper_copy(val);
76 m_log <<
MSG::INFO <<
"No table format type specified for \"" << fname
77 <<
"\". Assuming PDG" <<
endmsg;
86 <<
"Could not determine Particle Property table type: \""
87 << val <<
"\" for file \"" << fname <<
"\"" <<
endmsg;
130 static const auto table = { std::make_pair(
"PDG" , &HepPDT::addPDGParticles ),
131 std::make_pair(
"PYTHIA" , &HepPDT::addPythiaParticles ),
132 std::make_pair(
"EVTGEN" , &HepPDT::addEvtGenParticles ),
133 std::make_pair(
"HERWIG" , &HepPDT::addHerwigParticles ),
134 std::make_pair(
"ISAJET" , &HepPDT::addIsajetParticles ),
135 std::make_pair(
"QQ" , &HepPDT::addQQParticles ) };
137 [&](
const std::pair<const char*,inputFunPtr>& p)
138 {
return typ == p.first; } );
142 throw std::runtime_error(
"error parsing particle table type");
155 "Default Heavy Ion Handler");
161 HepPDT::TableBuilder tb( *
m_pdt );
164 const auto& f = itr.first;
165 const auto& pF = itr.second;
170 std::ifstream pdfile{ f };
172 if ( ! pF(pdfile,tb) ) {
186 HepPDT::ParticleDataTable*
193 m_pdt.reset(
nullptr);
204 const std::string&
n) {
207 <<
"\" as ParticleDataTable already instantiated" <<
endmsg;
212 <<
"\" at " << puid <<
endmsg;
216 <<
"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...
StatusCode finalize() override
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
inputFunPtr parseTableType(const std::string &)
auto begin(reverse_wrapper< T > &w)
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)
StatusCode finalize() override
HepPDT::ProcessUnknownID * m_upid
#define DECLARE_COMPONENT(type)
auto end(reverse_wrapper< T > &w)
This class is used for returning status codes from appropriate routines.
bool(*)(std::istream &, HepPDT::TableBuilder &) inputFunPtr
HepPDT::ParticleDataTable * PDT()
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
Base class used to extend a class implementing other interfaces.
void setLevel(int level)
Update outputlevel.
void setUnknownParticleHandler(HepPDT::ProcessUnknownID *, const std::string &)
std::vector< std::pair< std::string, inputFunPtr > > m_inputs
StringProperty m_pdtFiles