ATLAS Offline Software
Loading...
Searching...
No Matches
JobConfig Struct Reference
Collaboration diagram for JobConfig:

Public Types

enum  Format {
  UNDEF =0x00 , DB =0x01 , COOL =0x02 , XML =0x04 ,
  JSON =0x08
}
enum  ETriggerLevel { LVL1 = 0 , HLT = 1 , NONE = 2 }

Public Member Functions

int parseProgramOptions (int argc, char *argv[])
void PrintSetup ()
string CheckForCompleteSetup ()
void PrintSetup (std::ostream &log, std::ostream &(*lineend)(std::ostream &os))
void parseProgramOptions (int argc, char *argv[])
unsigned int getKey (unsigned int which)
unsigned int getKey2 (unsigned int which)

Public Attributes

string cooldb {"COOLONL_TRIGGER/CONDBR2"}
unsigned int run {0}
unsigned int lb {0}
unsigned int lbend {0}
bool openended {true}
bool fix {false}
bool extendedSelection {false}
string triggerdb {"TRIGGERDBR2"}
int smk {0}
int bgsk {0}
int l1psk {0}
int hltpsk {0}
string release {""}
bool help {false}
int printlevel {-1}
MSGTC::Level outputlevel {MSGTC::WARNING}
vector< stringerror
string coolConnection {""}
std::vector< std::string > inpar
std::vector< std::string > inpar2
std::vector< std::string > outpar
Format input {UNDEF}
Format input2 {UNDEF}
unsigned int output {UNDEF}
string db {""}
string db2 {""}
vector< unsigned int > keys
vector< unsigned int > keys2
string outBase {""}
string l1JsonOutFile {"L1Menu.json"}
string bgkJsonOutFile {"BunchGroupSet.json"}
string l1PSJsonOutFile { "L1PrescalesSet.json" }
string hltJsonOutFile { "HLTMenu.json" }
string hltPSJsonOutFile { "HLTPrescalesSet.json" }
string coolInputConnection { "" }
string coolOutputConnection { "" }
unsigned int coolOutputRunNr { 0 }
bool jo {false}
bool fw {false}
string logFileName {""}
bool merge = { true }

Detailed Description

Definition at line 80 of file CoolFix.cxx.

Member Enumeration Documentation

◆ ETriggerLevel

Enumerator
LVL1 
HLT 
NONE 

Definition at line 106 of file ReadWrite.cxx.

106{ LVL1 = 0, HLT = 1, NONE = 2 };

◆ Format

Enumerator
UNDEF 
DB 
COOL 
XML 
JSON 

Definition at line 105 of file ReadWrite.cxx.

105{ UNDEF=0x00, DB=0x01, COOL=0x02, XML=0x04, JSON=0x08 };

Member Function Documentation

◆ CheckForCompleteSetup()

string JobConfig::CheckForCompleteSetup ( )

Definition at line 298 of file ReadWrite.cxx.

298 {
299 if(input==UNDEF)
300 return "Use argument '-i' to specify input source and check that the input is specified correctly";
301 if( input == DB ) {
302 if( db == "" )
303 return "No TriggerDB connection string specified";
304 if( keys.size()==0 )
305 return "No configuration key(s) specified";
306 }
307 if( input2 == DB ) {
308 if( db2 == "" )
309 return "No TriggerDB connection string specified for comparison, use option '--db2'";
310 if( keys2.size()==0 )
311 return "No smk specified for comparison, use option '--dbsmk2'";
312 }
313 return "";
314}
vector< unsigned int > keys2
Format input
Format input2
vector< unsigned int > keys
string db2
string db

◆ getKey()

unsigned int JobConfig::getKey ( unsigned int which)
inline

Definition at line 144 of file ReadWrite.cxx.

144{ return keys.size()>which?keys[which]:0; }
which(filename, env=os.environ)
UNIX-style which ---------------------------------------------------------—.
Definition unixtools.py:39

◆ getKey2()

unsigned int JobConfig::getKey2 ( unsigned int which)
inline

Definition at line 146 of file ReadWrite.cxx.

146{ return keys2.size()>which?keys2[which]:0; }

◆ parseProgramOptions() [1/2]

void JobConfig::parseProgramOptions ( int argc,
char * argv[] )

Definition at line 113 of file CoolFix.cxx.

113 {
114 std::string currentPar("");
115 std::string listofUnknownParameters = "";
116 uint runargpos(0);
117 for(int i=1; i<argc; i++) {
118 string currInput(argv[i]);
119 int fchar = currInput.find_first_not_of('-');
120 string stripped = currInput.substr(fchar);
121 bool isParam = (fchar!=0); // string starts with a '-', so it is a parameter name
122
123 if(isParam)
124 if( ! (stripped == "c" || stripped == "cooldb" ||
125 stripped == "r" || stripped == "run" ||
126 stripped == "l" || stripped == "log" ||
127 stripped == "p" || stripped == "print" ||
128 stripped == "f" || stripped == "fix" ||
129 stripped == "e" || stripped == "extended" ||
130 stripped == "triggerdb" ||
131 stripped == "release" ||
132 stripped == "h" || stripped == "help" ||
133 stripped == "v" || stripped == "loglevel") ) {
134 listofUnknownParameters += " " + currInput;
135 continue;
136 }
137
138 if(isParam) {
139 currentPar = "";
140 if(stripped == "h" || stripped == "help" ) { help = true; continue; }
141 if(stripped == "f" || stripped == "fix") { fix = true; continue; }
142 if(stripped == "e" || stripped == "extended") { extendedSelection = true; continue; }
143 currentPar = std::move(stripped);
144 } else {
145 if(currentPar == "c" || currentPar == "cooldb") { cooldb = std::move(stripped); currentPar=""; continue; }
146 if(currentPar == "r" || currentPar == "run") {
147 unsigned int val = static_cast<unsigned int>(std::stoul(stripped));
148 switch(runargpos) {
149 case 0:
150 run = val;
151 break;
152 case 1:
153 lb = val;
154 break;
155 case 2:
156 lbend = val;
157 openended = false;
158 break;
159 }
160 runargpos++;
161 continue;
162 }
163 if(currentPar == "triggerdb") { triggerdb = std::move(stripped); continue; }
164 if(currentPar == "release") { release = std::move(stripped); continue; }
165 if(currentPar == "p" || currentPar == "print") { printlevel = std::stoi(stripped); currentPar=""; continue; }
166 if(currentPar == "v" || currentPar == "loglevel") {
167 if("NIL" == stripped ) { outputlevel = MSGTC::NIL; }
168 else if("VERBOSE" == stripped ) { outputlevel = MSGTC::VERBOSE; }
169 else if("DEBUG" == stripped ) { outputlevel = MSGTC::DEBUG; }
170 else if("INFO" == stripped ) { outputlevel = MSGTC::INFO; }
171 else if("WARNING" == stripped ) { outputlevel = MSGTC::WARNING; }
172 else if("ERROR" == stripped ) { outputlevel = MSGTC::ERROR; }
173 else if("FATAL" == stripped ) { outputlevel = MSGTC::FATAL; }
174 else if("ALWAYS" == stripped ) { outputlevel = MSGTC::ALWAYS; }
175 else {
176 error.push_back("Unknown output level: " + stripped + ". Must be one of NIL, VERBOSE, DEBUG, INFO, WARNING, ERROR, FATAL, ALWAYS");
177 }
178 currentPar="";
179 continue;
180 }
181 }
182 }
183 if(listofUnknownParameters!="")
184 error.push_back("Unknown parameter(s): " + listofUnknownParameters);
185
186 if(run==0)
187 error.push_back("No run specified, use '--run <run>' option");
188
189
190 {
191 string db = cooldb;
192 string dbname = "CONDBR2";
193 size_t slashpos = cooldb.find('/');
194 if(slashpos != string::npos) {
195 db = cooldb.substr(0,slashpos);
196 dbname = cooldb.substr(slashpos+1);
197 }
198 if(db.find('.') != string::npos) {
199 coolConnection = "sqlite://;schema="+db+";dbname=" + dbname;
200 } else {
201 coolConnection = db + "/" + dbname;
202 }
203 }
204
205 if(help) {
206 printhelp(cout, endl);
207 return 0;
208 }
209 if(error.size()!=0) {
210 for(const string& e: error)
211 cerr << e << endl;
212 printhelp(cout, endl);
213 return 1;
214 }
215
216 return -1;
217}
unsigned int uint
void printhelp(std::ostream &o, std::ostream &(*lineend)(std::ostream &os))
Definition ReadWrite.cxx:63
string release
Definition CoolFix.cxx:96
string triggerdb
Definition CoolFix.cxx:91
string coolConnection
Definition CoolFix.cxx:104
bool openended
Definition CoolFix.cxx:86
unsigned int run
Definition CoolFix.cxx:83
MSGTC::Level outputlevel
Definition CoolFix.cxx:100
unsigned int lbend
Definition CoolFix.cxx:85
bool fix
Definition CoolFix.cxx:88
bool extendedSelection
Definition CoolFix.cxx:89
unsigned int lb
Definition CoolFix.cxx:84
vector< string > error
Definition CoolFix.cxx:102
bool help
Definition CoolFix.cxx:98
string cooldb
Definition CoolFix.cxx:82
int printlevel
Definition CoolFix.cxx:99

