CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/DQM/SiStripCommissioningSources/interface/CommissioningTask.h

Go to the documentation of this file.
00001 #ifndef DQM_SiStripCommissioningSources_CommissioningTask_H
00002 #define DQM_SiStripCommissioningSources_CommissioningTask_H
00003 
00004 #include "CondFormats/SiStripObjects/interface/FedChannelConnection.h"
00005 #include "DataFormats/Common/interface/DetSet.h"
00006 #include "DataFormats/SiStripCommon/interface/SiStripEventSummary.h"
00007 #include "DataFormats/SiStripDigi/interface/SiStripRawDigi.h"
00008 #include "boost/cstdint.hpp"
00009 #include <vector>
00010 #include <string>
00011 #include <iomanip>
00012 
00013 class TAxis;
00014 class DQMStore;
00015 class MonitorElement;
00016 namespace edm { class EventSetup; }
00017 
00021 class CommissioningTask {
00022 
00023  public: 
00024   
00025   // ---------- Constructors, destructors ----------
00026 
00027   CommissioningTask( DQMStore*, 
00028                      const FedChannelConnection&,
00029                      const std::string& my_name );
00030 
00031   virtual ~CommissioningTask();
00032 
00033   // ---------- Classes, structs ----------
00034   
00037   class HistoSet {
00038   public:
00039     HistoSet();
00040     void histo( MonitorElement* );
00041     MonitorElement* histo();
00042     uint32_t bin( float value );
00043     std::vector<float> vNumOfEntries_;
00044     std::vector<float> vSumOfContents_;
00045     std::vector<double> vSumOfSquares_;
00046     bool isProfile_;
00047     bool explicitFill_;
00048   private:
00049     MonitorElement* histo_;
00050     TAxis* axis_;
00051   };
00052   
00053   class CompactHistoSet {
00054   public:
00055     CompactHistoSet();
00056     void histo( MonitorElement* );
00057     MonitorElement* histo();
00058     std::vector<short> vNumOfEntries_;
00059     bool explicitFill_;
00060   private:
00061     MonitorElement* histo_;
00062   };
00063   
00064   // ---------- Public methods ----------
00065   
00067   void bookHistograms();
00068   
00070   void fillHistograms( const SiStripEventSummary&, 
00071                        const edm::DetSet<SiStripRawDigi>& );
00072   
00074   void fillHistograms( const SiStripEventSummary&, 
00075                        const uint16_t& fed_id,
00076                        const std::map<uint16_t,float>& fed_ch );
00077   
00079   void updateHistograms();
00080 
00082   inline const uint32_t& fillCntr() const;
00083   
00085   inline const uint32_t& updateFreq() const;
00086 
00088   inline void updateFreq( const uint32_t& );
00089   
00091   inline const std::string& myName() const;
00092 
00094   inline void eventSetup( const edm::EventSetup* );
00095 
00096  protected: 
00097   
00098   // ---------- Protected methods ----------
00099   
00101   void updateHistoSet( HistoSet&, const uint32_t& bin, const float& value );
00102   void updateHistoSet( CompactHistoSet&, const uint32_t& bin, const short& value );
00103 
00105   void updateHistoSet( HistoSet&, const uint32_t& bin );
00106   void updateHistoSet( CompactHistoSet&, const uint32_t& bin );
00107 
00109   void updateHistoSet( HistoSet&, const float& value );
00110   void updateHistoSet( CompactHistoSet& );
00111 
00113   void updateHistoSet( HistoSet& );
00114   
00116   inline DQMStore* const dqm() const;
00117 
00119   inline const FedChannelConnection& connection() const;
00120   
00122   inline const uint32_t& fecKey() const;
00123 
00125   inline const uint32_t& fedKey() const;
00126 
00128   inline const edm::EventSetup* const eventSetup() const;
00129   
00130  private: 
00131   
00132   // ---------- Private methods ----------
00133 
00134   CommissioningTask() {;}
00135   
00136   virtual void book();
00137 
00138   virtual void fill( const SiStripEventSummary&,
00139                      const edm::DetSet<SiStripRawDigi>& );
00140 
00141   virtual void fill( const SiStripEventSummary&, 
00142                      const uint16_t& fed_id,
00143                      const std::map<uint16_t,float>& fed_ch );
00144 
00145   virtual void update();
00146   
00147   // ---------- Private member data ----------
00148 
00149   DQMStore* dqm_;
00150   
00151   uint32_t updateFreq_;
00152   
00153   uint32_t fillCntr_;
00154   
00155   FedChannelConnection connection_;
00156 
00157   uint32_t fedKey_;
00158 
00159   uint32_t fecKey_;
00160 
00161   bool booked_;
00162   
00163   std::string myName_;
00164   
00165   const edm::EventSetup* eventSetup_;
00166   
00167 };
00168 
00169 // ----- inline methods -----
00170 
00171 const uint32_t& CommissioningTask::fillCntr() const { return fillCntr_; }
00172 const uint32_t& CommissioningTask::updateFreq() const { return updateFreq_; }
00173 void CommissioningTask::updateFreq( const uint32_t& freq ) { updateFreq_ = freq; }
00174 const std::string& CommissioningTask::myName() const { return myName_; }
00175 
00176 DQMStore* const CommissioningTask::dqm() const { return dqm_; }
00177 const FedChannelConnection& CommissioningTask::connection() const { return connection_; }
00178 
00179 const uint32_t& CommissioningTask::fecKey() const { return fecKey_; }
00180 const uint32_t& CommissioningTask::fedKey() const { return fedKey_; }
00181 
00182 void CommissioningTask::eventSetup( const edm::EventSetup* setup ) { eventSetup_ = setup; }
00183 const edm::EventSetup* const CommissioningTask::eventSetup() const { return eventSetup_; }
00184 
00185 #endif // DQM_SiStripCommissioningSources_CommissioningTask_H