#include <JobOptionsMgr.h>
Public Member Functions | |
JobOptionsMgr (const std::string &optname) | |
virtual | ~JobOptionsMgr () |
const std::string & | optName () |
int | inputType () |
int | evtMax () |
const std::vector< std::string > & | inputFiles () |
const std::vector< int > & | outputTypes () |
const std::string & | dstFile () |
const std::string & | recFile () |
const std::vector< std::string > & | tupleOpts () |
const std::vector< std::string > & | histOpts () |
void | clientOptsTemplate (const std::string &svrName) |
Private Member Functions | |
const Property * | getProperty (const std::string &client, const std::string &name) |
JobOptionsMgr () | |
Private Attributes | |
std::string | m_optName |
int | m_iFileType |
int | m_evtMax |
std::vector< std::string > | m_inputFiles |
std::vector< int > | m_oFileTypes |
std::string | m_dstFile |
std::string | m_recFile |
std::vector< std::string > | m_tupleOpts |
std::vector< std::string > | m_histOpts |
JobOptionsSvc * | m_svc |
Definition at line 11 of file JobOptionsMgr.h.
JobOptionsMgr::JobOptionsMgr | ( | const std::string & | optname | ) |
Definition at line 29 of file JobOptionsMgr.cxx.
References CheckSTATUS, getProperty(), m_dstFile, m_evtMax, m_histOpts, m_iFileType, m_inputFiles, m_oFileTypes, m_recFile, m_svc, m_tupleOpts, and MyPARSE.
00030 : m_optName(optname), 00031 m_iFileType(-1), 00032 m_evtMax(10), 00033 m_dstFile("digi.root"), 00034 m_recFile("digi.root") 00035 { 00036 IService* svc; 00037 StatusCode sc = Gaudi::svcLocator()->service("JobOptionsSvc", svc); 00038 CheckSTATUS("Failed to retrieve the JobOptionsSvc"); 00039 m_svc = dynamic_cast<JobOptionsSvc*>(svc); 00040 00041 sc = m_svc->setProperty( StringProperty("TYPE", "FILE") ); 00042 sc = m_svc->setProperty( StringProperty("PATH", optname) ); 00043 CheckSTATUS("Failed to set the property of DistBossServer"); 00044 00045 sc = m_svc->initialize(); 00046 CheckSTATUS("Failed to initialize JobOptionsSvc"); 00047 00048 const Property* pprop = getProperty("ApplicationMgr", "EvtMax"); 00049 if ( pprop != NULL ) { 00050 MyPARSE( m_evtMax ); 00051 } 00052 00053 if ( (pprop = getProperty("RawDataInputSvc", "InputFiles")) != NULL ) { 00054 m_iFileType = 0; 00055 MyPARSE( m_inputFiles ); 00056 } 00057 else if ( (pprop = getProperty("BesSim", "TDSFlag")) != NULL ) { 00058 m_iFileType = 1; 00059 // to be continued ... 00060 } 00061 else if ( (pprop = getProperty("EventCnvSvc", "digiRootInputFile")) != NULL ) { 00062 m_iFileType = 2; 00063 MyPARSE( m_inputFiles ); 00064 } 00065 else { 00066 std::cout << "[JobOptionsMgr] Unknown Job Type!" << std::endl; 00067 exit(1); 00068 } 00069 00070 if ( (pprop = getProperty("EventPreSelect","WriteDst")) != NULL ) { 00071 bool status; 00072 MyPARSE(status); 00073 if ( status ) { 00074 m_oFileTypes.push_back(3); 00075 if ( (pprop = getProperty("WriteDst", "digiRootOutputFile")) != NULL ) { 00076 MyPARSE( m_dstFile ); 00077 } 00078 } 00079 } 00080 00081 if ( (pprop = getProperty("EventPreSelect","WriteRec")) != NULL ) { 00082 bool status; 00083 MyPARSE(status); 00084 if ( status ) { 00085 m_oFileTypes.push_back(4); 00086 if ( (pprop = getProperty("WriteRec", "digiRootOutputFile")) != NULL ) { 00087 MyPARSE( m_recFile ); 00088 } 00089 } 00090 } 00091 00092 if ( (pprop = getProperty("NTupleSvc", "Output")) != NULL ) { 00093 m_oFileTypes.push_back(5); 00094 MyPARSE( m_tupleOpts ); 00095 } 00096 00097 if ( (pprop = getProperty("THistSvc", "Output")) != NULL ) { 00098 m_oFileTypes.push_back(6); 00099 MyPARSE( m_histOpts); 00100 } 00101 }
JobOptionsMgr::~JobOptionsMgr | ( | ) | [virtual] |
Definition at line 103 of file JobOptionsMgr.cxx.
References CheckSTATUS, and m_svc.
00104 { 00105 StatusCode sc = m_svc->finalize(); 00106 CheckSTATUS("Failed to finalize JobOptionsSvc!"); 00107 }
JobOptionsMgr::JobOptionsMgr | ( | ) | [private] |
void JobOptionsMgr::clientOptsTemplate | ( | const std::string & | svrName | ) |
Definition at line 112 of file JobOptionsMgr.cxx.
References genRecEmupikp::i, ignorePROPERTY, ganga-rec::j, m_iFileType, m_oFileTypes, m_optName, m_svc, deljobs::string, and type.
Referenced by DistBossServer::DistBossServer().
00113 { 00114 //Gaudi::Parsers::Catalogue* m_clientCatalogue = new Gaudi::Parsers::Catalogue; 00115 SvcCatalog* m_clientCatalogue = new SvcCatalog; 00116 00117 StatusCode sc; 00118 00119 std::vector<std::string> clients = m_svc->getClients(); 00120 for ( unsigned int i = 0; i < clients.size(); ++i ) { 00121 const std::vector<const Property*>* properties = m_svc->getProperties(clients[i]); 00122 for ( unsigned int j = 0; j < properties->size(); ++j ) { 00123 const Property* property = properties->at(j); 00124 00125 ignorePROPERTY("ApplicationMgr", "EvtMax"); 00126 00127 ignorePROPERTY("RawDataInputSvc", "InputFiles"); 00128 //ignorePROPERTY("BesRndmGenSvc", "RndmSeed"); //placeholder for simulation 00129 ignorePROPERTY("EventCnvSvc", "digiRootInputFile"); 00130 00131 ignorePROPERTY("WriteDst", "digiRootOutputFile"); 00132 ignorePROPERTY("WriteRec", "digiRootOutputFile"); 00133 //ignorePROPERTY("NTupleSvc", "Output"); //placeholder for NTupleSvc 00134 //ignorePROPERTY("THistSvc", "Output"); //placeholder for THistSvc 00135 00136 StringProperty* tmp= new StringProperty(property->name(), property->toString()); 00137 sc = m_clientCatalogue->addProperty(clients[i], tmp); 00138 if ( sc.isFailure() ) { 00139 StringProperty* tmp2 = new StringProperty(property->name(), '"'+property->toString()+'"'); 00140 m_clientCatalogue->addProperty(clients[i], tmp2); 00141 } 00142 } 00143 } 00144 00145 StringProperty* tmpservername = new StringProperty("ServerName", '"'+svrName+'"'); 00146 m_clientCatalogue->addProperty("DistBoss", tmpservername); 00147 if ( m_iFileType == 0 ) { 00148 StringProperty* tmprunmode = new StringProperty("RunMode", "3"); 00149 m_clientCatalogue->addProperty("RawDataInputSvc", tmprunmode); 00150 } 00151 //else if ( m_iFileType == 1 ) { //placeholder for simulation 00152 // m_clientCatalogue->addProperty("BesRndmGenSvc", "RunMode", "3"); 00153 //} 00154 //else if ( m_iFileType == 2 ) { 00155 // m_clientCatalogue->addProperty("EventCnvSvc", "RunMode", "3"); 00156 //} 00157 for ( unsigned int i = 0; i < m_oFileTypes.size(); ++i ) { 00158 int type = m_oFileTypes[i]; 00159 if ( type == 3 ) { 00160 m_clientCatalogue->addProperty("WriteDst", new StringProperty("RunMode", "3")); 00161 } 00162 else if ( type == 4 ) { 00163 m_clientCatalogue->addProperty("WriteRec", new StringProperty("RunMode", "3")); 00164 } 00165 //else if ( type == 5 ) { 00166 // m_clientCatalogue->addProperty("NTupleSvc", "RunMode", "3"); 00167 //} 00168 //else if ( type == 6 ) { 00169 // m_clientCatalogue->addProperty("THistSvc", "RunMode", "3"); 00170 //} 00171 } 00172 00173 std::string client_opt_name = m_optName + ".distboss_client"; 00174 std::ofstream os(client_opt_name.c_str(), std::ios::out|std::ios::trunc); 00175 if ( ! os ) { 00176 std::cout << "[JobOptionsMgr] Failed to open client_template file!" << std::endl; 00177 exit(1); 00178 } 00179 00180 m_clientCatalogue->fillStream( os ); 00181 00182 delete m_clientCatalogue; 00183 }
const std::string& JobOptionsMgr::dstFile | ( | ) | [inline] |
Definition at line 25 of file JobOptionsMgr.h.
References m_dstFile.
Referenced by DistBossServer::DistBossServer().
00025 { return m_dstFile; }
int JobOptionsMgr::evtMax | ( | ) | [inline] |
Definition at line 21 of file JobOptionsMgr.h.
References m_evtMax.
Referenced by DistBossServer::DistBossServer().
00021 { return m_evtMax; }
const Property * JobOptionsMgr::getProperty | ( | const std::string & | client, | |
const std::string & | name | |||
) | [private] |
Definition at line 185 of file JobOptionsMgr.cxx.
References genRecEmupikp::i, and m_svc.
Referenced by JobOptionsMgr().
00186 { 00187 const Property* pprop = NULL; 00188 00189 const std::vector<const Property*>* properties = m_svc->getProperties(client); 00190 if ( properties != NULL ) { 00191 for ( unsigned int i = 0; i < properties->size(); ++i ) { 00192 if ( properties->at(i)->name() == name) { 00193 pprop = properties->at(i); 00194 break; 00195 } 00196 } 00197 } 00198 00199 return pprop; 00200 }
const std::vector<std::string>& JobOptionsMgr::histOpts | ( | ) | [inline] |
const std::vector<std::string>& JobOptionsMgr::inputFiles | ( | ) | [inline] |
Definition at line 22 of file JobOptionsMgr.h.
References m_inputFiles.
Referenced by DistBossServer::DistBossServer().
00022 { return m_inputFiles; }
int JobOptionsMgr::inputType | ( | ) | [inline] |
Definition at line 20 of file JobOptionsMgr.h.
References m_iFileType.
Referenced by DistBossServer::DistBossServer().
00020 { return m_iFileType; }
const std::string& JobOptionsMgr::optName | ( | ) | [inline] |
const std::vector<int>& JobOptionsMgr::outputTypes | ( | ) | [inline] |
Definition at line 24 of file JobOptionsMgr.h.
References m_oFileTypes.
Referenced by DistBossServer::DistBossServer().
00024 { return m_oFileTypes; }
const std::string& JobOptionsMgr::recFile | ( | ) | [inline] |
Definition at line 26 of file JobOptionsMgr.h.
References m_recFile.
Referenced by DistBossServer::DistBossServer().
00026 { return m_recFile; }
const std::vector<std::string>& JobOptionsMgr::tupleOpts | ( | ) | [inline] |
std::string JobOptionsMgr::m_dstFile [private] |
int JobOptionsMgr::m_evtMax [private] |
std::vector<std::string> JobOptionsMgr::m_histOpts [private] |
int JobOptionsMgr::m_iFileType [private] |
Definition at line 44 of file JobOptionsMgr.h.
Referenced by clientOptsTemplate(), inputType(), and JobOptionsMgr().
std::vector<std::string> JobOptionsMgr::m_inputFiles [private] |
std::vector<int> JobOptionsMgr::m_oFileTypes [private] |
Definition at line 48 of file JobOptionsMgr.h.
Referenced by clientOptsTemplate(), JobOptionsMgr(), and outputTypes().
std::string JobOptionsMgr::m_optName [private] |
std::string JobOptionsMgr::m_recFile [private] |
JobOptionsSvc* JobOptionsMgr::m_svc [private] |
Definition at line 54 of file JobOptionsMgr.h.
Referenced by clientOptsTemplate(), getProperty(), JobOptionsMgr(), and ~JobOptionsMgr().
std::vector<std::string> JobOptionsMgr::m_tupleOpts [private] |