|
Gaudi Framework, version v21r8 |
| Home | Generated: 17 Mar 2010 |
Functions | |
| PartPropSvc (const std::string &name, ISvcLocator *svc) | |
| ~PartPropSvc () | |
| StatusCode | initialize () |
| StatusCode | finalize () |
| StatusCode PartPropSvc::finalize | ( | ) |
Definition at line 137 of file PartPropSvc.cpp.
00137 { 00138 00139 MsgStream log( msgSvc(), name() ); 00140 StatusCode status = Service::finalize(); 00141 00142 if ( status.isSuccess() ) 00143 log << MSG::INFO << "Service finalised successfully" << endmsg; 00144 00145 return status; 00146 }
| StatusCode PartPropSvc::initialize | ( | ) |
Definition at line 44 of file PartPropSvc.cpp.
00044 { 00045 00046 MsgStream log( msgSvc(), name() ); 00047 std::vector<std::string>::const_iterator itr; 00048 00049 StatusCode status = Service::initialize(); 00050 00051 log << MSG::INFO << "PDT file(s): " << endmsg; 00052 for (itr=m_pdtFiles.begin(); itr!=m_pdtFiles.end(); ++itr) { 00053 log << MSG::INFO << " " << *itr << endmsg; 00054 } 00055 log << MSG::INFO << "Type: " << m_inputType << endmsg; 00056 00057 if ( status.isFailure() ) { 00058 log << MSG::ERROR << "Could not initialize main svc" << endmsg; 00059 return StatusCode::FAILURE; 00060 } 00061 00062 bool (*pF) (std::istream &, 00063 HepPDT::TableBuilder &); 00064 00065 00066 // Determine type of input 00067 if (m_inputType == "PDG") { 00068 pF = &HepPDT::addPDGParticles; 00069 } else if (m_inputType == "Pythia") { 00070 pF = &HepPDT::addPythiaParticles; 00071 } else if (m_inputType == "EvtGen") { 00072 pF = &HepPDT::addEvtGenParticles; 00073 } else if (m_inputType == "Herwig") { 00074 pF = &HepPDT::addHerwigParticles; 00075 } else if (m_inputType == "IsaJet") { 00076 pF = &HepPDT::addIsajetParticles; 00077 } else if (m_inputType == "QQ") { 00078 pF = &HepPDT::addQQParticles; 00079 } else { 00080 log << MSG::ERROR << "Unknown Particle Data file type: \"" 00081 << m_inputType << "\"" << endmsg; 00082 return StatusCode::FAILURE; 00083 } 00084 00085 // Make sure we have at least one file 00086 if (m_pdtFiles.size() == 0) { 00087 log << MSG::ERROR << "Need at least 1 PDT file" << endmsg; 00088 log << MSG::ERROR << "Check value of property \"InputFile\"" << endmsg; 00089 return StatusCode::FAILURE; 00090 } 00091 00092 m_pdt = new HepPDT::ParticleDataTable; 00093 00094 { 00095 // Construct table builder 00096 HepPDT::TableBuilder tb( *m_pdt ); 00097 00098 // read the input 00099 int good(0); 00100 for (itr=m_pdtFiles.begin(); itr!=m_pdtFiles.end(); ++itr) { 00101 00102 std::string rfile = System::PathResolver::find_file(*itr,"DATAPATH"); 00103 if (rfile == "") { 00104 log << MSG::ERROR << "Could not find PDT file: \"" << *itr 00105 << "\" in $DATAPATH" << endmsg; 00106 continue; 00107 } 00108 00109 std::ifstream pdfile( rfile.c_str() ); 00110 if (!pdfile) { 00111 log << MSG::ERROR << "Could not open PDT file: \"" << rfile 00112 << "\"" << endmsg; 00113 continue; 00114 } 00115 00116 if ( ! pF(pdfile,tb) ) { 00117 log << MSG::ERROR << "Error reading PDT file: \"" << rfile 00118 << "\"" << endmsg; 00119 return StatusCode::FAILURE; 00120 } 00121 ++good; 00122 } 00123 if (0 == good) { 00124 log << MSG::ERROR << "Unable to access any PDT file" <<endmsg; 00125 return StatusCode::FAILURE; 00126 } 00127 00128 } // the tb destructor fills datacol 00129 00130 00131 00132 return status; 00133 }
| PartPropSvc::PartPropSvc | ( | const std::string & | name, | |
| ISvcLocator * | svc | |||
| ) |
Definition at line 21 of file PartPropSvc.cpp.
00022 : base_class( 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 | ( | ) |