114 std::string currentPar(
"");
115 std::string listofUnknownParameters =
"";
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);
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;
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);
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));
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") {
176 error.push_back(
"Unknown output level: " + stripped +
". Must be one of NIL, VERBOSE, DEBUG, INFO, WARNING, ERROR, FATAL, ALWAYS");
183 if(listofUnknownParameters!=
"")
184 error.push_back(
"Unknown parameter(s): " + listofUnknownParameters);
187 error.push_back(
"No run specified, use '--run <run>' option");
192 string dbname =
"CONDBR2";
193 size_t slashpos =
cooldb.find(
'/');
194 if(slashpos != string::npos) {
196 dbname =
cooldb.substr(slashpos+1);
198 if(
db.find(
'.') != string::npos) {
209 if(
error.size()!=0) {
210 for(
const string& e:
error)
254int main(
int argc,
char* argv[] ) {
281 if( ! gConfig.
fix ) {
286 if(fixableFolders.size()==0) {
287 cout << endl <<
"All folders are properly filled. Exiting ..." << endl;
298 set<unsigned int> selectForFixing;
303 cout << endl <<
" 0 ... exit" << endl;
305 for(
const string & f : fixableFolders) {
306 if(selectForFixing.count(idx)>0) {
307 cout <<
" * " << ++idx <<
" ... " << f << endl;
309 cout <<
" " << ++idx <<
" ... " << f << endl;
312 cout << endl <<
" a ... select/deselect all" << endl;
313 cout << endl <<
" e ... " << (gConfig.
extendedSelection ?
"disallow" :
"allow") <<
" multiversion folder selection (clears selection)" << endl;
314 cout << endl <<
" f ... fix now" << endl;
315 cout << endl << endl <<
"Select/deselect folder to fix or other option : "; cin >>
selection;
320 bool allSelected = (fixableFolders.size() == selectForFixing.size());
322 selectForFixing.clear();
324 for(
unsigned int selInd = 0; selInd<fixableFolders.size();selInd++)
325 selectForFixing.insert(selInd);
333 selectForFixing.clear();
336 unsigned int selInd =
static_cast<unsigned int>(std::stoul(
selection)) - 1;
337 if(selectForFixing.count(selInd)) {
338 selectForFixing.erase(selInd);
340 selectForFixing.insert(selInd);
352 cout << endl <<
"Exiting ..." << endl;
356 if(selectForFixing.empty()) {
357 cout << endl <<
"Nothing selected. Exiting ..." << endl;
361 vector<string> foldersToFix;
362 for(
unsigned int idx=0; idx!=fixableFolders.size(); idx++) {
363 if(selectForFixing.count(idx)>0)
364 foldersToFix.push_back(fixableFolders[idx]);
368 cout << endl <<
"Folders for fixing:";
369 for(
const string & f : foldersToFix)
375 bool loadL1(
false), loadHLT(
false), loadBGSK(
false), loadL1PSK(
false), loadHLTPSK(
false), saveConfigSource(
false);
376 for(
const string & folderToFix : foldersToFix) {
379 ( folderToFix ==
"/TRIGGER/LVL1/Menu") ||
380 ( folderToFix ==
"/TRIGGER/LVL1/ItemDef") ||
381 ( folderToFix ==
"/TRIGGER/LVL1/Thresholds") ||
382 ( folderToFix ==
"/TRIGGER/LVL1/CTPCoreInputMapping") ||
383 ( folderToFix ==
"/TRIGGER/LVL1/BunchGroupDescription");
386 ( folderToFix ==
"/TRIGGER/HLT/HltConfigKeys") ||
387 ( folderToFix ==
"/TRIGGER/HLT/Menu") ||
388 ( folderToFix ==
"/TRIGGER/HLT/Groups");
391 ( folderToFix ==
"/TRIGGER/LVL1/BunchGroupKey") ||
392 ( folderToFix ==
"/TRIGGER/LVL1/BunchGroupContent") ||
393 ( folderToFix ==
"/TRIGGER/LVL1/BunchGroupDescription");
396 ( folderToFix ==
"/TRIGGER/LVL1/Lvl1ConfigKey") ||
397 ( folderToFix ==
"/TRIGGER/LVL1/Prescales");
400 ( folderToFix ==
"/TRIGGER/HLT/PrescaleKey") ||
401 ( folderToFix ==
"/TRIGGER/HLT/Prescales");
404 ( folderToFix ==
"/TRIGGER/HLT/HltConfigKeys");
409 if( (loadL1 || loadHLT) && gConfig.
smk==0)
412 if( loadBGSK && gConfig.
bgsk==0)
415 if( loadL1PSK && gConfig.
l1psk==0)
418 if( loadHLTPSK && gConfig.
hltpsk==0) {
419 string prompt =
"Please specify HLT Prescaleset key";
421 prompt +=
" (starting at LB " + std::to_string(gConfig.
lb) +
"): ";
423 prompt +=
" (for LB " + std::to_string(gConfig.
lb) +
" - " + std::to_string(gConfig.
lbend) +
"): ";
428 if( saveConfigSource && gConfig.
release==
"")
445 cout << endl << endl <<
"Retrieving Lvl1 CTP configuration" << endl;
446 sm->masterTableLoader().setLevel(gConfig.
outputlevel);
447 sm->masterTableLoader().load(*ctpConfig);
453 cout << endl << endl <<
"Retrieving HLT menu configuration" << endl;
456 sm->hltFrameLoader().load(*hltFrame);
462 cout << endl << endl <<
"Retrieving Lvl1 Bunchgroup set configuration" << endl;
465 sm->bunchGroupSetLoader().load(*bgs);
471 cout << endl << endl <<
"Retrieving L1 prescales" << endl;
474 sm->prescaleSetLoader().load(ctpConfig->
ctpVersion(), *l1pss);
480 cout << endl << endl <<
"Retrieving HLT prescales" << endl;
483 sm->hltPrescaleSetLoader().load(*hltpss);
496 cout <<
"Writing cool to destination " << gConfig.
coolConnection << endl;
504 cool::ValidityKey since(gConfig.
run); since <<= 32; since += gConfig.
lb;
505 cool::ValidityKey until(gConfig.
run); until <<= 32; until += gConfig.
lbend+1;
516 for(
const string & folderToFix : foldersToFix) {
517 if( folderToFix ==
"/TRIGGER/LVL1/BunchGroupKey" ||
518 folderToFix ==
"/TRIGGER/LVL1/BunchGroupContent") {
523 if(loadBGSK && doWrite) {
528 for(
const string & folderToFix : foldersToFix) {
529 if( folderToFix ==
"/TRIGGER/LVL1/BunchGroupDescription") {
530 if(ctpConfig && bgs) {
546 for(
const string & folderToFix : foldersToFix) {
547 if( folderToFix ==
"/TRIGGER/LVL1/Lvl1ConfigKey" ||
548 folderToFix ==
"/TRIGGER/LVL1/Prescales") {
553 if(loadL1PSK && doWrite) {
569 for(
const string & folderToFix : foldersToFix) {
570 if( folderToFix ==
"/TRIGGER/HLT/PrescaleKey" ||
571 folderToFix ==
"/TRIGGER/HLT/Prescales") {
576 if(hltpss && doWrite) {
588 for(
const string & folderToFix : foldersToFix) {
589 if( folderToFix ==
"/TRIGGER/LVL1/Menu" ||
590 folderToFix ==
"/TRIGGER/LVL1/ItemDef" ||
591 folderToFix ==
"/TRIGGER/LVL1/Thresholds" ||
592 folderToFix ==
"/TRIGGER/LVL1/CTPCoreInputMapping") {
597 if(ctpConfig && doWrite) {
610 for(
const string & folderToFix : foldersToFix) {
611 if( folderToFix ==
"/TRIGGER/HLT/Menu" ||
612 folderToFix ==
"/TRIGGER/HLT/Groups" ||
613 folderToFix ==
"/TRIGGER/HLT/HltConfigKeys" ) {
619 if(hltFrame && doWrite) {
620 string configSource =
"TRIGGERDBR2," + gConfig.
release +
",AtlasP1HLT";
void writeL1PrescalePayload(unsigned int runNumber, unsigned int lumiblockNumber, unsigned int lvl1PrescaleKey, const TrigConf::PrescaleSet &prescale)
Writing luminosityblock-wise configuration information the COOL database.