CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
cscdqm::Summary Class Reference

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. More...
 
const double GetEfficiencyArea (const Address &adr) const
 Get Efficiency area for the address. More...
 
const double GetEfficiencyHW () const
 Get efficiency of the whole detector. More...
 
const double GetEfficiencyHW (const unsigned int station) const
 Get efficiency of the station. More...
 
const double GetEfficiencyHW (Address adr) const
 Get efficiency of the detector part supplied by the address. More...
 
const HWStatusBitSet GetValue (Address adr) const
 Get value of some address. More...
 
bool isChamberStandby (unsigned int side, unsigned int station, unsigned int ring, unsigned int chamber) const
 Check if chamber is in standby? More...
 
bool isChamberStandby (CSCDetId cid) const
 Check if chamber is in standby? More...
 
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. More...
 
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. More...
 
void ReadReportingChambers (const TH2 *&h2, const double threshold=1.0)
 Read Reporting Chamber histogram and fill in detector map. More...
 
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. More...
 
void Reset ()
 Resets all detector map. More...
 
void ReSetValue (const HWStatusBit bit)
 ReSetValue for the whole of detector. More...
 
void ReSetValue (const Address &adr, const HWStatusBit bit)
 ReSet value recursivelly by following the supplied address. More...
 
const unsigned int setMaskedHWElements (std::vector< std::string > &tokens)
 Read HW element masks (strings), create Address and apply to detector map. More...
 
void SetValue (const HWStatusBit bit, const int value=1)
 SetValue for the whole of detector. More...
 
void SetValue (Address adr, const HWStatusBit bit, const int value=1)
 Set value recursivelly by following the supplied address. More...
 
 Summary ()
 Constructor. More...
 
void Write (TH2 *&h2, const unsigned int station) const
 Write detector map to H1 histogram (linear data) for the selected adr.station. More...
 
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. More...
 
void WriteMap (TH2 *&h2)
 Write PhysicsReady Map to H2 histogram. More...
 
 ~Summary ()
 Destructor. More...
 

Private Member Functions

const bool ChamberAddressToCoords (const Address &adr, unsigned int &x, unsigned int &y) const
 Calculate CSCChamberMap histogram coordinates from Address. More...
 
const bool ChamberCoordsToAddress (const unsigned int x, const unsigned int y, Address &adr) const
 Calculate Address from CSCChamberMap histogram coordinates. More...
 
const double GetReportingArea (Address adr) const
 Calculate the reporting area for the address. More...
 

Private Attributes

Detector detector
 
HWStatusBitSet map [2][4][3][36][6][5][5]
 

Detailed Description

Hardware and Physics Efficiency data structures and routines.

Definition at line 78 of file CSCDQM_Summary.h.

Constructor & Destructor Documentation

◆ Summary()

cscdqm::Summary::Summary ( )

Constructor.

Definition at line 26 of file CSCDQM_Summary.cc.

References Reset().

26 : detector(NTICS, NTICS) { Reset(); }
#define NTICS
void Reset()
Resets all detector map.

◆ ~Summary()

cscdqm::Summary::~Summary ( )

Destructor.

Definition at line 31 of file CSCDQM_Summary.cc.

31 {}

Member Function Documentation

◆ ChamberAddressToCoords()

const bool cscdqm::Summary::ChamberAddressToCoords ( const Address adr,
unsigned int &  x,
unsigned int &  y 
) const
private

Calculate CSCChamberMap histogram coordinates from Address.

Parameters
adrAddress
xX coordinate of histogram to be returned
yY coordinate of histogram to be returned
Returns
true if coords filled, false - otherwise

Definition at line 874 of file CSCDQM_Summary.cc.

References cscdqm::AddressMask::chamber, cscdqm::Address::chamber, cscdqm::Address::mask, cscdqm::AddressMask::ring, cscdqm::Address::ring, cscdqm::AddressMask::side, cscdqm::Address::side, cscdqm::AddressMask::station, cscdqm::Address::station, and x.

Referenced by WriteChamberState().

874  {
875  if (!adr.mask.side || !adr.mask.station || !adr.mask.ring || !adr.mask.chamber)
876  return false;
877 
878  x = adr.chamber;
879  y = 0;
880 
881  if (adr.side == 1) {
882  switch (adr.station) {
883  case 1:
884  y = 10;
885  if (adr.ring == 2)
886  y = 11;
887  if (adr.ring == 3)
888  y = 12;
889  break;
890  case 2:
891  y = 13;
892  if (adr.ring == 2)
893  y = 14;
894  break;
895  case 3:
896  y = 15;
897  if (adr.ring == 2)
898  y = 16;
899  break;
900  case 4:
901  y = 17;
902  if (adr.ring == 2)
903  y = 18;
904  break;
905  }
906  } else if (adr.side == 2) {
907  switch (adr.station) {
908  case 1:
909  y = 7;
910  if (adr.ring == 2)
911  y = 8;
912  if (adr.ring == 1)
913  y = 9;
914  break;
915  case 2:
916  y = 5;
917  if (adr.ring == 1)
918  y = 6;
919  break;
920  case 3:
921  y = 3;
922  if (adr.ring == 1)
923  y = 4;
924  break;
925  case 4:
926  y = 1;
927  if (adr.ring == 1)
928  y = 2;
929  break;
930  }
931  }
932 
933  return true;
934  }

◆ ChamberCoordsToAddress()

const bool cscdqm::Summary::ChamberCoordsToAddress ( const unsigned int  x,
const unsigned int  y,
Address adr 
) const
private

Calculate Address from CSCChamberMap histogram coordinates.

Parameters
xX coordinate of histogram
yY coordinate of histogram
adrAddress to be filled in and returned
Returns
true if address was found and filled, false - otherwise

Definition at line 821 of file CSCDQM_Summary.cc.

References cscdqm::AddressMask::cfeb, cscdqm::AddressMask::chamber, cscdqm::Address::chamber, cscdqm::AddressMask::hv, cscdqm::AddressMask::layer, cscdqm::Address::mask, cscdqm::AddressMask::ring, cscdqm::Address::ring, cscdqm::AddressMask::side, cscdqm::Address::side, cscdqm::AddressMask::station, cscdqm::Address::station, and x.

