254 {
255
256
257
258
259
260
263 if(retCode>=0)
264 return retCode;
265
267
268
269
270
271
272
273
274
276
278
280
281 if( ! gConfig.
fix ) {
282 delete coolReader;
283 return 0;
284 }
285
286 if(fixableFolders.size()==0) {
287 cout << endl << "All folders are properly filled. Exiting ..." << endl;
288 return 0;
289 }
290
291
292
293
294
295
296
297
298 set<unsigned int> selectForFixing;
299
302
303 cout << endl << " 0 ... exit" << endl;
305 for(const string & f : fixableFolders) {
306 if(selectForFixing.count(idx)>0) {
307 cout <<
" * " << ++
idx <<
" ... " <<
f << endl;
308 } else {
309 cout <<
" " << ++
idx <<
" ... " <<
f << endl;
310 }
311 }
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;
316
317 try {
319
320 bool allSelected = (fixableFolders.size() == selectForFixing.size());
321 if(allSelected) {
322 selectForFixing.clear();
323 } else {
324 for(unsigned int selInd = 0; selInd<fixableFolders.size();selInd++)
325 selectForFixing.insert(selInd);
326 }
328
330
332
333 selectForFixing.clear();
334
335 } else {
336 unsigned int selInd =
static_cast<unsigned int>(std::stoul(
selection)) - 1;
337 if(selectForFixing.count(selInd)) {
338 selectForFixing.erase(selInd);
339 } else {
340 selectForFixing.insert(selInd);
341 }
342 }
343 }
344 catch(...){}
345
346 }
347
348 delete coolReader;
349
350
352 cout << endl << "Exiting ..." << endl;
353 return 0;
354 }
355
356 if(selectForFixing.empty()) {
357 cout << endl << "Nothing selected. Exiting ..." << endl;
358 return 0;
359 }
360
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]);
365 }
366
367
368 cout << endl << "Folders for fixing:";
369 for(const string & f : foldersToFix)
371 cout << endl;
372
373
374
375 bool loadL1(false), loadHLT(false), loadBGSK(false), loadL1PSK(false), loadHLTPSK(false), saveConfigSource(false);
376 for(const string & folderToFix : foldersToFix) {
377
378 loadL1 |=
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");
384
385 loadHLT |=
386 ( folderToFix == "/TRIGGER/HLT/HltConfigKeys") ||
387 ( folderToFix == "/TRIGGER/HLT/Menu") ||
388 ( folderToFix == "/TRIGGER/HLT/Groups");
389
390 loadBGSK |=
391 ( folderToFix == "/TRIGGER/LVL1/BunchGroupKey") ||
392 ( folderToFix == "/TRIGGER/LVL1/BunchGroupContent") ||
393 ( folderToFix == "/TRIGGER/LVL1/BunchGroupDescription");
394
395 loadL1PSK |=
396 ( folderToFix == "/TRIGGER/LVL1/Lvl1ConfigKey") ||
397 ( folderToFix == "/TRIGGER/LVL1/Prescales");
398
399 loadHLTPSK |=
400 ( folderToFix == "/TRIGGER/HLT/PrescaleKey") ||
401 ( folderToFix == "/TRIGGER/HLT/Prescales");
402
403 saveConfigSource |=
404 ( folderToFix == "/TRIGGER/HLT/HltConfigKeys");
405 }
406
407
408
409 if( (loadL1 || loadHLT) && gConfig.
smk==0)
411
412 if( loadBGSK && gConfig.
bgsk==0)
414
415 if( loadL1PSK && gConfig.
l1psk==0)
417
418 if( loadHLTPSK && gConfig.
hltpsk==0) {
419 string prompt =
"Please specify HLT Prescaleset key";
421 prompt +=
" (starting at LB " + std::to_string(gConfig.
lb) +
"): ";
422 } else {
423 prompt +=
" (for LB " + std::to_string(gConfig.
lb) +
" - " + std::to_string(gConfig.
lbend) +
"): ";
424 }
426 }
427
428 if( saveConfigSource && gConfig.
release==
"")
430
431
437
438 {
440
442 if(loadL1) {
443 ctpConfig->setSMK( gConfig.
smk );
445 cout << endl << endl << "Retrieving Lvl1 CTP configuration" << endl;
446 sm->masterTableLoader().setLevel(gConfig.
outputlevel);
447 sm->masterTableLoader().load(*ctpConfig);
450 }
451
452 if(loadHLT) {
453 cout << endl << endl << "Retrieving HLT menu configuration" << endl;
455 hltFrame->setSMK( gConfig.
smk );
456 sm->hltFrameLoader().load(*hltFrame);
459 }
460
461 if( loadBGSK ) {
462 cout << endl << endl << "Retrieving Lvl1 Bunchgroup set configuration" << endl;
464 bgs->setId(gConfig.
bgsk);
465 sm->bunchGroupSetLoader().load(*bgs);
468 }
469
470 if( loadL1PSK ) {
471 cout << endl << endl << "Retrieving L1 prescales" << endl;
473 l1pss->setId(gConfig.
l1psk);
474 sm->prescaleSetLoader().load(ctpConfig->ctpVersion(), *l1pss);
477 }
478
479 if( loadHLTPSK ) {
480 cout << endl << endl << "Retrieving HLT prescales" << endl;
482 hltpss->setId(gConfig.
hltpsk);
483 sm->hltPrescaleSetLoader().load(*hltpss);
486 }
487 }
488
489
490
491
492
493
494
495
496 cout <<
"Writing cool to destination " << gConfig.
coolConnection << endl;
498
500
503 } else {
507 }
508
509
513 {
514
515 bool doWrite(false);
516 for(const string & folderToFix : foldersToFix) {
517 if( folderToFix == "/TRIGGER/LVL1/BunchGroupKey" ||
518 folderToFix == "/TRIGGER/LVL1/BunchGroupContent") {
520 doWrite = true;
521 }
522 }
523 if(loadBGSK && doWrite) {
525 }
527
528 for(const string & folderToFix : foldersToFix) {
529 if( folderToFix == "/TRIGGER/LVL1/BunchGroupDescription") {
530 if(ctpConfig && bgs) {
532 ctpConfig->menu(),
533 *bgs);
534 }
535 }
536 }
537
538 }
539
543 {
544
545 bool doWrite(false);
546 for(const string & folderToFix : foldersToFix) {
547 if( folderToFix == "/TRIGGER/LVL1/Lvl1ConfigKey" ||
548 folderToFix == "/TRIGGER/LVL1/Prescales") {
550 doWrite = true;
551 }
552 }
553 if(loadL1PSK && doWrite) {
555 }
557
558
559 }
560
561
562
566 {
567
568 bool doWrite(false);
569 for(const string & folderToFix : foldersToFix) {
570 if( folderToFix == "/TRIGGER/HLT/PrescaleKey" ||
571 folderToFix == "/TRIGGER/HLT/Prescales") {
573 doWrite = true;
574 }
575 }
576 if(hltpss && doWrite) {
578 }
580 }
581
582
586 {
587 bool doWrite(false);
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") {
594 doWrite = true;
595 }
596 }
597 if(ctpConfig && doWrite) {
599 }
601 }
602
603
604
608 {
609 bool doWrite(false);
610 for(const string & folderToFix : foldersToFix) {
611 if( folderToFix == "/TRIGGER/HLT/Menu" ||
612 folderToFix == "/TRIGGER/HLT/Groups" ||
613 folderToFix == "/TRIGGER/HLT/HltConfigKeys" ) {
615 doWrite = true;
616 }
617 }
618
619 if(hltFrame && doWrite) {
620 string configSource =
"TRIGGERDBR2," + gConfig.
release +
",AtlasP1HLT";
621
623 }
625 }
626
627
628 delete ctpConfig;
629 delete hltFrame;
630 delete bgs;
631 delete l1pss;
632 delete hltpss;
633
634}
void readKeyFromPrompt(const std::string &prompt, T &key)
HLT chain configuration information.
Database Storage Manager, controls the database session and the different loader classes for DB acces...
Reading/Writing of trigger configuration data from/to COOL.
void writeL1BunchGroupRunPayload(ValidityRange vr, const Menu &lvl1Menu, const BunchGroupSet &bgs)
Writing run-wise L1 bunch group names and item to bunch group mapping to COOL.
void writeHltPrescalePayload(unsigned int runNumber, unsigned int lumiblockNumber, const TrigConf::HLTPrescaleSet &pss)
Writing luminosityblock-wise configuration information the COOL database.
void writeL1MenuPayload(ValidityRange vr, const TrigConf::Menu &lvl1Menu)
Writing L1 run-wise configuration information to the COOL database.
void writeL1PrescalePayload(unsigned int runNumber, unsigned int lumiblockNumber, unsigned int lvl1PrescaleKey, const TrigConf::PrescaleSet &prescale)
Writing luminosityblock-wise configuration information the COOL database.
void writeHLTPayload(ValidityRange vr, const HLTFrame &hltFrame, const std::string &configSource)
void addWriteFolder(const std::string &fname)
void writeL1BunchGroupLBPayload(const RunRangeVec &runRanges, unsigned int bgKey, const BunchGroupSet &bgs)
Writing LB-wise L1 bunch group definition to the COOL database.
std::vector< std::string > checkPayloadSize(unsigned int run, unsigned int lb, int displayMode, bool openend, unsigned int lbend)
const std::string selection
int parseProgramOptions(int argc, char *argv[])