ATLAS Offline Software
Loading...
Searching...
No Matches
TestTriggerMenuAccess.cxx File Reference
#include <cstdlib>
#include <sys/stat.h>
#include <iomanip>
#include "TrigConfIO/JsonFileLoader.h"
#include "TrigConfIO/TrigDBMenuLoader.h"
#include "TrigConfData/HLTMenu.h"
#include "TrigConfData/L1Menu.h"
#include "TrigConfData/L1Threshold.h"
#include <boost/algorithm/string.hpp>
Include dependency graph for TestTriggerMenuAccess.cxx:

Go to the source code of this file.

Functions

void section (const std::string &sec)
void exampleL1Calo (const string &filename)
bool testL1Menu_Items (const TrigConf::L1Menu &l1menu)
bool testL1Menu_Boards (const TrigConf::L1Menu &l1menu)
bool testL1Menu_Connectors (const TrigConf::L1Menu &l1menu)
bool testL1Menu_Topo (const TrigConf::L1Menu &l1menu, bool printdetail)
bool testL1Menu_Thresholds (const TrigConf::L1Menu &l1menu, bool printdetail)
bool testL1Menu_Extrainfo (const TrigConf::L1Menu &l1menu)
bool testL1Menu (const TrigConf::L1Menu &l1menu, bool printdetail=false)
bool testHLTMenu (const TrigConf::HLTMenu &hltmenu)
void usage ()
 Main function just to get the filename and which type.
int main (int argc, char **argv)

Function Documentation

◆ exampleL1Calo()

void exampleL1Calo ( const string & filename)

Definition at line 32 of file TestTriggerMenuAccess.cxx.

32 {
33 cout << endl
34 << "===========================" << endl
35 << "===== =====" << endl
36 << "===== Example L1 Calo =====" << endl
37 << "===== =====" << endl
38 << "===========================" << endl << endl;
40 TrigConf::JsonFileLoader fileLoader;
41 fileLoader.loadFile( filename, l1menu);
42 cout << "Loaded the L1 menu " << l1menu.name() << endl;
43 cout << "Information to configure eFEX" << endl;
44 cout << "For producing eEM objects you need the working points" << endl;
45 auto & ei_eEM = l1menu.thrExtraInfo().eEM();
46 for( int ieta : { -30, -20, -10, 0, 10, 20, 30 } ) {
47 unsigned int ptMinToTopo = ei_eEM.ptMinToTopo(); // the minimum energy to send to topo (not eta dependent yet)
48 cout << "ptmin=" << ptMinToTopo << endl;
49 auto iso_loose = ei_eEM.isolation(TrigConf::Selection::WP::LOOSE, ieta);
50 auto iso_medium = ei_eEM.isolation(TrigConf::Selection::WP::MEDIUM, ieta);
51 auto iso_tight = ei_eEM.isolation(TrigConf::Selection::WP::TIGHT, ieta);
52 int reta_loose_fw = iso_loose.reta_fw();
53 int rhad_loose_fw = iso_loose.rhad_fw();
54 int wstot_loose_fw = iso_loose.wstot_fw();
55 int reta_loose_d = iso_loose.reta_d();
56 int rhad_loose_d = iso_loose.rhad_d();
57 int wstot_loose_d = iso_loose.wstot_d();
58 cout << "ieta=" << ieta << " loose => reta_fw=" << reta_loose_fw << ", rhad_fw=" << rhad_loose_fw << ", wstot_fw=" << wstot_loose_fw << endl;
59 cout << "ieta=" << ieta << " loose => reta_d=" << reta_loose_d << ", rhad_d=" << rhad_loose_d << ", wstot_d=" << wstot_loose_d << endl;
60 int reta_medium_fw = iso_medium.reta_fw();
61 int rhad_medium_fw = iso_medium.rhad_fw();
62 int wstot_medium_fw = iso_medium.wstot_fw();
63 int reta_medium_d = iso_medium.reta_d();
64 int rhad_medium_d = iso_medium.rhad_d();
65 int wstot_medium_d = iso_medium.wstot_d();
66 cout << "ieta=" << ieta << " medium => reta_fw=" << reta_medium_fw << ", rhad_fw=" << rhad_medium_fw << ", wstot_fw=" << wstot_medium_fw << endl;
67 cout << "ieta=" << ieta << " medium => reta_d=" << reta_medium_d << ", rhad_d=" << rhad_medium_d << ", wstot_d=" << wstot_medium_d << endl;
68 int reta_tight_fw = iso_tight.reta_fw();
69 int rhad_tight_fw = iso_tight.rhad_fw();
70 int wstot_tight_fw = iso_tight.wstot_fw();
71 int reta_tight_d = iso_tight.reta_d();
72 int rhad_tight_d = iso_tight.rhad_d();
73 int wstot_tight_d = iso_tight.wstot_d();
74 cout << "ieta=" << ieta << " tight => reta_fw=" << reta_tight_fw << ", rhad_fw=" << rhad_tight_fw << ", wstot_fw=" << wstot_tight_fw << endl;
75 cout << "ieta=" << ieta << " tight => reta_d=" << reta_tight_d << ", rhad_d=" << rhad_tight_d << ", wstot_d=" << wstot_tight_d << endl;
76 }
77}
Loader of trigger configurations from Json files.
bool loadFile(const std::string &filename, boost::property_tree::ptree &data, const std::string &pathToChild="") const
Load content of json file into a ptree.
L1 menu configuration.
Definition L1Menu.h:28

◆ main()

int main ( int argc,
char ** argv )

Definition at line 701 of file TestTriggerMenuAccess.cxx.

