#include <JobOptionsMgr.h>
Public Member Functions | |
void | clientOptsTemplate (const std::string &svrName) |
void | clientOptsTemplate (const std::string &svrName) |
const std::string & | dstFile () |
const std::string & | dstFile () |
int | evtMax () |
int | evtMax () |
const std::vector< std::string > & | histOpts () |
const std::vector< std::string > & | histOpts () |
const std::vector< std::string > & | inputFiles () |
const std::vector< std::string > & | inputFiles () |
int | inputType () |
int | inputType () |
JobOptionsMgr (const std::string &optname) | |
JobOptionsMgr (const std::string &optname) | |
const std::string & | optName () |
const std::string & | optName () |
const std::vector< int > & | outputTypes () |
const std::vector< int > & | outputTypes () |
const std::string & | recFile () |
const std::string & | recFile () |
const std::vector< std::string > & | tupleOpts () |
const std::vector< std::string > & | tupleOpts () |
virtual | ~JobOptionsMgr () |
virtual | ~JobOptionsMgr () |
Private Member Functions | |
const Property * | getProperty (const std::string &client, const std::string &name) |
const Property * | getProperty (const std::string &client, const std::string &name) |
JobOptionsMgr () | |
JobOptionsMgr () | |
Private Attributes | |
std::string | m_dstFile |
int | m_evtMax |
std::vector< std::string > | m_histOpts |
std::vector< std::string > | m_histOpts |
int | m_iFileType |
std::vector< std::string > | m_inputFiles |
std::vector< std::string > | m_inputFiles |
std::vector< int > | m_oFileTypes |
std::vector< int > | m_oFileTypes |
std::string | m_optName |
std::string | m_recFile |
JobOptionsSvc * | m_svc |
JobOptionsSvc * | m_svc |
std::vector< std::string > | m_tupleOpts |
std::vector< std::string > | m_tupleOpts |
|
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 }
|
|
00104 { 00105 StatusCode sc = m_svc->finalize(); 00106 CheckSTATUS("Failed to finalize JobOptionsSvc!"); 00107 }
|
|
|
|
|
|
|
|
|
|
|
|
00113 { 00114 Gaudi::Parsers::Catalogue* m_clientCatalogue = new Gaudi::Parsers::Catalogue; 00115 00116 StatusCode sc; 00117 00118 std::vector<std::string> clients = m_svc->getClients(); 00119 for ( unsigned int i = 0; i < clients.size(); ++i ) { 00120 const std::vector<const Property*>* properties = m_svc->getProperties(clients[i]); 00121 for ( unsigned int j = 0; j < properties->size(); ++j ) { 00122 const Property* property = properties->at(j); 00123 00124 ignorePROPERTY("ApplicationMgr", "EvtMax"); 00125 00126 ignorePROPERTY("RawDataInputSvc", "InputFiles"); 00127 //ignorePROPERTY("BesRndmGenSvc", "RndmSeed"); //placeholder for simulation 00128 ignorePROPERTY("EventCnvSvc", "digiRootInputFile"); 00129 00130 ignorePROPERTY("WriteDst", "digiRootOutputFile"); 00131 ignorePROPERTY("WriteRec", "digiRootOutputFile"); 00132 //ignorePROPERTY("NTupleSvc", "Output"); //placeholder for NTupleSvc 00133 //ignorePROPERTY("THistSvc", "Output"); //placeholder for THistSvc 00134 00135 sc = m_clientCatalogue->addProperty(clients[i], property->name(), property->toString()); 00136 if ( sc.isFailure() ) { 00137 m_clientCatalogue->addProperty(clients[i], property->name(), '"'+property->toString()+'"'); 00138 } 00139 } 00140 } 00141 00142 m_clientCatalogue->addProperty("DistBoss", "ServerName", '"'+svrName+'"'); 00143 if ( m_iFileType == 0 ) { 00144 m_clientCatalogue->addProperty("RawDataInputSvc", "RunMode", "3"); 00145 } 00146 //else if ( m_iFileType == 1 ) { //placeholder for simulation 00147 // m_clientCatalogue->addProperty("BesRndmGenSvc", "RunMode", "3"); 00148 //} 00149 //else if ( m_iFileType == 2 ) { 00150 // m_clientCatalogue->addProperty("EventCnvSvc", "RunMode", "3"); 00151 //} 00152 for ( unsigned int i = 0; i < m_oFileTypes.size(); ++i ) { 00153 int type = m_oFileTypes[i]; 00154 if ( type == 3 ) { 00155 m_clientCatalogue->addProperty("WriteDst", "RunMode", "3"); 00156 } 00157 else if ( type == 4 ) { 00158 m_clientCatalogue->addProperty("WriteRec", "RunMode", "3"); 00159 } 00160 //else if ( type == 5 ) { 00161 // m_clientCatalogue->addProperty("NTupleSvc", "RunMode", "3"); 00162 //} 00163 //else if ( type == 6 ) { 00164 // m_clientCatalogue->addProperty("THistSvc", "RunMode", "3"); 00165 //} 00166 } 00167 00168 std::string client_opt_name = m_optName + ".distboss_client"; 00169 std::ofstream os(client_opt_name.c_str(), std::ios::out|std::ios::trunc); 00170 if ( ! os ) { 00171 std::cout << "[JobOptionsMgr] Failed to open client_template file!" << std::endl; 00172 exit(1); 00173 } 00174 00175 m_clientCatalogue->fillStream( os ); 00176 00177 delete m_clientCatalogue; 00178 }
|
|
00025 { return m_dstFile; }
|
|
00025 { return m_dstFile; }
|
|
00021 { return m_evtMax; }
|
|
00021 { return m_evtMax; }
|
|
|
|
00181 { 00182 const Property* pprop = NULL; 00183 00184 const std::vector<const Property*>* properties = m_svc->getProperties(client); 00185 if ( properties != NULL ) { 00186 for ( unsigned int i = 0; i < properties->size(); ++i ) { 00187 if ( properties->at(i)->name() == name) { 00188 pprop = properties->at(i); 00189 break; 00190 } 00191 } 00192 } 00193 00194 return pprop; 00195 }
|
|
00028 { return m_histOpts; }
|
|
00028 { return m_histOpts; }
|
|
00022 { return m_inputFiles; }
|
|
00022 { return m_inputFiles; }
|
|
00020 { return m_iFileType; }
|
|
00020 { return m_iFileType; }
|
|
00018 { return m_optName; }
|
|
00018 { return m_optName; }
|
|
00024 { return m_oFileTypes; }
|
|
00024 { return m_oFileTypes; }
|
|
00026 { return m_recFile; }
|
|
00026 { return m_recFile; }
|
|
00027 { return m_tupleOpts; }
|
|
00027 { return m_tupleOpts; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|