CMS 3D CMS Logo

CSCDQM_Summary.h
Go to the documentation of this file.
1 /*
2  * =====================================================================================
3  *
4  * Filename: Summary.h
5  *
6  * Description: CSC summary map and appropriate functions.
7  *
8  * Version: 1.0
9  * Created: 05/19/2008 10:52:21 AM
10  * Revision: none
11  * Compiler: gcc
12  *
13  * Author: Valdas Rapsevicius (VR), Valdas.Rapsevicius@cern.ch
14  * Company: CERN, CH
15  *
16  * =====================================================================================
17  */
18 
19 #ifndef CSCDQM_Summary_H
20 #define CSCDQM_Summary_H
21 
22 #include <TH2.h>
23 #include <cmath>
24 #include <vector>
25 #include <bitset>
26 #include <iostream>
27 
28 #include "CSCDQM_Detector.h"
29 #include "CSCDQM_Logger.h"
31 
32 #define HWSTATUSBITSETSIZE 14
33 #define HWSTATUSERRORBITS 0xffc
34 #define HWSTATUSEQUALS(s, m) (((std::bitset<HWSTATUSBITSETSIZE>)m & s) == m)
35 #define HWSTATUSANY(s, m) (((std::bitset<HWSTATUSBITSETSIZE>)m & s).any())
36 #define HWSTATUSANYERROR(s) (HWSTATUSANY(s, HWSTATUSERRORBITS))
37 
38 #define NTICS 100
39 
40 namespace cscdqm {
41 
45  enum HWStatusBit {
46 
47  DATA,
49 
50  HOT,
51  COLD,
52 
57 
62 
65 
66  };
67 
72  typedef std::bitset<HWSTATUSBITSETSIZE> HWStatusBitSet;
73 
78  class Summary {
79  public:
80  Summary();
81  ~Summary();
82 
83  void Reset();
84 
85  const Detector getDetector() const { return detector; }
86 
87  void ReadReportingChambers(const TH2*& h2, const double threshold = 1.0);
88  void ReadReportingChambersRef(const TH2*& h2,
89  const TH2*& refh2,
90  const double cold_coef = 0.1,
91  const double cold_Sfail = 5.0,
92  const double hot_coef = 2.0,
93  const double hot_Sfail = 5.0);
94  void ReadErrorChambers(
95  const TH2*& evs, const TH2*& err, const HWStatusBit bit, const double eps_max = 0.1, const double Sfail = 5.0);
96 
97  const unsigned int setMaskedHWElements(std::vector<std::string>& tokens);
98 
99  void Write(TH2*& h2, const unsigned int station) const;
100  void WriteMap(TH2*& h2);
101  void WriteChamberState(
102  TH2*& h2, const int mask, const int value = 1, const bool reset = true, const bool op_any = false) const;
103 
104  void ReSetValue(const HWStatusBit bit);
105  void ReSetValue(const Address& adr, const HWStatusBit bit);
106  void SetValue(const HWStatusBit bit, const int value = 1);
107  void SetValue(Address adr, const HWStatusBit bit, const int value = 1);
108 
109  const HWStatusBitSet GetValue(Address adr) const;
110  const int IsPhysicsReady(const unsigned int px, const unsigned int py);
111  //const int IsPhysicsReady(const float xmin, const float xmax, const float ymin, const float ymax) const;
112 
113  const double GetEfficiencyHW() const;
114  const double GetEfficiencyHW(const unsigned int station) const;
115  const double GetEfficiencyHW(Address adr) const;
116  const double GetEfficiencyArea(const unsigned int station) const;
117  const double GetEfficiencyArea(const Address& adr) const;
118 
119  bool isChamberStandby(unsigned int side, unsigned int station, unsigned int ring, unsigned int chamber) const;
120  bool isChamberStandby(CSCDetId cid) const;
121 
122  private:
123  const bool ChamberCoordsToAddress(const unsigned int x, const unsigned int y, Address& adr) const;
124  const bool ChamberAddressToCoords(const Address& adr, unsigned int& x, unsigned int& y) const;
125  const double GetReportingArea(Address adr) const;
126 
129 
132  };
133 
134 } // namespace cscdqm
135 
136 #endif
Detector geometry and addressing related imformation and routines.
#define N_CHAMBERS
const unsigned int setMaskedHWElements(std::vector< std::string > &tokens)
Read HW element masks (strings), create Address and apply to detector map.
void ReadReportingChambers(const TH2 *&h2, const double threshold=1.0)
Read Reporting Chamber histogram and fill in detector map.
HW element in standby mode.
const HWStatusBitSet GetValue(Address adr) const
Get value of some address.
Data with CFEB BWORDS.
HW element was masked out (not in readout)
const bool ChamberCoordsToAddress(const unsigned int x, const unsigned int y, Address &adr) const
Calculate Address from CSCChamberMap histogram coordinates.
const double GetEfficiencyHW() const
Get efficiency of the whole detector.
Hardware and Physics Efficiency data structures and routines.
#define N_LAYERS
void Write(TH2 *&h2, const unsigned int station) const
Write detector map to H1 histogram (linear data) for the selected adr.station.
HW element is cold comparing with reference histogram.
HWStatusBitSet map[2][4][3][36][6][5][5]
const int IsPhysicsReady(const unsigned int px, const unsigned int py)
Check if the current partition element (aka eta/phi polygon) has at least 2 active HW elements in the...
Format errors.
Summary()
Constructor.
Data available (reporting)
HWStatusBit
Hardware Status Bit values used in Summary efficiency calculation.
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)
Read Reporting Chamber histogram and fill in detector map based on reference histogram.
#define N_CFEBS
void ReSetValue(const HWStatusBit bit)
ReSetValue for the whole of detector.
Definition: value.py:1
void WriteMap(TH2 *&h2)
Write PhysicsReady Map to H2 histogram.
const double GetReportingArea(Address adr) const
Calculate the reporting area for the address.
HW element is hot by comparing with reference histogram.
#define N_STATIONS
No CFEB data.
bool isChamberStandby(unsigned int side, unsigned int station, unsigned int ring, unsigned int chamber) const
Check if chamber is in standby?
DMB Input timeout error.
void ReadErrorChambers(const TH2 *&evs, const TH2 *&err, const HWStatusBit bit, const double eps_max=0.1, const double Sfail=5.0)
Read Error data for Chambers.
void WriteChamberState(TH2 *&h2, const int mask, const int value=1, const bool reset=true, const bool op_any=false) const
Write State information to chamber histogram.
#define N_HVS
void SetValue(const HWStatusBit bit, const int value=1)
SetValue for the whole of detector.
L1A out of sync errors.
const double GetEfficiencyArea(const unsigned int station) const
Get Efficiency area for the station.
#define N_SIDES
const Detector getDetector() const
DMB FIFO full error.
No CLCT data.
void Reset()
Resets all detector map.
std::bitset< 14 > HWStatusBitSet
Hardware Status Bits structure used in Summary efficiency calculation and storage.
const bool ChamberAddressToCoords(const Address &adr, unsigned int &x, unsigned int &y) const
Calculate CSCChamberMap histogram coordinates from Address.
Structure to store detector addresses of any granularity: from whole detector to the single HV elemen...
void reset(double vett[256])
Definition: TPedValues.cc:11
#define N_RINGS
~Summary()
Destructor.
No ALCT data.