Hardware and Physics Efficiency data structures and routines. More...
#include <CSCDQM_Summary.h>
Public Member Functions | |
const Detector | getDetector () const |
const double | GetEfficiencyArea (const unsigned int station) const |
Get Efficiency area for the station. | |
const double | GetEfficiencyArea (Address adr) const |
Get Efficiency area for the address. | |
const double | GetEfficiencyHW (const unsigned int station) const |
Get efficiency of the station. | |
const double | GetEfficiencyHW (Address adr) const |
Get efficiency of the detector part supplied by the address. | |
const double | GetEfficiencyHW () const |
Get efficiency of the whole detector. | |
const HWStatusBitSet | GetValue (Address adr) const |
Get value of some address. | |
bool | isChamberStandby (unsigned int side, unsigned int station, unsigned int ring, unsigned int chamber) const |
Check if chamber is in standby? | |
bool | isChamberStandby (CSCDetId cid) const |
Check if chamber is in standby? | |
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 area. | |
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 | ReadReportingChambers (const TH2 *&h2, const double threshold=1.0) |
Read Reporting Chamber histogram and fill in detector map. | |
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 | Reset () |
Resets all detector map. | |
void | ReSetValue (Address adr, const HWStatusBit bit) |
ReSet value recursivelly by following the supplied address. | |
void | ReSetValue (const HWStatusBit bit) |
ReSetValue for the whole of detector. | |
const unsigned int | setMaskedHWElements (std::vector< std::string > &tokens) |
Read HW element masks (strings), create Address and apply to detector map. | |
void | SetValue (const HWStatusBit bit, const int value=1) |
SetValue for the whole of detector. | |
void | SetValue (Address adr, const HWStatusBit bit, const int value=1) |
Set value recursivelly by following the supplied address. | |
Summary () | |
Constructor. | |
void | Write (TH2 *&h2, const unsigned int station) const |
Write detector map to H1 histogram (linear data) for the selected adr.station. | |
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 | WriteMap (TH2 *&h2) |
Write PhysicsReady Map to H2 histogram. | |
~Summary () | |
Destructor. | |
Private Member Functions | |
const bool | ChamberAddressToCoords (const Address &adr, unsigned int &x, unsigned int &y) const |
Calculate CSCChamberMap histogram coordinates from Address. | |
const bool | ChamberCoordsToAddress (const unsigned int x, const unsigned int y, Address &adr) const |
Calculate Address from CSCChamberMap histogram coordinates. | |
const double | GetReportingArea (Address adr) const |
Calculate the reporting area for the address. | |
Private Attributes | |
Detector | detector |
HWStatusBitSet | map [N_SIDES][N_STATIONS][N_RINGS][N_CHAMBERS][N_LAYERS][N_CFEBS][N_HVS] |
Hardware and Physics Efficiency data structures and routines.
Definition at line 78 of file CSCDQM_Summary.h.
cscdqm::Summary::Summary | ( | ) |
cscdqm::Summary::~Summary | ( | ) |
const bool cscdqm::Summary::ChamberAddressToCoords | ( | const Address & | adr, |
unsigned int & | x, | ||
unsigned int & | y | ||
) | const [private] |
Calculate CSCChamberMap histogram coordinates from Address.
adr | Address |
x | X coordinate of histogram to be returned |
y | Y coordinate of histogram to be returned |
Definition at line 875 of file CSCDQM_Summary.cc.
References cscdqm::Address::chamber, cscdqm::AddressMask::chamber, cscdqm::Address::mask, cscdqm::AddressMask::ring, cscdqm::Address::ring, cscdqm::Address::side, cscdqm::AddressMask::side, cscdqm::Address::station, and cscdqm::AddressMask::station.
Referenced by WriteChamberState().
{ if (!adr.mask.side || !adr.mask.station || !adr.mask.ring || !adr.mask.chamber) return false; x = adr.chamber; y = 0; if (adr.side == 1) { switch (adr.station) { case 1: y = 10; if (adr.ring == 2) y = 11; if (adr.ring == 3) y = 12; break; case 2: y = 13; if (adr.ring == 2) y = 14; break; case 3: y = 15; if (adr.ring == 2) y = 16; break; case 4: y = 17; if (adr.ring == 2) y = 18; break; } } else if (adr.side == 2) { switch (adr.station) { case 1: y = 7; if (adr.ring == 2) y = 8; if (adr.ring == 1) y = 9; break; case 2: y = 5; if (adr.ring == 1) y = 6; break; case 3: y = 3; if (adr.ring == 1) y = 4; break; case 4: y = 1; if (adr.ring == 1) y = 2; break; } } return true; }
const bool cscdqm::Summary::ChamberCoordsToAddress | ( | const unsigned int | x, |
const unsigned int | y, | ||
Address & | adr | ||
) | const [private] |
Calculate Address from CSCChamberMap histogram coordinates.
x | X coordinate of histogram |
y | Y coordinate of histogram |
adr | Address to be filled in and returned |
Definition at line 815 of file CSCDQM_Summary.cc.
References cscdqm::AddressMask::cfeb, cscdqm::Address::chamber, cscdqm::AddressMask::chamber, cscdqm::AddressMask::hv, cscdqm::AddressMask::layer, cscdqm::Address::mask, cscdqm::AddressMask::ring, cscdqm::Address::ring, cscdqm::Address::side, cscdqm::AddressMask::side, cscdqm::Address::station, cscdqm::AddressMask::station, and ExpressReco_HICollisions_FallBack::x.
Referenced by ReadErrorChambers(), ReadReportingChambers(), and ReadReportingChambersRef().
{ if( x < 1 || x > 36 || y < 1 || y > 18) return false; adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = true; adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false; if ( y < 10 ) adr.side = 2; else adr.side = 1; adr.chamber = x; if (y == 1 || y == 18) { adr.station = 4; adr.ring = 2; } else if (y == 2 || y == 17) { adr.station = 4; adr.ring = 1; } else if (y == 3 || y == 16) { adr.station = 3; adr.ring = 2; } else if (y == 4 || y == 15) { adr.station = 3; adr.ring = 1; } else if (y == 5 || y == 14) { adr.station = 2; adr.ring = 2; } else if (y == 6 || y == 13) { adr.station = 2; adr.ring = 1; } else if (y == 7 || y == 12) { adr.station = 1; adr.ring = 3; } else if (y == 8 || y == 11) { adr.station = 1; adr.ring = 2; } else if (y == 9 || y == 10) { adr.station = 1; adr.ring = 1; } return true; }
const Detector cscdqm::Summary::getDetector | ( | ) | const [inline] |
Definition at line 87 of file CSCDQM_Summary.h.
References detector.
Referenced by cscdqm::EventProcessor::processCSC(), and cscdqm::EventProcessor::updateEfficiencyHistos().
{ return detector; }
const double cscdqm::Summary::GetEfficiencyArea | ( | const unsigned int | station | ) | const |
Get Efficiency area for the station.
station | Station number 1..4 |
Definition at line 612 of file CSCDQM_Summary.cc.
References cscdqm::AddressMask::cfeb, cscdqm::AddressMask::chamber, cscdqm::AddressMask::hv, cscdqm::AddressMask::layer, cscdqm::Address::mask, N_STATIONS, cscdqm::AddressMask::ring, cscdqm::AddressMask::side, cscdqm::Address::station, and relativeConstraints::station.
{ if (station <= 0 || station > N_STATIONS) return 0.0; Address adr; adr.mask.side = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false; adr.station = true; adr.station = station; return GetEfficiencyArea(adr); }
const double cscdqm::Summary::GetEfficiencyArea | ( | Address | adr | ) | const |
Get Efficiency area for the address.
adr | Address |
Definition at line 628 of file CSCDQM_Summary.cc.
References cscdqm::Detector::Area(), cscdqm::AddressMask::cfeb, cscdqm::AddressMask::chamber, detector, GetReportingArea(), cscdqm::AddressMask::hv, cscdqm::AddressMask::layer, cscdqm::Address::mask, cscdqm::AddressMask::ring, cscdqm::AddressMask::side, cscdqm::Address::station, and cscdqm::AddressMask::station.
{ double all_area = 1; if (adr.mask.side == false && adr.mask.ring == false && adr.mask.chamber == false && adr.mask.layer == false && adr.mask.cfeb == false && adr.mask.hv == false && adr.mask.station == true) all_area = detector.Area(adr.station); else all_area = detector.Area(adr); double rep_area = GetReportingArea(adr); return rep_area / all_area; }
const double cscdqm::Summary::GetEfficiencyHW | ( | ) | const |
Get efficiency of the whole detector.
Definition at line 521 of file CSCDQM_Summary.cc.
References cscdqm::AddressMask::cfeb, cscdqm::AddressMask::chamber, cscdqm::AddressMask::hv, cscdqm::AddressMask::layer, cscdqm::Address::mask, cscdqm::AddressMask::ring, cscdqm::AddressMask::side, and cscdqm::AddressMask::station.
Referenced by GetEfficiencyHW(), and cscdqm::EventProcessor::updateEfficiencyHistos().
{ Address adr; adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false; return GetEfficiencyHW(adr); }
const double cscdqm::Summary::GetEfficiencyHW | ( | const unsigned int | station | ) | const |
Get efficiency of the station.
station | Station number |
Definition at line 534 of file CSCDQM_Summary.cc.
References cscdqm::AddressMask::cfeb, cscdqm::AddressMask::chamber, GetEfficiencyHW(), cscdqm::AddressMask::hv, cscdqm::AddressMask::layer, cscdqm::Address::mask, N_STATIONS, cscdqm::AddressMask::ring, cscdqm::AddressMask::side, cscdqm::Address::station, relativeConstraints::station, and cscdqm::AddressMask::station.
{ Address adr; adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false; if (station > 0 && station <= N_STATIONS) { adr.mask.station = true; adr.station = station; } else { return 0.0; } return GetEfficiencyHW(adr); }
const double cscdqm::Summary::GetEfficiencyHW | ( | Address | adr | ) | const |
Get efficiency of the detector part supplied by the address.
adr | Address to watch efficiency for |
if not error - then OK!
Definition at line 555 of file CSCDQM_Summary.cc.
References cscdqm::Address::cfeb, cscdqm::AddressMask::cfeb, cscdqm::Address::chamber, cscdqm::AddressMask::chamber, detector, GetEfficiencyHW(), GetValue(), cscdqm::AddressMask::hv, cscdqm::Address::hv, HWSTATUSANYERROR, cscdqm::AddressMask::layer, cscdqm::Address::layer, cscdqm::Address::mask, N_LAYERS, N_SIDES, N_STATIONS, cscdqm::Detector::NumberOfChamberCFEBs(), cscdqm::Detector::NumberOfChamberHVs(), cscdqm::Detector::NumberOfChambers(), cscdqm::Detector::NumberOfRings(), cscdqm::AddressMask::ring, cscdqm::Address::ring, cscdqm::Address::side, cscdqm::AddressMask::side, cscdqm::Address::station, cscdqm::AddressMask::station, and ntuplemaker::status.
{ double sum = 0.0; if (!adr.mask.side) { adr.mask.side = true; for (adr.side = 1; adr.side <= N_SIDES; adr.side++) sum += GetEfficiencyHW(adr); return sum / N_SIDES; } if (!adr.mask.station) { adr.mask.station = true; for (adr.station = 1; adr.station <= N_STATIONS; adr.station++) sum += GetEfficiencyHW(adr); return sum / N_STATIONS; } if (!adr.mask.ring) { adr.mask.ring = true; for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++) sum += GetEfficiencyHW(adr); return sum / detector.NumberOfRings(adr.station); } if (!adr.mask.chamber) { adr.mask.chamber = true; for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++) sum += GetEfficiencyHW(adr); return sum / detector.NumberOfChambers(adr.station, adr.ring); } if (!adr.mask.layer) { adr.mask.layer = true; for (adr.layer = 1; adr.layer <= N_LAYERS; adr.layer++) sum += GetEfficiencyHW(adr); return sum / N_LAYERS; } if (!adr.mask.cfeb) { adr.mask.cfeb = true; for (adr.cfeb = 1; adr.cfeb <= detector.NumberOfChamberCFEBs(adr.station, adr.ring); adr.cfeb++) sum += GetEfficiencyHW(adr); return sum / detector.NumberOfChamberCFEBs(adr.station, adr.ring); } if (!adr.mask.hv) { adr.mask.hv = true; for (adr.hv = 1; adr.hv <= detector.NumberOfChamberHVs(adr.station, adr.ring); adr.hv++) sum += GetEfficiencyHW(adr); return sum / detector.NumberOfChamberHVs(adr.station, adr.ring); } HWStatusBitSet status = GetValue(adr); if (HWSTATUSANYERROR(status)) return 0.0; return 1.0; }
const double cscdqm::Summary::GetReportingArea | ( | Address | adr | ) | const [private] |
Calculate the reporting area for the address.
adr | Address to calculate |
NOT errorous!
Definition at line 651 of file CSCDQM_Summary.cc.
References cscdqm::Detector::Area(), cscdqm::Address::cfeb, cscdqm::AddressMask::cfeb, cscdqm::Address::chamber, cscdqm::AddressMask::chamber, detector, GetValue(), cscdqm::AddressMask::hv, cscdqm::Address::hv, HWSTATUSANYERROR, cscdqm::AddressMask::layer, cscdqm::Address::mask, N_SIDES, N_STATIONS, cscdqm::Detector::NumberOfChamberCFEBs(), cscdqm::Detector::NumberOfChamberHVs(), cscdqm::Detector::NumberOfChambers(), cscdqm::Detector::NumberOfRings(), cscdqm::AddressMask::ring, cscdqm::Address::ring, cscdqm::Address::side, cscdqm::AddressMask::side, cscdqm::Address::station, cscdqm::AddressMask::station, and ntuplemaker::status.
Referenced by GetEfficiencyArea().
{ double sum = 0.0; if (!adr.mask.side) { adr.mask.side = true; for (adr.side = 1; adr.side <= N_SIDES; adr.side++) sum += GetReportingArea(adr); return sum; } if (!adr.mask.station) { adr.mask.station = true; for (adr.station = 1; adr.station <= N_STATIONS; adr.station++) sum += GetReportingArea(adr); return sum; } if (!adr.mask.ring) { adr.mask.ring = true; for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++) sum += GetReportingArea(adr); return sum; } if (!adr.mask.chamber) { adr.mask.chamber = true; for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++) sum += GetReportingArea(adr); return sum; } if (!adr.mask.cfeb) { adr.mask.cfeb = true; for (adr.cfeb = 1; adr.cfeb <= detector.NumberOfChamberCFEBs(adr.station, adr.ring); adr.cfeb++) sum += GetReportingArea(adr); return sum; } if (!adr.mask.hv) { adr.mask.hv = true; for (adr.hv = 1; adr.hv <= detector.NumberOfChamberHVs(adr.station, adr.ring); adr.hv++) sum += GetReportingArea(adr); return sum; } adr.mask.layer = false; HWStatusBitSet status = GetValue(adr); if (!HWSTATUSANYERROR(status)) { return detector.Area(adr); } return 0.0; }
const HWStatusBitSet cscdqm::Summary::GetValue | ( | Address | adr | ) | const |
Get value of some address.
adr | Address of atomic element to return value from |
Definition at line 738 of file CSCDQM_Summary.cc.
References cscdqm::Address::cfeb, cscdqm::AddressMask::cfeb, cscdqm::Address::chamber, cscdqm::AddressMask::chamber, detector, cscdqm::AddressMask::hv, cscdqm::Address::hv, cscdqm::AddressMask::layer, cscdqm::Address::layer, cscdqm::Address::mask, N_LAYERS, N_SIDES, N_STATIONS, cscdqm::Detector::NumberOfChamberCFEBs(), cscdqm::Detector::NumberOfChamberHVs(), cscdqm::Detector::NumberOfChambers(), cscdqm::Detector::NumberOfRings(), cscdqm::AddressMask::ring, cscdqm::Address::ring, cscdqm::Address::side, cscdqm::AddressMask::side, evf::utils::state, cscdqm::Address::station, and cscdqm::AddressMask::station.
Referenced by GetEfficiencyHW(), GetReportingArea(), isChamberStandby(), IsPhysicsReady(), Write(), and WriteChamberState().
{ HWStatusBitSet state; state.reset(); if (!adr.mask.side) { adr.mask.side = true; for (adr.side = 1; adr.side <= N_SIDES; adr.side++) state |= GetValue(adr); return state; } if (!adr.mask.station) { adr.mask.station = true; for (adr.station = 1; adr.station <= N_STATIONS; adr.station++) state |= GetValue(adr); return state; } if (!adr.mask.ring) { adr.mask.ring = true; for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++) state |= GetValue(adr); return state; } if (!adr.mask.chamber) { adr.mask.chamber = true; for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++) state |= GetValue(adr); return state; } if (!adr.mask.layer) { adr.mask.layer = true; for (adr.layer = 1; adr.layer <= N_LAYERS; adr.layer++) state |= GetValue(adr); return state; } if (!adr.mask.cfeb) { adr.mask.cfeb = true; for (adr.cfeb = 1; adr.cfeb <= detector.NumberOfChamberCFEBs(adr.station, adr.ring); adr.cfeb++) state |= GetValue(adr); return state; } if (!adr.mask.hv) { adr.mask.hv = true; for (adr.hv = 1; adr.hv <= detector.NumberOfChamberHVs(adr.station, adr.ring); adr.hv++) state |= GetValue(adr); return state; } return map[adr.side - 1][adr.station - 1][adr.ring - 1][adr.chamber - 1][adr.layer - 1][adr.cfeb - 1][adr.hv - 1]; }
bool cscdqm::Summary::isChamberStandby | ( | unsigned int | side, |
unsigned int | station, | ||
unsigned int | ring, | ||
unsigned int | chamber | ||
) | const |
Check if chamber is in standby?
side | Side |
station | Station |
ring | Ring |
chamber | Chamber |
Definition at line 709 of file CSCDQM_Summary.cc.
References cscdqm::AddressMask::cfeb, cscdqm::Address::chamber, cscdqm::AddressMask::chamber, GetValue(), cscdqm::AddressMask::hv, HWSTATUSANY, cscdqm::AddressMask::layer, cscdqm::Address::mask, cscdqm::AddressMask::ring, cscdqm::Address::ring, relativeConstraints::ring, cscdqm::Address::side, cscdqm::AddressMask::side, cscdqm::Address::station, relativeConstraints::station, and cscdqm::AddressMask::station.
Referenced by isChamberStandby(), and cscdqm::EventProcessor::processCSC().
{ Address adr; adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = true; adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false; adr.side = side; adr.station = station; adr.ring = ring; adr.chamber = chamber; //std::cout << adr << " = " << HWSTATUSANY(GetValue(adr), 0x1000) << "\n"; return HWSTATUSANY(GetValue(adr), 0x1000); }
bool cscdqm::Summary::isChamberStandby | ( | CSCDetId | cid | ) | const |
Check if chamber is in standby?
cid | Chamber identifier |
Definition at line 729 of file CSCDQM_Summary.cc.
References CSCDetId::chamber(), CSCDetId::endcap(), isChamberStandby(), CSCDetId::ring(), and CSCDetId::station().
{ return isChamberStandby(cid.endcap(), cid.station(), cid.ring(), cid.chamber()); }
const int cscdqm::Summary::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 area.
px | partition element index in x axis |
py | partition element index in y axis |
If at least 2 stations with data and without errors = OK
Else, if at least one station errorous = ERROR
Else, if at least one station masked = MASKED
Else, not sufficient data = OK
Definition at line 485 of file CSCDQM_Summary.cc.
References cscdqm::AddressBox::adr, cscdqm::DATA, detector, GetValue(), HWSTATUSANYERROR, i, cscdqm::MASKED, N_STATIONS, cscdqm::Detector::NextAddressBoxByPartition(), cscdqm::Address::station, and ntuplemaker::status.
Referenced by WriteMap().
{ AddressBox *box; HWStatusBitSet status[N_STATIONS]; unsigned int i = 0; while(detector.NextAddressBoxByPartition(i, px, py, box)) { status[box->adr.station - 1] |= GetValue(box->adr); } unsigned int cdata = 0, cerror = 0, cmask = 0; for (unsigned int i = 0; i < N_STATIONS; i++) { if (HWSTATUSANYERROR(status[i])) { cerror++; } else { if (status[i].test(MASKED)) cmask++; if (status[i].test(DATA)) cdata++; } } if (cdata > 1) return 1; if (cerror > 0) return -1; if (cmask > 0) return 2; return 0; }
void cscdqm::Summary::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.
evs | Histogram for number of events (total) |
err | Histogram for number of errors |
bit | Error bit to set |
eps_max | Maximum tolerance of errors (rate) |
Sfail | Significance threshold for failure report |
Definition at line 201 of file CSCDQM_Summary.cc.
References ChamberCoordsToAddress(), cscdqm::Utility::checkError(), LOG_WARN, MultiGaussianStateTransform::N, n, ReSetValue(), SetValue(), ExpressReco_HICollisions_FallBack::x, and ExpressReco_HICollisions_FallBack::y.
Referenced by cscdqm::EventProcessor::updateEfficiencyHistos().
{ if(evs->GetXaxis()->GetXmin() <= 1 && evs->GetXaxis()->GetXmax() >= 36 && evs->GetYaxis()->GetXmin() <= 1 && evs->GetYaxis()->GetXmax() >= 18 && err->GetXaxis()->GetXmin() <= 1 && err->GetXaxis()->GetXmax() >= 36 && err->GetYaxis()->GetXmin() <= 1 && err->GetYaxis()->GetXmax() >= 18) { Address adr; unsigned int N = 0, n = 0; for(unsigned int x = 1; x <= 36; x++) { for(unsigned int y = 1; y <= 18; y++) { N = int(evs->GetBinContent(x, y)); n = int(err->GetBinContent(x, y)); if (ChamberCoordsToAddress(x, y, adr)) { if(Utility::checkError(N, n, eps_max, Sfail)) { SetValue(adr, bit); } else { ReSetValue(adr, bit); } } } } } else { LOG_WARN << "cscdqm::Summary.ReadErrorChambers routine. Wrong histogram dimensions!"; } }
void cscdqm::Summary::ReadReportingChambers | ( | const TH2 *& | h2, |
const double | threshold = 1.0 |
||
) |
Read Reporting Chamber histogram and fill in detector map.
h2 | Histogram to read |
threshold | Min bin value to set HW element as reporting |
Definition at line 62 of file CSCDQM_Summary.cc.
References ChamberCoordsToAddress(), cscdqm::DATA, LOG_WARN, ReSetValue(), SetValue(), ExpressReco_HICollisions_FallBack::x, ExpressReco_HICollisions_FallBack::y, and z.
Referenced by cscdqm::EventProcessor::updateEfficiencyHistos().
{ if(h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >= 36 && h2->GetYaxis()->GetXmin() <= 1 && h2->GetYaxis()->GetXmax() >= 18) { Address adr; double z = 0.0; for(unsigned int x = 1; x <= 36; x++) { for(unsigned int y = 1; y <= 18; y++) { z = h2->GetBinContent(x, y); if(ChamberCoordsToAddress(x, y, adr)) { if(z >= threshold) { SetValue(adr, DATA); } else { ReSetValue(adr, DATA); } } } } } else { LOG_WARN << "cscdqm::Summary.ReadReportingChambers routine. Wrong histogram dimensions!"; } }
void cscdqm::Summary::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.
h2 | Histogram to read |
refh2 | Reference histogram of hit occupancies |
cold_coef | Minimum tolerance of difference (rate) to set COLD (not reporting) HW element |
cold_Sfail | Significance threshold for COLD HW element |
hot_coef | Minimum tolerance of difference (rate) to set HOT HW element |
hot_Sfail | Significance threshold for HOT HW element |
Rate Factor calculation
Reset some bits
Definition at line 97 of file CSCDQM_Summary.cc.
References ChamberCoordsToAddress(), cscdqm::Utility::checkOccupancy(), cscdqm::COLD, cscdqm::DATA, cscdqm::HOT, LOG_WARN, MultiGaussianStateTransform::N, n, funct::pow(), ReSetValue(), SetValue(), ExpressReco_HICollisions_FallBack::x, and ExpressReco_HICollisions_FallBack::y.
Referenced by cscdqm::EventProcessor::updateEfficiencyHistos().
{ if(h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >= 36 && h2->GetYaxis()->GetXmin() <= 1 && h2->GetYaxis()->GetXmax() >= 18 && refh2->GetXaxis()->GetXmin() <= 1 && refh2->GetXaxis()->GetXmax() >= 36 && refh2->GetYaxis()->GetXmin() <= 1 && refh2->GetYaxis()->GetXmax() >= 18) { double num = 1.0, denum = 1.0; for(unsigned int x = 1; x <= 36; x++) { for(unsigned int y = 1; y <= 18; y++) { double Nij = h2->GetBinContent(x, y); double Nrefij = refh2->GetBinContent(x, y); if (Nij > 0) { num += Nrefij; denum += pow(Nrefij, 2.0) / Nij; } } } double factor = num / denum; Address adr; unsigned int N = 0, n = 0; for(unsigned int x = 1; x <= 36; x++) { for(unsigned int y = 1; y <= 18; y++) { N = int(refh2->GetBinContent(x, y) * factor); n = int(h2->GetBinContent(x, y)); if(ChamberCoordsToAddress(x, y, adr)) { ReSetValue(adr, HOT); ReSetValue(adr, COLD); if (n == 0) { ReSetValue(adr, DATA); } else { SetValue(adr, DATA); } switch (Utility::checkOccupancy(N, n, cold_coef, hot_coef, cold_Sfail, hot_Sfail)) { case -1: SetValue(adr, COLD); /* std::cout << "adr = " << detector.AddressName(adr); std::cout << ", x = " << x << ", y = " << y; std::cout << ", value = " << GetValue(adr); std::cout << ", refh2 = " << refh2->GetBinContent(x, y); std::cout << ", factor = " << factor; std::cout << ", N = " << N; std::cout << ", n = " << n; std::cout << ", num = " << num; std::cout << ", denum = " << denum; std::cout << ", rate = " << (N > 0 ? n / N : 0); std::cout << ", cold_coef = " << cold_coef; std::cout << ", = COLD"; std::cout << "\n"; */ break; case 1: SetValue(adr, HOT); /* std::cout << "adr = " << detector.AddressName(adr); std::cout << ", x = " << x << ", y = " << y; std::cout << ", value = " << GetValue(adr); std::cout << ", refh2 = " << refh2->GetBinContent(x, y); std::cout << ", factor = " << factor; std::cout << ", N = " << N; std::cout << ", n = " << n; std::cout << ", num = " << num; std::cout << ", denum = " << denum; std::cout << ", rate = " << (N > 0 ? n / N : 0); std::cout << ", hot_coef = " << hot_coef; std::cout << ", = HOT"; std::cout << "\n"; */ break; }; } } } } else { LOG_WARN << "cscdqm::Summary.ReadReportingChambersRef routine. Wrong histogram dimensions!"; } }
void cscdqm::Summary::Reset | ( | ) |
Resets all detector map.
Setting Zeros (no data) for each HW element (and beyond)
Definition at line 38 of file CSCDQM_Summary.cc.
References cscdqm::Address::cfeb, cscdqm::AddressMask::cfeb, cscdqm::Address::chamber, cscdqm::AddressMask::chamber, cscdqm::AddressMask::hv, cscdqm::Address::hv, HWSTATUSBITSETSIZE, cscdqm::AddressMask::layer, cscdqm::Address::mask, N_CFEBS, N_CHAMBERS, N_HVS, N_RINGS, ReSetValue(), cscdqm::AddressMask::ring, cscdqm::Address::ring, cscdqm::AddressMask::side, and cscdqm::AddressMask::station.
Referenced by Summary().
{ Address adr; adr.mask.side = adr.mask.station = adr.mask.layer = false; adr.mask.ring = adr.mask.chamber = adr.mask.cfeb = adr.mask.hv = true; for (adr.ring = 1; adr.ring <= N_RINGS; adr.ring++) { for (adr.chamber = 1; adr.chamber <= N_CHAMBERS; adr.chamber++) { for (adr.cfeb = 1; adr.cfeb <= N_CFEBS; adr.cfeb++) { for (adr.hv = 1; adr.hv <= N_HVS; adr.hv++) { for (unsigned int bit = 0; bit < HWSTATUSBITSETSIZE; bit++) { ReSetValue(adr, (HWStatusBit) bit); } } } } } }
void cscdqm::Summary::ReSetValue | ( | const HWStatusBit | bit | ) |
ReSetValue for the whole of detector.
bit | Status bit to set |
Definition at line 393 of file CSCDQM_Summary.cc.
References SetValue().
Referenced by ReadErrorChambers(), ReadReportingChambers(), ReadReportingChambersRef(), and Reset().
{ SetValue(bit, 0); }
void cscdqm::Summary::ReSetValue | ( | Address | adr, |
const HWStatusBit | bit | ||
) |
ReSet value recursivelly by following the supplied address.
adr | Address to be updated |
bit | Status bit to set |
Definition at line 402 of file CSCDQM_Summary.cc.
References SetValue().
{ SetValue(adr, bit, 0); }
const unsigned int cscdqm::Summary::setMaskedHWElements | ( | std::vector< std::string > & | tokens | ) |
Read HW element masks (strings), create Address and apply to detector map.
tokens | Vector of mask strings |
Definition at line 794 of file CSCDQM_Summary.cc.
References cscdqm::Detector::AddressFromString(), detector, cscdqm::MASKED, csvReporter::r, and SetValue().
Referenced by cscdqm::EventProcessor::maskHWElements().
void cscdqm::Summary::SetValue | ( | const HWStatusBit | bit, |
const int | value = 1 |
||
) |
SetValue for the whole of detector.
bit | Status bit to set |
value | Value to set |
Definition at line 411 of file CSCDQM_Summary.cc.
References cscdqm::AddressMask::cfeb, cscdqm::AddressMask::chamber, cscdqm::AddressMask::hv, cscdqm::AddressMask::layer, cscdqm::Address::mask, cscdqm::AddressMask::ring, cscdqm::AddressMask::side, and cscdqm::AddressMask::station.
Referenced by ReadErrorChambers(), ReadReportingChambers(), ReadReportingChambersRef(), ReSetValue(), setMaskedHWElements(), SetValue(), and cscdqm::EventProcessor::standbyEfficiencyHistos().
void cscdqm::Summary::SetValue | ( | Address | adr, |
const HWStatusBit | bit, | ||
const int | value = 1 |
||
) |
Set value recursivelly by following the supplied address.
adr | Address to be updated |
bit | Status bit to set |
value | Value to be set |
Definition at line 423 of file CSCDQM_Summary.cc.
References cscdqm::Address::cfeb, cscdqm::AddressMask::cfeb, cscdqm::Address::chamber, cscdqm::AddressMask::chamber, detector, cscdqm::AddressMask::hv, cscdqm::Address::hv, cscdqm::AddressMask::layer, cscdqm::Address::layer, cscdqm::Address::mask, N_CFEBS, N_CHAMBERS, N_HVS, N_LAYERS, N_RINGS, N_SIDES, N_STATIONS, cscdqm::Detector::NumberOfChamberCFEBs(), cscdqm::Detector::NumberOfChamberHVs(), cscdqm::Detector::NumberOfChambers(), cscdqm::Detector::NumberOfRings(), cscdqm::AddressMask::ring, cscdqm::Address::ring, SetValue(), cscdqm::Address::side, cscdqm::AddressMask::side, cscdqm::Address::station, and cscdqm::AddressMask::station.
{ if (!adr.mask.side) { adr.mask.side = true; for (adr.side = 1; adr.side <= N_SIDES; adr.side++) SetValue(adr, bit, value); return; } if (!adr.mask.station) { adr.mask.station = true; for (adr.station = 1; adr.station <= N_STATIONS; adr.station++) SetValue(adr, bit, value); return; } if (!adr.mask.ring) { adr.mask.ring = true; for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++) SetValue(adr, bit, value); return; } if (!adr.mask.chamber) { adr.mask.chamber = true; for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++) SetValue(adr, bit, value); return; } if (!adr.mask.layer) { adr.mask.layer = true; for (adr.layer = 1; adr.layer <= N_LAYERS; adr.layer++) SetValue(adr, bit, value); return; } if (!adr.mask.cfeb) { adr.mask.cfeb = true; for (adr.cfeb = 1; adr.cfeb <= detector.NumberOfChamberCFEBs(adr.station, adr.ring); adr.cfeb++) SetValue(adr, bit, value); return; } if (!adr.mask.hv) { adr.mask.hv = true; for (adr.hv = 1; adr.hv <= detector.NumberOfChamberHVs(adr.station, adr.ring); adr.hv++) SetValue(adr, bit, value); return; } if( adr.side > 0 && adr.side <= N_SIDES && adr.station > 0 && adr.station <= N_STATIONS && adr.ring > 0 && adr.ring <= N_RINGS && adr.chamber > 0 && adr.chamber <= N_CHAMBERS && adr.layer > 0 && adr.layer <= N_LAYERS && adr.cfeb > 0 && adr.cfeb <= N_CFEBS && adr.hv > 0 && adr.hv <= N_HVS) { map[adr.side - 1][adr.station - 1][adr.ring - 1][adr.chamber - 1][adr.layer - 1][adr.cfeb - 1][adr.hv - 1].set(bit, value); } }
void cscdqm::Summary::Write | ( | TH2 *& | h2, |
const unsigned int | station | ||
) | const |
Write detector map to H1 histogram (linear data) for the selected adr.station.
h2 | Histogram to write data to |
station | station number (1-4) to write data for |
Definition at line 234 of file CSCDQM_Summary.cc.
References cscdqm::AddressBox::adr, cscdqm::Address::cfeb, cscdqm::AddressMask::cfeb, cscdqm::Address::chamber, cscdqm::AddressMask::chamber, cscdqm::DATA, detector, GetValue(), cscdqm::AddressMask::hv, cscdqm::Address::hv, HWSTATUSANYERROR, i, cscdqm::AddressMask::layer, cscdqm::Address::mask, cscdqm::MASKED, N_STATIONS, cscdqm::Detector::NextAddressBox(), cscdqm::AddressMask::ring, cscdqm::Address::ring, cscdqm::Address::side, cscdqm::AddressMask::side, cscdqm::Address::station, relativeConstraints::station, cscdqm::AddressMask::station, ntuplemaker::status, indexGen::title, ExpressReco_HICollisions_FallBack::x, cscdqm::AddressBox::xmax, cscdqm::AddressBox::xmin, ExpressReco_HICollisions_FallBack::y, cscdqm::AddressBox::ymax, and cscdqm::AddressBox::ymin.
Referenced by cscdqm::EventProcessor::updateEfficiencyHistos().
{ const AddressBox* box; Address adr, tadr; float area_all = 0.0, area_rep = 0.0; if(station < 1 || station > N_STATIONS) return; adr.mask.side = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false; adr.mask.station = true; adr.station = station; unsigned int i = 0; while (detector.NextAddressBox(i, box, adr)) { unsigned int x = 1 + (box->adr.side - 1) * 9 + (box->adr.ring - 1) * 3 + (box->adr.hv - 1); unsigned int y = 1 + (box->adr.chamber - 1) * 5 + (box->adr.cfeb - 1); tadr = box->adr; HWStatusBitSet status = GetValue(tadr); float area_box = fabs((box->xmax - box->xmin) * (box->ymax - box->ymin)); if (status.test(MASKED)) { h2->SetBinContent(x, y, 2.0); } else { area_all += area_box; if (HWSTATUSANYERROR(status)) { h2->SetBinContent(x, y, -1.0); } else { area_rep += area_box; if (status.test(DATA)) { h2->SetBinContent(x, y, 1.0); } else { h2->SetBinContent(x, y, 0.0); } } } } TString title = Form("ME%d Status: Physics Efficiency %.2f%%", station, (area_rep / area_all) * 100.0); h2->SetTitle(title); }
void cscdqm::Summary::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.
h2 | histogram to write to |
mask | mask of errors to check while writing |
value | to write to if state fits mask |
reset | should all chamber states be reseted to 0 prior writing? |
op_any | Should chamber be marked as errorous on any bit in mask? false - for all. |
Definition at line 351 of file CSCDQM_Summary.cc.
References cscdqm::AddressMask::cfeb, cscdqm::Address::chamber, cscdqm::AddressMask::chamber, ChamberAddressToCoords(), detector, GetValue(), cscdqm::AddressMask::hv, HWSTATUSANY, HWSTATUSEQUALS, cscdqm::AddressMask::layer, LOG_WARN, cscdqm::Address::mask, N_SIDES, N_STATIONS, cscdqm::Detector::NumberOfChambers(), cscdqm::Detector::NumberOfRings(), cscdqm::AddressMask::ring, cscdqm::Address::ring, cscdqm::Address::side, cscdqm::AddressMask::side, cscdqm::Address::station, cscdqm::AddressMask::station, ExpressReco_HICollisions_FallBack::x, and ExpressReco_HICollisions_FallBack::y.
Referenced by cscdqm::EventProcessor::standbyEfficiencyHistos(), and cscdqm::EventProcessor::writeShifterHistograms().
{ if(h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >= 36 && h2->GetYaxis()->GetXmin() <= 1 && h2->GetYaxis()->GetXmax() >= 18) { unsigned int x, y; Address adr; adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = true; adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false; for (adr.side = 1; adr.side <= N_SIDES; adr.side++) { for (adr.station = 1; adr.station <= N_STATIONS; adr.station++) { for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++) { for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++) { if (ChamberAddressToCoords(adr, x, y)) { HWStatusBitSet hwValue = GetValue(adr); bool hit = (op_any ? HWSTATUSANY(hwValue, mask) : HWSTATUSEQUALS(hwValue, mask)); // std::cout << "x = " << x << ", y = " << y << ", value = " << GetValue(adr) << std::endl; // std::cout << "adr = " << detector.AddressName(adr) << ", x = " << x << ", y = " << y << ", value = " << GetValue(adr) << std::endl; if (hit) { h2->SetBinContent(x, y, 1.0 * value); } else if (reset) { h2->SetBinContent(x, y, 0.0); } } } } } } } else { LOG_WARN << "cscdqm::Summary.WriteChamberState routine. Wrong histogram dimensions!"; } }
void cscdqm::Summary::WriteMap | ( | TH2 *& | h2 | ) |
Write PhysicsReady Map to H2 histogram.
h2 | Histogram to write map to |
Definition at line 284 of file CSCDQM_Summary.cc.
References IsPhysicsReady(), LOG_WARN, NTICS, indexGen::title, relativeConstraints::value, ExpressReco_HICollisions_FallBack::x, and ExpressReco_HICollisions_FallBack::y.
Referenced by cscdqm::EventProcessor::updateEfficiencyHistos().
{ unsigned int rep_el = 0, csc_el = 0; if(h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >= NTICS && h2->GetYaxis()->GetXmin() <= 1 && h2->GetYaxis()->GetXmax() >= NTICS) { float xd = 5.0 / NTICS, yd = 1.0 * (2.0 * 3.14159) / NTICS; float xmin, xmax, ymin, ymax; for(unsigned int x = 0; x < NTICS; x++) { xmin = -2.5 + xd * x; xmax = xmin + xd; for(unsigned int y = 0; y < NTICS; y++) { double value = 0.0; if (xmin == -2.5 || xmax == 2.5) continue; if (xmin >= -1 && xmax <= 1) continue; ymin = yd * y; ymax = ymin + yd; switch(IsPhysicsReady(x, y)) { case -1: value = -1.0; break; case 0: value = 0.0; rep_el++; break; case 1: value = 1.0; rep_el++; break; case 2: value = 2.0; rep_el++; } h2->SetBinContent(x + 1, y + 1, value); csc_el++; } } } else { LOG_WARN << "cscdqm::Summary.WriteMap routine. Wrong histogram dimensions!"; } TString title = Form("EMU Status: Physics Efficiency %.2f%%", (csc_el == 0 ? 0.0 : (1.0 * rep_el) / csc_el) * 100.0); h2->SetTitle(title); }
Detector cscdqm::Summary::detector [private] |
Detector routines object
Definition at line 127 of file CSCDQM_Summary.h.
Referenced by getDetector(), GetEfficiencyArea(), GetEfficiencyHW(), GetReportingArea(), GetValue(), IsPhysicsReady(), setMaskedHWElements(), SetValue(), Write(), and WriteChamberState().
HWStatusBitSet cscdqm::Summary::map[N_SIDES][N_STATIONS][N_RINGS][N_CHAMBERS][N_LAYERS][N_CFEBS][N_HVS] [private] |
Atomic HW element status matrix
Definition at line 124 of file CSCDQM_Summary.h.