Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

JobOptionsMgr Class Reference

#include <JobOptionsMgr.h>

List of all members.

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


Constructor & Destructor Documentation

JobOptionsMgr::JobOptionsMgr const std::string &  optname  ) 
 

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]
 

00104 {
00105    StatusCode sc = m_svc->finalize();
00106    CheckSTATUS("Failed to finalize JobOptionsSvc!");
00107 }

JobOptionsMgr::JobOptionsMgr  )  [private]
 

JobOptionsMgr::JobOptionsMgr const std::string &  optname  ) 
 

virtual JobOptionsMgr::~JobOptionsMgr  )  [virtual]
 

JobOptionsMgr::JobOptionsMgr  )  [private]
 


Member Function Documentation

void JobOptionsMgr::clientOptsTemplate const std::string &  svrName  ) 
 

void JobOptionsMgr::clientOptsTemplate const std::string &  svrName  ) 
 

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 }

const std::string& JobOptionsMgr::dstFile  )  [inline]
 

00025 { return m_dstFile; }

const std::string& JobOptionsMgr::dstFile  )  [inline]
 

00025 { return m_dstFile; }

int JobOptionsMgr::evtMax  )  [inline]
 

00021 { return m_evtMax; }

int JobOptionsMgr::evtMax  )  [inline]
 

00021 { return m_evtMax; }

const Property* JobOptionsMgr::getProperty const std::string &  client,
const std::string &  name
[private]
 

const Property * JobOptionsMgr::getProperty const std::string &  client,
const std::string &  name
[private]
 

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 }

const std::vector<std::string>& JobOptionsMgr::histOpts  )  [inline]
 

00028 { return m_histOpts; }

const std::vector<std::string>& JobOptionsMgr::histOpts  )  [inline]
 

00028 { return m_histOpts; }

const std::vector<std::string>& JobOptionsMgr::inputFiles  )  [inline]
 

00022 { return m_inputFiles; }

const std::vector<std::string>& JobOptionsMgr::inputFiles  )  [inline]
 

00022 { return m_inputFiles; }

int JobOptionsMgr::inputType  )  [inline]
 

00020 { return m_iFileType; }

int JobOptionsMgr::inputType  )  [inline]
 

00020 { return m_iFileType; }

const std::string& JobOptionsMgr::optName  )  [inline]
 

00018 { return m_optName; }

const std::string& JobOptionsMgr::optName  )  [inline]
 

00018 { return m_optName; }

const std::vector<int>& JobOptionsMgr::outputTypes  )  [inline]
 

00024 { return m_oFileTypes; }

const std::vector<int>& JobOptionsMgr::outputTypes  )  [inline]
 

00024 { return m_oFileTypes; }

const std::string& JobOptionsMgr::recFile  )  [inline]
 

00026 { return m_recFile; }

const std::string& JobOptionsMgr::recFile  )  [inline]
 

00026 { return m_recFile; }

const std::vector<std::string>& JobOptionsMgr::tupleOpts  )  [inline]
 

00027 { return m_tupleOpts; }

const std::vector<std::string>& JobOptionsMgr::tupleOpts  )  [inline]
 

00027 { return m_tupleOpts; }


Member Data Documentation

std::string JobOptionsMgr::m_dstFile [private]
 

int JobOptionsMgr::m_evtMax [private]
 

std::vector<std::string> JobOptionsMgr::m_histOpts [private]
 

std::vector<std::string> JobOptionsMgr::m_histOpts [private]
 

int JobOptionsMgr::m_iFileType [private]
 

std::vector<std::string> JobOptionsMgr::m_inputFiles [private]
 

std::vector<std::string> JobOptionsMgr::m_inputFiles [private]
 

std::vector<int> JobOptionsMgr::m_oFileTypes [private]
 

std::vector<int> JobOptionsMgr::m_oFileTypes [private]
 

std::string JobOptionsMgr::m_optName [private]
 

std::string JobOptionsMgr::m_recFile [private]
 

JobOptionsSvc* JobOptionsMgr::m_svc [private]
 

JobOptionsSvc* JobOptionsMgr::m_svc [private]
 

std::vector<std::string> JobOptionsMgr::m_tupleOpts [private]
 

std::vector<std::string> JobOptionsMgr::m_tupleOpts [private]
 


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 16:19:01 2011 for BOSS6.5.5 by  doxygen 1.3.9.1