701 {
702 bool help { false };
703 string filename{""};
704 unsigned int smk{0};
705 std::string dbalias {"TRIGGERDB_RUN3"};
706 std::vector<std::string> knownParameters { "file", "f", "smk", "db", "help", "h" };
707
708 std::string currentParameter("");
709 std::string listofUnknownParameters = "";
710 std::string listofUnknownArguments = "";
711 for(int i=1; i<argc; i++) {
712
713 std::string currentWord(argv[i]);
714 bool isParam = currentWord[0]=='-'; // string starts with a '-', so it is a parameter name
715
716 // get the parameter name
717 int firstChar = currentWord.find_first_not_of('-');
718 string paramName = currentWord.substr(firstChar);
719
720 // check if the parameter is known
721 if ( isParam && std::find(knownParameters.begin(), knownParameters.end(), paramName) == knownParameters.end() ) {
722 listofUnknownParameters += " " + currentWord;
723 continue;
724 }
725
726 if(isParam) {
727 currentParameter = "";
728 // check the boolean parameters
729 if(paramName == "h" || paramName == "help" ) { help = true; continue; }
730 currentParameter = std::move(paramName);
731 continue;
732 }
733
734 // inputs
735 if(currentParameter == "file" || currentParameter == "f") {
736 filename = std::move(currentWord);
737 continue;
738 }
739 if(currentParameter == "smk") {
740 smk = stoul(currentWord);
741 continue;
742 }
743 if(currentParameter == "db") {
744 dbalias = std::move(currentWord);
745 continue;
746 }
747 listofUnknownArguments += " " + currentWord;
748 }
749
750 if ( not listofUnknownParameters.empty() ) {
751 cerr << "Unknown parameter(s):" << listofUnknownParameters << endl;
752 usage();
753 return 1;
754 }
755
756 if ( not listofUnknownArguments.empty() ) {
757 cerr << "Unknown argument(s):" << listofUnknownArguments << endl;
758 usage();
759 return 1;
760 }
761
762 if( filename.empty() && smk==0 ) {
763 // no filename specified, going to take the L1 menu from the release
764 const char* env_AV = std::getenv("AtlasVersion");
765 const char* env_xmlpath = std::getenv("XMLPATH");
766 if( env_AV != nullptr and env_xmlpath != nullptr ) {
767 vector<string> paths;
768 string xmlpath(env_xmlpath);
769 boost::algorithm::split(paths, xmlpath, boost::is_any_of(":"));
770 for( const string & p : paths) {
771 string testFN = p + "/TriggerMenuMT/L1Menu_Dev_pp_run3_v1_" + string(env_AV) + ".json";
772 struct stat buffer;
773 if (stat (testFN.c_str(), &buffer) == 0) {
774 filename = std::move(testFN);
775 break;
776 }
777 }
778 }
779 if(filename == "") {
780 cout << "No filename or smk specified and no default L1 menu file found in the release" << endl;
781 usage();
782 return 1;
783 }
784 }
785
786 if(help) {
787 usage();
788 return 0;
789 }
790
791 bool success(false);
792 if(smk!=0) {
793 // load from db
795 TrigConf::TrigDBMenuLoader dbLoader(dbalias);
796 try{
797 dbLoader.loadL1Menu( smk, l1menu);
798 } catch (std::ios_base::failure & e){
799 std::cout<<"ios_base exception "<<e.what()<<" caught in TestTriggerMenuAccess.\n";
800 return 1;
801 }
802 success = testL1Menu(l1menu);
803 } else {
804 // load from file
805 TrigConf::JsonFileLoader fileLoader;
806 string filetype = fileLoader.getFileType( filename );
807 if(filetype == "l1menu") {
809 fileLoader.loadFile( filename, l1menu);
810 success = testL1Menu(l1menu);
811 } else if(filetype == "hltmenu") {
812 TrigConf::HLTMenu hltmenu;
813 fileLoader.loadFile( filename, hltmenu);
814 success = testHLTMenu(hltmenu);
815 } else {
816 cout << "File " << filename << " is neither an L1 or an HLT menu json file" << endl;
817 }
818 }
819
820 cout << "Finished " << (success ? "successfully" : "with failures") << endl;
821 return success ? 0 : 1;
822}
void usage()
Main function just to get the filename and which type.
bool testHLTMenu(const TrigConf::HLTMenu &hltmenu)
bool testL1Menu(const TrigConf::L1Menu &l1menu, bool printdetail=false)
HLT menu configuration.
Definition HLTMenu.h:21
std::string getFileType(const std::string &filename) const
Checks the trigger level of a given json file.
Loader of trigger menu configurations from the database.

◆ section()

void section ( const std::string & sec)

Definition at line 22 of file TestTriggerMenuAccess.cxx.

22 {
23 cout << "************************************************************" << endl;
24 cout << "** **" << endl;
25 cout << "** " << sec << setw(58-sec.size()) << "**" << endl;
26 cout << "** **" << endl;
27 cout << "************************************************************" << endl;
28
29}

◆ testHLTMenu()

bool testHLTMenu ( const TrigConf::HLTMenu & hltmenu)

Definition at line 624 of file TestTriggerMenuAccess.cxx.

