File indexing completed on 2024-04-06 12:03:12
0001 #include <iostream>
0002 #include <string>
0003
0004 #include "CondFormats/L1TObjects/interface/L1TUtmTriggerMenu.h"
0005
0006 void showHelpMessage() {
0007 std::cout << "---------------------------------------------------------------\n";
0008 std::cout << "=== l1tHashMenuFirmwareUUID ===\n";
0009 std::cout << "=== compute 32-bit hashed version of L1T-menu firmware UUID ===\n";
0010 std::cout << "---------------------------------------------------------------\n";
0011 std::cout << "\n"
0012 << "Purpose:\n"
0013 << " return 32-bit hashed version (type: int) of the firmware-UUID of a L1T menu\n\n"
0014 << "Input:\n"
0015 << " firmware-UUID of a L1T menu, i.e. value of the field \"uuid-firmware\""
0016 << " in the .xml file containing the L1T menu;\n"
0017 << " given a database payload XYZ, the .xml file can be obtained via \"conddb dump XYZ > tmp.xml\"\n"
0018 << " (if \"-h\" or \"--help\" are specified, this help message is shown)\n\n"
0019 << "Exit code:\n"
0020 << " 1 if no command-line arguments are specified, 0 otherwise\n\n"
0021 << "Example:\n"
0022 << " > l1tHashMenuFirmwareUUID 7a1a9c0b-5e34-4c25-804f-2ae8094c4832\n\n";
0023 }
0024
0025 int main(int argc, char** argv) {
0026 if (argc < 2) {
0027 std::cerr << "ERROR: no L1T-menu firmware UUID specified (hint: specify --help for more info).\n";
0028 return 1;
0029 } else {
0030 for (int idx = 1; idx < argc; ++idx) {
0031 std::string const argv_i = argv[idx];
0032 if (argv_i == "-h" or argv_i == "--help") {
0033 showHelpMessage();
0034 return 0;
0035 }
0036 }
0037
0038 if (argc > 2) {
0039 std::cerr << "WARNING: specified " << argc - 1 << " command-line arguments,"
0040 << " but only the first one will be used (" << argv[1] << ").\n";
0041 }
0042 }
0043
0044 L1TUtmTriggerMenu foo;
0045 foo.setFirmwareUuid(argv[1]);
0046
0047 std::cout << int(foo.getFirmwareUuidHashed()) << std::endl;
0048
0049 return 0;
0050 }