File indexing completed on 2024-04-06 12:06:58
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #ifndef CSCDQM_Summary_H
0020 #define CSCDQM_Summary_H
0021
0022 #include <TH2.h>
0023 #include <cmath>
0024 #include <vector>
0025 #include <bitset>
0026 #include <iostream>
0027
0028 #include "CSCDQM_Detector.h"
0029 #include "CSCDQM_Logger.h"
0030 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
0031
0032 #define HWSTATUSBITSETSIZE 14
0033 #define HWSTATUSERRORBITS 0xffc
0034 #define HWSTATUSEQUALS(s, m) (((std::bitset<HWSTATUSBITSETSIZE>)m & s) == m)
0035 #define HWSTATUSANY(s, m) (((std::bitset<HWSTATUSBITSETSIZE>)m & s).any())
0036 #define HWSTATUSANYERROR(s) (HWSTATUSANY(s, HWSTATUSERRORBITS))
0037
0038 #define NTICS 100
0039
0040 namespace cscdqm {
0041
0042
0043
0044
0045 enum HWStatusBit {
0046
0047 DATA,
0048 MASKED,
0049
0050 HOT,
0051 COLD,
0052
0053 FORMAT_ERR,
0054 L1SYNC_ERR,
0055 FIFOFULL_ERR,
0056 INPUTTO_ERR,
0057
0058 NODATA_ALCT,
0059 NODATA_CLCT,
0060 NODATA_CFEB,
0061 CFEB_BWORDS,
0062
0063 STANDBY,
0064 WAS_ON
0065
0066 };
0067
0068
0069
0070
0071
0072 typedef std::bitset<HWSTATUSBITSETSIZE> HWStatusBitSet;
0073
0074
0075
0076
0077
0078 class Summary {
0079 public:
0080 Summary();
0081 ~Summary();
0082
0083 void Reset();
0084
0085 const Detector getDetector() const { return detector; }
0086
0087 void ReadReportingChambers(const TH2*& h2, const double threshold = 1.0);
0088 void ReadReportingChambersRef(const TH2*& h2,
0089 const TH2*& refh2,
0090 const double cold_coef = 0.1,
0091 const double cold_Sfail = 5.0,
0092 const double hot_coef = 2.0,
0093 const double hot_Sfail = 5.0);
0094 void ReadErrorChambers(
0095 const TH2*& evs, const TH2*& err, const HWStatusBit bit, const double eps_max = 0.1, const double Sfail = 5.0);
0096
0097 const unsigned int setMaskedHWElements(std::vector<std::string>& tokens);
0098
0099 void Write(TH2*& h2, const unsigned int station) const;
0100 void WriteMap(TH2*& h2);
0101 void WriteChamberState(
0102 TH2*& h2, const int mask, const int value = 1, const bool reset = true, const bool op_any = false) const;
0103
0104 void ReSetValue(const HWStatusBit bit);
0105 void ReSetValue(const Address& adr, const HWStatusBit bit);
0106 void SetValue(const HWStatusBit bit, const int value = 1);
0107 void SetValue(Address adr, const HWStatusBit bit, const int value = 1);
0108
0109 const HWStatusBitSet GetValue(Address adr) const;
0110 const int IsPhysicsReady(const unsigned int px, const unsigned int py);
0111
0112
0113 const double GetEfficiencyHW() const;
0114 const double GetEfficiencyHW(const unsigned int station) const;
0115 const double GetEfficiencyHW(Address adr) const;
0116 const double GetEfficiencyArea(const unsigned int station) const;
0117 const double GetEfficiencyArea(const Address& adr) const;
0118
0119 bool isChamberStandby(unsigned int side, unsigned int station, unsigned int ring, unsigned int chamber) const;
0120 bool isChamberStandby(CSCDetId cid) const;
0121
0122 private:
0123 const bool ChamberCoordsToAddress(const unsigned int x, const unsigned int y, Address& adr) const;
0124 const bool ChamberAddressToCoords(const Address& adr, unsigned int& x, unsigned int& y) const;
0125 const double GetReportingArea(Address adr) const;
0126
0127
0128 HWStatusBitSet map[N_SIDES][N_STATIONS][N_RINGS][N_CHAMBERS][N_LAYERS][N_CFEBS][N_HVS];
0129
0130
0131 Detector detector;
0132 };
0133
0134 }
0135
0136 #endif