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
cscdqm::Summary::ReadReportingChambers
void ReadReportingChambers(const TH2 *&h2, const double threshold=1.0)
Read Reporting Chamber histogram and fill in detector map.
Definition: CSCDQM_Summary.cc:60
cscdqm::Summary::WriteChamberState
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.
Definition: CSCDQM_Summary.cc:333
CSCDQM_Logger.h
cscdqm::Summary::~Summary
~Summary()
Destructor.
Definition: CSCDQM_Summary.cc:31
cscdqm::NODATA_CLCT
No ALCT data.
Definition: CSCDQM_Summary.h:59
cscdqm::FORMAT_ERR
HW element is cold comparing with reference histogram.
Definition: CSCDQM_Summary.h:53
cscdqm::Summary::ChamberCoordsToAddress
const bool ChamberCoordsToAddress(const unsigned int x, const unsigned int y, Address &adr) const
Calculate Address from CSCChamberMap histogram coordinates.
Definition: CSCDQM_Summary.cc:809
cscdqm::HWStatusBit
HWStatusBit
Hardware Status Bit values used in Summary efficiency calculation.
Definition: CSCDQM_Summary.h:45
cscdqm::Summary
Hardware and Physics Efficiency data structures and routines.
Definition: CSCDQM_Summary.h:78
cscdqm::FIFOFULL_ERR
L1A out of sync errors.
Definition: CSCDQM_Summary.h:55
cscdqm::HWStatusBitSet
std::bitset< 14 > HWStatusBitSet
Hardware Status Bits structure used in Summary efficiency calculation and storage.
Definition: CSCDQM_Summary.h:72
relativeConstraints.station
station
Definition: relativeConstraints.py:67
multPhiCorr_741_25nsDY_cfi.py
py
Definition: multPhiCorr_741_25nsDY_cfi.py:12
cscdqm::MASKED
Data available (reporting)
Definition: CSCDQM_Summary.h:48
N_CFEBS
#define N_CFEBS
Definition: CSCDQM_Detector.h:47
CSCDQM_Detector.h
N_HVS
#define N_HVS
Definition: CSCDQM_Detector.h:48
cscdqm::CFEB_BWORDS
No CFEB data.
Definition: CSCDQM_Summary.h:61
cscdqm::Summary::Write
void Write(TH2 *&h2, const unsigned int station) const
Write detector map to H1 histogram (linear data) for the selected adr.station.
Definition: CSCDQM_Summary.cc:225
cscdqm::Summary::ChamberAddressToCoords
const bool ChamberAddressToCoords(const Address &adr, unsigned int &x, unsigned int &y) const
Calculate CSCChamberMap histogram coordinates from Address.
Definition: CSCDQM_Summary.cc:862
CSCDetId.h
N_LAYERS
#define N_LAYERS
Definition: CSCDQM_Detector.h:46
N_CHAMBERS
#define N_CHAMBERS
Definition: CSCDQM_Detector.h:45
cscdqm::Summary::ReSetValue
void ReSetValue(const HWStatusBit bit)
ReSetValue for the whole of detector.
Definition: CSCDQM_Summary.cc:372
N_SIDES
#define N_SIDES
Definition: CSCDQM_Detector.h:42
cscdqm::Summary::IsPhysicsReady
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...
Definition: CSCDQM_Summary.cc:465
cscdqm::Summary::GetReportingArea
const double GetReportingArea(Address adr) const
Calculate the reporting area for the address.
Definition: CSCDQM_Summary.cc:634
cscdqm::HOT
HW element was masked out (not in readout)
Definition: CSCDQM_Summary.h:50
cscdqm::Summary::SetValue
void SetValue(const HWStatusBit bit, const int value=1)
SetValue for the whole of detector.
Definition: CSCDQM_Summary.cc:386
cscdqm::DATA
Definition: CSCDQM_Summary.h:47
runTheMatrix.err
err
Definition: runTheMatrix.py:288
cscdqm
Definition: CSCDQM_DCSBase.h:29
CSCDetId
Definition: CSCDetId.h:26
value
Definition: value.py:1
cscdqm::Summary::Summary
Summary()
Constructor.
Definition: CSCDQM_Summary.cc:26
cscdqm::STANDBY
Data with CFEB BWORDS.
Definition: CSCDQM_Summary.h:63
cscdqm::NODATA_CFEB
No CLCT data.
Definition: CSCDQM_Summary.h:60
cscdqm::Summary::setMaskedHWElements
const unsigned int setMaskedHWElements(std::vector< std::string > &tokens)
Read HW element masks (strings), create Address and apply to detector map.
Definition: CSCDQM_Summary.cc:788
cscdqm::NODATA_ALCT
DMB Input timeout error.
Definition: CSCDQM_Summary.h:58
N_RINGS
#define N_RINGS
Definition: CSCDQM_Detector.h:44
cscdqm::Summary::ReadErrorChambers
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.
Definition: CSCDQM_Summary.cc:194
cscdqm::Summary::GetValue
const HWStatusBitSet GetValue(Address adr) const
Get value of some address.
Definition: CSCDQM_Summary.cc:727
cscdqm::Summary::WriteMap
void WriteMap(TH2 *&h2)
Write PhysicsReady Map to H2 histogram.
Definition: CSCDQM_Summary.cc:273
cscdqm::Address
Structure to store detector addresses of any granularity: from whole detector to the single HV elemen...
Definition: CSCDQM_Detector.h:82
multPhiCorr_741_25nsDY_cfi.px
px
Definition: multPhiCorr_741_25nsDY_cfi.py:10
cscdqm::Summary::isChamberStandby
bool isChamberStandby(unsigned int side, unsigned int station, unsigned int ring, unsigned int chamber) const
Check if chamber is in standby?
Definition: CSCDQM_Summary.cc:696
cscdqm::Summary::GetEfficiencyHW
const double GetEfficiencyHW() const
Get efficiency of the whole detector.
Definition: CSCDQM_Summary.cc:504
cscdqm::L1SYNC_ERR
Format errors.
Definition: CSCDQM_Summary.h:54
cscdqm::Summary::ReadReportingChambersRef
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.
Definition: CSCDQM_Summary.cc:93
cscdqm::COLD
HW element is hot by comparing with reference histogram.
Definition: CSCDQM_Summary.h:51
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
N_STATIONS
#define N_STATIONS
Definition: CSCDQM_Detector.h:43
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
cscdqm::WAS_ON
HW element in standby mode.
Definition: CSCDQM_Summary.h:64
cscdqm::Summary::GetEfficiencyArea
const double GetEfficiencyArea(const unsigned int station) const
Get Efficiency area for the station.
Definition: CSCDQM_Summary.cc:599
reset
void reset(double vett[256])
Definition: TPedValues.cc:11
cscdqm::Summary::detector
Detector detector
Definition: CSCDQM_Summary.h:131
cscdqm::Detector
Detector geometry and addressing related imformation and routines.
Definition: CSCDQM_Detector.h:169
remoteMonitoring_LED_IterMethod_cfg.threshold
threshold
Definition: remoteMonitoring_LED_IterMethod_cfg.py:426
cscdqm::Summary::map
HWStatusBitSet map[2][4][3][36][6][5][5]
Definition: CSCDQM_Summary.h:128
cscdqm::Summary::getDetector
const Detector getDetector() const
Definition: CSCDQM_Summary.h:85
cscdqm::INPUTTO_ERR
DMB FIFO full error.
Definition: CSCDQM_Summary.h:56
cscdqm::Summary::Reset
void Reset()
Resets all detector map.
Definition: CSCDQM_Summary.cc:36