Referenced by ReadErrorChambers(), ReadReportingChambers(), and ReadReportingChambersRef().

821  {
822  if (x < 1 || x > 36 || y < 1 || y > 18)
823  return false;
824 
825  adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = true;
826  adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
827 
828  if (y < 10)
829  adr.side = 2;
830  else
831  adr.side = 1;
832 
833  adr.chamber = x;
834 
835  if (y == 1 || y == 18) {
836  adr.station = 4;
837  adr.ring = 2;
838  } else if (y == 2 || y == 17) {
839  adr.station = 4;
840  adr.ring = 1;
841  } else if (y == 3 || y == 16) {
842  adr.station = 3;
843  adr.ring = 2;
844  } else if (y == 4 || y == 15) {
845  adr.station = 3;
846  adr.ring = 1;
847  } else if (y == 5 || y == 14) {
848  adr.station = 2;
849  adr.ring = 2;
850  } else if (y == 6 || y == 13) {
851  adr.station = 2;
852  adr.ring = 1;
853  } else if (y == 7 || y == 12) {
854  adr.station = 1;
855  adr.ring = 3;
856  } else if (y == 8 || y == 11) {
857  adr.station = 1;
858  adr.ring = 2;
859  } else if (y == 9 || y == 10) {
860  adr.station = 1;
861  adr.ring = 1;
862  }
863 
864  return true;
865  }

◆ getDetector()

const Detector cscdqm::Summary::getDetector ( ) const
inline

Definition at line 85 of file CSCDQM_Summary.h.

References detector.

Referenced by cscdqm::EventProcessor::processCSC(), and cscdqm::EventProcessor::updateEfficiencyHistos().

85 { return detector; }

◆ GetEfficiencyArea() [1/2]

const double cscdqm::Summary::GetEfficiencyArea ( const unsigned int  station) const

Get Efficiency area for the station.

Parameters
stationStation number 1..4
Returns
Reporting Area for the Station

Definition at line 609 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, relativeConstraints::station, cscdqm::AddressMask::station, and cscdqm::Address::station.

609  {
610  if (station <= 0 || station > N_STATIONS)
611  return 0.0;
612 
613  Address adr;
614  bzero(&adr, sizeof(Address));
615  adr.mask.side = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
616  adr.mask.station = true;
617  adr.station = station;
618 
619  return GetEfficiencyArea(adr);
620  }
#define N_STATIONS
const double GetEfficiencyArea(const unsigned int station) const
Get Efficiency area for the station.

◆ GetEfficiencyArea() [2/2]

const double cscdqm::Summary::GetEfficiencyArea ( const Address adr) const

Get Efficiency area for the address.

Parameters
adrAddress
Returns
Area in eta/phi space

Definition at line 627 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::AddressMask::station, and cscdqm::Address::station.

627  {
628  double all_area = 1;
629 
630  if ((adr.mask.side == false) && (adr.mask.ring == false) && (adr.mask.chamber == false) &&
631  (adr.mask.layer == false) && (adr.mask.cfeb == false) && (adr.mask.hv == false) && (adr.mask.station == true))
632  all_area = detector.Area(adr.station);
633  else
634  all_area = detector.Area(adr);
635 
636  double rep_area = GetReportingArea(adr);
637  return rep_area / all_area;
638  }
const float Area(const unsigned int station) const
Calculate station area in eta/phi space.
const double GetReportingArea(Address adr) const
Calculate the reporting area for the address.

◆ GetEfficiencyHW() [1/3]

const double cscdqm::Summary::GetEfficiencyHW ( ) const

Get efficiency of the whole detector.

Returns
Detector efficiency rate (0..1)

Definition at line 512 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().

512  {
513  Address adr;
514  bzero(&adr, sizeof(Address));
515  adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv =
516  false;
517  return GetEfficiencyHW(adr);
518  }
const double GetEfficiencyHW() const
Get efficiency of the whole detector.

◆ GetEfficiencyHW() [2/3]

const double cscdqm::Summary::GetEfficiencyHW ( const unsigned int  station) const

Get efficiency of the station.

Parameters
stationStation number
Returns
Detector efficiency rate (0..1)

Definition at line 525 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, relativeConstraints::station, cscdqm::AddressMask::station, and cscdqm::Address::station.

525  {
526  Address adr;
527  bzero(&adr, sizeof(Address));
528  adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv =
529  false;
530 
531  if (station > 0 && station <= N_STATIONS) {
532  adr.mask.station = true;
533  adr.station = station;
534  } else {
535  return 0.0;
536  }
537 
538  return GetEfficiencyHW(adr);
539  }
const double GetEfficiencyHW() const
Get efficiency of the whole detector.
#define N_STATIONS

◆ GetEfficiencyHW() [3/3]

const double cscdqm::Summary::GetEfficiencyHW ( Address  adr) const

Get efficiency of the detector part supplied by the address.

Parameters
adrAddress to watch efficiency for
Returns
Subdetector efficiency rate (0..1)

if not error - then OK!

Definition at line 546 of file CSCDQM_Summary.cc.

References cscdqm::AddressMask::cfeb, cscdqm::Address::cfeb, cscdqm::AddressMask::chamber, cscdqm::Address::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::AddressMask::side, cscdqm::Address::side, cscdqm::AddressMask::station, cscdqm::Address::station, and mps_update::status.