624 {
625
626 cout << "===========================" << endl
627 << "===== =====" << endl
628 << "===== Test HLT access =====" << endl
629 << "===== =====" << endl
630 << "===========================" << endl << endl;
631
632 cout << "Loaded the HLT menu " << hltmenu.name() << endl;
633 cout << "Menu has " << hltmenu.size() << " chains, going to print the first 3." << endl;
634 int np = 3;
635 for( auto & ch : hltmenu ) {
636 cout << endl << "Chain '" << ch.name() << "' with counter " << ch["counter"] << " and seeded by " << ch["l1item"] << endl;
637 cout << "has the following L1 thresholds: " << endl << " ";
638 bool printComma = false;
639 for( auto & thr : ch.l1thresholds() ) {
640 if (printComma)
641 cout << ", ";
642 cout << thr;
643 printComma = true;
644 }
645 cout << endl;
646 cout << "streams:" << endl << " ";
647 printComma = false;
648 for( auto & s : ch.streams() ) {
649 if (printComma)
650 cout << ", ";
651 cout << s;
652 printComma = true;
653 }
654 cout << endl;
655 cout << "and groups:" << endl << " ";
656 printComma = false;
657 for( auto & g : ch.groups() ) {
658 if (printComma)
659 cout << ", ";
660 cout << g;
661 printComma = true;
662 }
663 cout << endl;
664 if(--np==0) break;
665 }
666 vector<TrigConf::DataStructure> streams = hltmenu.streams();
667 cout << "Menu has " << streams.size() << " streams, going to print the first 3." << endl;
668 np = 3;
669 for( auto & s : streams ) {
670 cout << " " << s["type"] << "_" << s["name"]
671 << (s["obeyLB"]=="true" ? " (obeys LB" : " (does not obey LB") << ")"
672 << (s["forceFullEventBuilding"]=="true" ? " (forces FullEventBuilding" : " (does not force FullEventBuilding") << ")"
673 << endl;
674 if(--np==0) break;
675 }
676 return true;
677}
virtual const std::string & name() const final
std::size_t size() const
Accessor to the number of HLT chains.
Definition HLTMenu.cxx:35

◆ testL1Menu()

bool testL1Menu ( const TrigConf::L1Menu & l1menu,
bool printdetail = false )

Definition at line 599 of file TestTriggerMenuAccess.cxx.

600{
601 cout << endl
602 << "==========================" << endl
603 << "===== =====" << endl
604 << "===== Test L1 access =====" << endl
605 << "===== =====" << endl
606 << "==========================" << endl << endl;
607
608 cout << "Printing detail " << (printdetail ? "yes" : "no") << endl;
609 section("Menu loading");
610 cout << "Loaded the L1 menu " << l1menu.name() << endl;
611
612 bool result = true;
613 result &= testL1Menu_Items(l1menu);
614 result &= testL1Menu_Boards(l1menu);
615 result &= testL1Menu_Connectors(l1menu);
616 result &= testL1Menu_Topo(l1menu, printdetail);
617 result &= testL1Menu_Thresholds(l1menu, printdetail);
618 result &= testL1Menu_Extrainfo(l1menu);
619 return result;
620}
bool testL1Menu_Items(const TrigConf::L1Menu &l1menu)
void section(const std::string &sec)
bool testL1Menu_Connectors(const TrigConf::L1Menu &l1menu)
bool testL1Menu_Boards(const TrigConf::L1Menu &l1menu)
bool testL1Menu_Thresholds(const TrigConf::L1Menu &l1menu, bool printdetail)
bool testL1Menu_Topo(const TrigConf::L1Menu &l1menu, bool printdetail)
bool testL1Menu_Extrainfo(const TrigConf::L1Menu &l1menu)

◆ testL1Menu_Boards()

bool testL1Menu_Boards ( const TrigConf::L1Menu & l1menu)

Definition at line 106 of file TestTriggerMenuAccess.cxx.

106 {
107 section("Boards");
108 cout << "L1 menu has " << l1menu.boardNames().size() << " boards configured" << endl;
109 string boardName("Topo1");
110 auto & board = l1menu.board(boardName);
111 cout << "Board " << boardName << " of type " << board.type() << " has " << board.size() << " connectors configured: ";
112 for( auto & connName : board.connectorNames() ) { cout << connName << " "; }
113 cout << endl;
114 return true;
115}

◆ testL1Menu_Connectors()

bool testL1Menu_Connectors ( const TrigConf::L1Menu & l1menu)

Definition at line 124 of file TestTriggerMenuAccess.cxx.

124 {
125 section("Connnectors");
126 cout << "L1 menu has " << l1menu.connectorNames().size() << " connectors configured" << endl;
127 for( const string & connName : l1menu.connectorNames() ) {
128 auto & conn = l1menu.connector(connName);
129 cout << "Connector " << connName << (conn.legacy() ? " (legacy)": "") << " has " << conn.size() << " trigger lines configured:" << endl;
130 if( connName == "MuCTPiOpt0" ) {
131 for( auto & tl : conn.triggerLines() ) {
132 cout << " Triggerline " << tl.name() << " bits=[" << tl.startbit() << ".." << tl.endbit() << "] is a muon threshold " << endl;
133 }
134 } else if( connName == "AlfaCtpin" ) {
135 for( size_t clock : { 0, 1 } ) {
136 for( auto & tl : conn.triggerLines(0, clock) ) {
137 cout << " Triggerline " << tl.name() << " (clock " << clock << ", bit " << tl.startbit() << ") is an ALFA threshold " << endl;
138 }
139 }
140 } else if( conn.connectorType() == TrigConf::L1Connector::ConnectorType::CTPIN ) {
141 for( auto & tl : conn.triggerLines() ) {
142 cout << " Triggerline " << tl.name() << " bits=[" << tl.startbit() << ".." << tl.endbit() << "] is a legacy threshold " << endl;
143 }
144 } else if( conn.connectorType() == TrigConf::L1Connector::ConnectorType::OPTICAL ) {
145 for( auto & tl : conn.triggerLines() ) {
146 const string & tlName = tl.name();
147 auto & topoAlg = l1menu.algorithmFromTriggerline(tlName);
148 cout << " Triggerline " << tlName << " bits=[" << tl.startbit() << ".." << tl.endbit()
149 << "] is produced by topo algorithm " << topoAlg.name() << endl;
150 }
151 } else if( conn.connectorType() == TrigConf::L1Connector::ConnectorType::ELECTRICAL ) {
152 for( size_t fpga : { 0, 1 } ) {
153 for( size_t clock : { 0, 1 } ) {
154 for( auto & tl : conn.triggerLines(fpga, clock) ) {
155 const string & tlName = tl.name();
156 auto & topoAlg = l1menu.algorithmFromTriggerline(tlName);
157 cout << " Triggerline " << tlName << " bits=[" << tl.startbit() << ".." << tl.endbit()
158 << "] is produced by topo algorithm " << topoAlg.name() << endl;
159 }
160 }
161 }
162 }
163 }
164 return true;
165}

