File indexing completed on 2023-03-17 11:14:28
0001 #include "L1Trigger/L1TCommon/src/Setting.cc"
0002 #include "L1Trigger/L1TCommon/src/Mask.cc"
0003 #include "L1Trigger/L1TCommon/src/Tools.cc"
0004 #include "L1Trigger/L1TCommon/src/XmlConfigReader.cc"
0005 #include "L1Trigger/L1TCommon/src/TrigSystem.cc"
0006
0007 #include <iostream>
0008 #include <fstream>
0009
0010 #include <time.h>
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 using namespace std;
0023
0024 int main(int argc, char *argv[]){
0025
0026
0027 list<string> sequence;
0028 map<string,string> xmlPayload;
0029 for(int p=1; p<argc; p++){
0030
0031 ifstream input( argv[p] );
0032 if( !input ){ cout << "Cannot open " << argv[p] << " file" << endl; return 0; }
0033 sequence.push_back( argv[p] );
0034
0035 size_t nLinesRead=0;
0036
0037 while( !input.eof() ){
0038 string tmp;
0039 getline( input, tmp, '\n' );
0040 xmlPayload[ argv[p] ].append( tmp );
0041 nLinesRead++;
0042 }
0043
0044 cout << argv[p] << ": read " << nLinesRead << " lines" << endl;
0045 input.close();
0046 }
0047
0048
0049 l1t::XmlConfigReader xmlRdr;
0050 l1t::TrigSystem trgSys;
0051
0052
0053
0054
0055 for(auto &name : sequence){
0056 cout<<"Parsing "<<name<<endl;
0057 xmlRdr.readDOMFromString( xmlPayload[name] );
0058 xmlRdr.readRootElement ( trgSys );
0059 }
0060 trgSys.setConfigured();
0061
0062 try {
0063
0064 map<string, l1t::Setting> conf1 = trgSys.getSettings("EMTF+1");
0065 string tmp1 = conf1["control_firmware_version"].getValueAsStr();
0066 cout << "EMTF+1 control_firmware_version =" << tmp1 << endl;
0067
0068 map<string, l1t::Setting> conf2 = trgSys.getSettings("EMTF-1");
0069 string tmp2 = conf2["control_firmware_version"].getValueAsStr();
0070 cout << "EMTF-1 control_firmware_version =" << tmp2 << endl;
0071
0072 string core_fwv = conf2["core_firmware_version"].getValueAsStr();
0073 tm brokenTime;
0074 strptime(core_fwv.c_str(), "%Y-%m-%d %T", &brokenTime);
0075 time_t sinceEpoch = timegm(&brokenTime);
0076 cout << "core_fwv= " << core_fwv << " timestamp= " << sinceEpoch << endl;
0077
0078 cout << "pT LUT version "<< conf2["pt_lut_version"].getValue<unsigned int>() << endl;
0079
0080 } catch ( std::runtime_error &e ){
0081 cout << "Exception thrown: "<< e.what() << endl;
0082 }
0083
0084 return 0;
0085 }
0086