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/XmlConfigReader.cc"
0004 #include "L1Trigger/L1TCommon/src/TrigSystem.cc"
0005 
0006 #include <iostream>
0007 #include <fstream>
0008 
0009 // To compile run these lines in your CMSSW_X_Y_Z/src/ :
0010 /*
0011 cmsenv
0012 eval "setenv `scram tool info xerces-c | sed -n -e 's/INCLUDE=/XERC_INC /gp'`"
0013 eval "setenv `scram tool info xerces-c | sed -n -e 's/LIBDIR=/XERC_LIB /gp'`"
0014 eval "setenv `scram tool info boost    | sed -n -e 's/INCLUDE=/BOOST_INC /gp'`"
0015 eval "setenv `scram tool info boost    | sed -n -e 's/LIBDIR=/BOOST_LIB /gp'`"
0016 g++ -g -std=c++11 -o test readcalol2.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 -L$CMSSW_BASE/lib/slc6_amd64_gcc530/ -lL1TriggerL1TCommon
0017 ./test ~kkotov/public/MPs*.xml
0018 */
0019 
0020 using namespace std;
0021 
0022 int main(int argc, char *argv[]){
0023     if( argc < 2 ) return 0;
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     // parse the string using the XML reader
0048     XmlConfigReader xmlRdr;
0049     l1t::TrigSystem trgSys;
0050     trgSys.addProcRole("MainProcessor", "processors"); //
0051 
0052     for(auto &name : sequence){
0053         cout<<"Parsing "<<name<<endl;
0054         xmlRdr.readDOMFromString( xmlPayload[name] );
0055         xmlRdr.readRootElement  ( trgSys, "calol2" );
0056     }
0057     trgSys.setConfigured();
0058 
0059     // feel free to play with the containers:
0060     map<string, l1t::Setting> conf = trgSys.getSettings("MainProcessor"); // use your context id here
0061 //    map<string, l1t::Mask>    rs   = trgSys.getMasks   ("processors"); // don't call a context that doesn't exist
0062 
0063     string tmp = conf["leptonSeedThreshold"].getValueAsStr();
0064     cout << "leptonSeedThreshold=" << tmp << endl;
0065 
0066     return 0;
0067 }
0068