4 #pragma warning(disable:1572)
16 #include "HepPDT/HeavyIonUnknownID.hh"
26 std::transform(s.begin(), s.end(), s.begin(),
33 :
base_class( name, svc ), m_upid(0), m_pdt(0), m_log(msgSvc(), name),
51 m_log.setLevel( m_outputLevel.value() );
59 std::string key = m_pdtFiles.value();
63 tok.
analyse( key,
" ",
"",
"",
"=",
"",
"");
65 for ( Tokenizer::Items::iterator
i = tok.
items().begin();
67 const std::string& fname = (*i).tag();
72 m_log <<
MSG::ERROR <<
"Could not find PDT file: \"" << fname
73 <<
"\" in $DATAPATH" <<
endmsg;
79 std::ifstream pdfile( rfile.c_str() );
81 m_log <<
MSG::ERROR <<
"Could not open PDT file: \"" << rfile
93 m_log <<
MSG::INFO <<
"No table format type specified for \"" << fname
94 <<
"\". Assuming PDG" <<
endmsg;
98 bool (*pF) (std::istream &,
99 HepPDT::TableBuilder &);
101 pF = parseTableType(VAL);
104 <<
"Could not determine Particle Property table type: \""
105 << val <<
"\" for file \"" << fname <<
"\"" <<
endmsg;
109 m_log <<
MSG::DEBUG <<
"Adding PDT file \"" << rfile <<
"\" type "
112 m_inputs.push_back( make_pair( rfile, pF ) );
138 if (m_upid_local && m_upid != 0) {
139 m_upid_local =
false;
159 HepPDT::TableBuilder&) {
161 bool (*pF) (std::istream &,
162 HepPDT::TableBuilder &);
165 pF = &HepPDT::addPDGParticles;
166 }
else if (typ ==
"PYTHIA") {
167 pF = &HepPDT::addPythiaParticles;
168 }
else if (typ ==
"EVTGEN") {
169 pF = &HepPDT::addEvtGenParticles;
170 }
else if (typ ==
"HERWIG") {
171 pF = &HepPDT::addHerwigParticles;
172 }
else if (typ ==
"ISAJET") {
173 pF = &HepPDT::addIsajetParticles;
174 }
else if (typ ==
"QQ") {
175 pF = &HepPDT::addQQParticles;
177 m_log <<
MSG::ERROR <<
"Unknown Particle Data file type: \""
179 throw( std::runtime_error(
"error parsing particle table type") );
193 setUnknownParticleHandler(
new HepPDT::HeavyIonUnknownID,
194 "Default Heavy Ion Handler");
198 m_pdt =
new HepPDT::ParticleDataTable(m_upid_name, m_upid);
200 HepPDT::TableBuilder tb( *m_pdt );
203 bool(*) (std::istream&,HepPDT::TableBuilder&)> >::const_iterator itr;
204 for (itr = m_inputs.begin(); itr != m_inputs.end(); ++itr) {
205 string f = itr->first;
206 bool (*pF) (std::istream&,HepPDT::TableBuilder&) = itr->second;
208 m_log <<
MSG::DEBUG <<
"Reading PDT file \"" << f <<
"\""
211 std::ifstream pdfile( f.c_str() );
213 if ( ! pF(pdfile,tb) ) {
214 m_log <<
MSG::ERROR <<
"Error reading PDT file: \"" << f
227 HepPDT::ParticleDataTable*
232 if (createTable().isFailure()) {
245 const std::string&
n) {
247 m_log <<
MSG::ERROR <<
"not setting Unknown Particle Handler \"" << n
248 <<
"\" as ParticleDataTable already instantiated" <<
endmsg;
252 m_log <<
MSG::DEBUG <<
"setting Unknown Particle Handler \"" << n
253 <<
"\" at " << puid <<
endmsg;
257 <<
"overriding previously selected Unknown Particle Handler \""
258 << m_upid_name <<
"\" with \"" << n <<
"\"" <<
endmsg;
Definition of the MsgStream class used to transmit messages.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
Items & items()
Access token collection.
bool isSuccess() const
Test for a status code of SUCCESS.
struct GAUDI_API vector
Parametrisation class for vector-like implementation.
void analyse(const std::string &s, const char *delim, const char *tagBegin, const char *tagEnd, const char *eq, const char *valBegin, const char *valEnd)
Analyse tokens from string.
bool isFailure() const
Test for a status code of FAILURE.
PartPropSvc(const std::string &name, ISvcLocator *svc)
#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)
virtual StatusCode reinitialize()
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
bool(*)(std::istream &, HepPDT::TableBuilder &) parseTableType(std::string &)
Templated class to add the standard messaging functionalities.
void setUnknownParticleHandler(HepPDT::ProcessUnknownID *, const std::string &)
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).
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
StringProperty m_pdtFiles