62 if (h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >= 36 && h2->GetYaxis()->GetXmin() <= 1 &&
63 h2->GetYaxis()->GetXmax() >= 18) {
68 for (
unsigned int x = 1;
x <= 36;
x++) {
69 for (
unsigned int y = 1; y <= 18; y++) {
70 z = h2->GetBinContent(
x, y);
81 LOG_WARN <<
"cscdqm::Summary.ReadReportingChambers routine. Wrong histogram dimensions!";
97 const double cold_coef,
98 const double cold_Sfail,
99 const double hot_coef,
100 const double hot_Sfail) {
101 if (h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >= 36 && h2->GetYaxis()->GetXmin() <= 1 &&
102 h2->GetYaxis()->GetXmax() >= 18 && refh2->GetXaxis()->GetXmin() <= 1 && refh2->GetXaxis()->GetXmax() >= 36 &&
103 refh2->GetYaxis()->GetXmin() <= 1 && refh2->GetYaxis()->GetXmax() >= 18) {
105 double num = 1.0, denum = 1.0;
106 for (
unsigned int x = 1;
x <= 36;
x++) {
107 for (
unsigned int y = 1; y <= 18; y++) {
108 double Nij = h2->GetBinContent(
x, y);
109 double Nrefij = refh2->GetBinContent(
x, y);
112 denum +=
pow(Nrefij, 2.0) / Nij;
120 unsigned int N = 0,
n = 0;
122 for (
unsigned int x = 1;
x <= 36;
x++) {
123 for (
unsigned int y = 1; y <= 18; y++) {
125 n =
int(h2->GetBinContent(
x, y));
185 LOG_WARN <<
"cscdqm::Summary.ReadReportingChambersRef routine. Wrong histogram dimensions!";
198 const TH2*& evs,
const TH2*&
err,
const HWStatusBit bit,
const double eps_max,
const double Sfail) {
199 if (evs->GetXaxis()->GetXmin() <= 1 && evs->GetXaxis()->GetXmax() >= 36 && evs->GetYaxis()->GetXmin() <= 1 &&
200 evs->GetYaxis()->GetXmax() >= 18 &&
err->GetXaxis()->GetXmin() <= 1 &&
err->GetXaxis()->GetXmax() >= 36 &&
201 err->GetYaxis()->GetXmin() <= 1 &&
err->GetYaxis()->GetXmax() >= 18) {
204 unsigned int N = 0,
n = 0;
206 for (
unsigned int x = 1;
x <= 36;
x++) {
207 for (
unsigned int y = 1; y <= 18; y++) {
208 N =
int(evs->GetBinContent(
x, y));
220 LOG_WARN <<
"cscdqm::Summary.ReadErrorChambers routine. Wrong histogram dimensions!";
234 float area_all = 0.0, area_rep = 0.0;
255 h2->SetBinContent(
x, y, 2.0);
257 area_all += area_box;
259 h2->SetBinContent(
x, y, -1.0);
261 area_rep += area_box;
263 h2->SetBinContent(
x, y, 1.0);
265 h2->SetBinContent(
x, y, 0.0);
271 TString
title = Form(
"ME%d Status: Physics Efficiency %.2f%%",
station, (area_rep / area_all) * 100.0);
280 unsigned int rep_el = 0, csc_el = 0;
282 if (h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >=
NTICS && h2->GetYaxis()->GetXmin() <= 1 &&
283 h2->GetYaxis()->GetXmax() >=
NTICS) {
284 float xd = 5.0 /
NTICS;
288 for (
unsigned int x = 0;
x <
NTICS;
x++) {
289 xmin = -2.5 + xd *
x;
292 for (
unsigned int y = 0; y <
NTICS; y++) {
317 h2->SetBinContent(
x + 1, y + 1,
value);
323 LOG_WARN <<
"cscdqm::Summary.WriteMap routine. Wrong histogram dimensions!";
327 Form(
"EMU Status: Physics Efficiency %.2f%%", (csc_el == 0 ? 0.0 : (1.0 * rep_el) / csc_el) * 100.0);
340 if (h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >= 36 && h2->GetYaxis()->GetXmin() <= 1 &&
341 h2->GetYaxis()->GetXmax() >= 18) {
360 h2->SetBinContent(
x, y, 1.0 *
value);
362 h2->SetBinContent(
x, y, 0.0);
371 LOG_WARN <<
"cscdqm::Summary.WriteChamberState routine. Wrong histogram dimensions!";
483 unsigned int cdata = 0, cerror = 0, cmask = 0;
637 return rep_area / all_area;
801 unsigned int applied = 0;
803 for (
unsigned int r = 0; r < tokens.size(); r++) {
822 if (x < 1 || x > 36 || y < 1 || y > 18)
835 if (y == 1 || y == 18) {
838 }
else if (y == 2 || y == 17) {
841 }
else if (y == 3 || y == 16) {
844 }
else if (y == 4 || y == 15) {
847 }
else if (y == 5 || y == 14) {
850 }
else if (y == 6 || y == 13) {
853 }
else if (y == 7 || y == 12) {
856 }
else if (y == 8 || y == 11) {
859 }
else if (y == 9 || y == 10) {
906 }
else if (adr.
side == 2) {
const bool NextAddressBox(unsigned int &i, const AddressBox *&box, const Address &mask) const
Address box iterator by mask.
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.
const HWStatusBitSet GetValue(Address adr) const
Get value of some address.
#define HWSTATUSANYERROR(s)
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.
void Write(TH2 *&h2, const unsigned int station) const
Write detector map to H1 histogram (linear data) for the selected adr.station.
Area covered by Address in eta/phy space.
#define HWSTATUSANY(s, m)
HWStatusBitSet map[2][4][3][36][6][5][5]
ALPAKA_FN_ACC int side(int ieta, int iphi)
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...
static bool checkError(const unsigned int N, const unsigned int n, const double threshold, const double sigfail)
Check the hypothesis that error events (n) value above threshold comparing with the expected 0 and st...
#define HWSTATUSEQUALS(s, m)
const bool NextAddressBoxByPartition(unsigned int &i, const unsigned int px, const unsigned int py, AddressBox *&box)
Address box iterator by partition.
const float Area(const unsigned int station) const
Calculate station area in eta/phi space.
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.
void ReSetValue(const HWStatusBit bit)
ReSetValue for the whole of detector.
const unsigned int NumberOfChamberCFEBs(const unsigned int station, const unsigned int ring) const
Returns the number of CFEBs per Chamber on given Station/Ring.
void WriteMap(TH2 *&h2)
Write PhysicsReady Map to H2 histogram.
const unsigned int NumberOfRings(const unsigned int station) const
Returns the number of rings for the given station.
const double GetReportingArea(Address adr) const
Calculate the reporting area for the address.
HW element is hot by comparing with reference histogram.
bool isChamberStandby(unsigned int side, unsigned int station, unsigned int ring, unsigned int chamber) const
Check if chamber is in standby?
const bool AddressFromString(const std::string &str_address, Address &adr) const
Construct address from string.
const unsigned int NumberOfChambers(const unsigned int station, const unsigned int ring) const
Returns the number of chambers for the given station and ring.
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.
void SetValue(const HWStatusBit bit, const int value=1)
SetValue for the whole of detector.
const double GetEfficiencyArea(const unsigned int station) const
Get Efficiency area for the station.
static short checkOccupancy(const unsigned int N, const unsigned int n, const double low_threshold, const double high_threshold, const double low_sigfail, const double high_sigfail)
Check the hypothesis that observed events (n) value is too low or too high comparing with the expecte...
void Reset()
Resets all detector map.
std::bitset< 14 > HWStatusBitSet
Hardware Status Bits structure used in Summary efficiency calculation and storage.
#define HWSTATUSBITSETSIZE
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])
Power< A, B >::type pow(const A &a, const B &b)
const unsigned int NumberOfChamberHVs(const unsigned int station, const unsigned int ring) const
Returns the number of HVs per Chamber on given Station/Ring.