00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef CSCDQM_Summary_H
00020 #define CSCDQM_Summary_H
00021
00022 #include <TH2.h>
00023 #include <math.h>
00024 #include <vector>
00025 #include <bitset>
00026 #include <iostream>
00027
00028 #include "DQM/CSCMonitorModule/interface/CSCDQM_Detector.h"
00029 #include "DQM/CSCMonitorModule/interface/CSCDQM_Logger.h"
00030
00031 #define HWSTATUSBITSETSIZE 12
00032 #define HWSTATUSERRORBITS 0xffe
00033 #define HWSTATUSEQUALS(s, m) (((std::bitset<HWSTATUSBITSETSIZE>) m & s) == m)
00034 #define HWSTATUSANY(s, m) (((std::bitset<HWSTATUSBITSETSIZE>) m & s).any())
00035 #define HWSTATUSANYERROR(s) (HWSTATUSANY(s, HWSTATUSERRORBITS))
00036
00037 #define NTICS 100
00038
00039 namespace cscdqm {
00040
00044 enum HWStatusBit {
00045
00046 DATA,
00047 MASKED,
00048 HOT,
00049 COLD,
00050
00051 FORMAT_ERR,
00052 L1SYNC_ERR,
00053 FIFOFULL_ERR,
00054 INPUTTO_ERR,
00055
00056 NODATA_ALCT,
00057 NODATA_CLCT,
00058 NODATA_CFEB,
00059 CFEB_BWORDS
00060
00061 };
00062
00067 typedef std::bitset<HWSTATUSBITSETSIZE> HWStatusBitSet;
00068
00073 class Summary {
00074
00075 public:
00076
00077 Summary();
00078 ~Summary();
00079
00080 void Reset();
00081
00082 const Detector getDetector() const { return detector; }
00083
00084 void ReadReportingChambers(const TH2*& h2, const double threshold = 1.0);
00085 void ReadReportingChambersRef(const TH2*& h2, const TH2*& refh2, const double cold_coef = 0.1, const double cold_Sfail = 5.0, const double hot_coef = 2.0, const double hot_Sfail = 5.0);
00086 void ReadErrorChambers(const TH2*& evs, const TH2*& err, const HWStatusBit bit, const double eps_max = 0.1, const double Sfail = 5.0);
00087
00088 const unsigned int setMaskedHWElements(std::vector<std::string>& tokens);
00089
00090 void Write(TH2*& h2, const unsigned int station) const;
00091 void WriteMap(TH2*& h2);
00092 void WriteChamberState(TH2*& h2, const int mask, const int value = 1, const bool reset = true, const bool op_any = false) const;
00093
00094 void ReSetValue(const HWStatusBit bit);
00095 void ReSetValue(Address adr, const HWStatusBit bit);
00096 void SetValue(const HWStatusBit bit, const int value = 1);
00097 void SetValue(Address adr, const HWStatusBit bit, const int value = 1);
00098
00099 const HWStatusBitSet GetValue(Address adr) const;
00100 const int IsPhysicsReady(const unsigned int px, const unsigned int py);
00101
00102
00103 const double GetEfficiencyHW() const;
00104 const double GetEfficiencyHW(const unsigned int station) const;
00105 const double GetEfficiencyHW(Address adr) const;
00106 const double GetEfficiencyArea(const unsigned int station) const;
00107 const double GetEfficiencyArea(Address adr) const;
00108
00109 private:
00110
00111 const bool ChamberCoordsToAddress(const unsigned int x, const unsigned int y, Address& adr) const;
00112 const bool ChamberAddressToCoords(const Address& adr, unsigned int& x, unsigned int& y) const;
00113 const double GetReportingArea(Address adr) const;
00114 const double SignificanceLevel(const unsigned int N, const unsigned int n, const double eps) const;
00115 const double SignificanceLevelHot(const unsigned int N, const unsigned int n) const;
00116
00117
00118 HWStatusBitSet map[N_SIDES][N_STATIONS][N_RINGS][N_CHAMBERS][N_LAYERS][N_CFEBS][N_HVS];
00119
00120 std::vector<Address*> masked;
00121
00122 Detector detector;
00123
00124 };
00125
00126 }
00127
00128 #endif