CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch2/src/FWCore/MessageService/src/MsgContext.cc

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------
00002 //
00003 // MessageLoggerScribe.cc
00004 //
00005 // Changes:
00006 //
00007 // 0 - 6/27/06 mf - created this file to contain compress(), to convert from 
00008 //                  Run: 124 Event: 4567 to 124/4567 for purposes of 
00009 //                  ELstatistics output.
00010 
00011 
00012 #include "FWCore/MessageService/interface/MsgContext.h"
00013 #include <sstream>
00014 
00015 #include <iostream>
00016 
00017 namespace edm {
00018 namespace service {       
00019 
00020   std::string MsgContext::compress (const std::string& c) const
00021   {
00022     if ( c.substr (0,4) != "Run:" ) return c;
00023     std::istringstream is (c);
00024     std::string runWord;
00025     int run;
00026     is >> runWord >> run;
00027     if (!is) return c;
00028     if (runWord != "Run:") return c;
00029     std::string eventWord;
00030     int event;
00031     is >> eventWord >> event;
00032     if (!is) return c;
00033     if (eventWord != "Event:") return c;
00034     std::ostringstream os;
00035     os << run << "/" << event;
00036     return os.str();    
00037   }
00038 }        // end of namespace service
00039 }       // end of namespace edm