115 std::string currentPar(
"");
116 std::string listofUnknownParameters =
"";
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);
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;
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);
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));
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") {
177 error.push_back(
"Unknown output level: " + stripped +
". Must be one of NIL, VERBOSE, DEBUG, INFO, WARNING, ERROR, FATAL, ALWAYS");
184 if(listofUnknownParameters!=
"")
185 error.push_back(
"Unknown parameter(s): " + listofUnknownParameters);
188 error.push_back(
"No run specified, use '--run <run>' option");
193 string dbname =
"CONDBR2";
194 size_t slashpos =
cooldb.find(
'/');
195 if(slashpos != string::npos) {
197 dbname =
cooldb.substr(slashpos+1);
199 if(
db.find(
'.') != string::npos) {
210 if(
error.size()!=0) {
211 for(
const string& e:
error)
255int main(
int argc,
char* argv[] ) {
282 if( ! gConfig.
fix ) {
287 if(fixableFolders.size()==0) {
288 cout << endl <<
"All folders are properly filled. Exiting ..." << endl;
299 set<unsigned int> selectForFixing;
304 cout << endl <<
" 0 ... exit" << endl;
306 for(
const string & f : fixableFolders) {
307 if(selectForFixing.count(idx)>0) {
308 cout <<
" * " << ++idx <<
" ... " << f << endl;
310 cout <<
" " << ++idx <<
" ... " << f << endl;
313 cout << endl <<
" a ... select/deselect all" << endl;
314 cout << endl <<
" e ... " << (gConfig.
extendedSelection ?
"disallow" :
"allow") <<
" multiversion folder selection (clears selection)" << endl;
315 cout << endl <<
" f ... fix now" << endl;
316 cout << endl << endl <<
"Select/deselect folder to fix or other option : "; cin >>
selection;
321 bool allSelected = (fixableFolders.size() == selectForFixing.size());
323 selectForFixing.clear();
325 for(
unsigned int selInd = 0; selInd<fixableFolders.size();selInd++)
326 selectForFixing.insert(selInd);
334 selectForFixing.clear();
337 unsigned int selInd =
static_cast<unsigned int>(std::stoul(
selection)) - 1;
338 if(selectForFixing.count(selInd)) {
339 selectForFixing.erase(selInd);
341 selectForFixing.insert(selInd);
353 cout << endl <<
"Exiting ..." << endl;
357 if(selectForFixing.empty()) {
358 cout << endl <<
"Nothing selected. Exiting ..." << endl;
362 vector<string> foldersToFix;
363 for(
unsigned int idx=0; idx!=fixableFolders.size(); idx++) {
364 if(selectForFixing.count(idx)>0)
365 foldersToFix.push_back(fixableFolders[idx]);
369 cout << endl <<
"Folders for fixing:";
370 for(
const string & f : foldersToFix)
376 bool loadL1(
false), loadHLT(
false), loadBGSK(
false), loadL1PSK(
false), loadHLTPSK(
false), saveConfigSource(
false);
377 for(
const string & folderToFix : foldersToFix) {
380 ( folderToFix ==
"/TRIGGER/LVL1/Menu") ||
381 ( folderToFix ==
"/TRIGGER/LVL1/ItemDef") ||
382 ( folderToFix ==
"/TRIGGER/LVL1/Thresholds") ||
383 ( folderToFix ==
"/TRIGGER/LVL1/CTPCoreInputMapping") ||
384 ( folderToFix ==
"/TRIGGER/LVL1/BunchGroupDescription");
387 ( folderToFix ==
"/TRIGGER/HLT/HltConfigKeys") ||
388 ( folderToFix ==
"/TRIGGER/HLT/Menu") ||
389 ( folderToFix ==
"/TRIGGER/HLT/Groups");
392 ( folderToFix ==
"/TRIGGER/LVL1/BunchGroupKey") ||
393 ( folderToFix ==
"/TRIGGER/LVL1/BunchGroupContent") ||
394 ( folderToFix ==
"/TRIGGER/LVL1/BunchGroupDescription");
397 ( folderToFix ==
"/TRIGGER/LVL1/Lvl1ConfigKey") ||
398 ( folderToFix ==
"/TRIGGER/LVL1/Prescales");
401 ( folderToFix ==
"/TRIGGER/HLT/PrescaleKey") ||
402 ( folderToFix ==
"/TRIGGER/HLT/Prescales");
405 ( folderToFix ==
"/TRIGGER/HLT/HltConfigKeys");
410 if( (loadL1 || loadHLT) && gConfig.
smk==0)
413 if( loadBGSK && gConfig.
bgsk==0)
416 if( loadL1PSK && gConfig.
l1psk==0)
419 if( loadHLTPSK && gConfig.
hltpsk==0) {
420 string prompt =
"Please specify HLT Prescaleset key";
422 prompt +=
" (starting at LB " + std::to_string(gConfig.
lb) +
"): ";
424 prompt +=
" (for LB " + std::to_string(gConfig.
lb) +
" - " + std::to_string(gConfig.
lbend) +
"): ";
429 if( saveConfigSource && gConfig.
release==
"")
446 cout << endl << endl <<
"Retrieving Lvl1 CTP configuration" << endl;
447 sm->masterTableLoader().setLevel(gConfig.
outputlevel);
448 sm->masterTableLoader().load(*ctpConfig);
454 cout << endl << endl <<
"Retrieving HLT menu configuration" << endl;
457 sm->hltFrameLoader().load(*hltFrame);
463 cout << endl << endl <<
"Retrieving Lvl1 Bunchgroup set configuration" << endl;
466 sm->bunchGroupSetLoader().load(*bgs);
472 cout << endl << endl <<
"Retrieving L1 prescales" << endl;
475 sm->prescaleSetLoader().load(ctpConfig->
ctpVersion(), *l1pss);
481 cout << endl << endl <<
"Retrieving HLT prescales" << endl;
484 sm->hltPrescaleSetLoader().load(*hltpss);
497 cout <<
"Writing cool to destination " << gConfig.
coolConnection << endl;
505 cool::ValidityKey since(gConfig.
run); since <<= 32; since += gConfig.
lb;
506 cool::ValidityKey until(gConfig.
run); until <<= 32; until += gConfig.
lbend+1;
517 for(
const string & folderToFix : foldersToFix) {
518 if( folderToFix ==
"/TRIGGER/LVL1/BunchGroupKey" ||
519 folderToFix ==
"/TRIGGER/LVL1/BunchGroupContent") {
524 if(loadBGSK && doWrite) {
529 for(
const string & folderToFix : foldersToFix) {
530 if( folderToFix ==
"/TRIGGER/LVL1/BunchGroupDescription") {
531 if(ctpConfig && bgs) {
547 for(
const string & folderToFix : foldersToFix) {
548 if( folderToFix ==
"/TRIGGER/LVL1/Lvl1ConfigKey" ||
549 folderToFix ==
"/TRIGGER/LVL1/Prescales") {
554 if(loadL1PSK && doWrite) {
570 for(
const string & folderToFix : foldersToFix) {
571 if( folderToFix ==
"/TRIGGER/HLT/PrescaleKey" ||
572 folderToFix ==
"/TRIGGER/HLT/Prescales") {
577 if(hltpss && doWrite) {
589 for(
const string & folderToFix : foldersToFix) {
590 if( folderToFix ==
"/TRIGGER/LVL1/Menu" ||
591 folderToFix ==
"/TRIGGER/LVL1/ItemDef" ||
592 folderToFix ==
"/TRIGGER/LVL1/Thresholds" ||
593 folderToFix ==
"/TRIGGER/LVL1/CTPCoreInputMapping") {
598 if(ctpConfig && doWrite) {
611 for(
const string & folderToFix : foldersToFix) {
612 if( folderToFix ==
"/TRIGGER/HLT/Menu" ||
613 folderToFix ==
"/TRIGGER/HLT/Groups" ||
614 folderToFix ==
"/TRIGGER/HLT/HltConfigKeys" ) {
620 if(hltFrame && doWrite) {
621 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.