CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/CondCore/RunInfoPlugins/plugins/RunInfoPyWrapper.cc

Go to the documentation of this file.
00001 
00002 #include "CondFormats/RunInfo/interface/RunInfo.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 namespace cond {
00011 
00012   template<>
00013   class ValueExtractor<RunInfo>: public  BaseValueExtractor<RunInfo> {
00014   public:
00015 
00016     typedef RunInfo Class;
00017     typedef ExtractWhat<Class> What;
00018     static What what() { return What();}
00019 
00020     ValueExtractor(){}
00021     ValueExtractor(What const & what)
00022     {
00023       // here one can make stuff really complicated...
00024     }
00025     void compute(Class const & it){
00026       this->add(it.m_start_current);
00027       this->add(it.m_stop_current);
00028       this->add(it.m_avg_current);
00029       this->add(it.m_max_current);
00030       this->add(it.m_min_current);
00031       this->add(it.m_run_intervall_micros);
00032       this->add(it.m_start_time_ll);
00033       this->add(it.m_stop_time_ll);
00034     }
00035   private:
00036   
00037   };
00038 
00039 
00040   template<>
00041   std::string
00042   PayLoadInspector<RunInfo>::dump() const {
00043     std::stringstream ss;
00044     return ss.str();
00045     
00046   }
00047   
00048   template<>
00049   std::string PayLoadInspector<RunInfo>::summary() const {
00050     std::stringstream ss;
00051     ss << "RUN: "<<object().m_run;
00052     ss << ", START TIME: " << object().m_start_time_str;
00053     ss << ", STOP TIME:" << object().m_stop_time_str;
00054     ss << ", START CURRENT:  " << object().m_start_current;
00055     ss << ", STOP CURRENT:  " << object().m_stop_current;
00056     ss << ", AVG CURRENT:  " << object().m_avg_current;
00057     ss << ", MIN CURRENT:  " << object().m_min_current;
00058     ss << ", MAX CURRENT:  " << object().m_max_current;
00059     ss << ", RUN INTERVALL IN MICROSECONDS: "<< object().m_run_intervall_micros;  /*
00060      ss << ", ALL CURRENT VALUE FROM STOP TO START (BACKWARD) :" ;
00061     for (size_t i=0; i< object().m_current.size() ; i++){
00062       ss<< object().m_current[i] << ", ";
00063     } 
00064                                                                                  */    
00065     ss << ", FED IN :" ;
00066     for (size_t i=0; i<object().m_fed_in.size(); i++){
00067       ss<< object().m_fed_in[i] << ", "; 
00068     }  
00069       
00070   return ss.str();
00071 }
00072   
00073 
00074   template<>
00075   std::string PayLoadInspector<RunInfo>::plot(std::string const & filename,
00076                                                    std::string const &, 
00077                                                    std::vector<int> const&, 
00078                                                    std::vector<float> const& ) const {
00079     std::string fname = filename + ".png";
00080     std::ofstream f(fname.c_str());
00081     return fname;
00082   }
00083 
00084 
00085 }
00086 
00087 PYTHON_WRAPPER(RunInfo,RunInfo);