BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
JobOptionsMgr Class Reference

#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)
 

Detailed Description

Definition at line 11 of file JobOptionsMgr.h.

Constructor & Destructor Documentation

◆ JobOptionsMgr()

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

Definition at line 29 of file JobOptionsMgr.cxx.

30 : m_optName(optname),
31 m_iFileType(-1),
32 m_evtMax(10),
33 m_dstFile("digi.root"),
34 m_recFile("digi.root")
35{
36 IService* svc;
37 StatusCode sc = Gaudi::svcLocator()->service("JobOptionsSvc", svc);
38 CheckSTATUS("Failed to retrieve the JobOptionsSvc");
39 m_svc = dynamic_cast<JobOptionsSvc*>(svc);
40
41 sc = m_svc->setProperty( StringProperty("TYPE", "FILE") );
42 sc = m_svc->setProperty( StringProperty("PATH", optname) );
43 CheckSTATUS("Failed to set the property of DistBossServer");
44
45 sc = m_svc->initialize();
46 CheckSTATUS("Failed to initialize JobOptionsSvc");
47
48 const Property* pprop = getProperty("ApplicationMgr", "EvtMax");
49 if ( pprop != NULL ) {
50 MyPARSE( m_evtMax );
51 }
52
53 if ( (pprop = getProperty("RawDataInputSvc", "InputFiles")) != NULL ) {
54 m_iFileType = 0;
55 MyPARSE( m_inputFiles );
56 }
57 else if ( (pprop = getProperty("BesSim", "TDSFlag")) != NULL ) {
58 m_iFileType = 1;
59 // to be continued ...
60 }
61 else if ( (pprop = getProperty("EventCnvSvc", "digiRootInputFile")) != NULL ) {
62 m_iFileType = 2;
63 MyPARSE( m_inputFiles );
64 }
65 else {
66 std::cout << "[JobOptionsMgr] Unknown Job Type!" << std::endl;
67 exit(1);
68 }
69
70 if ( (pprop = getProperty("EventPreSelect","WriteDst")) != NULL ) {
71 bool status;
72 MyPARSE(status);
73 if ( status ) {
74 m_oFileTypes.push_back(3);
75 if ( (pprop = getProperty("WriteDst", "digiRootOutputFile")) != NULL ) {
76 MyPARSE( m_dstFile );
77 }
78 }
79 }
80
81 if ( (pprop = getProperty("EventPreSelect","WriteRec")) != NULL ) {
82 bool status;
83 MyPARSE(status);
84 if ( status ) {
85 m_oFileTypes.push_back(4);
86 if ( (pprop = getProperty("WriteRec", "digiRootOutputFile")) != NULL ) {
87 MyPARSE( m_recFile );
88 }
89 }
90 }
91
92 if ( (pprop = getProperty("NTupleSvc", "Output")) != NULL ) {
93 m_oFileTypes.push_back(5);
94 MyPARSE( m_tupleOpts );
95 }
96
97 if ( (pprop = getProperty("THistSvc", "Output")) != NULL ) {
98 m_oFileTypes.push_back(6);
99 MyPARSE( m_histOpts);
100 }
101}
#define CheckSTATUS(msg)
#define MyPARSE(var)

Referenced by JobOptionsMgr().

◆ ~JobOptionsMgr()

JobOptionsMgr::~JobOptionsMgr ( )
virtual

Definition at line 103 of file JobOptionsMgr.cxx.

104{
105 StatusCode sc = m_svc->finalize();
106 CheckSTATUS("Failed to finalize JobOptionsSvc!");
107}

Member Function Documentation

◆ clientOptsTemplate()

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

Definition at line 112 of file JobOptionsMgr.cxx.