◆ parseProgramOptions() [2/2]

void JobConfig::parseProgramOptions ( int argc,
char * argv[] )

◆ PrintSetup() [1/2]

void JobConfig::PrintSetup ( )

Definition at line 222 of file CoolFix.cxx.

222 {
223 cout << "========================================" << endl;
224 cout << "JOB SETUP: " << endl;
225 cout << "----------" << endl;
226 cout << " Run : " << run << endl;
227 cout << " LB : " << lb << " - " << lbend << endl;
228 cout << " Cool DB : " << coolConnection << endl;
229 cout << " Trigger database : " << triggerdb << endl;
230 cout << " Fix flag : " << (fix ? "yes" : "no") << endl;
231
232 if( printlevel>=0)
233 cout << " Print menu detail : " << printlevel << endl;
234 cout << "========================================" << endl;
235
236}

◆ PrintSetup() [2/2]

void JobConfig::PrintSetup ( std::ostream & log,
std::ostream &(* lineend )(std::ostream &os) )

Definition at line 318 of file ReadWrite.cxx.

318 {
319 log << "========================================" << lineend;
320 log << "JOB SETUP: " << (input==DB?"DB":"COOL");
321 if(output!=UNDEF)
322 log << " --> " << (output==COOL?"COOL":"JSON");
323 log << lineend;
324 log << "----------" << lineend;
325 log << " Input : ";
326 for(const string& s: inpar) log << s << ", ";
327 log << lineend;
328 if( input2 != UNDEF ) {
329 log << " Input for comparison: ";
330 for(const string& s: inpar2) log << s << ", ";
331 log << lineend;
332 }
333 if( output != UNDEF ) {
334 log << " Output : ";
335 if( output&COOL ) {
337 if(coolOutputRunNr==0) { log << ", infinite IOV"; } else { log << ", run nr " << coolOutputRunNr; }
338 }
339 log << lineend;
340 }
341 if( printlevel>=0)
342 log << " Print menu detail : " << printlevel << lineend;
343 log << "========================================" << lineend;
344
345}
std::vector< std::string > inpar2
string coolOutputConnection
std::vector< std::string > inpar
unsigned int coolOutputRunNr
unsigned int output

Member Data Documentation

◆ bgkJsonOutFile

string JobConfig::bgkJsonOutFile {"BunchGroupSet.json"}

Definition at line 118 of file ReadWrite.cxx.

118{"BunchGroupSet.json"};

◆ bgsk

int JobConfig::bgsk {0}

Definition at line 93 of file CoolFix.cxx.

93{0};

◆ coolConnection

string JobConfig::coolConnection {""}

Definition at line 104 of file CoolFix.cxx.

104{""};

◆ cooldb

string JobConfig::cooldb {"COOLONL_TRIGGER/CONDBR2"}

Definition at line 82 of file CoolFix.cxx.

82{"COOLONL_TRIGGER/CONDBR2"};

◆ coolInputConnection

string JobConfig::coolInputConnection { "" }

Definition at line 123 of file ReadWrite.cxx.

123{ "" };

◆ coolOutputConnection

string JobConfig::coolOutputConnection { "" }

Definition at line 124 of file ReadWrite.cxx.

124{ "" };

◆ coolOutputRunNr

unsigned int JobConfig::coolOutputRunNr { 0 }

Definition at line 125 of file ReadWrite.cxx.

125{ 0 };

◆ db

string JobConfig::db {""}

Definition at line 113 of file ReadWrite.cxx.

113{""}, db2{""};

◆ db2

string JobConfig::db2 {""}

Definition at line 113 of file ReadWrite.cxx.

113{""}, db2{""};

◆ error

