CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/DQM/SiStripCommissioningClients/interface/CommissioningHistograms.h

Go to the documentation of this file.
00001 #ifndef DQM_SiStripCommissioningClients_CommissioningHistograms_H
00002 #define DQM_SiStripCommissioningClients_CommissioningHistograms_H
00003 
00004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00005 #include "FWCore/Framework/interface/EventSetup.h"
00006 #include "DataFormats/SiStripCommon/interface/SiStripConstants.h"
00007 #include "DataFormats/SiStripCommon/interface/SiStripHistoTitle.h"
00008 #include "DataFormats/SiStripCommon/interface/SiStripEnumsAndStrings.h"
00009 #include "DQM/SiStripCommissioningSummary/interface/CommissioningSummaryFactory.h"
00010 #include "DQM/SiStripCommon/interface/ExtractTObject.h"
00011 #include "DQMServices/Core/interface/MonitorElement.h"
00012 #include "DQMServices/Core/interface/DQMStore.h"
00013 #include <boost/cstdint.hpp>
00014 #include "TProfile.h"
00015 #include "TH1.h"
00016 #include <iostream>
00017 #include <sstream>
00018 #include <string>
00019 #include <vector>
00020 #include <map>
00021 
00022 class MonitorElement;
00023 class CommissioningAnalysis;
00024 
00025 class CommissioningHistograms {
00026 
00027  public:
00028 
00029   // ---------- con(de)structors ----------
00030   
00031   CommissioningHistograms( const edm::ParameterSet& pset,
00032                            DQMStore* const,
00033                            const sistrip::RunType& );
00034 
00035   // MAKE PRIVATE
00036   CommissioningHistograms(); // private constructor
00037 
00038   virtual ~CommissioningHistograms();
00039 
00040   virtual void configure( const edm::ParameterSet&, const edm::EventSetup& ) { }
00041 
00042   // ---------- histogram container class ----------
00043   
00044   class Histo {
00045   public:
00046     Histo( const std::string& title, 
00047            MonitorElement* const me,
00048            MonitorElement* const cme ) 
00049       : title_(title), me_(me), cme_(cme) {;}
00050     Histo() : title_(""), me_(0), cme_(0) {;}
00051     void print( std::stringstream& ) const;
00052     std::string title_;
00053     MonitorElement* me_;
00054     MonitorElement* cme_;
00055   };
00056   
00057   // ---------- typedefs ----------
00058   
00059   typedef std::map<uint32_t,CommissioningAnalysis*> Analyses;
00060 
00061   typedef Analyses::iterator Analysis;
00062   
00063   typedef SummaryPlotFactory<CommissioningAnalysis*> Factory; 
00064 
00065   typedef std::vector<Histo*> Histos;
00066   
00067   typedef std::map<uint32_t,Histos> HistosMap;
00068   
00069   typedef std::map<uint32_t,uint32_t> FedToFecMap;
00070 
00071   // ---------- histogram "actions" ----------
00072   
00073   static uint32_t runNumber( DQMStore* const,
00074                              const std::vector<std::string>& );
00075   
00076   static sistrip::RunType runType( DQMStore* const,
00077                                    const std::vector<std::string>& );
00078   
00080   static void copyCustomInformation( DQMStore* const,
00081                                      const std::vector<std::string>& );
00082   
00084   static void getContents( DQMStore* const,
00085                            std::vector<std::string>& );
00086   
00087   void extractHistograms( const std::vector<std::string>& );
00088 
00089   // DEPRECATE
00090   void createCollations( const std::vector<std::string>& );
00091 
00092   virtual void histoAnalysis( bool debug );
00093 
00094   virtual void printAnalyses();
00095 
00096   virtual void printSummary();
00097   
00098   virtual void createSummaryHisto( const sistrip::Monitorable&, 
00099                                    const sistrip::Presentation&, 
00100                                    const std::string& top_level_dir,
00101                                    const sistrip::Granularity& );
00102   
00103   void remove( std::string pattern = "" ); 
00104   
00105   void save( std::string& filename,
00106              uint32_t run_number = 0 ); 
00107 
00108   // ---------- protected methods ----------
00109   
00110  protected:
00111 
00112   inline const sistrip::RunType& task() const;
00113   
00114   inline DQMStore* const bei() const;
00115   
00116   inline Analyses& data();
00117   
00118   inline Factory* const factory();
00119   
00120   inline const HistosMap& histos() const;
00121   
00122   inline const FedToFecMap& mapping() const;
00123   
00124   inline const edm::ParameterSet& pset() const;
00125 
00126   TH1* histogram( const sistrip::Monitorable&, 
00127                   const sistrip::Presentation&, 
00128                   const sistrip::View&,
00129                   const std::string& directory,
00130                   const uint32_t& xbins,
00131                   const float& xlow = 1. * sistrip::invalid_,
00132                   const float& xhigh = 1. * sistrip::invalid_ );
00133   
00134   void printHistosMap();
00135 
00136   void clearHistosMap();
00137 
00138   // ---------- private member data ----------
00139 
00140  protected:
00141 
00142   std::auto_ptr<Factory> factory_;
00143   
00144  private:
00145   
00146   sistrip::RunType task_;
00147   
00148   DQMStore* bei_;
00149   
00150   Analyses data_;
00151   
00152   HistosMap histos_;
00153   
00154   FedToFecMap mapping_;
00155 
00156   edm::ParameterSet pset_;
00157   
00158 };
00159 
00160 // ---------- inline methods ----------
00161 
00162 const sistrip::RunType& CommissioningHistograms::task() const { return task_; }
00163 DQMStore* const CommissioningHistograms::bei() const { return bei_; }
00164 CommissioningHistograms::Analyses& CommissioningHistograms::data() { return data_; }
00165 CommissioningHistograms::Factory* const CommissioningHistograms::factory() { return factory_.get(); }
00166 const CommissioningHistograms::HistosMap& CommissioningHistograms::histos() const { return histos_; }
00167 const CommissioningHistograms::FedToFecMap& CommissioningHistograms::mapping() const { return mapping_; }
00168 const edm::ParameterSet& CommissioningHistograms::pset() const { return pset_; }
00169 
00170 #endif // DQM_SiStripCommissioningClients_CommissioningHistograms_H