113{
114 Gaudi::Parsers::Catalogue* m_clientCatalogue = new Gaudi::Parsers::Catalogue;
115
116 StatusCode sc;
117
118 std::vector<std::string> clients = m_svc->getClients();
119 for ( unsigned int i = 0; i < clients.size(); ++i ) {
120 const std::vector<const Property*>* properties = m_svc->getProperties(clients[i]);
121 for ( unsigned int j = 0; j < properties->size(); ++j ) {
122 const Property* property = properties->at(j);
123
124 ignorePROPERTY("ApplicationMgr", "EvtMax");
125
126 ignorePROPERTY("RawDataInputSvc", "InputFiles");
127 //ignorePROPERTY("BesRndmGenSvc", "RndmSeed"); //placeholder for simulation
128 ignorePROPERTY("EventCnvSvc", "digiRootInputFile");
129
130 ignorePROPERTY("WriteDst", "digiRootOutputFile");
131 ignorePROPERTY("WriteRec", "digiRootOutputFile");
132 //ignorePROPERTY("NTupleSvc", "Output"); //placeholder for NTupleSvc
133 //ignorePROPERTY("THistSvc", "Output"); //placeholder for THistSvc
134
135 sc = m_clientCatalogue->addProperty(clients[i], property->name(), property->toString());
136 if ( sc.isFailure() ) {
137 m_clientCatalogue->addProperty(clients[i], property->name(), '"'+property->toString()+'"');
138 }
139 }
140 }
141
142 m_clientCatalogue->addProperty("DistBoss", "ServerName", '"'+svrName+'"');
143 if ( m_iFileType == 0 ) {
144 m_clientCatalogue->addProperty("RawDataInputSvc", "RunMode", "3");
145 }
146 //else if ( m_iFileType == 1 ) { //placeholder for simulation
147 // m_clientCatalogue->addProperty("BesRndmGenSvc", "RunMode", "3");
148 //}
149 //else if ( m_iFileType == 2 ) {
150 // m_clientCatalogue->addProperty("EventCnvSvc", "RunMode", "3");
151 //}
152 for ( unsigned int i = 0; i < m_oFileTypes.size(); ++i ) {
153 int type = m_oFileTypes[i];
154 if ( type == 3 ) {
155 m_clientCatalogue->addProperty("WriteDst", "RunMode", "3");
156 }
157 else if ( type == 4 ) {
158 m_clientCatalogue->addProperty("WriteRec", "RunMode", "3");
159 }
160 //else if ( type == 5 ) {
161 // m_clientCatalogue->addProperty("NTupleSvc", "RunMode", "3");
162 //}
163 //else if ( type == 6 ) {
164 // m_clientCatalogue->addProperty("THistSvc", "RunMode", "3");
165 //}
166 }
167
168 std::string client_opt_name = m_optName + ".distboss_client";
169 std::ofstream os(client_opt_name.c_str(), std::ios::out|std::ios::trunc);
170 if ( ! os ) {
171 std::cout << "[JobOptionsMgr] Failed to open client_template file!" << std::endl;
172 exit(1);
173 }
174
175 m_clientCatalogue->fillStream( os );
176
177 delete m_clientCatalogue;
178}
#define ignorePROPERTY(client, pname)

Referenced by DistBossServer::DistBossServer().

◆ dstFile()

const std::string & JobOptionsMgr::dstFile ( )
inline

Definition at line 25 of file JobOptionsMgr.h.

25{ return m_dstFile; }

Referenced by DistBossServer::DistBossServer().

◆ evtMax()

int JobOptionsMgr::evtMax ( )
inline

Definition at line 21 of file JobOptionsMgr.h.

21{ return m_evtMax; }

Referenced by DistBossServer::DistBossServer().

◆ histOpts()

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

Definition at line 28 of file JobOptionsMgr.h.

28{ return m_histOpts; }

◆ inputFiles()

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

Definition at line 22 of file JobOptionsMgr.h.

22{ return m_inputFiles; }

Referenced by DistBossServer::DistBossServer().

◆ inputType()

int JobOptionsMgr::inputType ( )
inline

Definition at line 20 of file JobOptionsMgr.h.

20{ return m_iFileType; }

Referenced by DistBossServer::DistBossServer().

◆ optName()

const std::string & JobOptionsMgr::optName ( )
inline

Definition at line 18 of file JobOptionsMgr.h.

18{ return m_optName; }

◆ outputTypes()

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

Definition at line 24 of file JobOptionsMgr.h.

24{ return m_oFileTypes; }

Referenced by DistBossServer::DistBossServer().

◆ recFile()

const std::string & JobOptionsMgr::recFile ( )
inline

Definition at line 26 of file JobOptionsMgr.h.

26{ return m_recFile; }

Referenced by DistBossServer::DistBossServer().

◆ tupleOpts()

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

Definition at line 27 of file JobOptionsMgr.h.

27{ return m_tupleOpts; }

The documentation for this class was generated from the following files: