CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/CondCore/RunInfoPlugins/plugins/RunNumberPyWrapper.cc

Go to the documentation of this file.
00001 
00002 #include "CondFormats/RunInfo/interface/RunNumber.h"
00003 
00004 #include "CondCore/Utilities/interface/PayLoadInspector.h"
00005 #include "CondCore/Utilities/interface/InspectorPythonWrapper.h"
00006 
00007 #include <string>
00008 #include <fstream>
00009 
00010 using namespace runinfo_test;
00011 
00012 namespace cond {
00013 
00014   template<>
00015   class ValueExtractor<RunNumber>: public  BaseValueExtractor<RunNumber> {
00016   public:
00017 
00018     typedef RunNumber Class;
00019     typedef ExtractWhat<Class> What;
00020     static What what() { return What();}
00021 
00022     ValueExtractor(){}
00023     ValueExtractor(What const & what)
00024     {
00025       // here one can make stuff really complicated...
00026     }
00027     void compute(Class const & it){
00028     }
00029   private:
00030   
00031   };
00032 
00033 
00034   template<>
00035   std::string
00036   PayLoadInspector<RunNumber>::dump() const {
00037     std::stringstream ss;
00038     return ss.str();
00039     
00040   }
00041   
00042   template<>
00043   std::string PayLoadInspector<RunNumber>::summary() const {
00044     std::stringstream ss;
00045     ss << object().m_runnumber.size() <<", ";
00046     if (!object().m_runnumber.empty()) {
00047       ss << object().m_runnumber.front().m_run;
00048       ss << ", ";
00049       ss << object().m_runnumber.front().m_name;
00050       ss << ", " << object().m_runnumber.front().m_start_time_str;
00051       ss << "; ";
00052       ss << ", " << object().m_runnumber.front().m_stop_time_str;
00053       ss << "; ";
00054       for (size_t i=0; i< object().m_runnumber.front().m_subdt_joined.size(); ++i){
00055       ss << ", " << object().m_runnumber.front().m_subdt_joined[i];
00056       ss << "; ";
00057       }
00058      
00059     }
00060     return ss.str();
00061    
00062   }
00063   
00064 
00065   template<>
00066   std::string PayLoadInspector<RunNumber>::plot(std::string const & filename,
00067                                                    std::string const &, 
00068                                                    std::vector<int> const&, 
00069                                                    std::vector<float> const& ) const {
00070     std::string fname = filename + ".png";
00071     std::ofstream f(fname.c_str());
00072     return fname;
00073   }
00074 
00075 
00076 }
00077 
00078 PYTHON_WRAPPER(RunNumber,RunNumber);