◆ testL1Menu_Extrainfo()

bool testL1Menu_Extrainfo ( const TrigConf::L1Menu & l1menu)

Definition at line 328 of file TestTriggerMenuAccess.cxx.

329{
330 section("Extra information for threholds");
331 cout << "These threshold types have extra information" << endl << " ";
332 for( const string & tt : l1menu.thresholdTypes()) {
333 if( l1menu.thrExtraInfo().hasInfo(tt) ) {
334 cout << tt << " ";
335 }
336 }
337 cout << endl << "going to print details of the extra threshold information" << endl;
338 {
339 auto & exEM = l1menu.thrExtraInfo().EM();
340 cout << " EM" << endl;
341 cout << " energy resolution (MeV) " << exEM.resolutionMeV() << endl;
342 cout << " ptMinToTopo " << exEM.ptMinToTopo() << endl;
343 for( const std::string tt : {"HAIsoForEMthr", "EMIsoForEMthr"} ) {
344 cout << " Isolation " << tt << endl;
345 for(size_t bit = 1; bit <= 5; bit++) {
346 auto & iso = exEM.isolation(tt, bit);
347 cout << " " << iso << endl;
348 }
349 }
350 }
351 {
352 auto & ex = l1menu.thrExtraInfo().JET();
353 cout << " JET" << endl;
354 cout << " jetScale " << ex.jetScale() << endl;
355 cout << " energy resolution (MeV) " << ex.resolutionMeV() << endl;
356 cout << " ptMinToTopoSmallWindow " << ex.ptMinToTopoSmallWindow() << endl;
357 cout << " ptMinToTopoLargeWindow " << ex.ptMinToTopoLargeWindow() << endl;
358 cout << " ptMinToTopoSmallWindow (MeV) " << ex.ptMinToTopoSmallWindowMeV() << endl;
359 cout << " ptMinToTopoLargeWindow (MeV) " << ex.ptMinToTopoLargeWindowMeV() << endl;
360 cout << " ptMinToTopoSmallWindow (counts) " << ex.ptMinToTopoSmallWindowCounts() << endl;
361 cout << " ptMinToTopoLargeWindow (counts) " << ex.ptMinToTopoLargeWindowCounts() << endl;
362 }
363 {
364 auto & ex = l1menu.thrExtraInfo().TAU();
365 cout << " TAU" << endl;
366 cout << " energy resolution (MeV) " << ex.resolutionMeV() << endl;
367 cout << " ptMinToTopo " << ex.ptMinToTopo() << endl;
368 cout << " ptMinToTopo (MeV) " << ex.ptMinToTopoMeV() << endl;
369 cout << " ptMinToTopo (counts)" << ex.ptMinToTopoCounts() << endl;
370 cout << " Isolation EMIsoForTAUthr" << endl;
371 for(size_t bit = 1; bit <= 5; bit++) {
372 cout << " " << ex.isolation("EMIsoForTAUthr", bit) << endl;
373 }
374 }
375 {
376 auto & ex = l1menu.thrExtraInfo().eEM();
377 cout << " eEM" << endl;
378 cout << " iso maxEt (GeV) " << ex.maxEt() << endl;
379 cout << " iso maxEt (MeV) " << ex.maxEtMeV() << endl;
380 cout << " iso maxEt (Counts) " << ex.maxEtCounts(ex.resolutionMeV()) << endl;
381 cout << " energy resolution (MeV) " << ex.resolutionMeV() << endl;
382 cout << " ptMinToTopo " << ex.ptMinToTopo() << endl;
383 cout << " ptMinToTopo (MeV) " << ex.ptMinToTopoMeV() << endl;
384 cout << " ptMinToTopo (counts)" << ex.ptMinToTopoCounts() << endl;
385 cout << " working point Loose" << endl;
386 for(auto & iso : ex.isolation(TrigConf::Selection::WP::LOOSE)) {
387 cout << " range etaMin=" << iso.etaMin() << ", etaMax=" << iso.etaMax()
388 << ", priority=" << iso.priority() << ", symmetric=" << (iso.symmetric() ? "yes" : "no")
389 << ", isolation=" << iso.value() << endl;
390 }
391 cout << " working point Medium" << endl;
392 for(auto & iso : ex.isolation(TrigConf::Selection::WP::MEDIUM)) {
393 cout << " range etaMin=" << iso.etaMin() << ", etaMax=" << iso.etaMax()
394 << ", priority=" << iso.priority() << ", symmetric=" << (iso.symmetric() ? "yes" : "no")
395 << ", isolation=" << iso.value() << endl;
396 }
397 cout << " working point Tight" << endl;
398 for(auto & iso : ex.isolation(TrigConf::Selection::WP::TIGHT)) {
399 cout << " range etaMin=" << iso.etaMin() << ", etaMax=" << iso.etaMax()
400 << ", priority=" << iso.priority() << ", symmetric=" << (iso.symmetric() ? "yes" : "no")
401 << ", isolation=" << iso.value() << endl;
402 }
403 //cout << " working point Medium at eta = -20:" << ex.isolation(TrigConf::Selection::WP::MEDIUM,-20) << endl;
404 cout << " working point Medium at eta = 20:" << ex.isolation(TrigConf::Selection::WP::LOOSE,20) << endl;
405
406 for( int ieta : { -30, -20, -10, 0, 10, 20, 30 } ) {
407 const auto & iso_loose = ex.isolation(TrigConf::Selection::WP::LOOSE, ieta);
408 int reta_loose_fw = iso_loose.reta_fw();
409 int rhad_loose_fw = iso_loose.rhad_fw();
410 int wstot_loose_fw = iso_loose.wstot_fw();
411 int reta_loose_d = iso_loose.reta_d();
412 int rhad_loose_d = iso_loose.rhad_d();
413 int wstot_loose_d = iso_loose.wstot_d();
414 cout << "ieta=" << ieta << " loose => reta_fw=" << reta_loose_fw << ", rhad_fw=" << rhad_loose_fw << ", wstot_fw=" << wstot_loose_fw << endl;
415 cout << "ieta=" << ieta << " loose => reta_d=" << reta_loose_d << ", rhad_d=" << rhad_loose_d << ", wstot_d=" << wstot_loose_d << endl;
416 }
417
418 }
419 {
420 auto & ex = l1menu.thrExtraInfo().jEM();
421 cout << " jEM" << endl;
422 cout << " energy resolution (MeV) " << ex.resolutionMeV() << endl;
423 cout << " ptMinToTopo " << ex.ptMinToTopo("1A") << endl;
424 cout << " ptMinToTopo (MeV) " << ex.ptMinToTopoMeV("1A") << endl;
425 cout << " ptMinToTopo (counts)" << ex.ptMinToTopoCounts("1A") << endl;
426 cout << " ptMinxTOB " << ex.ptMinxTOB("1A") << endl;
427 cout << " ptMinxTOB (MeV) " << ex.ptMinxTOBMeV("1A") << endl;
428 cout << " ptMinxTOB (counts) " << ex.ptMinxTOBCounts("1A") << endl;
429 cout << " working point Loose" << endl;
430 for(auto & iso : ex.isolation(TrigConf::Selection::WP::LOOSE)) {
431 cout << " range etaMin=" << iso.etaMin() << ", etaMax=" << iso.etaMax()
432 << ", priority=" << iso.priority() << ", symmetric=" << (iso.symmetric() ? "yes" : "no")
433 << ", isolation=" << iso.value() << endl;
434 }
435 cout << " working point Medium" << endl;
436 for(auto & iso : ex.isolation(TrigConf::Selection::WP::MEDIUM)) {
437 cout << " range etaMin=" << iso.etaMin() << ", etaMax=" << iso.etaMax()
438 << ", priority=" << iso.priority() << ", symmetric=" << (iso.symmetric() ? "yes" : "no")
439 << ", isolation=" << iso.value() << endl;
440 }
441 cout << " working point Tight" << endl;
442 for(auto & iso : ex.isolation(TrigConf::Selection::WP::TIGHT)) {
443 cout << " range etaMin=" << iso.etaMin() << ", etaMax=" << iso.etaMax()
444 << ", priority=" << iso.priority() << ", symmetric=" << (iso.symmetric() ? "yes" : "no")
445 << ", isolation=" << iso.value() << endl;
446 }
447 //cout << " working point Medium at eta = -20:" << ex.isolation(TrigConf::Selection::WP::MEDIUM,-20) << endl;
448 cout << " working point Medium at eta = 20:" << ex.isolation(TrigConf::Selection::WP::LOOSE,20) << endl;
449 }
450 {
451 auto & ex = l1menu.thrExtraInfo().jJ();
452 cout << " jJ" << endl;
453 cout << " energy resolution (MeV) " << ex.resolutionMeV() << endl;
454 cout << " ptMinToTopo " << ex.ptMinToTopo("1A") << endl;
455 cout << " ptMinToTopo (MeV) " << ex.ptMinToTopoMeV("1A") << endl;
456 cout << " ptMinToTopo (counts) " << ex.ptMinToTopoCounts("1A") << endl;
457 cout << " ptMinxTOB " << ex.ptMinxTOB("1A") << endl;
458 cout << " ptMinxTOB (MeV) " << ex.ptMinxTOBMeV("1A") << endl;
459 cout << " ptMinxTOB (counts) " << ex.ptMinxTOBCounts("1A") << endl;
460 }
461 {
462 auto & ex = l1menu.thrExtraInfo().jLJ();
463 cout << " jLJ" << endl;
464 cout << " energy resolution (MeV) " << ex.resolutionMeV() << endl;
465 cout << " ptMinToTopo " << ex.ptMinToTopo("1A") << endl;
466 cout << " ptMinToTopo (MeV) " << ex.ptMinToTopoMeV("1A") << endl;
467 cout << " ptMinToTopo (counts) " << ex.ptMinToTopoCounts("1A") << endl;
468 cout << " ptMinxTOB " << ex.ptMinxTOB("1A") << endl;
469 cout << " ptMinxTOB (MeV) " << ex.ptMinxTOBMeV("1A") << endl;
470 cout << " ptMinxTOB (counts) " << ex.ptMinxTOBCounts("1A") << endl;
471 }
472 {
473 auto & ex = l1menu.thrExtraInfo().gLJ();
474 cout << " gLJ" << endl;
475 cout << " energy resolution (MeV) " << ex.resolutionMeV() << endl;
476 cout << " ptMinToTopo (eta range "<<std::to_string(1)<<") in GeV " << ex.ptMinToTopo(1) << endl;
477 cout << " ptMinToTopo (MeV) " << ex.ptMinToTopoMeV(1) << endl;
478 cout << " ptMinToTopo (counts) " << ex.ptMinToTopoCounts(1) << endl;
479 cout << " seedThr(A) " << ex.seedThr('A') << endl;
480 cout << " seedThr(A) (MeV) " << ex.seedThrMeV('A') << endl;
481 cout << " rhoTowerMin(B) " << ex.rhoTowerMin('B') << endl;
482 cout << " rhoTowerMin(B) (MeV) " << ex.rhoTowerMinMeV('B') << endl;
483 cout << " rhoTowerMax(C) " << ex.rhoTowerMax('C') << endl;
484 cout << " rhoTowerMax(C) (MeV) " << ex.rhoTowerMaxMeV('C') << endl;
485 }
486 {
487 auto & ex = l1menu.thrExtraInfo().gXE();
488 cout << " gXE" << endl;
489 cout << " energy resolution (MeV) " << ex.resolutionMeV() << endl;
490 cout << " seedThr(A) " << ex.seedThr('A') << endl;
491 cout << " seedThr(A) (MeV) " << ex.seedThrMeV('A') << endl;
492 cout << " XERHO_sigmaPosA " << ex.XERHO_param('A',true) << endl;
493 cout << " XERHO_sigmaNegB " << ex.XERHO_param('B',false) << endl;
494 cout << " XEJWOJ_a_C " << ex.JWOJ_param('C','a') << endl;
495 cout << " XEJWOJ_b_B " << ex.JWOJ_param('B','b') << endl;
496 cout << " XEJWOJ_c_A " << ex.JWOJ_param('A','c') << endl;
497 }
498 {
499 auto & ex = l1menu.thrExtraInfo().eTAU();
500 cout << " eTAU" << endl;
501 cout << " energy resolution (MeV) " << ex.resolutionMeV() << endl;
502 cout << " ptMinToTopo " << ex.ptMinToTopo() << endl;
503 cout << " ptMinToTopo (MeV) " << ex.ptMinToTopoMeV() << endl;
504 cout << " ptMinToTopo (counts)" << ex.ptMinToTopoCounts() << endl;
505 cout << " working point Loose" << endl;
506 for(auto & iso : ex.isolation(TrigConf::Selection::WP::LOOSE)) {
507 cout << " range etaMin=" << iso.etaMin() << ", etaMax=" << iso.etaMax()
508 << ", priority=" << iso.priority() << ", symmetric=" << (iso.symmetric() ? "yes" : "no")
509 << ", isolation=" << iso.value() << endl;
510 }
511 cout << " working point Medium" << endl;
512 for(auto & iso : ex.isolation(TrigConf::Selection::WP::MEDIUM)) {
513 cout << " range etaMin=" << iso.etaMin() << ", etaMax=" << iso.etaMax()
514 << ", priority=" << iso.priority() << ", symmetric=" << (iso.symmetric() ? "yes" : "no")
515 << ", isolation=" << iso.value() << endl;
516 }
517 cout << " working point Tight" << endl;
518 for(auto & iso : ex.isolation(TrigConf::Selection::WP::TIGHT)) {
519 cout << " range etaMin=" << iso.etaMin() << ", etaMax=" << iso.etaMax()
520 << ", priority=" << iso.priority() << ", symmetric=" << (iso.symmetric() ? "yes" : "no")
521 << ", isolation=" << iso.value() << endl;
522 }
523 }
524 {
525 auto & ex = l1menu.thrExtraInfo().jTAU();
526 cout << " jTAU" << endl;
527 cout << " energy resolution (MeV) " << ex.resolutionMeV() << endl;
528 cout << " ptMinToTopo " << ex.ptMinToTopo("1A") << endl;
529 cout << " ptMinToTopo (MeV) " << ex.ptMinToTopoMeV("1A") << endl;
530 cout << " ptMinToTopo (counts)" << ex.ptMinToTopoCounts("1A") << endl;
531 cout << " ptMinxTOB " << ex.ptMinxTOB("1A") << endl;
532 cout << " ptMinxTOB (MeV) " << ex.ptMinxTOBMeV("1A") << endl;
533 cout << " ptMinxTOB (counts) " << ex.ptMinxTOBCounts("1A") << endl;
534 cout << " working point Loose" << endl;
535 for(auto & iso : ex.isolation(TrigConf::Selection::WP::LOOSE)) {
536 cout << " range etaMin=" << iso.etaMin() << ", etaMax=" << iso.etaMax()
537 << ", priority=" << iso.priority() << ", symmetric=" << (iso.symmetric() ? "yes" : "no")
538 << ", isolation=" << iso.value() << endl;
539 }
540 cout << " working point Medium" << endl;
541 for(auto & iso : ex.isolation(TrigConf::Selection::WP::MEDIUM)) {
542 cout << " range etaMin=" << iso.etaMin() << ", etaMax=" << iso.etaMax()
543 << ", priority=" << iso.priority() << ", symmetric=" << (iso.symmetric() ? "yes" : "no")
544 << ", isolation=" << iso.value() << endl;
545 }
546 cout << " working point Tight" << endl;
547 for(auto & iso : ex.isolation(TrigConf::Selection::WP::TIGHT)) {
548 cout << " range etaMin=" << iso.etaMin() << ", etaMax=" << iso.etaMax()
549 << ", priority=" << iso.priority() << ", symmetric=" << (iso.symmetric() ? "yes" : "no")
550 << ", isolation=" << iso.value() << endl;
551 }
552 }
553 {
554 auto & ex = l1menu.thrExtraInfo().cTAU();
555 cout << " cTAU" << endl;
556 cout << " working point Loose" << endl;
557 for(auto & iso : ex.isolation(TrigConf::Selection::WP::LOOSE)) {
558 cout << " range etaMin=" << iso.etaMin() << ", etaMax=" << iso.etaMax()
559 << ", priority=" << iso.priority() << ", symmetric=" << (iso.symmetric() ? "yes" : "no")
560 << ", isolation=" << iso.value() << endl;
561 }
562 cout << " working point Medium" << endl;
563 for(auto & iso : ex.isolation(TrigConf::Selection::WP::MEDIUM)) {
564 cout << " range etaMin=" << iso.etaMin() << ", etaMax=" << iso.etaMax()
565 << ", priority=" << iso.priority() << ", symmetric=" << (iso.symmetric() ? "yes" : "no")
566 << ", isolation=" << iso.value() << endl;
567 }
568 cout << " working point Tight" << endl;
569 for(auto & iso : ex.isolation(TrigConf::Selection::WP::TIGHT)) {
570 cout << " range etaMin=" << iso.etaMin() << ", etaMax=" << iso.etaMax()
571 << ", priority=" << iso.priority() << ", symmetric=" << (iso.symmetric() ? "yes" : "no")
572 << ", isolation=" << iso.value() << endl;
573 }
574 }
575
576 auto & exMU = l1menu.thrExtraInfo().MU();
577 cout << " MU" << endl;
578 cout << " known pt values for rpc ";
579 for(auto pt : exMU.knownRpcPtValues()) cout << pt << " ";
580 cout << endl << " known pt values for tgc ";
581 for(auto pt : exMU.knownTgcPtValues()) cout << pt << " ";
582 cout << endl;
583 cout << " RPC pt value for index 2: "<< exMU.ptForRpcIdx(2) << endl;
584 cout << " TGC pt value for index 2: "<< exMU.ptForTgcIdx(2) << endl;
585 cout << " TGC index for RPC index 2: "<< exMU.tgcIdxForRpcIdx(2) << endl;
586 if( const auto & list = exMU.exclusionListNames(); std::find(list.begin(), list.end(), "rpcFeet")!=list.end() ) {
587 cout << " exclusionList 'rpcFeet'" << endl;
588 for(auto & x : exMU.exclusionList("rpcFeet")) {
589 cout << " sector " << x.first << ": ";
590 for( auto roi : x.second ) cout << roi << " ";
591 cout << endl;
592 }
593 }
594 return true;
595}
#define x

