255 {
256
257
258
259
260
261
264 if(retCode>=0)
265 return retCode;
266
268
269
270
271
272
273
274
275
277
279
281
282 if( ! gConfig.
fix ) {
283 delete coolReader;
284 return 0;
285 }
286
287 if(fixableFolders.size()==0) {
288 cout << endl << "All folders are properly filled. Exiting ..." << endl;
289 return 0;
290 }
291
292
293
294
295
296
297
298
299 set<unsigned int> selectForFixing;
300
303
304 cout << endl << " 0 ... exit" << endl;
306 for(const string & f : fixableFolders) {
307 if(selectForFixing.count(idx)>0) {
308 cout <<
" * " << ++
idx <<
" ... " <<
f << endl;
309 } else {
310 cout <<
" " << ++
idx <<
" ... " <<
f << endl;
311 }
312 }
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;
317
318 try {
320
321 bool allSelected = (fixableFolders.size() == selectForFixing.size());
322 if(allSelected) {
323 selectForFixing.clear();
324 } else {
325 for(unsigned int selInd = 0; selInd<fixableFolders.size();selInd++)
326 selectForFixing.insert(selInd);
327 }
329
331
333
334 selectForFixing.clear();
335
336 } else {
337 unsigned int selInd =
static_cast<unsigned int>(std::stoul(
selection)) - 1;
338 if(selectForFixing.count(selInd)) {
339 selectForFixing.erase(selInd);
340 } else {
341 selectForFixing.insert(selInd);
342 }
343 }
344 }
345 catch(...){}
346
347 }
348
349 delete coolReader;
350
351
353 cout << endl << "Exiting ..." << endl;
354 return 0;
355 }
356
357 if(selectForFixing.empty()) {
358 cout << endl << "Nothing selected. Exiting ..." << endl;
359 return 0;
360 }
361
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]);
366 }
367
368
369 cout << endl << "Folders for fixing:";
370 for(const string & f : foldersToFix)
372 cout << endl;
373
374
375
376 bool loadL1(false), loadHLT(false), loadBGSK(false), loadL1PSK(false), loadHLTPSK(false), saveConfigSource(false);
377 for(const string & folderToFix : foldersToFix) {
378
379 loadL1 |=
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");
385
386 loadHLT |=
387 ( folderToFix == "/TRIGGER/HLT/HltConfigKeys") ||
388 ( folderToFix == "/TRIGGER/HLT/Menu") ||
389 ( folderToFix == "/TRIGGER/HLT/Groups");
390
391 loadBGSK |=
392 ( folderToFix == "/TRIGGER/LVL1/BunchGroupKey") ||
393 ( folderToFix == "/TRIGGER/LVL1/BunchGroupContent") ||
394 ( folderToFix == "/TRIGGER/LVL1/BunchGroupDescription");
395
396 loadL1PSK |=
397 ( folderToFix == "/TRIGGER/LVL1/Lvl1ConfigKey") ||
398 ( folderToFix == "/TRIGGER/LVL1/Prescales");
399
400 loadHLTPSK |=
401 ( folderToFix == "/TRIGGER/HLT/PrescaleKey") ||
402 ( folderToFix == "/TRIGGER/HLT/Prescales");
403
404 saveConfigSource |=
405 ( folderToFix == "/TRIGGER/HLT/HltConfigKeys");
406 }
407
408
409
410 if( (loadL1 || loadHLT) && gConfig.
smk==0)
412
413 if( loadBGSK && gConfig.
bgsk==0)
415
416 if( loadL1PSK && gConfig.
l1psk==0)
418
419 if( loadHLTPSK && gConfig.
hltpsk==0) {
420 string prompt =
"Please specify HLT Prescaleset key";
422 prompt +=
" (starting at LB " + std::to_string(gConfig.
lb) +
"): ";
423 } else {
424 prompt +=
" (for LB " + std::to_string(gConfig.
lb) +
" - " + std::to_string(gConfig.
lbend) +
"): ";
425 }
427 }
428
429 if( saveConfigSource && gConfig.
release==
"")
431
432
438
439 {
441
443 if(loadL1) {
444 ctpConfig->setSMK( gConfig.
smk );
446 cout << endl << endl << "Retrieving Lvl1 CTP configuration" << endl;
447 sm->masterTableLoader().setLevel(gConfig.
outputlevel);
448 sm->masterTableLoader().load(*ctpConfig);
451 }
452
453 if(loadHLT) {
454 cout << endl << endl << "Retrieving HLT menu configuration" << endl;
456 hltFrame->setSMK( gConfig.
smk );
457 sm->hltFrameLoader().load(*hltFrame);
460 }
461
462 if( loadBGSK ) {
463 cout << endl << endl << "Retrieving Lvl1 Bunchgroup set configuration" << endl;
465 bgs->setId(gConfig.
bgsk);
466 sm->bunchGroupSetLoader().load(*bgs);
469 }
470
471 if( loadL1PSK ) {
472 cout << endl << endl << "Retrieving L1 prescales" << endl;
474 l1pss->setId(gConfig.
l1psk);
475 sm->prescaleSetLoader().load(ctpConfig->ctpVersion(), *l1pss);
478 }
479
480 if( loadHLTPSK ) {
481 cout << endl << endl << "Retrieving HLT prescales" << endl;
483 hltpss->setId(gConfig.
hltpsk);
484 sm->hltPrescaleSetLoader().load(*hltpss);
487 }
488 }
489
490
491
492
493
494
495
496
497 cout <<
"Writing cool to destination " << gConfig.
coolConnection << endl;
499
501
504 } else {
508 }
509
510
514 {
515
516 bool doWrite(false);
517 for(const string & folderToFix : foldersToFix) {
518 if( folderToFix == "/TRIGGER/LVL1/BunchGroupKey" ||
519 folderToFix == "/TRIGGER/LVL1/BunchGroupContent") {
521 doWrite = true;
522 }
523 }
524 if(loadBGSK && doWrite) {
526 }
528
529 for(const string & folderToFix : foldersToFix) {
530 if( folderToFix == "/TRIGGER/LVL1/BunchGroupDescription") {
531 if(ctpConfig && bgs) {
533 ctpConfig->menu(),
534 *bgs);
535 }
536 }
537 }
538
539 }
540
544 {
545
546 bool doWrite(false);
547 for(const string & folderToFix : foldersToFix) {
548 if( folderToFix == "/TRIGGER/LVL1/Lvl1ConfigKey" ||
549 folderToFix == "/TRIGGER/LVL1/Prescales") {
551 doWrite = true;
552 }
553 }
554 if(loadL1PSK && doWrite) {
556 }
558
559
560 }
561
562
563
567 {
568
569 bool doWrite(false);
570 for(const string & folderToFix : foldersToFix) {
571 if( folderToFix == "/TRIGGER/HLT/PrescaleKey" ||
572 folderToFix == "/TRIGGER/HLT/Prescales") {
574 doWrite = true;
575 }
576 }
577 if(hltpss && doWrite) {
579 }
581 }
582
583
587 {
588 bool doWrite(false);
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") {
595 doWrite = true;
596 }
597 }
598 if(ctpConfig && doWrite) {
600 }
602 }
603
604
605
609 {
610 bool doWrite(false);
611 for(const string & folderToFix : foldersToFix) {
612 if( folderToFix == "/TRIGGER/HLT/Menu" ||
613 folderToFix == "/TRIGGER/HLT/Groups" ||
614 folderToFix == "/TRIGGER/HLT/HltConfigKeys" ) {
616 doWrite = true;
617 }
618 }
619
620 if(hltFrame && doWrite) {
621 string configSource =
"TRIGGERDBR2," + gConfig.
release +
",AtlasP1HLT";
622
624 }
626 }
627
628
629 delete ctpConfig;
630 delete hltFrame;
631 delete bgs;
632 delete l1pss;
633 delete hltpss;
634
635}
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[])