546  {
547  double sum = 0.0;
548  if (!adr.mask.side) {
549  adr.mask.side = true;
550  for (adr.side = 1; adr.side <= N_SIDES; adr.side++)
551  sum += GetEfficiencyHW(adr);
552  return sum / N_SIDES;
553  }
554 
555  if (!adr.mask.station) {
556  adr.mask.station = true;
557  for (adr.station = 1; adr.station <= N_STATIONS; adr.station++)
558  sum += GetEfficiencyHW(adr);
559  return sum / N_STATIONS;
560  }
561 
562  if (!adr.mask.ring) {
563  adr.mask.ring = true;
564  for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++)
565  sum += GetEfficiencyHW(adr);
566  return sum / detector.NumberOfRings(adr.station);
567  }
568 
569  if (!adr.mask.chamber) {
570  adr.mask.chamber = true;
571  for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++)
572  sum += GetEfficiencyHW(adr);
573  return sum / detector.NumberOfChambers(adr.station, adr.ring);
574  }
575 
576  if (!adr.mask.layer) {
577  adr.mask.layer = true;
578  for (adr.layer = 1; adr.layer <= N_LAYERS; adr.layer++)
579  sum += GetEfficiencyHW(adr);
580  return sum / N_LAYERS;
581  }
582 
583  if (!adr.mask.cfeb) {
584  adr.mask.cfeb = true;
585  for (adr.cfeb = 1; adr.cfeb <= detector.NumberOfChamberCFEBs(adr.station, adr.ring); adr.cfeb++)
586  sum += GetEfficiencyHW(adr);
587  return sum / detector.NumberOfChamberCFEBs(adr.station, adr.ring);
588  }
589 
590  if (!adr.mask.hv) {
591  adr.mask.hv = true;
592  for (adr.hv = 1; adr.hv <= detector.NumberOfChamberHVs(adr.station, adr.ring); adr.hv++)
593  sum += GetEfficiencyHW(adr);
594  return sum / detector.NumberOfChamberHVs(adr.station, adr.ring);
595  }
596 
600  return 0.0;
601  return 1.0;
602  }
const HWStatusBitSet GetValue(Address adr) const
Get value of some address.
#define HWSTATUSANYERROR(s)
const double GetEfficiencyHW() const
Get efficiency of the whole detector.
#define N_LAYERS
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 NumberOfRings(const unsigned int station) const
Returns the number of rings for the given station.
#define N_STATIONS
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 N_SIDES
std::bitset< 14 > HWStatusBitSet
Hardware Status Bits structure used in Summary efficiency calculation and storage.
const unsigned int NumberOfChamberHVs(const unsigned int station, const unsigned int ring) const
Returns the number of HVs per Chamber on given Station/Ring.

◆ GetReportingArea()

const double cscdqm::Summary::GetReportingArea ( Address  adr) const
private

Calculate the reporting area for the address.

Parameters
adrAddress to calculate
Returns
Area in eta/phi space

NOT errorous!

Definition at line 645 of file CSCDQM_Summary.cc.

References cscdqm::Detector::Area(), cscdqm::AddressMask::cfeb, cscdqm::Address::cfeb, cscdqm::AddressMask::chamber, cscdqm::Address::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::AddressMask::side, cscdqm::Address::side, cscdqm::AddressMask::station, cscdqm::Address::station, and mps_update::status.

Referenced by GetEfficiencyArea().

645  {
646  double sum = 0.0;
647  if (!adr.mask.side) {
648  adr.mask.side = true;
649  for (adr.side = 1; adr.side <= N_SIDES; adr.side++)
650  sum += GetReportingArea(adr);
651  return sum;
652  }
653 
654  if (!adr.mask.station) {
655  adr.mask.station = true;
656  for (adr.station = 1; adr.station <= N_STATIONS; adr.station++)
657  sum += GetReportingArea(adr);
658  return sum;
659  }
660 
661  if (!adr.mask.ring) {
662  adr.mask.ring = true;
663  for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++)
664  sum += GetReportingArea(adr);
665  return sum;
666  }
667 
668  if (!adr.mask.chamber) {
669  adr.mask.chamber = true;
670  for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++)
671  sum += GetReportingArea(adr);
672  return sum;
673  }
674 
675  if (!adr.mask.cfeb) {
676  adr.mask.cfeb = true;
677  for (adr.cfeb = 1; adr.cfeb <= detector.NumberOfChamberCFEBs(adr.station, adr.ring); adr.cfeb++)
678  sum += GetReportingArea(adr);
679  return sum;
680  }
681 
682  if (!adr.mask.hv) {
683  adr.mask.hv = true;
684  for (adr.hv = 1; adr.hv <= detector.NumberOfChamberHVs(adr.station, adr.ring); adr.hv++)
685  sum += GetReportingArea(adr);
686  return sum;
687  }
688 
689  adr.mask.layer = false;
690 
693  if (!HWSTATUSANYERROR(status)) {
694  return detector.Area(adr);
695  }
696  return 0.0;
697  }
const HWStatusBitSet GetValue(Address adr) const
Get value of some address.
#define HWSTATUSANYERROR(s)
const float Area(const unsigned int station) const
Calculate station area in eta/phi space.
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 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.
#define N_STATIONS
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 N_SIDES
std::bitset< 14 > HWStatusBitSet
Hardware Status Bits structure used in Summary efficiency calculation and storage.
const unsigned int NumberOfChamberHVs(const unsigned int station, const unsigned int ring) const
Returns the number of HVs per Chamber on given Station/Ring.

◆ GetValue()

const HWStatusBitSet cscdqm::Summary::GetValue ( Address  adr) const

Get value of some address.

Parameters
adrAddress of atomic element to return value from
Returns
Value of the requested element

Definition at line 739 of file CSCDQM_Summary.cc.

References cscdqm::AddressMask::cfeb, cscdqm::Address::cfeb, cscdqm::AddressMask::chamber, cscdqm::Address::chamber, detector, cscdqm::AddressMask::hv, cscdqm::Address::hv, cscdqm::AddressMask::layer, cscdqm::Address::layer, map, 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::AddressMask::side, cscdqm::Address::side, cscdqm::AddressMask::station, and cscdqm::Address::station.

Referenced by GetEfficiencyHW(), GetReportingArea(), isChamberStandby(), IsPhysicsReady(), Write(), and WriteChamberState().

