4 #pragma warning(disable:1572)
8 #include "GaudiKernel/ISvcLocator.h"
9 #include "GaudiKernel/MsgStream.h"
10 #include "GaudiKernel/PathResolver.h"
15 #include "HepPDT/HeavyIonUnknownID.hh"
21 #include <boost/regex.hpp>
25 std::transform(s.begin(), s.end(), s.begin(),
32 :
base_class( name, svc ), m_upid(0), m_pdt(0), m_log(msgSvc(), name),
60 static const boost::regex exp{
"[[:space:]]*([^[:space:]]+)[[:space:]]*=[[:space:]]*([^[:space:]]+)"};
61 static const auto tok_end = boost::sregex_iterator();
62 for (
auto tok_iter = boost::sregex_iterator(begin(key),
end(key), exp);
63 tok_iter != tok_end; ++tok_iter)
65 const std::string fname = (*tok_iter)[1];
71 <<
"\" in $DATAPATH" <<
endmsg;
77 std::ifstream pdfile( rfile.c_str() );
84 std::string val = (*tok_iter)[1];
85 std::string VAL = val;
90 m_log <<
MSG::INFO <<
"No table format type specified for \"" << fname
91 <<
"\". Assuming PDG" <<
endmsg;
95 bool (*pF) (std::istream &,
96 HepPDT::TableBuilder &);
101 <<
"Could not determine Particle Property table type: \""
102 << val <<
"\" for file \"" << fname <<
"\"" <<
endmsg;
109 m_inputs.push_back( make_pair( rfile, pF ) );
156 HepPDT::TableBuilder&) {
158 bool (*pF) (std::istream &,
159 HepPDT::TableBuilder &);
162 pF = &HepPDT::addPDGParticles;
163 }
else if (typ ==
"PYTHIA") {
164 pF = &HepPDT::addPythiaParticles;
165 }
else if (typ ==
"EVTGEN") {
166 pF = &HepPDT::addEvtGenParticles;
167 }
else if (typ ==
"HERWIG") {
168 pF = &HepPDT::addHerwigParticles;
169 }
else if (typ ==
"ISAJET") {
170 pF = &HepPDT::addIsajetParticles;
171 }
else if (typ ==
"QQ") {
172 pF = &HepPDT::addQQParticles;
174 m_log <<
MSG::ERROR <<
"Unknown Particle Data file type: \""
176 throw( std::runtime_error(
"error parsing particle table type") );
191 "Default Heavy Ion Handler");
197 HepPDT::TableBuilder tb( *
m_pdt );
200 bool(*) (std::istream&,HepPDT::TableBuilder&)> >::const_iterator itr;
202 std::string f = itr->first;
203 bool (*pF) (std::istream&,HepPDT::TableBuilder&) = itr->second;
208 std::ifstream pdfile( f.c_str() );
210 if ( ! pF(pdfile,tb) ) {
224 HepPDT::ParticleDataTable*
242 const std::string&
n) {
245 <<
"\" as ParticleDataTable already instantiated" <<
endmsg;
250 <<
"\" at " << puid <<
endmsg;
254 <<
"overriding previously selected Unknown Particle Handler \""
Definition of the MsgStream class used to transmit messages.
IntegerProperty m_outputLevel
Service output level.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
bool isSuccess() const
Test for a status code of SUCCESS.
struct GAUDI_API vector
Parametrisation class for vector-like implementation.
bool isFailure() const
Test for a status code of FAILURE.
PartPropSvc(const std::string &name, ISvcLocator *svc)
HepPDT::ProcessUnknownID * m_upid
#define DECLARE_COMPONENT(type)
This class is used for returning status codes from appropriate routines.
void toupper(std::string &s)
HepPDT::ParticleDataTable * PDT()
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
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
virtual const std::string & name() const
Retrieve name of the service.
virtual StatusCode reinitialize()
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
HepPDT::ParticleDataTable * m_pdt
bool(*)(std::istream &, HepPDT::TableBuilder &) parseTableType(std::string &)
void setLevel(int level)
Update outputlevel.
Templated class to add the standard messaging functionalities.
void setUnknownParticleHandler(HepPDT::ProcessUnknownID *, const std::string &)
std::vector< std::pair< std::string, bool(*)(std::istream &, HepPDT::TableBuilder &)> > m_inputs
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
StringProperty m_pdtFiles