Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:08:48

0001 #ifndef DQM_SiStripMonitorHardware_SPYHistograms_HH
0002 #define DQM_SiStripMonitorHardware_SPYHistograms_HH
0003 
0004 #include <sstream>
0005 
0006 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0007 
0008 #include "DQMServices/Core/interface/DQMStore.h"
0009 
0010 #include "DQM/SiStripMonitorHardware/interface/SiStripSpyUtilities.h"
0011 #include "DQM/SiStripMonitorHardware/interface/HistogramBase.hh"
0012 
0013 class SPYHistograms : public HistogramBase {
0014 public:
0015   struct Trends {
0016     unsigned int meanDigitalLow;  // digitalLow averaged over all channels
0017   };
0018 
0019   struct ErrorCounters {
0020     unsigned int nNoData;     //max=min=0
0021     unsigned int nLowRange;   // max-min < min value to tune
0022     unsigned int nHighRange;  // max-min > max value to tune
0023     unsigned int nMinZero;    // min = 0
0024     unsigned int nMaxSat;     //max = 1023
0025     unsigned int nLowPb;      //min < min value to tune but > 0
0026     unsigned int nHighPb;     //max > max value to tune but < 1023
0027     unsigned int nOOS;        //header+trailer found with right distance between them but not in expected position
0028                               // or header found above 16 (no trailer found)
0029                               // or 2*2-high separated by 70 samples found (last in right position...)
0030     unsigned int nOtherPbs;
0031     unsigned int nAPVError;         //number of APVs with error bit 0
0032     unsigned int nAPVAddressError;  //number of APV pairs with different APV addresses
0033     unsigned int nNegPeds;          //ped subtr value = 0
0034   };
0035 
0036   //helper structs to fill histograms
0037   struct Errors {
0038     bool hasNoData;
0039     bool hasLowRange;
0040     bool hasHighRange;
0041     bool hasMinZero;
0042     bool hasMaxSat;
0043     bool hasLowPb;
0044     bool hasHighPb;
0045     bool hasOOS;
0046     bool hasOtherPbs;
0047     bool hasErrorBit0;
0048     bool hasErrorBit1;
0049     bool hasAPVAddressError0;
0050     bool hasAPVAddressError1;
0051     bool hasNegPeds;
0052   };
0053 
0054   SPYHistograms();
0055 
0056   ~SPYHistograms() override;
0057 
0058   //initialise histograms
0059   void initialise(const edm::ParameterSet& iConfig, std::ostringstream* pDebugStream) override;
0060 
0061   //book the top level histograms
0062   void bookTopLevelHistograms(DQMStore::IBooker&, const TkDetMap*);
0063 
0064   //book individual FED histograms or book all FED level histograms at once
0065   void bookFEDHistograms(DQMStore::IBooker&, const unsigned int fedId, const Errors& aErr, bool doAll = false);
0066 
0067   void bookAllFEDHistograms(DQMStore::IBooker&);
0068 
0069   void fillCountersHistograms(const ErrorCounters& aCounter, const double aTime);
0070 
0071   void fillGainHistograms(const Trends& aTrendElement, const double aTime);
0072 
0073   void fillFEDHistograms(const Errors& aErr, const unsigned int aFedId);
0074 
0075   void fillDetailedHistograms(const Errors& aErr,
0076                               const sistrip::SpyUtilities::Frame& aFrame,
0077                               const unsigned int aFedId,
0078                               const unsigned int aFedChannel);
0079 
0080   bool tkHistoMapEnabled(unsigned int aIndex = 0) override { return false; };
0081 
0082   TkHistoMap* tkHistoMapPointer(unsigned int aIndex = 0) override { return nullptr; };
0083 
0084 protected:
0085 private:
0086   //histos
0087 
0088   //counting histograms (histogram of number of problems per event)
0089   HistogramConfig nNoData_;
0090   HistogramConfig nLowRange_;
0091   HistogramConfig nHighRange_;
0092   HistogramConfig nMinZero_;
0093   HistogramConfig nMaxSat_;
0094   HistogramConfig nLowPb_;
0095   HistogramConfig nHighPb_;
0096   HistogramConfig nOutOfSync_;
0097   HistogramConfig nOtherPbs_;
0098   HistogramConfig nApvErrorBit_;
0099   HistogramConfig nApvAddressError_;
0100   HistogramConfig nNegativePeds_;
0101 
0102   //vsTime
0103   HistogramConfig nNoDatavsTime_;
0104   HistogramConfig nLowRangevsTime_;
0105   HistogramConfig nHighRangevsTime_;
0106   HistogramConfig nMinZerovsTime_;
0107   HistogramConfig nMaxSatvsTime_;
0108   HistogramConfig nLowPbvsTime_;
0109   HistogramConfig nHighPbvsTime_;
0110   HistogramConfig nOutOfSyncvsTime_;
0111   HistogramConfig nOtherPbsvsTime_;
0112   HistogramConfig nApvErrorBitvsTime_;
0113   HistogramConfig nApvAddressErrorvsTime_;
0114   HistogramConfig nNegativePedsvsTime_;
0115   HistogramConfig meanDigitalLowvsTime_;
0116 
0117   //top level histograms
0118   HistogramConfig noData_;
0119   HistogramConfig lowRange_;
0120   HistogramConfig highRange_;
0121   HistogramConfig minZero_;
0122   HistogramConfig maxSat_;
0123   HistogramConfig lowPb_;
0124   HistogramConfig highPb_;
0125   HistogramConfig outOfSync_;
0126   HistogramConfig otherPbs_;
0127   HistogramConfig apvErrorBit_;
0128   HistogramConfig apvAddressError_;
0129   HistogramConfig negativePeds_;
0130 
0131   HistogramConfig frameRange_;
0132   HistogramConfig frameMin_;
0133   HistogramConfig frameMax_;
0134   HistogramConfig baseline_;
0135 
0136   //FED level histograms
0137   HistogramConfig noDataDetailed_;
0138   HistogramConfig lowRangeDetailed_;
0139   HistogramConfig highRangeDetailed_;
0140   HistogramConfig minZeroDetailed_;
0141   HistogramConfig maxSatDetailed_;
0142   HistogramConfig lowPbDetailed_;
0143   HistogramConfig highPbDetailed_;
0144   HistogramConfig outOfSyncDetailed_;
0145   HistogramConfig otherPbsDetailed_;
0146   HistogramConfig apvErrorBitDetailed_;
0147   HistogramConfig apvAddressErrorDetailed_;
0148   HistogramConfig negativePedsDetailed_;
0149 
0150   HistogramConfig positionOfFirstHeaderBitDetailed_;
0151   HistogramConfig positionOfFirstTrailerBitDetailed_;
0152   HistogramConfig distanceHeaderTrailerDetailed_;
0153 
0154   std::map<unsigned int, MonitorElement*> noDataDetailedMap_;
0155   std::map<unsigned int, MonitorElement*> lowRangeDetailedMap_;
0156   std::map<unsigned int, MonitorElement*> highRangeDetailedMap_;
0157   std::map<unsigned int, MonitorElement*> minZeroDetailedMap_;
0158   std::map<unsigned int, MonitorElement*> maxSatDetailedMap_;
0159   std::map<unsigned int, MonitorElement*> lowPbDetailedMap_;
0160   std::map<unsigned int, MonitorElement*> highPbDetailedMap_;
0161   std::map<unsigned int, MonitorElement*> outOfSyncDetailedMap_;
0162   std::map<unsigned int, MonitorElement*> otherPbsDetailedMap_;
0163   std::map<unsigned int, MonitorElement*> apvErrorBitDetailedMap_;
0164   std::map<unsigned int, MonitorElement*> apvAddressErrorDetailedMap_;
0165   std::map<unsigned int, MonitorElement*> negativePedsDetailedMap_;
0166 
0167   std::map<unsigned int, MonitorElement*> positionOfFirstHeaderBitDetailedMap_;
0168   std::map<unsigned int, MonitorElement*> positionOfFirstTrailerBitDetailedMap_;
0169   std::map<unsigned int, MonitorElement*> distanceHeaderTrailerDetailedMap_;
0170 
0171   std::vector<bool> histosBooked_;
0172 
0173 };  //class
0174 
0175 #endif  //DQM_SiStripMonitorHardware_SPYHistograms_HH