739  {
741  state.reset();
742 
743  if (!adr.mask.side) {
744  adr.mask.side = true;
745  for (adr.side = 1; adr.side <= N_SIDES; adr.side++)
746  state |= GetValue(adr);
747  return state;
748  }
749 
750  if (!adr.mask.station) {
751  adr.mask.station = true;
752  for (adr.station = 1; adr.station <= N_STATIONS; adr.station++)
753  state |= GetValue(adr);
754  return state;
755  }
756 
757  if (!adr.mask.ring) {
758  adr.mask.ring = true;
759  for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++)
760  state |= GetValue(adr);
761  return state;
762  }
763 
764  if (!adr.mask.chamber) {
765  adr.mask.chamber = true;
766  for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++)
767  state |= GetValue(adr);
768  return state;
769  }
770 
771  if (!adr.mask.layer) {
772  adr.mask.layer = true;
773  for (adr.layer = 1; adr.layer <= N_LAYERS; adr.layer++)
774  state |= GetValue(adr);
775  return state;
776  }
777 
778  if (!adr.mask.cfeb) {
779  adr.mask.cfeb = true;
780  for (adr.cfeb = 1; adr.cfeb <= detector.NumberOfChamberCFEBs(adr.station, adr.ring); adr.cfeb++)
781  state |= GetValue(adr);
782  return state;
783  }
784 
785  if (!adr.mask.hv) {
786  adr.mask.hv = true;
787  for (adr.hv = 1; adr.hv <= detector.NumberOfChamberHVs(adr.station, adr.ring); adr.hv++)
788  state |= GetValue(adr);
789  return state;
790  }
791 
792  return map[adr.side - 1][adr.station - 1][adr.ring - 1][adr.chamber - 1][adr.layer - 1][adr.cfeb - 1][adr.hv - 1];
793  }
const HWStatusBitSet GetValue(Address adr) const
Get value of some address.
#define N_LAYERS
HWStatusBitSet map[2][4][3][36][6][5][5]
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 NumberOfRings(const unsigned int station) const
Returns the number of rings for the given station.
#define N_STATIONS
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 N_SIDES
std::bitset< 14 > HWStatusBitSet
Hardware Status Bits structure used in Summary efficiency calculation and storage.
const unsigned int NumberOfChamberHVs(const unsigned int station, const unsigned int ring) const
Returns the number of HVs per Chamber on given Station/Ring.

◆ isChamberStandby() [1/2]

bool cscdqm::Summary::isChamberStandby ( unsigned int  side,
unsigned int  station,
unsigned int  ring,
unsigned int  chamber 
) const

Check if chamber is in standby?

Parameters
sideSide
stationStation
ringRing
chamberChamber
Returns
true if chamber is in standby, false - otherwise

Definition at line 707 of file CSCDQM_Summary.cc.

References cscdqm::AddressMask::cfeb, relativeConstraints::chamber, cscdqm::AddressMask::chamber, cscdqm::Address::chamber, GetValue(), cscdqm::AddressMask::hv, HWSTATUSANY, cscdqm::AddressMask::layer, cscdqm::Address::mask, relativeConstraints::ring, cscdqm::AddressMask::ring, cscdqm::Address::ring, cscdqm::AddressMask::side, cscdqm::Address::side, relativeConstraints::station, cscdqm::AddressMask::station, and cscdqm::Address::station.

Referenced by isChamberStandby(), and cscdqm::EventProcessor::processCSC().

710  {
711  Address adr;
712  bzero(&adr, sizeof(Address));
713  adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = true;
714  adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
715  adr.side = side;
716  adr.station = station;
717  adr.ring = ring;
718  adr.chamber = chamber;
719 
720  //std::cout << adr << " = " << HWSTATUSANY(GetValue(adr), 0x1000) << "\n";
721 
722  return HWSTATUSANY(GetValue(adr), 0x1000);
723  }
const HWStatusBitSet GetValue(Address adr) const
Get value of some address.
#define HWSTATUSANY(s, m)

◆ isChamberStandby() [2/2]

bool cscdqm::Summary::isChamberStandby ( CSCDetId  cid) const

Check if chamber is in standby?

Parameters
cidChamber identifier
Returns
true if chamber is in standby, false - otherwise

Definition at line 730 of file CSCDQM_Summary.cc.

References CSCDetId::chamber(), CSCDetId::endcap(), isChamberStandby(), CSCDetId::ring(), and CSCDetId::station().

730  {
731  return isChamberStandby(cid.endcap(), cid.station(), cid.ring(), cid.chamber());
732  }
int chamber() const
Definition: CSCDetId.h:62
bool isChamberStandby(unsigned int side, unsigned int station, unsigned int ring, unsigned int chamber) const
Check if chamber is in standby?
int station() const
Definition: CSCDetId.h:79
int endcap() const
Definition: CSCDetId.h:85
int ring() const
Definition: CSCDetId.h:68

◆ IsPhysicsReady()

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.

Parameters
pxpartition element index in x axis
pypartition element index in y axis
Returns
1 if this polygon is ok for physics and reporting, 0 - if it is ok but does not report, -1 - otherwise

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 473 of file CSCDQM_Summary.cc.

References cscdqm::AddressBox::adr, cscdqm::DATA, detector, GetValue(), HWSTATUSANYERROR, mps_fire::i, cscdqm::MASKED, N_STATIONS, cscdqm::Detector::NextAddressBoxByPartition(), multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, cscdqm::Address::station, mps_update::status, and ctpps_dqm_sourceclient-live_cfg::test.

Referenced by WriteMap().

473  {
474  AddressBox* box;
475 
477 
478  unsigned int i = 0;
479  while (detector.NextAddressBoxByPartition(i, px, py, box)) {
480  status[box->adr.station - 1] |= GetValue(box->adr);
481  }
482 
483  unsigned int cdata = 0, cerror = 0, cmask = 0;
484  for (unsigned int i = 0; i < N_STATIONS; i++) {
485  if (HWSTATUSANYERROR(status[i])) {
486  cerror++;
487  } else {
488  if (status[i].test(MASKED))
489  cmask++;
490  if (status[i].test(DATA))
491  cdata++;
492  }
493  }
494 
496  if (cdata > 1)
497  return 1;
499  if (cerror > 0)
500  return -1;
502  if (cmask > 0)
503  return 2;
505  return 0;
506  }
const HWStatusBitSet GetValue(Address adr) const
Get value of some address.
#define HWSTATUSANYERROR(s)
const bool NextAddressBoxByPartition(unsigned int &i, const unsigned int px, const unsigned int py, AddressBox *&box)
Address box iterator by partition.
Data available (reporting)
#define N_STATIONS
std::bitset< 14 > HWStatusBitSet
Hardware Status Bits structure used in Summary efficiency calculation and storage.

◆ ReadErrorChambers()

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.

