Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "L1Trigger/L1TCommon/src/Setting.cc"
0002 #include "L1Trigger/L1TCommon/src/Mask.cc"
0003 #include "L1Trigger/L1TCommon/src/XmlConfigReader.cc"
0004 #include "L1Trigger/L1TCommon/src/TrigSystem.cc"
0005 #include "L1Trigger/L1TMuon/src/L1TMuonGlobalParamsHelper.cc"
0006 #include "L1Trigger/L1TMuon/src/L1TMuonGlobalParams_PUBLIC.cc"
0007 
0008 #include <iostream>
0009 #include <fstream>
0010 
0011 // To compile run these lines in your CMSSW_X_Y_Z/src/ :
0012 /*
0013 cmsenv
0014 eval "export `scram tool info xerces-c | sed -n -e 's/INCLUDE=/XERC_INC=/gp'`"
0015 eval "export `scram tool info xerces-c | sed -n -e 's/LIBDIR=/XERC_LIB=/gp'`"
0016 eval "export `scram tool info boost    | sed -n -e 's/INCLUDE=/BOOST_INC=/gp'`"
0017 eval "export `scram tool info boost    | sed -n -e 's/LIBDIR=/BOOST_LIB=/gp'`"
0018 g++ -g -std=c++11 -o test readugmt.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
0019 */
0020 
0021 using namespace std;
0022 
0023 int main(int argc, char *argv[]){
0024 
0025     // read the input xml file into a string
0026     list<string> sequence;
0027     map<string,string> xmlPayload;
0028     for(int p=1; p<argc; p++){
0029 
0030         ifstream input( argv[p] );
0031         if( !input ){ cout << "Cannot open " << argv[p] << " file" << endl; return 0; }
0032         sequence.push_back( argv[p] );
0033 
0034         size_t nLinesRead=0;
0035 
0036         while( !input.eof() ){
0037             string tmp;
0038             getline( input, tmp, '\n' );
0039             xmlPayload[ argv[p] ].append( tmp );
0040             nLinesRead++;
0041         }
0042 
0043         cout << argv[p] << ": read " << nLinesRead << " lines" << endl;
0044         input.close();
0045     }
0046 
0047     // finally, push all payloads to the XML parser and construct the trigSystem objects with each of those
0048     l1t::XmlConfigReader xmlRdr;
0049     l1t::TrigSystem trgSys;
0050 
0051 // uncommenting the following line seems to solve one of the problems
0052 //    trgSys.addProcRole("processors", "processors");
0053 
0054     // HW settings should always go first
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> conf = trgSys.getSettings("ugmt_processor");
0065 //    map<string, l1t::Mask>    rs   = trgSys.getMasks   ("daqttcs");
0066 //    string tmp = conf["bmtfInputsToDisable"].getValueAsStr();
0067 //    cout << "bmtfInputsToDisable=" << tmp << endl;
0068 
0069     L1TMuonGlobalParamsHelper m_params_helper;
0070     m_params_helper.loadFromOnline(trgSys);
0071 
0072 } catch ( std::runtime_error &e ){
0073 cout << "Exception thrown: "<< e.what() << endl;
0074 }
0075 
0076     return 0;
0077 }
0078