◆ testL1Menu_Items()

bool testL1Menu_Items ( const TrigConf::L1Menu & l1menu)

Definition at line 86 of file TestTriggerMenuAccess.cxx.

86 {
87 section("Items");
88 cout << endl << "L1 menu has " << l1menu.size() << " items, going to print the first:" << endl;
89 int ni = 3; // print only first 1
90 for(const auto & item : l1menu ) {
91 cout << " " << item.name() << "(ctpId " << item.ctpId() << ") has definition '" << item.definition() << "' and triggerType " << item.triggerType()<< endl;
92 cout << "Full printout:" << endl;
93 item.print();
94 if(--ni==0) break;
95 }
96 return true;
97}

◆ testL1Menu_Thresholds()

bool testL1Menu_Thresholds ( const TrigConf::L1Menu & l1menu,
bool printdetail )

Definition at line 217 of file TestTriggerMenuAccess.cxx.

218{
219 section("Thresholds");
220
221 cout << "L1 menu has " << l1menu.thresholdTypes().size() << " threshold types configured: " << endl << " ";
222 for( const string & tt : l1menu.thresholdTypes()) { cout << tt << " "; } cout << endl;
223 for( const string & tt : l1menu.thresholdTypes()) {
224 cout << "L1 menu has " << l1menu.thresholds(tt).size() << " thresholds of type " << tt;
225 if(printdetail) {
226 cout << " thresholds, going to print the first three." << endl;
227 int ni = 3; // print the first 3
228 for(const auto& thr : l1menu.thresholds(tt) ) {
229 cout << " " << thr->name() << " of type " << thr->type() << " (mapping " << thr->mapping() << ") " << endl;
230 if(--ni==0) break;
231 }
232 } else {
233 cout << endl;
234 }
235 if(tt != "internal") {
236 for(const auto& thr : l1menu.thresholds(tt) ) {
237 if(thr->name().find("MULT-CMU") != std::string::npos){ continue; } // tmp hack!
238 const std::string & connName = l1menu.connectorNameFromThreshold(thr->name());
239 if(! l1menu.connector(connName).hasLine(thr->name())) {
240 throw std::runtime_error("Threshold " + thr->name() + " does not exist as triggerline of connector " + connName);
241 }
242 }
243 }
244 }
245
246 const auto & thrEM = dynamic_cast<const TrigConf::L1Threshold_EM&>(l1menu.threshold("EM22VHI"));
247 thrEM.print();
248
249 const auto & thrTAU = dynamic_cast<const TrigConf::L1Threshold_TAU&>(l1menu.threshold("HA12IM"));
250 if(thrTAU) {
251 cout << thrTAU.name() << ":" << endl;
252 for(int eta : {0, 10, 20, -10,-20}) {
253 cout << " value at eta = " << eta << ": " << thrTAU.thrValue(eta) << " GeV, "<< thrTAU.thrValueCounts(eta) <<" counts, iso " << thrTAU.isolationMask() << endl;
254 }
255 }
256
257 if(printdetail) {
258 for ( const string & thrName : l1menu.thresholdNames() ) {
259 cout << thrName << " threshold value: " << l1menu.threshold(thrName).thrValue() << endl;
260 }
261 }
262
263 cout << "XE30 cut: " << l1menu.threshold("XE30").thrValue() << endl;
264 const auto & thrjXE = dynamic_cast<const TrigConf::L1Threshold_jXE&>(l1menu.threshold("jXESPARE1"));
265 if(thrjXE) cout << "jXESPARE1 cut [100 MeV]: " << thrjXE.thrValue100MeV() << endl;
266
267
268 auto thrJET = dynamic_pointer_cast<TrigConf::L1Threshold_JET>(l1menu.thresholds("JET")[0]);
269 if(thrJET) {
270 cout << thrJET->name() << ":" << endl;
271 for(int eta : {0, 20, 30, 40}) {
272 cout << " value at eta = " << eta << ": " << thrJET->thrValue(eta) << " GeV, "
273 << thrJET->thrValueMeV(eta) << " MeV, " << thrJET->thrValueCounts(eta) << " counts" << endl;
274 }
275 }
276
277 auto thrXE = dynamic_pointer_cast<TrigConf::L1Threshold_XE>(l1menu.thresholds("XE")[0]);
278 if(thrXE) {
279 cout << thrXE->name() << ": value " << thrXE->thrValue() << " GeV, " << thrXE->thrValueMeV() << " MeV, " << thrXE->thrValueCounts() << " counts" << endl;
280 }
281
282// auto thrTERR = dynamic_cast<const TrigConf::L1Threshold_TE&>(l1menu.threshold("TE5.0ETA24"));
283// cout << thrTERR.name() << ":" << endl;
284// for(int eta : {0, 20, 30, 40}) {
285// cout << " value at eta = " << eta << ": " << thrTERR.thrValue(eta) << " GeV, " << thrTERR.thrValueMeV(eta) << " MeV, " << thrTERR.thrValueCounts(eta) << " counts" << endl;
286// }
287
288
289 const auto & threEM = dynamic_cast<const TrigConf::L1Threshold_eEM&>(l1menu.threshold("eEM26M"));
290 cout << "eEM26M isolation: rhad = " << (int)threEM.rhad() << ", reta = " << (int)threEM.reta() << ", wstot = " << (int)threEM.wstot() << endl;
291
292 const auto & threTAU = dynamic_cast<const TrigConf::L1Threshold_eTAU&>(l1menu.threshold("eTAU12"));
293 if(threTAU) {
294 cout << threTAU.name() << ":" << endl;
295 for(int eta : {0, 10, 20, -10,-20}) {
296 cout << " value at eta = " << eta << ": " << threTAU.thrValue(eta) << " GeV, " << threTAU.thrValueCounts(eta) << " counts, iso " << (int)threTAU.rCore() << endl;
297 }
298 }
299
300 const auto & thrjEM = dynamic_cast<const TrigConf::L1Threshold_jEM&>(l1menu.threshold("jEM20M"));
301 cout << "jEM20M isolation: iso = " << (int)thrjEM.iso() << ", frac = " << (int)thrjEM.frac() << ", frac2 = " << (int)thrjEM.frac2() << endl;
302
303 const auto & thrjJET = dynamic_cast<const TrigConf::L1Threshold_jJ&>(l1menu.threshold("jJ30p0ETA25"));
304 if(thrjJET) {
305 cout << thrjJET.name() << ":" << endl;
306 for(int eta : {0, 20, 30, 40}) {
307 cout << " value at eta = " << eta << ": " << thrjJET.thrValue(eta) << " GeV, "
308 << thrjJET.thrValueMeV(eta) << " MeV, " << thrjJET.thrValueCounts(eta) << " counts" << endl;
309 }
310 }
311
312
313 const auto & thrMU8VF = dynamic_cast<const TrigConf::L1Threshold_MU&>(l1menu.threshold("MU8VF"));
314 cout << "Threshold MU8VF with "
315 << "barrel pt=" << thrMU8VF.ptBarrel() << " (idx " << thrMU8VF.idxBarrel() << "), "
316 << "endcap pt=" << thrMU8VF.ptEndcap() << " (idx " << thrMU8VF.idxEndcap() << "), and "
317 << "forward pt=" << thrMU8VF.ptForward() << " (idx " << thrMU8VF.idxForward() << ")" << endl;
318 return true;
319}
Scalar eta() const
pseudorapidity method
virtual unsigned int thrValue100MeV(int eta=0) const
as above above but in 100 MeV
void print(std::ostream &os=std::cout) const override
unsigned int ptBarrel() const
Selection::WP rhad() const
Selection::WP iso() const