Parameters
evsHistogram for number of events (total)
errHistogram for number of errors
bitError bit to set
eps_maxMaximum tolerance of errors (rate)
SfailSignificance threshold for failure report

Definition at line 197 of file CSCDQM_Summary.cc.

References ChamberCoordsToAddress(), cscdqm::Utility::checkError(), submitPVResolutionJobs::err, createfilelist::int, LOG_WARN, N, dqmiodumpmetadata::n, ReSetValue(), SetValue(), and x.

Referenced by cscdqm::EventProcessor::updateEfficiencyHistos().

198  {
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) {
202  Address adr;
203  bzero(&adr, sizeof(Address));
204  unsigned int N = 0, n = 0;
205 
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));
209  n = int(err->GetBinContent(x, y));
210  if (ChamberCoordsToAddress(x, y, adr)) {
211  if (Utility::checkError(N, n, eps_max, Sfail)) {
212  SetValue(adr, bit);
213  } else {
214  ReSetValue(adr, bit);
215  }
216  }
217  }
218  }
219  } else {
220  LOG_WARN << "cscdqm::Summary.ReadErrorChambers routine. Wrong histogram dimensions!";
221  }
222  }
const bool ChamberCoordsToAddress(const unsigned int x, const unsigned int y, Address &adr) const
Calculate Address from CSCChamberMap histogram coordinates.
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...
void ReSetValue(const HWStatusBit bit)
ReSetValue for the whole of detector.
void SetValue(const HWStatusBit bit, const int value=1)
SetValue for the whole of detector.
#define N
Definition: blowfish.cc:9
#define LOG_WARN
Definition: CSCDQM_Logger.h:41

◆ ReadReportingChambers()

void cscdqm::Summary::ReadReportingChambers ( const TH2 *&  h2,
const double  threshold = 1.0 
)

Read Reporting Chamber histogram and fill in detector map.

Parameters
h2Histogram to read
thresholdMin bin value to set HW element as reporting

Definition at line 61 of file CSCDQM_Summary.cc.

References ChamberCoordsToAddress(), cscdqm::DATA, LOG_WARN, ReSetValue(), SetValue(), remoteMonitoring_LASER_era2018_cfg::threshold, and x.

Referenced by cscdqm::EventProcessor::updateEfficiencyHistos().

61  {
62  if (h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >= 36 && h2->GetYaxis()->GetXmin() <= 1 &&
63  h2->GetYaxis()->GetXmax() >= 18) {
64  Address adr;
65  bzero(&adr, sizeof(Address));
66  double z = 0.0;
67 
68  for (unsigned int x = 1; x <= 36; x++) {
69  for (unsigned int y = 1; y <= 18; y++) {
70  z = h2->GetBinContent(x, y);
71  if (ChamberCoordsToAddress(x, y, adr)) {
72  if (z >= threshold) {
73  SetValue(adr, DATA);
74  } else {
75  ReSetValue(adr, DATA);
76  }
77  }
78  }
79  }
80  } else {
81  LOG_WARN << "cscdqm::Summary.ReadReportingChambers routine. Wrong histogram dimensions!";
82  }
83  }
const bool ChamberCoordsToAddress(const unsigned int x, const unsigned int y, Address &adr) const
Calculate Address from CSCChamberMap histogram coordinates.
void ReSetValue(const HWStatusBit bit)
ReSetValue for the whole of detector.
void SetValue(const HWStatusBit bit, const int value=1)
SetValue for the whole of detector.
#define LOG_WARN
Definition: CSCDQM_Logger.h:41

◆ ReadReportingChambersRef()

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.

Parameters
h2Histogram to read
refh2Reference histogram of hit occupancies
cold_coefMinimum tolerance of difference (rate) to set COLD (not reporting) HW element
cold_SfailSignificance threshold for COLD HW element
hot_coefMinimum tolerance of difference (rate) to set HOT HW element
hot_SfailSignificance threshold for HOT HW element

Rate Factor calculation
Reset some bits

Definition at line 95 of file CSCDQM_Summary.cc.

References ChamberCoordsToAddress(), cscdqm::Utility::checkOccupancy(), cscdqm::COLD, cscdqm::DATA, DQMScaleToClient_cfi::factor, cscdqm::HOT, createfilelist::int, LOG_WARN, N, dqmiodumpmetadata::n, EgammaValidation_cff::num, funct::pow(), ReSetValue(), SetValue(), and x.

Referenced by cscdqm::EventProcessor::updateEfficiencyHistos().

100  {
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);
110  if (Nij > 0) {
111  num += Nrefij;
112  denum += pow(Nrefij, 2.0) / Nij;
113  }
114  }
115  }
116  double factor = num / denum;
117 
118  Address adr;
119  bzero(&adr, sizeof(Address));
120  unsigned int N = 0, n = 0;
121 
122  for (unsigned int x = 1; x <= 36; x++) {
123  for (unsigned int y = 1; y <= 18; y++) {
124  N = int(refh2->GetBinContent(x, y) * factor);
125  n = int(h2->GetBinContent(x, y));
126 
127  if (ChamberCoordsToAddress(x, y, adr)) {
129  ReSetValue(adr, HOT);
130  ReSetValue(adr, COLD);
131 
132  if (n == 0) {
133  ReSetValue(adr, DATA);
134  } else {
135  SetValue(adr, DATA);
136  }
137 
138  switch (Utility::checkOccupancy(N, n, cold_coef, hot_coef, cold_Sfail, hot_Sfail)) {
139  case -1:
140  SetValue(adr, COLD);
141 
142  /*
143  std::cout << "adr = " << detector.AddressName(adr);
144  std::cout << ", x = " << x << ", y = " << y;
145  std::cout << ", value = " << GetValue(adr);
146  std::cout << ", refh2 = " << refh2->GetBinContent(x, y);
147  std::cout << ", factor = " << factor;
148  std::cout << ", N = " << N;
149  std::cout << ", n = " << n;
150  std::cout << ", num = " << num;
151  std::cout << ", denum = " << denum;
152  std::cout << ", rate = " << (N > 0 ? n / N : 0);
153  std::cout << ", cold_coef = " << cold_coef;
154  std::cout << ", = COLD";
155  std::cout << "\n";
156  */
157 
158  break;
159  case 1:
160  SetValue(adr, HOT);
161 
162  /*
163  std::cout << "adr = " << detector.AddressName(adr);
164  std::cout << ", x = " << x << ", y = " << y;
165  std::cout << ", value = " << GetValue(adr);
166  std::cout << ", refh2 = " << refh2->GetBinContent(x, y);
167  std::cout << ", factor = " << factor;
168  std::cout << ", N = " << N;
169  std::cout << ", n = " << n;
170  std::cout << ", num = " << num;
171  std::cout << ", denum = " << denum;
172  std::cout << ", rate = " << (N > 0 ? n / N : 0);
173  std::cout << ", hot_coef = " << hot_coef;
174  std::cout << ", = HOT";
175  std::cout << "\n";
176  */
177 
178  break;
179  };
180  }
181  }
182  }
183 
184  } else {
185  LOG_WARN << "cscdqm::Summary.ReadReportingChambersRef routine. Wrong histogram dimensions!";
186  }
187  }
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.
void ReSetValue(const HWStatusBit bit)
ReSetValue for the whole of detector.
HW element is hot by comparing with reference histogram.
void SetValue(const HWStatusBit bit, const int value=1)
SetValue for the whole of detector.
#define N
Definition: blowfish.cc:9
#define LOG_WARN
Definition: CSCDQM_Logger.h:41
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...
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ Reset()

