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 81 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 302 of file ReadWrite.cxx.

302 {
303 if(input==UNDEF)
304 return "Use argument '-i' to specify input source and check that the input is specified correctly";
305 if( input == DB ) {
306 if( db == "" )
307 return "No TriggerDB connection string specified";
308 if( keys.size()==0 )
309 return "No configuration key(s) specified";
310 }
311 if( input2 == DB ) {
312 if( db2 == "" )
313 return "No TriggerDB connection string specified for comparison, use option '--db2'";
314 if( keys2.size()==0 )
315 return "No smk specified for comparison, use option '--dbsmk2'";
316 }
317 return "";
318}
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 114 of file CoolFix.cxx.

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

◆ parseProgramOptions() [2/2]

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

◆ PrintSetup() [1/2]

void JobConfig::PrintSetup ( )

Definition at line 223 of file CoolFix.cxx.

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

◆ PrintSetup() [2/2]

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

Definition at line 322 of file ReadWrite.cxx.

322 {
323 log << "========================================" << lineend;
324 log << "JOB SETUP: " << (input==DB?"DB":"COOL");
325 if(output!=UNDEF)
326 log << " --> " << (output==COOL?"COOL":"JSON");
327 log << lineend;
328 log << "----------" << lineend;
329 log << " Input : ";
330 for(const string& s: inpar) log << s << ", ";
331 log << lineend;
332 if( input2 != UNDEF ) {
333 log << " Input for comparison: ";
334 for(const string& s: inpar2) log << s << ", ";
335 log << lineend;
336 }
337 if( output != UNDEF ) {
338 log << " Output : ";
339 if( output&COOL ) {
341 if(coolOutputRunNr==0) { log << ", infinite IOV"; } else { log << ", run nr " << coolOutputRunNr; }
342 }
343 log << lineend;
344 }
345 if( printlevel>=0)
346 log << " Print menu detail : " << printlevel << lineend;
347 log << "========================================" << lineend;
348
349}
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 94 of file CoolFix.cxx.

94{0};

◆ coolConnection

string JobConfig::coolConnection {""}

Definition at line 105 of file CoolFix.cxx.

105{""};

◆ cooldb

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

Definition at line 83 of file CoolFix.cxx.

83{"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 103 of file CoolFix.cxx.

◆ extendedSelection

bool JobConfig::extendedSelection {false}

Definition at line 90 of file CoolFix.cxx.

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

◆ fix

bool JobConfig::fix {false}

Definition at line 89 of file CoolFix.cxx.

89{false};

◆ fw

bool JobConfig::fw {false}

Definition at line 132 of file ReadWrite.cxx.

132{false};

◆ help

bool JobConfig::help {false}

Definition at line 99 of file CoolFix.cxx.

99{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 96 of file CoolFix.cxx.

96{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 95 of file CoolFix.cxx.

95{0};

◆ lb

unsigned int JobConfig::lb {0}

Definition at line 85 of file CoolFix.cxx.

85{0};

◆ lbend

unsigned int JobConfig::lbend {0}

Definition at line 86 of file CoolFix.cxx.

86{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 87 of file CoolFix.cxx.

87{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 101 of file CoolFix.cxx.

◆ printlevel

int JobConfig::printlevel {-1}

Definition at line 100 of file CoolFix.cxx.

100{-1};

◆ release

string JobConfig::release {""}

Definition at line 97 of file CoolFix.cxx.

97{""};

◆ run

unsigned int JobConfig::run {0}

Definition at line 84 of file CoolFix.cxx.

84{0};

◆ smk

int JobConfig::smk {0}

Definition at line 93 of file CoolFix.cxx.

93{0};

◆ triggerdb

string JobConfig::triggerdb {"TRIGGERDBR2"}

Definition at line 92 of file CoolFix.cxx.

92{"TRIGGERDBR2"};

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