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.cpp"
0002 #include "L1Trigger/L1TCommon/src/mask.cpp"
0003 #include "L1Trigger/L1TCommon/src/XmlConfigReader.cc"
0004 #include "L1Trigger/L1TCommon/src/trigSystem.cpp"
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 "export `scram tool info xerces-c | sed -n -e 's/INCLUDE=/XERC_INC=/gp'`"
0013 eval "export `scram tool info xerces-c | sed -n -e 's/LIBDIR=/XERC_LIB=/gp'`"
0014 eval "export `scram tool info boost    | sed -n -e 's/INCLUDE=/BOOST_INC=/gp'`"
0015 eval "export `scram tool info boost    | sed -n -e 's/LIBDIR=/BOOST_LIB=/gp'`"
0016 g++ -g -std=c++11 -o test test2.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
0017 */
0018 
0019 using namespace std;
0020 
0021 int main(int argc, char *argv[]){
0022     XMLPlatformUtils::Initialize();
0023 
0024     // read the input xml file into a string
0025     ifstream input( argv[1] );
0026     if( !input ){ cout << "Cannot open " << argv[1] << " file" << endl; return 0; }
0027 
0028     string xmlPayload;
0029     size_t nLinesRead=0;
0030 
0031     while( !input.eof() ){
0032         string tmp;
0033         getline( input, tmp, '\n' );
0034         xmlPayload.append( tmp );
0035         nLinesRead++;
0036     }
0037 
0038     cout << "read " << nLinesRead << " lines" << endl;
0039     input.close();
0040 
0041     // parse the string using the XML reader
0042     XmlConfigReader xmlReader;
0043     l1t::trigSystem ts;
0044     ts.addProcRole("processors", "processors"); //
0045 
0046     // run the parser 
0047     xmlReader.readDOMFromString( xmlPayload ); // initialize it
0048     xmlReader.readRootElement( "calol1", ts ); // extract all of the relevant context (labeled "calol1" here)
0049     ts.setConfigured();
0050 
0051     // feel free to play with the containers:
0052     map<string, l1t::setting> conf = ts.getSettings("processors"); // use your context id here
0053 //    map<string, l1t::mask>    rs   = ts.getMasks   ("processors"); // don't call a context that doesn't exist
0054 
0055     string tmp = conf["layer1ECalScaleETBins"].getValueAsStr();
0056     cout << "layer1ECalScaleETBins =" << tmp << endl;
0057 
0058     return 0;
0059 }