237 {
238
240 cfg.parseProgramOptions(argc, argv);
243 return 0;
244 }
245
246 if(
cfg.error.size()!=0) {
247 for(
const string & e:
cfg.error)
250 return 1;
251 }
252
253 if(
cfg.inputFiles.size()>0 ) {
254
256 for (
const std::string & fn :
cfg.inputFiles) {
257
258 std::string filetype = fileLoader.
getFileType( fn );
259 if(filetype == "l1menu") {
262 cout <<
"Loaded L1 menu " <<
l1menu.name() <<
" with " <<
l1menu.size() <<
" items from " <<
fn << endl;
264 writeJsonFile(l1menu, "L1Menu", cfg);
265 } else if(filetype == "hltmenu" ) {
268 cout <<
"Loaded HLT menu " << hltmenu.
name() <<
" with " << hltmenu.
size() <<
" chains from " <<
fn << endl;
270 writeJsonFile(hltmenu, "HLTMenu", cfg);
271 } else if(filetype == "l1prescale" ) {
274 cout <<
"Loaded L1 prescales set file " <<
fn <<
" with " << l1pss.
size() <<
" prescales from " <<
fn << endl;
275 writeJsonFile(l1pss, "L1PrescalesSet", cfg);
276 } else if(filetype == "hltprescale" ) {
279 cout <<
"Loaded HLT prescales set file " <<
fn <<
" with " << hltpss.
size() <<
" prescales from " <<
fn << endl;
281 writeJsonFile(hltpss, "HLTPrescalesSet", cfg);
282 } else if(filetype == "bunchgroupset" ) {
285 cout <<
"Loaded L1 BunchGroup set file " <<
fn <<
" with " << bgs.
sizeNonEmpty() <<
" non-empty bunchgroups from " <<
fn << endl;
287 writeJsonFile(bgs, "BunchGroupSet", cfg);
288 } else if(filetype == "joboptions" ) {
291 cout <<
"Loaded job options with " << jo.
getObject(
"properties").
getKeys().size() <<
" properties from " <<
fn << endl;
294
295 for(
const auto& alg :
ds.data()) {
296 std::cout <<
alg.first << std::endl;
297 for(
const auto& prop :
alg.second ) {
298 std::cout << " " << prop.first << " -> " << prop.second.data() << std::endl;
299 }
300 }
301 }
302 writeJsonFile(jo, "HLTJobOptions", cfg);
303 } else if(filetype == "hltmonitoringsummary" ) {
306 cout <<
"Loaded HLT monnitoring with " <<
mon.size() <<
" signatures from " <<
fn << endl;
307 mon.printMonConfig(
cfg.detail);
308 writeJsonFile(mon, "HLTMonitoring", cfg);
309 } else {
310 cerr <<
"File " <<
fn <<
" not recognized as being an L1 or HLT menu or prescale set or bunchgroup set" << endl;
311 }
312 }
313 }
314
315 if(
cfg.smk != 0 && !
cfg.doCtp ) {
316
317 {
318
320 if(!
cfg.crestDb.empty()) {
321 dbloader.setCrestTrigDB(
cfg.crestDb);
322 dbloader.setCrestConnection(
cfg.crestServer,
cfg.crestApi);
323 }
324
325
326 {
328 try {
330 }
332 cout <<
"Could not load L1 menu. An exception occurred: " << ex.
what() << endl;
333 }
334 if(l1menu) {
335 cout <<
"Loaded L1 menu " <<
l1menu.name() <<
" with " <<
l1menu.size() <<
" items from " <<
cfg.dbalias <<
" with SMK " <<
cfg.smk << endl;
338 }
339 }
340 cout << endl;
341 }
342
343
344 {
346 try {
348 }
350 cout <<
"Could not load HLT menu. An exception occurred: " << ex.
what() << endl;
351 }
352 if (hltmenu) {
353 cout <<
"Loaded HLT menu " << hltmenu.
name() <<
" with " << hltmenu.
size() <<
" chains from " <<
cfg.dbalias <<
" with SMK " <<
cfg.smk << endl;
356 }
357 }
358 cout << endl;
359 }
360 }
361
362
363 {
365 if(!
cfg.crestDb.empty()) {
366 dbloader.setCrestTrigDB(
cfg.crestDb);
367 dbloader.setCrestConnection(
cfg.crestServer,
cfg.crestApi);
368 }
370 try {
372 }
374 cout <<
"Could not load HLT job options. An exception occurred: " << ex.
what() << endl;
375 }
376 if (jo) {
377 cout <<
"Loaded job options with " << jo.
getObject(
"properties").
getKeys().size() <<
" entries from " <<
cfg.dbalias <<
" with SMK " <<
cfg.smk << endl;
380 for(
const auto& alg :
ds.data()) {
381 std::cout <<
alg.first << std::endl;
382 for(
const auto& prop :
alg.second ) {
383 std::cout << " " << prop.first << " -> " << prop.second.data() << std::endl;
384 }
385 }
386 }
387 }
388 cout << endl;
389 }
390
391
392 {
394 if(!
cfg.crestDb.empty()) {
395 dbloader.setCrestTrigDB(
cfg.crestDb);
396 dbloader.setCrestConnection(
cfg.crestServer,
cfg.crestApi);
397 }
399 try {
400 dbloader.loadHLTMonitoring(
cfg.smk, hltmon,
outputFileName(
"HLTMonitoring", cfg));
401 }
403 cout <<
"Could not load HLT monitoring. An exception occurred: " << ex.
what() << endl;
404 }
405 if (hltmon) {
406 cout <<
"Loaded HLT monitoring with " << hltmon.
size() <<
" signatures rom " <<
cfg.dbalias <<
" with SMK " <<
cfg.smk << endl;
409 }
410 }
411 cout << endl;
412 }
413
414 }
415
416 if(
cfg.smk != 0 &&
cfg.doCtp ) {
419 try{
420 dbloader.loadHardwareFiles(
cfg.smk, ctpfiles, 0x0F,
outputFileName(
"CTPFiles", cfg));
421 } catch (std::format_error & e){
422 cout <<
" format_error "<<
e.what()<<
" thrown in TriggerMenuRW.\n";
423 return 1;
424 }
426 }
427
428 if(
cfg.l1psk != 0 ) {
429
431 if(!
cfg.crestDb.empty()) {
432 dbloader.setCrestTrigDB(
cfg.crestDb);
433 dbloader.setCrestConnection(
cfg.crestServer,
cfg.crestApi);
434 }
436 try {
437 dbloader.loadL1Prescales(
cfg.l1psk, l1pss,
outputFileName(
"L1PrescalesSet", cfg) );
438 }
440 cout <<
"Could not load L1 prescales. An exception occurred: " << ex.
what() << endl;
441 }
442 if (l1pss) {
443 cout <<
"Loaded L1 prescales set " << l1pss.
name() <<
" with " << l1pss.
size() <<
" prescales from " <<
cfg.dbalias <<
" with L1 PSK " <<
cfg.l1psk << endl;
444 }
445 }
446
447 if(
cfg.hltpsk != 0 ) {
448
450 if(!
cfg.crestDb.empty()) {
451 dbloader.setCrestTrigDB(
cfg.crestDb);
452 dbloader.setCrestConnection(
cfg.crestServer,
cfg.crestApi);
453 }
455 try {
456 dbloader.loadHLTPrescales(
cfg.hltpsk, hltpss,
outputFileName(
"HLTPrescalesSet", cfg) );
457 }
459 cout <<
"Could not load HLT prescales. An exception occurred: " << ex.
what() << endl;
460 }
461 if (hltpss) {
462 cout <<
"Loaded HLT prescales set " << hltpss.
name() <<
" with " << hltpss.
size() <<
" prescales from " <<
cfg.dbalias <<
" with HLT PSK " <<
cfg.hltpsk << endl;
463 }
464 }
465
466 if(
cfg.bgsk != 0 ) {
467
469 if(!
cfg.crestDb.empty()) {
470 dbloader.setCrestTrigDB(
cfg.crestDb);
471 dbloader.setCrestConnection(
cfg.crestServer,
cfg.crestApi);
472 }
474 try {
475 dbloader.loadBunchGroupSet(
cfg.bgsk, bgs,
outputFileName(
"BunchGroupSet", cfg) );
476 }
478 cout <<
"Could not load bunchgroup set. An exception occurred: " << ex.
what() << endl;
479 }
480 if (bgs) {
481 cout <<
"Loaded L1 bunchgroup set " << bgs.
name() <<
" with " << bgs.
size() <<
" bunchgroups from " <<
cfg.dbalias <<
" with BGSK " <<
cfg.bgsk << endl;
484 }
485 }
486 }
487
488 return 0;
489}
static const std::string outputFileName
Base class for Trigger configuration data and wrapper around underlying representation.
virtual const std::string & name() const final
std::vector< std::string > getKeys() const
Access to the keys of an DataStructure which presents a dictionary.
DataStructure getObject(const std::string &pathToChild, bool ignoreIfMissing=false) const
Access to configuration object.
HLT monitoring configuration.
std::size_t size() const
Accessor to the number of HLT monitoring chains.
void printMonConfig(bool full=false) const
print overview of L1 Menu
std::size_t size() const
number of HLT prescales
void printPrescaleSet(bool full) const
virtual const char * what() const noexcept
Loader of trigger configurations from Json files.
std::string getFileType(const std::string &filename) const
Checks the trigger level of a given json file.
bool loadFile(const std::string &filename, boost::property_tree::ptree &data, const std::string &pathToChild="") const
Load content of json file into a ptree.
std::size_t size() const
Accessor to the number of defined bunchgroups.
std::size_t sizeNonEmpty() const
Accessor to the number of non-empty bunchgroups.
void printSummary(bool detailed=false) const
print a more or less detailed summary
std::size_t size() const
number of L1 prescales
Loader of trigger configurations from Json files.
Loader of trigger configurations from Json files.
Loader of trigger configurations from Json files.
Loader of trigger configurations from Json files.
Loader of trigger configurations from Json files.
Loader of trigger menu configurations from the database.