Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:26:38

0001 #include <string>
0002 #include <iostream>
0003 #include <fstream>
0004 #include <algorithm>
0005 #include <iterator>
0006 #include <boost/regex.hpp>
0007 #include <boost/tokenizer.hpp>
0008 int main(){
0009   std::string input("TK_HV_ON&N/A&N/A%PIX_HV_ON&N/A&N/A%LHC_RAMPING&false&false%PHYSICS_DECLARED&false&false%");
0010   std::string nameinput("CMS.LVL0:RUNSECTION_DELIMITER_DCSLHCFLAGS_5");
0011   //const boost::regex e("TK_HV_ON&N/A&N/A%PIX_HV_ON&N/A&N/A%LHC_RAMPING&false&false%PHYSICS_DECLARED&(true|false|N/A)&(true|false|N/A)%$");
0012   const boost::regex e("%PHYSICS_DECLARED&(true|false|N/A)&(true|false|N/A)%");
0013   const boost::regex ename("^CMS.LVL0:RUNSECTION_DELIMITER_DCSLHCFLAGS_([0-9]+)");
0014   boost::match_results<std::string::const_iterator> what;
0015   boost::regex_search(input,what,e,boost::match_default);
0016   if(what[0].matched){
0017     std::cout<<"matched"<<std::endl;
0018     std::cout<<std::string(what[1].first,what[1].second)<<std::endl;
0019     std::cout<<std::string(what[2].first,what[2].second)<<std::endl;
0020   }
0021   boost::regex_match(nameinput,what,ename,boost::match_default);
0022   if(what[0].matched){ 
0023     std::cout<<"named matched"<<std::endl;
0024     std::cout<<std::string(what[1].first,what[1].second)<<std::endl;
0025   }
0026   std::string fname("fillsummary.dat");
0027   std::ifstream ins(fname.c_str());
0028   if (!ins.is_open()) {
0029     std::cout<<"cannot open file "<<fname<<std::endl;
0030     return 0;
0031   }
0032   typedef boost::tokenizer< boost::escaped_list_separator<char> > Tokenizer;
0033   std::vector< std::string > result;
0034   std::string line;
0035   while(std::getline(ins,line)){
0036     Tokenizer tok(line);
0037     result.assign(tok.begin(),tok.end());
0038     if (result.size()<3) continue;
0039     std::cout<<"fill num "<<result[0]<<" , fill scheme "<<result[1]<<", ncolliding bunches "<<result[2]<<std::endl;
0040     //std::copy(result.begin(),result.end(),std::ostream_iterator<std::string>(std::cout,","));
0041   }
0042 }