CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/CondCore/RunInfoPlugins/plugins/RunSummaryPyWrapper.cc

Go to the documentation of this file.
00001 
00002 #include "CondFormats/RunInfo/interface/RunSummary.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<RunSummary>: public  BaseValueExtractor<RunSummary> {
00014   public:
00015 
00016     typedef RunSummary 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     }
00027   private:
00028   
00029   };
00030 
00031 
00032   template<>
00033   std::string
00034   PayLoadInspector<RunSummary>::dump() const {
00035     std::stringstream ss;
00036     return ss.str();
00037     
00038   }
00039   
00040   template<>
00041   std::string PayLoadInspector<RunSummary>::summary() const {
00042     std::stringstream ss;
00043       ss << "RUN: "<<object().m_run;
00044       ss << ", NAME: " <<object().m_name;
00045       ss << ", START TIME: " << object().m_start_time_str;
00046       ss << ", STOP TIME:" << object().m_stop_time_str;
00047       ss << ", LUMISECTIONS: " << object().m_lumisections;
00048       ss << ", HLT_KEY:  " << object().m_hltkey;
00049       ss << ", TRG_NEVENTS:  " << object().m_nevents;
00050       ss << ", TRG_RATE:  " << object().m_rate;
00051       ss << ", SUBDETS IB RUN: ";  
00052       for (size_t i=0; i<object().m_subdt_in.size() ; i++){
00053         if (object().m_subdt_in[i]==0) {
00054           ss<< "PIXEL, ";
00055         }
00056         if (object().m_subdt_in[i]==1) {
00057           ss<<"TRACKER, ";
00058         }
00059         if (object().m_subdt_in[i]==2) {
00060           ss<< "ECAL, " ;
00061         }
00062         if (object().m_subdt_in[i]==3) {
00063           ss<< "HCAL, ";
00064         }
00065         if (object().m_subdt_in[i]==4) {
00066           ss<<"DT," ;
00067         }  
00068         if (object().m_subdt_in[i]==5) {
00069           ss<<"CSC,";
00070         }   
00071         if (object().m_subdt_in[i]==6) {
00072           ss<<"RPC, ";
00073         }  
00074       }
00075       
00076     
00077     return ss.str();
00078   }
00079   
00080 
00081   template<>
00082   std::string PayLoadInspector<RunSummary>::plot(std::string const & filename,
00083                                                    std::string const &, 
00084                                                    std::vector<int> const&, 
00085                                                    std::vector<float> const& ) const {
00086     std::string fname = filename + ".png";
00087     std::ofstream f(fname.c_str());
00088     return fname;
00089   }
00090 
00091 
00092 }
00093 
00094 PYTHON_WRAPPER(RunSummary,RunSummary);