void cscdqm::Summary::Reset ( )

Resets all detector map.

Setting Zeros (no data) for each HW element (and beyond)

Definition at line 36 of file CSCDQM_Summary.cc.

References cscdqm::AddressMask::cfeb, cscdqm::Address::cfeb, cscdqm::AddressMask::chamber, cscdqm::Address::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().

36  {
37  Address adr;
38  bzero(&adr, sizeof(Address));
39 
41  adr.mask.side = adr.mask.station = adr.mask.layer = false;
42  adr.mask.ring = adr.mask.chamber = adr.mask.cfeb = adr.mask.hv = true;
43  for (adr.ring = 1; adr.ring <= N_RINGS; adr.ring++) {
44  for (adr.chamber = 1; adr.chamber <= N_CHAMBERS; adr.chamber++) {
45  for (adr.cfeb = 1; adr.cfeb <= N_CFEBS; adr.cfeb++) {
46  for (adr.hv = 1; adr.hv <= N_HVS; adr.hv++) {
47  for (unsigned int bit = 0; bit < HWSTATUSBITSETSIZE; bit++) {
48  ReSetValue(adr, (HWStatusBit)bit);
49  }
50  }
51  }
52  }
53  }
54  }
#define N_CHAMBERS
HWStatusBit
Hardware Status Bit values used in Summary efficiency calculation.
#define N_CFEBS
void ReSetValue(const HWStatusBit bit)
ReSetValue for the whole of detector.
#define N_HVS
#define HWSTATUSBITSETSIZE
#define N_RINGS

◆ ReSetValue() [1/2]

void cscdqm::Summary::ReSetValue ( const HWStatusBit  bit)

ReSetValue for the whole of detector.

Parameters
bitStatus bit to set

Definition at line 379 of file CSCDQM_Summary.cc.

References SetValue().

Referenced by ReadErrorChambers(), ReadReportingChambers(), ReadReportingChambersRef(), and Reset().

379 { SetValue(bit, 0); }
void SetValue(const HWStatusBit bit, const int value=1)
SetValue for the whole of detector.

◆ ReSetValue() [2/2]

void cscdqm::Summary::ReSetValue ( const Address adr,
const HWStatusBit  bit 
)

ReSet value recursivelly by following the supplied address.

Parameters
adrAddress to be updated
bitStatus bit to set

Definition at line 386 of file CSCDQM_Summary.cc.

References SetValue().

386 { SetValue(adr, bit, 0); }
void SetValue(const HWStatusBit bit, const int value=1)
SetValue for the whole of detector.

◆ setMaskedHWElements()

const unsigned int cscdqm::Summary::setMaskedHWElements ( std::vector< std::string > &  tokens)

Read HW element masks (strings), create Address and apply to detector map.

Parameters
tokensVector of mask strings
Returns
number of read and applied masks

Definition at line 800 of file CSCDQM_Summary.cc.

References cscdqm::Detector::AddressFromString(), detector, cscdqm::MASKED, alignCSCRings::r, SetValue(), AlCaHLTBitMon_QueryRunRegistry::string, and unpackBuffers-CaloStage2::token.

Referenced by cscdqm::EventProcessor::maskHWElements().

800  {
801  unsigned int applied = 0;
802 
803  for (unsigned int r = 0; r < tokens.size(); r++) {
804  std::string token = (std::string)tokens.at(r);
805  Address adr;
806  if (detector.AddressFromString(token, adr)) {
807  SetValue(adr, MASKED);
808  applied++;
809  }
810  }
811  return applied;
812  }
Data available (reporting)
const bool AddressFromString(const std::string &str_address, Address &adr) const
Construct address from string.
void SetValue(const HWStatusBit bit, const int value=1)
SetValue for the whole of detector.

◆ SetValue() [1/2]

void cscdqm::Summary::SetValue ( const HWStatusBit  bit,
const int  value = 1 
)

SetValue for the whole of detector.

Parameters
bitStatus bit to set
valueValue to set

Definition at line 393 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().

393  {
394  Address adr;
395  bzero(&adr, sizeof(Address));
396  adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv =
397  false;
398  SetValue(adr, bit, value);
399  }
Definition: value.py:1
void SetValue(const HWStatusBit bit, const int value=1)
SetValue for the whole of detector.

◆ SetValue() [2/2]

void cscdqm::Summary::SetValue ( Address  adr,
const HWStatusBit  bit,
const int  value = 1 
)

Set value recursivelly by following the supplied address.

Parameters
adrAddress to be updated
bitStatus bit to set
valueValue to be set

Definition at line 407 of file CSCDQM_Summary.cc.

