64 if(h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >= 36 &&
65 h2->GetYaxis()->GetXmin() <= 1 && h2->GetYaxis()->GetXmax() >= 18) {
70 for(
unsigned int x = 1;
x <= 36;
x++) {
71 for(
unsigned int y = 1;
y <= 18;
y++) {
72 z = h2->GetBinContent(
x,
y);
83 LOG_WARN <<
"cscdqm::Summary.ReadReportingChambers routine. Wrong histogram dimensions!";
99 if(h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >= 36 &&
100 h2->GetYaxis()->GetXmin() <= 1 && h2->GetYaxis()->GetXmax() >= 18 &&
101 refh2->GetXaxis()->GetXmin() <= 1 && refh2->GetXaxis()->GetXmax() >= 36 &&
102 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;
116 double factor = num / denum;
119 unsigned int N = 0,
n = 0;
121 for(
unsigned int x = 1;
x <= 36;
x++) {
122 for(
unsigned int y = 1;
y <= 18;
y++) {
124 N = int(refh2->GetBinContent(
x,
y) * factor);
125 n = int(h2->GetBinContent(
x,
y));
189 LOG_WARN <<
"cscdqm::Summary.ReadReportingChambersRef routine. Wrong histogram dimensions!";
203 if(evs->GetXaxis()->GetXmin() <= 1 && evs->GetXaxis()->GetXmax() >= 36 &&
204 evs->GetYaxis()->GetXmin() <= 1 && evs->GetYaxis()->GetXmax() >= 18 &&
205 err->GetXaxis()->GetXmin() <= 1 && err->GetXaxis()->GetXmax() >= 36 &&
206 err->GetYaxis()->GetXmin() <= 1 && err->GetYaxis()->GetXmax() >= 18) {
209 unsigned int N = 0,
n = 0;
211 for(
unsigned int x = 1;
x <= 36;
x++) {
212 for(
unsigned int y = 1;
y <= 18;
y++) {
213 N = int(evs->GetBinContent(
x,
y));
214 n = int(err->GetBinContent(
x,
y));
225 LOG_WARN <<
"cscdqm::Summary.ReadErrorChambers routine. Wrong histogram dimensions!";
237 float area_all = 0.0, area_rep = 0.0;
239 if(station < 1 || station >
N_STATIONS)
return;
257 if (status.test(
MASKED)) {
258 h2->SetBinContent(x, y, 2.0);
260 area_all += area_box;
262 h2->SetBinContent(x, y, -1.0);
264 area_rep += area_box;
265 if (status.test(
DATA)) {
266 h2->SetBinContent(x, y, 1.0);
268 h2->SetBinContent(x, y, 0.0);
275 TString
title = Form(
"ME%d Status: Physics Efficiency %.2f%%", station, (area_rep / area_all) * 100.0);
286 unsigned int rep_el = 0, csc_el = 0;
288 if(h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >=
NTICS &&
289 h2->GetYaxis()->GetXmin() <= 1 && h2->GetYaxis()->GetXmax() >=
NTICS) {
291 float xd = 5.0 /
NTICS;
295 for(
unsigned int x = 0;
x <
NTICS;
x++) {
297 xmin = -2.5 + xd *
x;
300 for(
unsigned int y = 0;
y <
NTICS;
y++) {
304 if (xmin == -2.5 || xmax == 2.5)
continue;
305 if (xmin >= -1 && xmax <= 1)
continue;
324 h2->SetBinContent(x + 1,
y + 1, value);
331 LOG_WARN <<
"cscdqm::Summary.WriteMap routine. Wrong histogram dimensions!";
334 TString
title = Form(
"EMU Status: Physics Efficiency %.2f%%", (csc_el == 0 ? 0.0 : (1.0 * rep_el) / csc_el) * 100.0);
350 if(h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >= 36 &&
351 h2->GetYaxis()->GetXmin() <= 1 && h2->GetYaxis()->GetXmax() >= 18) {
370 h2->SetBinContent(x, y, 1.0 * value);
372 h2->SetBinContent(x, y, 0.0);
381 LOG_WARN <<
"cscdqm::Summary.WriteChamberState routine. Wrong histogram dimensions!";
492 unsigned int cdata = 0, cerror = 0, cmask = 0;
493 for (
unsigned int i = 0; i <
N_STATIONS; i++) {
503 if (cdata > 1)
return 1;
505 if (cerror > 0)
return -1;
507 if (cmask > 0)
return 2;
608 if (station <= 0 || station >
N_STATIONS)
return 0.0;
638 return rep_area / all_area;
788 unsigned int applied = 0;
790 for (
unsigned int r = 0;
r < tokens.size();
r++) {
810 if( x < 1 || x > 36 || y < 1 || y > 18)
return false;
815 if ( y < 10 ) adr.
side = 2;
820 if (y == 1 || y == 18) {
824 if (y == 2 || y == 17) {
828 if (y == 3 || y == 16) {
832 if (y == 4 || y == 15) {
836 if (y == 5 || y == 14) {
840 if (y == 6 || y == 13) {
844 if (y == 7 || y == 12) {
848 if (y == 8 || y == 11) {
852 if (y == 9 || y == 10) {
879 if (adr.
ring == 2) y = 11;
880 if (adr.
ring == 3) y = 12;
884 if (adr.
ring == 2) y = 14;
888 if (adr.
ring == 2) y = 16;
892 if (adr.
ring == 2) y = 18;
900 if (adr.
ring == 2) y = 8;
901 if (adr.
ring == 1) y = 9;
905 if (adr.
ring == 1) y = 6;
909 if (adr.
ring == 1) y = 4;
913 if (adr.
ring == 1) y = 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)
HWStatusBitSet map[N_SIDES][N_STATIONS][N_RINGS][N_CHAMBERS][N_LAYERS][N_CFEBS][N_HVS]
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.
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.
std::bitset< HWSTATUSBITSETSIZE > HWStatusBitSet
Hardware Status Bits structure used in Summary efficiency calculation and storage.
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.
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)