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 
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 
80  public:
81 
82  Summary();
83  ~Summary();
84 
85  void Reset();
86 
87  const Detector getDetector() const { return detector; }
88 
89  void ReadReportingChambers(const TH2*& h2, const double threshold = 1.0);
90  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);
91  void ReadErrorChambers(const TH2*& evs, const TH2*& err, const HWStatusBit bit, const double eps_max = 0.1, const double Sfail = 5.0);
92 
93  const unsigned int setMaskedHWElements(std::vector<std::string>& tokens);
94 
95  void Write(TH2*& h2, const unsigned int station) const;
96  void WriteMap(TH2*& h2);
97  void WriteChamberState(TH2*& h2, const int mask, const int value = 1, const bool reset = true, const bool op_any = false) const;
98 
99  void ReSetValue(const HWStatusBit bit);
100  void ReSetValue(const Address& adr, const HWStatusBit bit);
101  void SetValue(const HWStatusBit bit, const int value = 1);
102  void SetValue(Address adr, const HWStatusBit bit, const int value = 1);
103 
104  const HWStatusBitSet GetValue(Address adr) const;
105  const int IsPhysicsReady(const unsigned int px, const unsigned int py);
106  //const int IsPhysicsReady(const float xmin, const float xmax, const float ymin, const float ymax) const;
107 
108  const double GetEfficiencyHW() const;
109  const double GetEfficiencyHW(const unsigned int station) const;
110  const double GetEfficiencyHW(Address adr) const;
111  const double GetEfficiencyArea(const unsigned int station) const;
112  const double GetEfficiencyArea(const Address& adr) const;
113 
114  bool isChamberStandby(unsigned int side, unsigned int station, unsigned int ring, unsigned int chamber) const;
115  bool isChamberStandby(CSCDetId cid) const;
116 
117  private:
118 
119  const bool ChamberCoordsToAddress(const unsigned int x, const unsigned int y, Address& adr) const;
120  const bool ChamberAddressToCoords(const Address& adr, unsigned int& x, unsigned int& y) const;
121  const double GetReportingArea(Address adr) const;
122 
125 
128 
129 };
130 
131 }
132 
133 #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.
Data with CFEB BWORDS.
HW element was masked out (not in readout)
void Write(TH2 *&h2, const unsigned int station) const
Write detector map to H1 histogram (linear data) for the selected adr.station.
bool isChamberStandby(unsigned int side, unsigned int station, unsigned int ring, unsigned int chamber) const
Check if chamber is in standby?
Hardware and Physics Efficiency data structures and routines.
const HWStatusBitSet GetValue(Address adr) const
Get value of some address.
#define N_LAYERS
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)
const bool ChamberAddressToCoords(const Address &adr, unsigned int &x, unsigned int &y) const
Calculate CSCChamberMap histogram coordinates from Address.
HWStatusBit
Hardware Status Bit values used in Summary efficiency calculation.
const double GetEfficiencyHW() const
Get efficiency of the whole detector.
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.
const double GetEfficiencyArea(const unsigned int station) const
Get Efficiency area for the station.
#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 Detector getDetector() const
HW element is hot by comparing with reference histogram.
#define N_STATIONS
No CFEB data.
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.
#define N_HVS
void SetValue(const HWStatusBit bit, const int value=1)
SetValue for the whole of detector.
L1A out of sync errors.
#define N_SIDES
DMB FIFO full error.
const double GetReportingArea(Address adr) const
Calculate the reporting area for the address.
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.
No CLCT data.
const bool ChamberCoordsToAddress(const unsigned int x, const unsigned int y, Address &adr) const
Calculate Address from CSCChamberMap histogram coordinates.
void Reset()
Resets all detector map.
std::bitset< 14 > HWStatusBitSet
Hardware Status Bits structure used in Summary efficiency calculation and storage.
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.