CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/DQM/SiStripCommissioningSummary/interface/SummaryGenerator.h

Go to the documentation of this file.
00001 #ifndef DQM_SiStripCommon_SummaryGenerator_H
00002 #define DQM_SiStripCommon_SummaryGenerator_H
00003 
00004 #include "DataFormats/SiStripCommon/interface/SiStripConstants.h"
00005 #include "boost/cstdint.hpp"
00006 #include <string>
00007 #include <vector>
00008 #include <map>
00009 
00010 class TH1;
00011 
00019 class SummaryGenerator {
00020 
00021  public: 
00022 
00023   // ---------- General ----------
00024   
00025   SummaryGenerator( std::string name );
00026   virtual ~SummaryGenerator() {;}
00027   
00028   // Some useful typedefs
00029   typedef std::pair<float,float> Data;
00030   typedef std::vector<Data> BinData;
00031   typedef std::map<std::string,BinData> HistoData;
00032   
00034   static SummaryGenerator* instance( const sistrip::View& );
00035 
00036   // ---------- Contruct name and TObject ----------
00037 
00039   static std::string name( const sistrip::RunType&, 
00040                            const sistrip::Monitorable&, 
00041                            const sistrip::Presentation&,
00042                            const sistrip::View&, 
00043                            const std::string& directory );
00044 
00046   static TH1* histogram( const sistrip::Presentation&,
00047                          const uint32_t& xbins );
00048   
00049   // ---------- Methods to fill and update histograms ----------
00050 
00052   void fillMap( const std::string& top_level_dir,
00053                 const sistrip::Granularity&,
00054                 const uint32_t& key, 
00055                 const float& value, 
00056                 const float& error = 0. );
00057 
00059   void clearMap();
00060 
00062   void printMap();
00063   
00065   void histo1D( TH1& ); 
00066   
00070   void histo2DSum( TH1& );
00071   
00075   void histo2DScatter( TH1& );
00076 
00080   void profile1D( TH1& );
00081 
00082   // ---------- Histogram formatting ----------
00083   
00085   void format( const sistrip::RunType&, 
00086                const sistrip::Monitorable&, 
00087                const sistrip::Presentation&,
00088                const sistrip::View&, 
00089                const std::string& directory,
00090                const sistrip::Granularity&,
00091                TH1& );
00092   
00094   inline void axisLabel( const std::string& );
00095   
00097   inline uint32_t nBins() const;
00098   inline uint32_t size() const { return nBins(); } //@@ TEMPORARY!!!
00099 
00100   // ---------- Utility methods ----------
00101 
00103   inline const std::string& myName() const;
00104   
00105  protected: 
00106 
00107   // ---------- Protected methods ----------
00108   
00110   virtual void fill( const std::string& top_level_dir,
00111                      const sistrip::Granularity&,
00112                      const uint32_t& key, 
00113                      const float& value, 
00114                      const float& error );
00115 
00116  protected: 
00117 
00118   // ---------- Protected member data ----------
00119   
00122   HistoData map_;
00123 
00124   float entries_;
00125 
00126   float max_;
00127 
00128   float min_;
00129 
00130   std::string label_;
00131 
00132  private: 
00133   
00134   // ---------- Private member data ----------
00135   
00136   std::string myName_;
00137   
00138 };
00139 
00140 const std::string& SummaryGenerator::myName() const { return myName_; }
00141 uint32_t SummaryGenerator::nBins() const { return map_.size(); }
00142 void SummaryGenerator::axisLabel( const std::string& label ) { label_ = label; }
00143 
00144 #endif // DQM_SiStripCommon_SummaryGenerator_H