![]() |
|
|
Generated: 18 Jul 2008 |
#include <PartPropSvc.h>
Inheritance diagram for PartPropSvc:


Definition at line 27 of file PartPropSvc.h.
Public Member Functions | |
| virtual StatusCode | initialize () |
| Initialization (from CONFIGURED to INITIALIZED). | |
| virtual StatusCode | finalize () |
| Finalize (from INITIALIZED to CONFIGURED). | |
| virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvInterface) |
| Query interfaces of Interface. | |
| virtual const InterfaceID & | type () const |
| Retrieve ID of the Service. | |
| HepPDT::ParticleDataTable * | PDT () |
Protected Member Functions | |
| PartPropSvc (const std::string &name, ISvcLocator *svc) | |
| virtual | ~PartPropSvc () |
Private Attributes | |
| std::string | m_inputType |
| std::vector< std::string > | m_pdtFiles |
| HepPDT::ParticleDataTable * | m_pdt |
Friends | |
| class | SvcFactory< PartPropSvc > |
| PartPropSvc::PartPropSvc | ( | const std::string & | name, | |
| ISvcLocator * | svc | |||
| ) | [protected] |
Definition at line 21 of file PartPropSvc.cpp.
00022 : Service( name, svc ), m_pdt(0) { 00023 00024 declareProperty( "InputType", m_inputType="PDG"); 00025 declareProperty( "InputFile", m_pdtFiles); 00026 00027 if (m_pdtFiles.empty() ) { 00028 m_pdtFiles.push_back("PDGTABLE.MeV"); 00029 } 00030 00031 }
| PartPropSvc::~PartPropSvc | ( | ) | [protected, virtual] |
| StatusCode PartPropSvc::initialize | ( | ) | [virtual] |
Initialization (from CONFIGURED to INITIALIZED).
Reimplemented from Service.
Definition at line 50 of file PartPropSvc.cpp.
References endreq(), MSG::ERROR, StatusCode::FAILURE, System::PathResolver::find_file(), MSG::INFO, Service::initialize(), StatusCode::isFailure(), m_inputType, m_pdt, m_pdtFiles, Service::msgSvc(), and Service::name().
00050 { 00051 00052 MsgStream log( msgSvc(), name() ); 00053 std::vector<std::string>::const_iterator itr; 00054 00055 StatusCode status = Service::initialize(); 00056 00057 log << MSG::INFO << "PDT file(s): " << endreq; 00058 for (itr=m_pdtFiles.begin(); itr!=m_pdtFiles.end(); ++itr) { 00059 log << MSG::INFO << " " << *itr << endreq; 00060 } 00061 log << MSG::INFO << "Type: " << m_inputType << endreq; 00062 00063 if ( status.isFailure() ) { 00064 log << MSG::ERROR << "Could not initialize main svc" << endreq; 00065 return StatusCode::FAILURE; 00066 } 00067 00068 bool (*pF) (std::istream &, 00069 HepPDT::TableBuilder &); 00070 00071 00072 // Determine type of input 00073 if (m_inputType == "PDG") { 00074 pF = &HepPDT::addPDGParticles; 00075 } else if (m_inputType == "Pythia") { 00076 pF = &HepPDT::addPythiaParticles; 00077 } else if (m_inputType == "EvtGen") { 00078 pF = &HepPDT::addEvtGenParticles; 00079 } else if (m_inputType == "Herwig") { 00080 pF = &HepPDT::addHerwigParticles; 00081 } else if (m_inputType == "IsaJet") { 00082 pF = &HepPDT::addIsajetParticles; 00083 } else if (m_inputType == "QQ") { 00084 pF = &HepPDT::addQQParticles; 00085 } else { 00086 log << MSG::ERROR << "Unknown Particle Data file type: \"" 00087 << m_inputType << "\"" << endreq; 00088 return StatusCode::FAILURE; 00089 } 00090 00091 // Make sure we have at least one file 00092 if (m_pdtFiles.size() == 0) { 00093 log << MSG::ERROR << "Need at least 1 PDT file" << endreq; 00094 log << MSG::ERROR << "Check value of property \"InputFile\"" << endreq; 00095 return StatusCode::FAILURE; 00096 } 00097 00098 m_pdt = new HepPDT::ParticleDataTable; 00099 00100 { 00101 // Construct table builder 00102 HepPDT::TableBuilder tb( *m_pdt ); 00103 00104 // read the input 00105 int good(0); 00106 for (itr=m_pdtFiles.begin(); itr!=m_pdtFiles.end(); ++itr) { 00107 00108 std::string rfile = System::PathResolver::find_file(*itr,"DATAPATH"); 00109 if (rfile == "") { 00110 log << MSG::ERROR << "Could not find PDT file: \"" << *itr 00111 << "\" in $DATAPATH" << endreq; 00112 continue; 00113 } 00114 00115 std::ifstream pdfile( rfile.c_str() ); 00116 if (!pdfile) { 00117 log << MSG::ERROR << "Could not open PDT file: \"" << rfile 00118 << "\"" << endreq; 00119 continue; 00120 } 00121 00122 if ( ! pF(pdfile,tb) ) { 00123 log << MSG::ERROR << "Error reading PDT file: \"" << rfile 00124 << "\"" << endreq; 00125 return StatusCode::FAILURE; 00126 } 00127 ++good; 00128 } 00129 if (0 == good) { 00130 log << MSG::ERROR << "Unable to access any PDT file" <<endreq; 00131 return StatusCode::FAILURE; 00132 } 00133 00134 } // the tb destructor fills datacol 00135 00136 00137 00138 return status; 00139 }
| StatusCode PartPropSvc::finalize | ( | ) | [virtual] |
Finalize (from INITIALIZED to CONFIGURED).
Reimplemented from Service.
Definition at line 143 of file PartPropSvc.cpp.
References endreq(), Service::finalize(), MSG::INFO, StatusCode::isSuccess(), Service::msgSvc(), and Service::name().
00143 { 00144 00145 MsgStream log( msgSvc(), name() ); 00146 StatusCode status = Service::finalize(); 00147 00148 if ( status.isSuccess() ) 00149 log << MSG::INFO << "Service finalised successfully" << endreq; 00150 00151 return status; 00152 }
| StatusCode PartPropSvc::queryInterface | ( | const InterfaceID & | riid, | |
| void ** | ppvInterface | |||
| ) | [virtual] |
Query interfaces of Interface.
| riid | ID of Interface to be retrieved | |
| ppvUnknown | Pointer to Location for interface pointer |
Reimplemented from Service.
Definition at line 156 of file PartPropSvc.cpp.
References Service::addRef(), StatusCode::FAILURE, IID_IPartPropSvc, Service::queryInterface(), and StatusCode::SUCCESS.
00157 { 00158 StatusCode sc = StatusCode::FAILURE; 00159 if ( ppvInterface ) { 00160 *ppvInterface = 0; 00161 00162 if ( riid == IID_IPartPropSvc ) { 00163 *ppvInterface = static_cast<IPartPropSvc*>(this); 00164 sc = StatusCode::SUCCESS; 00165 addRef(); 00166 } 00167 else 00168 sc = Service::queryInterface( riid, ppvInterface ); 00169 } 00170 return sc; 00171 }
| const InterfaceID & PartPropSvc::type | ( | ) | const [virtual] |
Retrieve ID of the Service.
Reimplemented from Service.
Definition at line 44 of file PartPropSvc.cpp.
References IID_IPartPropSvc.
00044 { 00045 return IID_IPartPropSvc; 00046 }
| HepPDT::ParticleDataTable* PartPropSvc::PDT | ( | ) | [inline, virtual] |
Implements IPartPropSvc.
Definition at line 42 of file PartPropSvc.h.
References m_pdt.
00042 { return m_pdt; };
friend class SvcFactory< PartPropSvc > [friend] |
Definition at line 54 of file PartPropSvc.h.
std::string PartPropSvc::m_inputType [private] |
std::vector<std::string> PartPropSvc::m_pdtFiles [private] |
HepPDT::ParticleDataTable* PartPropSvc::m_pdt [private] |