Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:27

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 // To compile run these lines in your CMSSW_X_Y_Z/src/ :
0011 /*
0012 cmsenv
0013 eval "export `scram tool info xerces-c | sed -n -e 's/INCLUDE=/XERC_INC=/gp'`"
0014 eval "export `scram tool info xerces-c | sed -n -e 's/LIBDIR=/XERC_LIB=/gp'`"
0015 eval "export `scram tool info boost    | sed -n -e 's/INCLUDE=/BOOST_INC=/gp'`"
0016 eval "export `scram tool info boost    | sed -n -e 's/LIBDIR=/BOOST_LIB=/gp'`"
0017 g++ -g -std=c++11 -o test readbmtf.cpp -I./ -I$CMSSW_RELEASE_BASE/src -I$XERC_INC -L$XERC_LIB -lxerces-c -I$BOOST_INC -L$BOOST_LIB -lboost_thread -lboost_signals -lboost_date_time -L$CMSSW_RELEASE_BASE/lib/$SCRAM_ARCH/ -lFWCoreMessageLogger -lCondFormatsL1TObjects
0018 */
0019 
0020 using namespace std;
0021 
0022 int main(int argc, char *argv[]){
0023 
0024     // read the input xml file into a string
0025     list<string> sequence;
0026     map<string,string> xmlPayload;
0027     for(int p=1; p<argc; p++){
0028 
0029         ifstream input( argv[p] );
0030         if( !input ){ cout << "Cannot open " << argv[p] << " file" << endl; return 0; }
0031         sequence.push_back( argv[p] );
0032 
0033         size_t nLinesRead=0;
0034 
0035         while( !input.eof() ){
0036             string tmp;
0037             getline( input, tmp, '\n' );
0038             xmlPayload[ argv[p] ].append( tmp );
0039             nLinesRead++;
0040         }
0041 
0042         cout << argv[p] << ": read " << nLinesRead << " lines" << endl;
0043         input.close();
0044     }
0045 
0046     // finally, push all payloads to the XML parser and construct the TrigSystem objects with each of those
0047     l1t::XmlConfigReader xmlRdr;
0048     l1t::TrigSystem trgSys;
0049 
0050 //    trgSys.addProcRole("processors", "processors");
0051 
0052     // HW settings should always go first
0053     for(auto &name : sequence){
0054         cout<<"Parsing "<<name<<endl;
0055         xmlRdr.readDOMFromString( xmlPayload[name] );
0056         xmlRdr.readRootElement  ( trgSys           );
0057     }
0058     trgSys.setConfigured();
0059 
0060 //try {
0061 //    map<string, l1t::setting> conf = trgSys.getSettings("ugmt_processor");
0062 //    map<string, l1t::mask>    rs   = trgSys.getMasks   ("daqttcs");
0063 //    string tmp = conf["bmtfInputsToDisable"].getValueAsStr();
0064 //    cout << "bmtfInputsToDisable=" << tmp << endl;
0065 //} catch ( std::runtime_error &e ){
0066 //cout << "Exception thrown: "<< e.what() << endl;
0067 //}
0068     std::cout << "Checking the masked procs\n";
0069     std::map<std::string, std::string> allProcs = trgSys.getProcRole();
0070     for(auto it = allProcs.begin(); it != allProcs.end(); ++it)
0071         std::cout << "Proc " << it->first << " is " << trgSys.isProcEnabled(it->first) << std::endl;
0072 
0073     return 0;
0074 }
0075