CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/DQM/SiStripMonitorHardware/interface/SPYHistograms.h

Go to the documentation of this file.
00001 #ifndef DQM_SiStripMonitorHardware_SPYHistograms_HH
00002 #define DQM_SiStripMonitorHardware_SPYHistograms_HH
00003 
00004 #include <sstream>
00005 
00006 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00007 
00008 #include "DQMServices/Core/interface/DQMStore.h"
00009 #include "DQMServices/Core/interface/MonitorElement.h"
00010 
00011 #include "DQM/SiStripMonitorHardware/interface/SiStripSpyUtilities.h"
00012 #include "DQM/SiStripMonitorHardware/interface/HistogramBase.hh"
00013 
00014 class SPYHistograms: public HistogramBase {
00015 
00016  public:
00017 
00018   struct Trends {
00019     unsigned int meanDigitalLow; // digitalLow averaged over all channels
00020   };
00021 
00022   struct ErrorCounters {
00023     unsigned int nNoData; //max=min=0
00024     unsigned int nLowRange; // max-min < min value to tune
00025     unsigned int nHighRange; // max-min > max value to tune
00026     unsigned int nMinZero; // min = 0
00027     unsigned int nMaxSat; //max = 1023
00028     unsigned int nLowPb; //min < min value to tune but > 0
00029     unsigned int nHighPb; //max > max value to tune but < 1023
00030     unsigned int nOOS;//header+trailer found with right distance between them but not in expected position
00031                       // or header found above 16 (no trailer found)
00032                       // or 2*2-high separated by 70 samples found (last in right position...)
00033     unsigned int nOtherPbs;
00034     unsigned int nAPVError;//number of APVs with error bit 0
00035     unsigned int nAPVAddressError;//number of APV pairs with different APV addresses
00036     unsigned int nNegPeds;//ped subtr value = 0
00037   };
00038 
00039   //helper structs to fill histograms
00040   struct Errors {
00041     bool hasNoData;
00042     bool hasLowRange; 
00043     bool hasHighRange;
00044     bool hasMinZero;
00045     bool hasMaxSat;
00046     bool hasLowPb;
00047     bool hasHighPb;
00048     bool hasOOS;
00049     bool hasOtherPbs;
00050     bool hasErrorBit0;
00051     bool hasErrorBit1;
00052     bool hasAPVAddressError0;
00053     bool hasAPVAddressError1;
00054     bool hasNegPeds;
00055   };
00056 
00057   SPYHistograms();
00058   
00059   ~SPYHistograms();
00060   
00061   //initialise histograms
00062   void initialise(const edm::ParameterSet& iConfig,
00063                   std::ostringstream* pDebugStream
00064                   );
00065 
00066   //book the top level histograms
00067   void bookTopLevelHistograms(DQMStore* dqm);
00068 
00069   //book individual FED histograms or book all FED level histograms at once
00070   void bookFEDHistograms(const unsigned int fedId,
00071                          const Errors & aErr,
00072                          bool doAll = false);
00073 
00074   void bookAllFEDHistograms();
00075 
00076   void fillCountersHistograms(const ErrorCounters & aCounter, const double aTime);
00077 
00078   void fillGainHistograms(const Trends & aTrendElement, const double aTime);
00079 
00080   void fillFEDHistograms(const Errors & aErr, const unsigned int aFedId);
00081 
00082   void fillDetailedHistograms(const Errors & aErr,
00083                               const sistrip::SpyUtilities::Frame & aFrame,
00084                               const unsigned int aFedId, 
00085                               const unsigned int aFedChannel);
00086 
00087   bool tkHistoMapEnabled(unsigned int aIndex=0){
00088     return false;
00089   };
00090 
00091   TkHistoMap * tkHistoMapPointer(unsigned int aIndex=0){
00092     return 0;
00093 };
00094 
00095  protected:
00096   
00097  private:
00098  //histos
00099 
00100   //counting histograms (histogram of number of problems per event)
00101   HistogramConfig nNoData_;
00102   HistogramConfig nLowRange_;
00103   HistogramConfig nHighRange_;
00104   HistogramConfig nMinZero_;
00105   HistogramConfig nMaxSat_;
00106   HistogramConfig nLowPb_;
00107   HistogramConfig nHighPb_;
00108   HistogramConfig nOutOfSync_;
00109   HistogramConfig nOtherPbs_;
00110   HistogramConfig nApvErrorBit_;
00111   HistogramConfig nApvAddressError_;
00112   HistogramConfig nNegativePeds_;
00113 
00114   //vsTime
00115   HistogramConfig nNoDatavsTime_;
00116   HistogramConfig nLowRangevsTime_;
00117   HistogramConfig nHighRangevsTime_;
00118   HistogramConfig nMinZerovsTime_;
00119   HistogramConfig nMaxSatvsTime_;
00120   HistogramConfig nLowPbvsTime_;
00121   HistogramConfig nHighPbvsTime_;
00122   HistogramConfig nOutOfSyncvsTime_;
00123   HistogramConfig nOtherPbsvsTime_;
00124   HistogramConfig nApvErrorBitvsTime_;
00125   HistogramConfig nApvAddressErrorvsTime_;
00126   HistogramConfig nNegativePedsvsTime_;
00127   HistogramConfig meanDigitalLowvsTime_;
00128 
00129  //top level histograms
00130   HistogramConfig noData_;
00131   HistogramConfig lowRange_;
00132   HistogramConfig highRange_;
00133   HistogramConfig minZero_;
00134   HistogramConfig maxSat_;
00135   HistogramConfig lowPb_;
00136   HistogramConfig highPb_;
00137   HistogramConfig outOfSync_;
00138   HistogramConfig otherPbs_;
00139   HistogramConfig apvErrorBit_;
00140   HistogramConfig apvAddressError_;
00141   HistogramConfig negativePeds_;
00142 
00143   HistogramConfig frameRange_;
00144   HistogramConfig frameMin_;
00145   HistogramConfig frameMax_;
00146   HistogramConfig baseline_;
00147 
00148 
00149   //FED level histograms
00150   HistogramConfig  noDataDetailed_;
00151   HistogramConfig  lowRangeDetailed_;
00152   HistogramConfig  highRangeDetailed_;
00153   HistogramConfig  minZeroDetailed_;
00154   HistogramConfig  maxSatDetailed_;
00155   HistogramConfig  lowPbDetailed_;
00156   HistogramConfig  highPbDetailed_;
00157   HistogramConfig  outOfSyncDetailed_;
00158   HistogramConfig  otherPbsDetailed_;
00159   HistogramConfig  apvErrorBitDetailed_;
00160   HistogramConfig  apvAddressErrorDetailed_;
00161   HistogramConfig  negativePedsDetailed_;
00162 
00163   HistogramConfig  positionOfFirstHeaderBitDetailed_;
00164   HistogramConfig  positionOfFirstTrailerBitDetailed_;
00165   HistogramConfig  distanceHeaderTrailerDetailed_;
00166 
00167   std::map<unsigned int,MonitorElement* > noDataDetailedMap_;
00168   std::map<unsigned int,MonitorElement* > lowRangeDetailedMap_;
00169   std::map<unsigned int,MonitorElement* > highRangeDetailedMap_;
00170   std::map<unsigned int,MonitorElement* > minZeroDetailedMap_;
00171   std::map<unsigned int,MonitorElement* > maxSatDetailedMap_;
00172   std::map<unsigned int,MonitorElement* > lowPbDetailedMap_;
00173   std::map<unsigned int,MonitorElement* > highPbDetailedMap_;
00174   std::map<unsigned int,MonitorElement* > outOfSyncDetailedMap_;
00175   std::map<unsigned int,MonitorElement* > otherPbsDetailedMap_;
00176   std::map<unsigned int,MonitorElement* > apvErrorBitDetailedMap_;
00177   std::map<unsigned int,MonitorElement* > apvAddressErrorDetailedMap_;
00178   std::map<unsigned int,MonitorElement* > negativePedsDetailedMap_;
00179 
00180   std::map<unsigned int,MonitorElement* > positionOfFirstHeaderBitDetailedMap_;
00181   std::map<unsigned int,MonitorElement* > positionOfFirstTrailerBitDetailedMap_;
00182   std::map<unsigned int,MonitorElement* > distanceHeaderTrailerDetailedMap_;
00183 
00184   std::vector<bool> histosBooked_;
00185 
00186 };//class
00187 
00188 
00189 
00190 #endif //DQM_SiStripMonitorHardware_SPYHistograms_HH
00191 
00192