References cscdqm::AddressMask::cfeb, cscdqm::Address::cfeb, cscdqm::AddressMask::chamber, cscdqm::Address::chamber, detector, cscdqm::AddressMask::hv, cscdqm::Address::hv, cscdqm::AddressMask::layer, cscdqm::Address::layer, map, 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::AddressMask::side, cscdqm::Address::side, cscdqm::AddressMask::station, and cscdqm::Address::station.

407  {
408  if (!adr.mask.side) {
409  adr.mask.side = true;
410  for (adr.side = 1; adr.side <= N_SIDES; adr.side++)
411  SetValue(adr, bit, value);
412  return;
413  }
414 
415  if (!adr.mask.station) {
416  adr.mask.station = true;
417  for (adr.station = 1; adr.station <= N_STATIONS; adr.station++)
418  SetValue(adr, bit, value);
419  return;
420  }
421 
422  if (!adr.mask.ring) {
423  adr.mask.ring = true;
424  for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++)
425  SetValue(adr, bit, value);
426  return;
427  }
428 
429  if (!adr.mask.chamber) {
430  adr.mask.chamber = true;
431  for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++)
432  SetValue(adr, bit, value);
433  return;
434  }
435 
436  if (!adr.mask.layer) {
437  adr.mask.layer = true;
438  for (adr.layer = 1; adr.layer <= N_LAYERS; adr.layer++)
439  SetValue(adr, bit, value);
440  return;
441  }
442 
443  if (!adr.mask.cfeb) {
444  adr.mask.cfeb = true;
445  for (adr.cfeb = 1; adr.cfeb <= detector.NumberOfChamberCFEBs(adr.station, adr.ring); adr.cfeb++)
446  SetValue(adr, bit, value);
447  return;
448  }
449 
450  if (!adr.mask.hv) {
451  adr.mask.hv = true;
452  for (adr.hv = 1; adr.hv <= detector.NumberOfChamberHVs(adr.station, adr.ring); adr.hv++)
453  SetValue(adr, bit, value);
454  return;
455  }
456 
457  if (adr.side > 0 && adr.side <= N_SIDES && adr.station > 0 && adr.station <= N_STATIONS && adr.ring > 0 &&
458  adr.ring <= N_RINGS && adr.chamber > 0 && adr.chamber <= N_CHAMBERS && adr.layer > 0 && adr.layer <= N_LAYERS &&
459  adr.cfeb > 0 && adr.cfeb <= N_CFEBS && adr.hv > 0 && adr.hv <= N_HVS) {
460  map[adr.side - 1][adr.station - 1][adr.ring - 1][adr.chamber - 1][adr.layer - 1][adr.cfeb - 1][adr.hv - 1].set(
461  bit, value);
462  }
463  }
#define N_CHAMBERS
#define N_LAYERS
HWStatusBitSet map[2][4][3][36][6][5][5]
#define N_CFEBS
const unsigned int NumberOfChamberCFEBs(const unsigned int station, const unsigned int ring) const
Returns the number of CFEBs per Chamber on given Station/Ring.
Definition: value.py:1
const unsigned int NumberOfRings(const unsigned int station) const
Returns the number of rings for the given station.
#define N_STATIONS
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 N_HVS
void SetValue(const HWStatusBit bit, const int value=1)
SetValue for the whole of detector.
#define N_SIDES
#define N_RINGS
const unsigned int NumberOfChamberHVs(const unsigned int station, const unsigned int ring) const
Returns the number of HVs per Chamber on given Station/Ring.

◆ Write()

void cscdqm::Summary::Write ( TH2 *&  h2,
const unsigned int  station 
) const

Write detector map to H1 histogram (linear data) for the selected adr.station.

Parameters
h2Histogram to write data to
stationstation number (1-4) to write data for

Definition at line 229 of file CSCDQM_Summary.cc.

References cscdqm::AddressBox::adr, cscdqm::AddressMask::cfeb, cscdqm::Address::cfeb, cscdqm::AddressMask::chamber, cscdqm::Address::chamber, cscdqm::DATA, detector, GetValue(), cscdqm::AddressMask::hv, cscdqm::Address::hv, HWSTATUSANYERROR, mps_fire::i, cscdqm::AddressMask::layer, cscdqm::Address::mask, cscdqm::MASKED, N_STATIONS, cscdqm::Detector::NextAddressBox(), cscdqm::AddressMask::ring, cscdqm::Address::ring, cscdqm::AddressMask::side, cscdqm::Address::side, relativeConstraints::station, cscdqm::AddressMask::station, cscdqm::Address::station, mps_update::status, runGCPTkAlMap::title, x, cscdqm::AddressBox::xmax, cscdqm::AddressBox::xmin, cscdqm::AddressBox::ymax, and cscdqm::AddressBox::ymin.

Referenced by cscdqm::EventProcessor::updateEfficiencyHistos().

229  {
230  const AddressBox* box;
231  Address adr, tadr;
232  bzero(&adr, sizeof(Address));
233  bzero(&tadr, sizeof(Address));
234  float area_all = 0.0, area_rep = 0.0;
235 
236  if (station < 1 || station > N_STATIONS)
237  return;
238 
239  adr.mask.side = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
240  adr.mask.station = true;
241  adr.station = station;
242 
243  unsigned int i = 0;
244 
245  while (detector.NextAddressBox(i, box, adr)) {
246  unsigned int x = 1 + (box->adr.side - 1) * 9 + (box->adr.ring - 1) * 3 + (box->adr.hv - 1);
247  unsigned int y = 1 + (box->adr.chamber - 1) * 5 + (box->adr.cfeb - 1);
248 
249  tadr = box->adr;
251 
252  float area_box = fabs((box->xmax - box->xmin) * (box->ymax - box->ymin));
253 
254  if (status.test(MASKED)) {
255  h2->SetBinContent(x, y, 2.0);
256  } else {
257  area_all += area_box;
258  if (HWSTATUSANYERROR(status)) {
259  h2->SetBinContent(x, y, -1.0);
260  } else {
261  area_rep += area_box;
262  if (status.test(DATA)) {
263  h2->SetBinContent(x, y, 1.0);
264  } else {
265  h2->SetBinContent(x, y, 0.0);
266  }
267  }
268  }
269  }
270 
271  TString title = Form("ME%d Status: Physics Efficiency %.2f%%", station, (area_rep / area_all) * 100.0);
272  h2->SetTitle(title);
273  }
const bool NextAddressBox(unsigned int &i, const AddressBox *&box, const Address &mask) const
Address box iterator by mask.
const HWStatusBitSet GetValue(Address adr) const
Get value of some address.
#define HWSTATUSANYERROR(s)
Data available (reporting)
#define N_STATIONS
std::bitset< 14 > HWStatusBitSet
Hardware Status Bits structure used in Summary efficiency calculation and storage.