◆ testL1Menu_Topo()

bool testL1Menu_Topo ( const TrigConf::L1Menu & l1menu,
bool printdetail )

Definition at line 174 of file TestTriggerMenuAccess.cxx.

175{
176 section("Topo algorithms");
177 {
178 cout << "Number of topo algorithms: " << l1menu.topoAlgorithmNames("TOPO").size() << endl;
179 cout << "Number of topo algorithm outputs: " << l1menu.topoAlgorithmOutputNames("TOPO").size() << endl;
180
181 const auto & tl = l1menu.connector("LegacyTopo1").triggerLines(0,0)[0];
182 auto & topoAlg = l1menu.algorithmFromTriggerline(tl.name());
183 topoAlg.print();
184
185 auto & topoAlgInvmassLeg = l1menu.algorithmFromTriggerline("R2TOPO_900INVM9999-AJ30s6-AJ20s6");
186 topoAlgInvmassLeg.print();
187 cout << "Explicit access to 'NumResultBits' as unsigned int: " << topoAlgInvmassLeg.genericParameter<unsigned int>("NumResultBits") << endl;
188
189 auto & topoAlgEMJ = l1menu.algorithmFromOutput("0DR03-eEM7ab-CjJ15ab", "TOPO");
190 topoAlgEMJ.print();
191
192 auto & topoMultAlg = l1menu.algorithm("Mult_eEM22M","MULTTOPO");
193 topoMultAlg.print();
194 cout << " threshold definition: " << topoMultAlg.getAttribute("threshold") << endl;
195
196 if(printdetail) {
197 for( auto & algName : l1menu.topoAlgorithmNames("TOPO") ) {
198 auto & alg = l1menu.algorithm( algName, "TOPO" );
199 cout << algName << " has inputs ";
200 for( auto & inp : alg.inputs() ) {
201 cout << inp;
202 }
203 cout << endl;
204 }
205 }
206 }
207 return true;
208}
const std::string & algName(ID id)
Converts a JetAlgorithmType::ID into a string.

◆ usage()

void usage ( )

Main function just to get the filename and which type.

Definition at line 686 of file TestTriggerMenuAccess.cxx.

686 {
687
688 cout << "The program needs to be run with the following specifications:\n\n";
689 cout << "TestTriggerMenuAccess <options>\n";
690 cout << "\n";
691 cout << "[Input options]\n";
692 cout << " -f|--file file1 ... input json file to test\n";
693 cout << " --smk smk ... smk \n";
694 cout << " --db dbalias ... dbalias (default TRIGGERDB_RUN3) \n";
695 cout << "[Other options]\n";
696 cout << " -h|--help ... this help\n";
697 cout << "\n";
698 cout << "If no input is specified, the default Dev_pp_run3_v1 menu file will be taken from the release\n\n";
699}