vector< string > JobConfig::error

Definition at line 102 of file CoolFix.cxx.

◆ extendedSelection

bool JobConfig::extendedSelection {false}

Definition at line 89 of file CoolFix.cxx.

89{false}; // if true also allows fixing of MV folders

◆ fix

bool JobConfig::fix {false}

Definition at line 88 of file CoolFix.cxx.

88{false};

◆ fw

bool JobConfig::fw {false}

Definition at line 132 of file ReadWrite.cxx.

132{false};

◆ help

bool JobConfig::help {false}

Definition at line 98 of file CoolFix.cxx.

98{false};

◆ hltJsonOutFile

string JobConfig::hltJsonOutFile { "HLTMenu.json" }

Definition at line 120 of file ReadWrite.cxx.

120{ "HLTMenu.json" };

◆ hltPSJsonOutFile

string JobConfig::hltPSJsonOutFile { "HLTPrescalesSet.json" }

Definition at line 121 of file ReadWrite.cxx.

121{ "HLTPrescalesSet.json" };

◆ hltpsk

int JobConfig::hltpsk {0}

Definition at line 95 of file CoolFix.cxx.

95{0};

◆ inpar

std::vector<std::string> JobConfig::inpar

Definition at line 108 of file ReadWrite.cxx.

◆ inpar2

std::vector<std::string> JobConfig::inpar2

Definition at line 108 of file ReadWrite.cxx.

◆ input

Format JobConfig::input {UNDEF}

Definition at line 110 of file ReadWrite.cxx.

110{UNDEF};

◆ input2

Format JobConfig::input2 {UNDEF}

Definition at line 111 of file ReadWrite.cxx.

111{UNDEF};

◆ jo

bool JobConfig::jo {false}

Definition at line 131 of file ReadWrite.cxx.

131{false};

◆ keys

vector<unsigned int> JobConfig::keys

Definition at line 114 of file ReadWrite.cxx.

◆ keys2

vector<unsigned int> JobConfig::keys2

Definition at line 114 of file ReadWrite.cxx.

◆ l1JsonOutFile

string JobConfig::l1JsonOutFile {"L1Menu.json"}

Definition at line 117 of file ReadWrite.cxx.

117{"L1Menu.json"};

◆ l1PSJsonOutFile

string JobConfig::l1PSJsonOutFile { "L1PrescalesSet.json" }

Definition at line 119 of file ReadWrite.cxx.

119{ "L1PrescalesSet.json" };

◆ l1psk

int JobConfig::l1psk {0}

Definition at line 94 of file CoolFix.cxx.

94{0};

◆ lb

unsigned int JobConfig::lb {0}

Definition at line 84 of file CoolFix.cxx.

84{0};

◆ lbend

unsigned int JobConfig::lbend {0}

Definition at line 85 of file CoolFix.cxx.

85{0};

◆ logFileName

string JobConfig::logFileName {""}

Definition at line 133 of file ReadWrite.cxx.

133{""};

◆ merge

bool JobConfig::merge = { true }

Definition at line 134 of file ReadWrite.cxx.

134{ true };

◆ openended

bool JobConfig::openended {true}

Definition at line 86 of file CoolFix.cxx.

86{true};

◆ outBase

string JobConfig::outBase {""}

Definition at line 115 of file ReadWrite.cxx.

115{""};

◆ outpar

std::vector<std::string> JobConfig::outpar

Definition at line 108 of file ReadWrite.cxx.

◆ output

unsigned int JobConfig::output {UNDEF}

Definition at line 112 of file ReadWrite.cxx.

112{UNDEF};

◆ outputlevel

MSGTC::Level JobConfig::outputlevel {MSGTC::WARNING}

Definition at line 100 of file CoolFix.cxx.

◆ printlevel

int JobConfig::printlevel {-1}

Definition at line 99 of file CoolFix.cxx.

99{-1};

◆ release

string JobConfig::release {""}

Definition at line 96 of file CoolFix.cxx.

96{""};

◆ run

unsigned int JobConfig::run {0}

Definition at line 83 of file CoolFix.cxx.

83{0};

◆ smk

int JobConfig::smk {0}

Definition at line 92 of file CoolFix.cxx.

92{0};

◆ triggerdb

string JobConfig::triggerdb {"TRIGGERDBR2"}

Definition at line 91 of file CoolFix.cxx.

91{"TRIGGERDBR2"};

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