61 if (h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >= 36 && h2->GetYaxis()->GetXmin() <= 1 &&
62 h2->GetYaxis()->GetXmax() >= 18) {
66 for (
unsigned int x = 1; x <= 36; x++) {
67 for (
unsigned int y = 1; y <= 18; y++) {
68 z = h2->GetBinContent(x, y);
79 LOG_WARN <<
"cscdqm::Summary.ReadReportingChambers routine. Wrong histogram dimensions!";
95 const double cold_coef,
96 const double cold_Sfail,
97 const double hot_coef,
98 const double hot_Sfail) {
99 if (h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >= 36 && h2->GetYaxis()->GetXmin() <= 1 &&
100 h2->GetYaxis()->GetXmax() >= 18 && refh2->GetXaxis()->GetXmin() <= 1 && refh2->GetXaxis()->GetXmax() >= 36 &&
101 refh2->GetYaxis()->GetXmin() <= 1 && refh2->GetYaxis()->GetXmax() >= 18) {
103 double num = 1.0, denum = 1.0;
104 for (
unsigned int x = 1; x <= 36; x++) {
105 for (
unsigned int y = 1; y <= 18; y++) {
106 double Nij = h2->GetBinContent(x, y);
107 double Nrefij = refh2->GetBinContent(x, y);
110 denum +=
pow(Nrefij, 2.0) / Nij;
114 double factor = num / denum;
117 unsigned int N = 0,
n = 0;
119 for (
unsigned int x = 1; x <= 36; x++) {
120 for (
unsigned int y = 1; y <= 18; y++) {
121 N =
int(refh2->GetBinContent(x, y) *
factor);
122 n =
int(h2->GetBinContent(x, y));
182 LOG_WARN <<
"cscdqm::Summary.ReadReportingChambersRef routine. Wrong histogram dimensions!";
195 const TH2*& evs,
const TH2*&
err,
const HWStatusBit bit,
const double eps_max,
const double Sfail) {
196 if (evs->GetXaxis()->GetXmin() <= 1 && evs->GetXaxis()->GetXmax() >= 36 && evs->GetYaxis()->GetXmin() <= 1 &&
197 evs->GetYaxis()->GetXmax() >= 18 && err->GetXaxis()->GetXmin() <= 1 && err->GetXaxis()->GetXmax() >= 36 &&
198 err->GetYaxis()->GetXmin() <= 1 && err->GetYaxis()->GetXmax() >= 18) {
200 unsigned int N = 0,
n = 0;
202 for (
unsigned int x = 1; x <= 36; x++) {
203 for (
unsigned int y = 1; y <= 18; y++) {
204 N =
int(evs->GetBinContent(x, y));
205 n =
int(err->GetBinContent(x, y));
216 LOG_WARN <<
"cscdqm::Summary.ReadErrorChambers routine. Wrong histogram dimensions!";
228 float area_all = 0.0, area_rep = 0.0;
240 unsigned int x = 1 + (box->
adr.
side - 1) * 9 + (box->
adr.
ring - 1) * 3 + (box->
adr.
hv - 1);
248 if (status.test(
MASKED)) {
249 h2->SetBinContent(x, y, 2.0);
251 area_all += area_box;
253 h2->SetBinContent(x, y, -1.0);
255 area_rep += area_box;
256 if (status.test(
DATA)) {
257 h2->SetBinContent(x, y, 1.0);
259 h2->SetBinContent(x, y, 0.0);
265 TString
title = Form(
"ME%d Status: Physics Efficiency %.2f%%", station, (area_rep / area_all) * 100.0);
274 unsigned int rep_el = 0, csc_el = 0;
276 if (h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >=
NTICS && h2->GetYaxis()->GetXmin() <= 1 &&
277 h2->GetYaxis()->GetXmax() >=
NTICS) {
278 float xd = 5.0 /
NTICS;
282 for (
unsigned int x = 0; x <
NTICS; x++) {
283 xmin = -2.5 + xd * x;
286 for (
unsigned int y = 0; y <
NTICS; y++) {
289 if (xmin == -2.5 || xmax == 2.5)
291 if (xmin >= -1 && xmax <= 1)
311 h2->SetBinContent(x + 1, y + 1, value);
317 LOG_WARN <<
"cscdqm::Summary.WriteMap routine. Wrong histogram dimensions!";
321 Form(
"EMU Status: Physics Efficiency %.2f%%", (csc_el == 0 ? 0.0 : (1.0 * rep_el) / csc_el) * 100.0);
334 if (h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >= 36 && h2->GetYaxis()->GetXmin() <= 1 &&
335 h2->GetYaxis()->GetXmax() >= 18) {
353 h2->SetBinContent(x, y, 1.0 * value);
355 h2->SetBinContent(x, y, 0.0);
364 LOG_WARN <<
"cscdqm::Summary.WriteChamberState routine. Wrong histogram dimensions!";
475 unsigned int cdata = 0, cerror = 0, cmask = 0;
476 for (
unsigned int i = 0; i <
N_STATIONS; i++) {
626 return rep_area / all_area;
789 unsigned int applied = 0;
791 for (
unsigned int r = 0;
r < tokens.size();
r++) {
810 if (x < 1 || x > 36 || y < 1 || y > 18)
823 if (y == 1 || y == 18) {
826 }
else if (y == 2 || y == 17) {
829 }
else if (y == 3 || y == 16) {
832 }
else if (y == 4 || y == 15) {
835 }
else if (y == 5 || y == 14) {
838 }
else if (y == 6 || y == 13) {
841 }
else if (y == 7 || y == 12) {
844 }
else if (y == 8 || y == 11) {
847 }
else if (y == 9 || y == 10) {
894 }
else if (adr.
side == 2) {
const unsigned int setMaskedHWElements(std::vector< std::string > &tokens)
Read HW element masks (strings), create Address and apply to detector map.
const bool AddressFromString(const std::string &str_address, Address &adr) const
Construct address from string.
void ReadReportingChambers(const TH2 *&h2, const double threshold=1.0)
Read Reporting Chamber histogram and fill in detector map.
#define HWSTATUSANYERROR(s)
HW element was masked out (not in readout)
const float Area(const unsigned int station) const
Calculate station area in eta/phi space.
const bool NextAddressBox(unsigned int &i, const AddressBox *&box, const Address &mask) const
Address box iterator by mask.
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?
const HWStatusBitSet GetValue(Address adr) const
Get value of some address.
Area covered by Address in eta/phy space.
#define HWSTATUSANY(s, m)
const unsigned int NumberOfRings(const unsigned int station) const
Returns the number of rings for the given station.
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...
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 unsigned int NumberOfChamberCFEBs(const unsigned int station, const unsigned int ring) const
Returns the number of CFEBs per Chamber on given Station/Ring.
const unsigned int NumberOfChamberHVs(const unsigned int station, const unsigned int ring) const
Returns the number of HVs per Chamber on given Station/Ring.
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.
void ReSetValue(const HWStatusBit bit)
ReSetValue for the whole of detector.
void WriteMap(TH2 *&h2)
Write PhysicsReady Map to H2 histogram.
HW element is hot by comparing with reference histogram.
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 SetValue(const HWStatusBit bit, const int value=1)
SetValue for the whole of detector.
const double GetReportingArea(Address adr) const
Calculate the reporting area for the address.
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 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.
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.
const unsigned int NumberOfChambers(const unsigned int station, const unsigned int ring) const
Returns the number of chambers for the given station and ring.
#define HWSTATUSBITSETSIZE
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)