◆ WriteChamberState()

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.

Parameters
h2histogram to write to
maskmask of errors to check while writing
valueto write to if state fits mask
resetshould all chamber states be reseted to 0 prior writing?
op_anyShould chamber be marked as errorous on any bit in mask? false - for all.

Definition at line 339 of file CSCDQM_Summary.cc.

References cscdqm::AddressMask::cfeb, cscdqm::AddressMask::chamber, cscdqm::Address::chamber, ChamberAddressToCoords(), detector, GetValue(), cscdqm::AddressMask::hv, HWSTATUSANY, HWSTATUSEQUALS, cscdqm::AddressMask::layer, LOG_WARN, gpuClustering::pixelStatus::mask, cscdqm::Address::mask, N_SIDES, N_STATIONS, cscdqm::Detector::NumberOfChambers(), cscdqm::Detector::NumberOfRings(), reset(), cscdqm::AddressMask::ring, cscdqm::Address::ring, cscdqm::AddressMask::side, cscdqm::Address::side, cscdqm::AddressMask::station, cscdqm::Address::station, and x.

Referenced by cscdqm::EventProcessor::standbyEfficiencyHistos(), and cscdqm::EventProcessor::writeShifterHistograms().

339  {
340  if (h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >= 36 && h2->GetYaxis()->GetXmin() <= 1 &&
341  h2->GetYaxis()->GetXmax() >= 18) {
342  unsigned int x, y;
343  Address adr;
344  bzero(&adr, sizeof(Address));
345 
346  adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = true;
347  adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
348 
349  for (adr.side = 1; adr.side <= N_SIDES; adr.side++) {
350  for (adr.station = 1; adr.station <= N_STATIONS; adr.station++) {
351  for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++) {
352  for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++) {
353  if (ChamberAddressToCoords(adr, x, y)) {
354  HWStatusBitSet hwValue = GetValue(adr);
355  bool hit = (op_any ? HWSTATUSANY(hwValue, mask) : HWSTATUSEQUALS(hwValue, mask));
356 
357  // std::cout << "x = " << x << ", y = " << y << ", value = " << GetValue(adr) << std::endl;
358  // std::cout << "adr = " << detector.AddressName(adr) << ", x = " << x << ", y = " << y << ", value = " << GetValue(adr) << std::endl;
359  if (hit) {
360  h2->SetBinContent(x, y, 1.0 * value);
361  } else if (reset) {
362  h2->SetBinContent(x, y, 0.0);
363  }
364  }
365  }
366  }
367  }
368  }
369 
370  } else {
371  LOG_WARN << "cscdqm::Summary.WriteChamberState routine. Wrong histogram dimensions!";
372  }
373  }
const HWStatusBitSet GetValue(Address adr) const
Get value of some address.
#define HWSTATUSANY(s, m)
#define HWSTATUSEQUALS(s, m)
constexpr uint32_t mask
Definition: gpuClustering.h:24
Definition: value.py:1
const unsigned int NumberOfRings(const unsigned int station) const
Returns the number of rings for the given station.
#define N_STATIONS
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 N_SIDES
#define LOG_WARN
Definition: CSCDQM_Logger.h:41
std::bitset< 14 > HWStatusBitSet
Hardware Status Bits structure used in Summary efficiency calculation and storage.
const bool ChamberAddressToCoords(const Address &adr, unsigned int &x, unsigned int &y) const
Calculate CSCChamberMap histogram coordinates from Address.
void reset(double vett[256])
Definition: TPedValues.cc:11

◆ WriteMap()

void cscdqm::Summary::WriteMap ( TH2 *&  h2)

Write PhysicsReady Map to H2 histogram.

Parameters
h2Histogram to write map to

Definition at line 279 of file CSCDQM_Summary.cc.

References IsPhysicsReady(), LOG_WARN, NTICS, runGCPTkAlMap::title, x, TrackerOfflineValidation_Dqm_cff::xmax, and TrackerOfflineValidation_Dqm_cff::xmin.

Referenced by cscdqm::EventProcessor::updateEfficiencyHistos().

279  {
280  unsigned int rep_el = 0, csc_el = 0;
281 
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;
285 
286  float xmin, xmax;
287 
288  for (unsigned int x = 0; x < NTICS; x++) {
289  xmin = -2.5 + xd * x;
290  xmax = xmin + xd;
291 
292  for (unsigned int y = 0; y < NTICS; y++) {
293  double value = 0.0;
294 
295  if (xmin == -2.5 || xmax == 2.5)
296  continue;
297  if (xmin >= -1 && xmax <= 1)
298  continue;
299 
300  switch (IsPhysicsReady(x, y)) {
301  case -1:
302  value = -1.0;
303  break;
304  case 0:
305  value = 0.0;
306  rep_el++;
307  break;
308  case 1:
309  value = 1.0;
310  rep_el++;
311  break;
312  case 2:
313  value = 2.0;
314  rep_el++;
315  }
316 
317  h2->SetBinContent(x + 1, y + 1, value);
318  csc_el++;
319  }
320  }
321 
322  } else {
323  LOG_WARN << "cscdqm::Summary.WriteMap routine. Wrong histogram dimensions!";
324  }
325 
326  TString title =
327  Form("EMU Status: Physics Efficiency %.2f%%", (csc_el == 0 ? 0.0 : (1.0 * rep_el) / csc_el) * 100.0);
328  h2->SetTitle(title);
329  }
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: value.py:1
#define NTICS
#define LOG_WARN
Definition: CSCDQM_Logger.h:41

Member Data Documentation

◆ detector

Detector cscdqm::Summary::detector
private

◆ map

HWStatusBitSet cscdqm::Summary::map[2][4][3][36][6][5][5]
private