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

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.
cscdqm::Summary::~Summary ( )

Destructor.

Definition at line 31 of file CSCDQM_Summary.cc.

31 {}

Member Function Documentation

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 862 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, and cscdqm::Address::station.

Referenced by getDetector(), and WriteChamberState().

862  {
863  if (!adr.mask.side || !adr.mask.station || !adr.mask.ring || !adr.mask.chamber)
864  return false;
865 
866  x = adr.chamber;
867  y = 0;
868 
869  if (adr.side == 1) {
870  switch (adr.station) {
871  case 1:
872  y = 10;
873  if (adr.ring == 2)
874  y = 11;
875  if (adr.ring == 3)
876  y = 12;
877  break;
878  case 2:
879  y = 13;
880  if (adr.ring == 2)
881  y = 14;
882  break;
883  case 3:
884  y = 15;
885  if (adr.ring == 2)
886  y = 16;
887  break;
888  case 4:
889  y = 17;
890  if (adr.ring == 2)
891  y = 18;
892  break;
893  }
894  } else if (adr.side == 2) {
895  switch (adr.station) {
896  case 1:
897  y = 7;
898  if (adr.ring == 2)
899  y = 8;
900  if (adr.ring == 1)
901  y = 9;
902  break;
903  case 2:
904  y = 5;
905  if (adr.ring == 1)
906  y = 6;
907  break;
908  case 3:
909  y = 3;
910  if (adr.ring == 1)
911  y = 4;
912  break;
913  case 4:
914  y = 1;
915  if (adr.ring == 1)
916  y = 2;
917  break;
918  }
919  }
920 
921  return true;
922  }
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 809 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, and cscdqm::Address::station.

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

809  {
810  if (x < 1 || x > 36 || y < 1 || y > 18)
811  return false;
812 
813  adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = true;
814  adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
815 
816  if (y < 10)
817  adr.side = 2;
818  else
819  adr.side = 1;
820 
821  adr.chamber = x;
822 
823  if (y == 1 || y == 18) {
824  adr.station = 4;
825  adr.ring = 2;
826  } else if (y == 2 || y == 17) {
827  adr.station = 4;
828  adr.ring = 1;
829  } else if (y == 3 || y == 16) {
830  adr.station = 3;
831  adr.ring = 2;
832  } else if (y == 4 || y == 15) {
833  adr.station = 3;
834  adr.ring = 1;
835  } else if (y == 5 || y == 14) {
836  adr.station = 2;
837  adr.ring = 2;
838  } else if (y == 6 || y == 13) {
839  adr.station = 2;
840  adr.ring = 1;
841  } else if (y == 7 || y == 12) {
842  adr.station = 1;
843  adr.ring = 3;
844  } else if (y == 8 || y == 11) {
845  adr.station = 1;
846  adr.ring = 2;
847  } else if (y == 9 || y == 10) {
848  adr.station = 1;
849  adr.ring = 1;
850  }
851 
852  return true;
853  }
const Detector cscdqm::Summary::getDetector ( ) const
inline
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 599 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, and cscdqm::Address::station.

Referenced by getDetector().

599  {
600  if (station <= 0 || station > N_STATIONS)
601  return 0.0;
602 
603  Address adr;
604  adr.mask.side = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
605  adr.station = true;
606  adr.station = station;
607 
608  return GetEfficiencyArea(adr);
609  }
const double GetEfficiencyArea(const unsigned int station) const
Get Efficiency area for the station.
#define N_STATIONS
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 616 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.

616  {
617  double all_area = 1;
618 
619  if (adr.mask.side == false && adr.mask.ring == false && adr.mask.chamber == false && adr.mask.layer == false &&
620  adr.mask.cfeb == false && adr.mask.hv == false && adr.mask.station == true)
621  all_area = detector.Area(adr.station);
622  else
623  all_area = detector.Area(adr);
624 
625  double rep_area = GetReportingArea(adr);
626  return rep_area / all_area;
627  }
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.
const double cscdqm::Summary::GetEfficiencyHW ( ) const

Get efficiency of the whole detector.

Returns
Detector efficiency rate (0..1)

Definition at line 504 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 getDetector(), GetEfficiencyHW(), and cscdqm::EventProcessor::updateEfficiencyHistos().

504  {
505  Address adr;
506  adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv =
507  false;
508  return GetEfficiencyHW(adr);
509  }
const double GetEfficiencyHW() const
Get efficiency of the whole detector.
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 516 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.

516  {
517  Address adr;
518  adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv =
519  false;
520 
521  if (station > 0 && station <= N_STATIONS) {
522  adr.mask.station = true;
523  adr.station = station;
524  } else {
525  return 0.0;
526  }
527 
528  return GetEfficiencyHW(adr);
529  }
const double GetEfficiencyHW() const
Get efficiency of the whole detector.
#define N_STATIONS
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 536 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.

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

634  {
635  double sum = 0.0;
636  if (!adr.mask.side) {
637  adr.mask.side = true;
638  for (adr.side = 1; adr.side <= N_SIDES; adr.side++)
639  sum += GetReportingArea(adr);
640  return sum;
641  }
642 
643  if (!adr.mask.station) {
644  adr.mask.station = true;
645  for (adr.station = 1; adr.station <= N_STATIONS; adr.station++)
646  sum += GetReportingArea(adr);
647  return sum;
648  }
649 
650  if (!adr.mask.ring) {
651  adr.mask.ring = true;
652  for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++)
653  sum += GetReportingArea(adr);
654  return sum;
655  }
656 
657  if (!adr.mask.chamber) {
658  adr.mask.chamber = true;
659  for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++)
660  sum += GetReportingArea(adr);
661  return sum;
662  }
663 
664  if (!adr.mask.cfeb) {
665  adr.mask.cfeb = true;
666  for (adr.cfeb = 1; adr.cfeb <= detector.NumberOfChamberCFEBs(adr.station, adr.ring); adr.cfeb++)
667  sum += GetReportingArea(adr);
668  return sum;
669  }
670 
671  if (!adr.mask.hv) {
672  adr.mask.hv = true;
673  for (adr.hv = 1; adr.hv <= detector.NumberOfChamberHVs(adr.station, adr.ring); adr.hv++)
674  sum += GetReportingArea(adr);
675  return sum;
676  }
677 
678  adr.mask.layer = false;
679 
682  if (!HWSTATUSANYERROR(status)) {
683  return detector.Area(adr);
684  }
685  return 0.0;
686  }
#define HWSTATUSANYERROR(s)
const float Area(const unsigned int station) const
Calculate station area in eta/phi space.
const HWStatusBitSet GetValue(Address adr) const
Get value of some address.
const unsigned int NumberOfRings(const unsigned int station) const
Returns the number of rings for the given station.
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.
#define N_STATIONS
#define N_SIDES
const double GetReportingArea(Address adr) const
Calculate the reporting area for the address.
std::bitset< 14 > HWStatusBitSet
Hardware Status Bits structure used in Summary efficiency calculation and storage.
const unsigned int NumberOfChambers(const unsigned int station, const unsigned int ring) const
Returns the number of chambers for the given station and ring.
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 727 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 getDetector(), GetEfficiencyHW(), GetReportingArea(), isChamberStandby(), IsPhysicsReady(), Write(), and WriteChamberState().

727  {
728  HWStatusBitSet state;
729  state.reset();
730 
731  if (!adr.mask.side) {
732  adr.mask.side = true;
733  for (adr.side = 1; adr.side <= N_SIDES; adr.side++)
734  state |= GetValue(adr);
735  return state;
736  }
737 
738  if (!adr.mask.station) {
739  adr.mask.station = true;
740  for (adr.station = 1; adr.station <= N_STATIONS; adr.station++)
741  state |= GetValue(adr);
742  return state;
743  }
744 
745  if (!adr.mask.ring) {
746  adr.mask.ring = true;
747  for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++)
748  state |= GetValue(adr);
749  return state;
750  }
751 
752  if (!adr.mask.chamber) {
753  adr.mask.chamber = true;
754  for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++)
755  state |= GetValue(adr);
756  return state;
757  }
758 
759  if (!adr.mask.layer) {
760  adr.mask.layer = true;
761  for (adr.layer = 1; adr.layer <= N_LAYERS; adr.layer++)
762  state |= GetValue(adr);
763  return state;
764  }
765 
766  if (!adr.mask.cfeb) {
767  adr.mask.cfeb = true;
768  for (adr.cfeb = 1; adr.cfeb <= detector.NumberOfChamberCFEBs(adr.station, adr.ring); adr.cfeb++)
769  state |= GetValue(adr);
770  return state;
771  }
772 
773  if (!adr.mask.hv) {
774  adr.mask.hv = true;
775  for (adr.hv = 1; adr.hv <= detector.NumberOfChamberHVs(adr.station, adr.ring); adr.hv++)
776  state |= GetValue(adr);
777  return state;
778  }
779 
780  return map[adr.side - 1][adr.station - 1][adr.ring - 1][adr.chamber - 1][adr.layer - 1][adr.cfeb - 1][adr.hv - 1];
781  }
const HWStatusBitSet GetValue(Address adr) const
Get value of some address.
#define N_LAYERS
const unsigned int NumberOfRings(const unsigned int station) const
Returns the number of rings for the given station.
HWStatusBitSet map[2][4][3][36][6][5][5]
const 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.
#define N_STATIONS
#define N_SIDES
std::bitset< 14 > HWStatusBitSet
Hardware Status Bits structure used in Summary efficiency calculation and storage.
const unsigned int NumberOfChambers(const unsigned int station, const unsigned int ring) const
Returns the number of chambers for the given station and ring.
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 696 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 getDetector(), isChamberStandby(), and cscdqm::EventProcessor::processCSC().

699  {
700  Address adr;
701  adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = true;
702  adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
703  adr.side = side;
704  adr.station = station;
705  adr.ring = ring;
706  adr.chamber = chamber;
707 
708  //std::cout << adr << " = " << HWSTATUSANY(GetValue(adr), 0x1000) << "\n";
709 
710  return HWSTATUSANY(GetValue(adr), 0x1000);
711  }
const HWStatusBitSet GetValue(Address adr) const
Get value of some address.
#define HWSTATUSANY(s, m)
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 718 of file CSCDQM_Summary.cc.

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

718  {
719  return isChamberStandby(cid.endcap(), cid.station(), cid.ring(), cid.chamber());
720  }
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 endcap() const
Definition: CSCDetId.h:85
int ring() const
Definition: CSCDetId.h:68
int station() const
Definition: CSCDetId.h:79
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 465 of file CSCDQM_Summary.cc.

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

Referenced by getDetector(), and WriteMap().

465  {
466  AddressBox* box;
467 
469 
470  unsigned int i = 0;
471  while (detector.NextAddressBoxByPartition(i, px, py, box)) {
472  status[box->adr.station - 1] |= GetValue(box->adr);
473  }
474 
475  unsigned int cdata = 0, cerror = 0, cmask = 0;
476  for (unsigned int i = 0; i < N_STATIONS; i++) {
477  if (HWSTATUSANYERROR(status[i])) {
478  cerror++;
479  } else {
480  if (status[i].test(MASKED))
481  cmask++;
482  if (status[i].test(DATA))
483  cdata++;
484  }
485  }
486 
488  if (cdata > 1)
489  return 1;
491  if (cerror > 0)
492  return -1;
494  if (cmask > 0)
495  return 2;
497  return 0;
498  }
#define HWSTATUSANYERROR(s)
const HWStatusBitSet GetValue(Address adr) const
Get value of some address.
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.
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 194 of file CSCDQM_Summary.cc.

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

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

195  {
196  if (evs->GetXaxis()->GetXmin() <= 1 && evs->GetXaxis()->GetXmax() >= 36 && evs->GetYaxis()->GetXmin() <= 1 &&
197  evs->GetYaxis()->GetXmax() >= 18 && err->GetXaxis()->GetXmin() <= 1 && err->GetXaxis()->GetXmax() >= 36 &&
198  err->GetYaxis()->GetXmin() <= 1 && err->GetYaxis()->GetXmax() >= 18) {
199  Address adr;
200  unsigned int N = 0, n = 0;
201 
202  for (unsigned int x = 1; x <= 36; x++) {
203  for (unsigned int y = 1; y <= 18; y++) {
204  N = int(evs->GetBinContent(x, y));
205  n = int(err->GetBinContent(x, y));
206  if (ChamberCoordsToAddress(x, y, adr)) {
207  if (Utility::checkError(N, n, eps_max, Sfail)) {
208  SetValue(adr, bit);
209  } else {
210  ReSetValue(adr, bit);
211  }
212  }
213  }
214  }
215  } else {
216  LOG_WARN << "cscdqm::Summary.ReadErrorChambers routine. Wrong histogram dimensions!";
217  }
218  }
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
const bool ChamberCoordsToAddress(const unsigned int x, const unsigned int y, Address &adr) const
Calculate Address from CSCChamberMap histogram coordinates.
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 60 of file CSCDQM_Summary.cc.

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

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

60  {
61  if (h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >= 36 && h2->GetYaxis()->GetXmin() <= 1 &&
62  h2->GetYaxis()->GetXmax() >= 18) {
63  Address adr;
64  double z = 0.0;
65 
66  for (unsigned int x = 1; x <= 36; x++) {
67  for (unsigned int y = 1; y <= 18; y++) {
68  z = h2->GetBinContent(x, y);
69  if (ChamberCoordsToAddress(x, y, adr)) {
70  if (z >= threshold) {
71  SetValue(adr, DATA);
72  } else {
73  ReSetValue(adr, DATA);
74  }
75  }
76  }
77  }
78  } else {
79  LOG_WARN << "cscdqm::Summary.ReadReportingChambers routine. Wrong histogram dimensions!";
80  }
81  }
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
const bool ChamberCoordsToAddress(const unsigned int x, const unsigned int y, Address &adr) const
Calculate Address from CSCChamberMap histogram coordinates.
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 93 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(), and SetValue().

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

98  {
99  if (h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >= 36 && h2->GetYaxis()->GetXmin() <= 1 &&
100  h2->GetYaxis()->GetXmax() >= 18 && refh2->GetXaxis()->GetXmin() <= 1 && refh2->GetXaxis()->GetXmax() >= 36 &&
101  refh2->GetYaxis()->GetXmin() <= 1 && refh2->GetYaxis()->GetXmax() >= 18) {
103  double num = 1.0, denum = 1.0;
104  for (unsigned int x = 1; x <= 36; x++) {
105  for (unsigned int y = 1; y <= 18; y++) {
106  double Nij = h2->GetBinContent(x, y);
107  double Nrefij = refh2->GetBinContent(x, y);
108  if (Nij > 0) {
109  num += Nrefij;
110  denum += pow(Nrefij, 2.0) / Nij;
111  }
112  }
113  }
114  double factor = num / denum;
115 
116  Address adr;
117  unsigned int N = 0, n = 0;
118 
119  for (unsigned int x = 1; x <= 36; x++) {
120  for (unsigned int y = 1; y <= 18; y++) {
121  N = int(refh2->GetBinContent(x, y) * factor);
122  n = int(h2->GetBinContent(x, y));
123 
124  if (ChamberCoordsToAddress(x, y, adr)) {
126  ReSetValue(adr, HOT);
127  ReSetValue(adr, COLD);
128 
129  if (n == 0) {
130  ReSetValue(adr, DATA);
131  } else {
132  SetValue(adr, DATA);
133  }
134 
135  switch (Utility::checkOccupancy(N, n, cold_coef, hot_coef, cold_Sfail, hot_Sfail)) {
136  case -1:
137  SetValue(adr, COLD);
138 
139  /*
140  std::cout << "adr = " << detector.AddressName(adr);
141  std::cout << ", x = " << x << ", y = " << y;
142  std::cout << ", value = " << GetValue(adr);
143  std::cout << ", refh2 = " << refh2->GetBinContent(x, y);
144  std::cout << ", factor = " << factor;
145  std::cout << ", N = " << N;
146  std::cout << ", n = " << n;
147  std::cout << ", num = " << num;
148  std::cout << ", denum = " << denum;
149  std::cout << ", rate = " << (N > 0 ? n / N : 0);
150  std::cout << ", cold_coef = " << cold_coef;
151  std::cout << ", = COLD";
152  std::cout << "\n";
153  */
154 
155  break;
156  case 1:
157  SetValue(adr, HOT);
158 
159  /*
160  std::cout << "adr = " << detector.AddressName(adr);
161  std::cout << ", x = " << x << ", y = " << y;
162  std::cout << ", value = " << GetValue(adr);
163  std::cout << ", refh2 = " << refh2->GetBinContent(x, y);
164  std::cout << ", factor = " << factor;
165  std::cout << ", N = " << N;
166  std::cout << ", n = " << n;
167  std::cout << ", num = " << num;
168  std::cout << ", denum = " << denum;
169  std::cout << ", rate = " << (N > 0 ? n / N : 0);
170  std::cout << ", hot_coef = " << hot_coef;
171  std::cout << ", = HOT";
172  std::cout << "\n";
173  */
174 
175  break;
176  };
177  }
178  }
179  }
180 
181  } else {
182  LOG_WARN << "cscdqm::Summary.ReadReportingChambersRef routine. Wrong histogram dimensions!";
183  }
184  }
HW element was masked out (not in readout)
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...
const bool ChamberCoordsToAddress(const unsigned int x, const unsigned int y, Address &adr) const
Calculate Address from CSCChamberMap histogram coordinates.
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
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 
40  adr.mask.side = adr.mask.station = adr.mask.layer = false;
41  adr.mask.ring = adr.mask.chamber = adr.mask.cfeb = adr.mask.hv = true;
42  for (adr.ring = 1; adr.ring <= N_RINGS; adr.ring++) {
43  for (adr.chamber = 1; adr.chamber <= N_CHAMBERS; adr.chamber++) {
44  for (adr.cfeb = 1; adr.cfeb <= N_CFEBS; adr.cfeb++) {
45  for (adr.hv = 1; adr.hv <= N_HVS; adr.hv++) {
46  for (unsigned int bit = 0; bit < HWSTATUSBITSETSIZE; bit++) {
47  ReSetValue(adr, (HWStatusBit)bit);
48  }
49  }
50  }
51  }
52  }
53  }
#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
void cscdqm::Summary::ReSetValue ( const HWStatusBit  bit)

ReSetValue for the whole of detector.

Parameters
bitStatus bit to set

Definition at line 372 of file CSCDQM_Summary.cc.

References SetValue().

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

372 { SetValue(bit, 0); }
void SetValue(const HWStatusBit bit, const int value=1)
SetValue for the whole of detector.
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 379 of file CSCDQM_Summary.cc.

References SetValue().

379 { SetValue(adr, bit, 0); }
void SetValue(const HWStatusBit bit, const int value=1)
SetValue for the whole of detector.
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 788 of file CSCDQM_Summary.cc.

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

Referenced by getDetector(), and cscdqm::EventProcessor::maskHWElements().

788  {
789  unsigned int applied = 0;
790 
791  for (unsigned int r = 0; r < tokens.size(); r++) {
792  std::string token = (std::string)tokens.at(r);
793  Address adr;
794  if (detector.AddressFromString(token, adr)) {
795  SetValue(adr, MASKED);
796  applied++;
797  }
798  }
799  return applied;
800  }
const bool AddressFromString(const std::string &str_address, Address &adr) const
Construct address from string.
Data available (reporting)
void SetValue(const HWStatusBit bit, const int value=1)
SetValue for the whole of detector.
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 386 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 getDetector(), ReadErrorChambers(), ReadReportingChambers(), ReadReportingChambersRef(), ReSetValue(), setMaskedHWElements(), SetValue(), and cscdqm::EventProcessor::standbyEfficiencyHistos().

386  {
387  Address adr;
388  adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv =
389  false;
390  SetValue(adr, bit, value);
391  }
Definition: value.py:1
void SetValue(const HWStatusBit bit, const int value=1)
SetValue for the whole of detector.
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 399 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.

399  {
400  if (!adr.mask.side) {
401  adr.mask.side = true;
402  for (adr.side = 1; adr.side <= N_SIDES; adr.side++)
403  SetValue(adr, bit, value);
404  return;
405  }
406 
407  if (!adr.mask.station) {
408  adr.mask.station = true;
409  for (adr.station = 1; adr.station <= N_STATIONS; adr.station++)
410  SetValue(adr, bit, value);
411  return;
412  }
413 
414  if (!adr.mask.ring) {
415  adr.mask.ring = true;
416  for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++)
417  SetValue(adr, bit, value);
418  return;
419  }
420 
421  if (!adr.mask.chamber) {
422  adr.mask.chamber = true;
423  for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++)
424  SetValue(adr, bit, value);
425  return;
426  }
427 
428  if (!adr.mask.layer) {
429  adr.mask.layer = true;
430  for (adr.layer = 1; adr.layer <= N_LAYERS; adr.layer++)
431  SetValue(adr, bit, value);
432  return;
433  }
434 
435  if (!adr.mask.cfeb) {
436  adr.mask.cfeb = true;
437  for (adr.cfeb = 1; adr.cfeb <= detector.NumberOfChamberCFEBs(adr.station, adr.ring); adr.cfeb++)
438  SetValue(adr, bit, value);
439  return;
440  }
441 
442  if (!adr.mask.hv) {
443  adr.mask.hv = true;
444  for (adr.hv = 1; adr.hv <= detector.NumberOfChamberHVs(adr.station, adr.ring); adr.hv++)
445  SetValue(adr, bit, value);
446  return;
447  }
448 
449  if (adr.side > 0 && adr.side <= N_SIDES && adr.station > 0 && adr.station <= N_STATIONS && adr.ring > 0 &&
450  adr.ring <= N_RINGS && adr.chamber > 0 && adr.chamber <= N_CHAMBERS && adr.layer > 0 && adr.layer <= N_LAYERS &&
451  adr.cfeb > 0 && adr.cfeb <= N_CFEBS && adr.hv > 0 && adr.hv <= N_HVS) {
452  map[adr.side - 1][adr.station - 1][adr.ring - 1][adr.chamber - 1][adr.layer - 1][adr.cfeb - 1][adr.hv - 1].set(
453  bit, value);
454  }
455  }
#define N_CHAMBERS
#define N_LAYERS
const unsigned int NumberOfRings(const unsigned int station) const
Returns the number of rings for the given station.
HWStatusBitSet map[2][4][3][36][6][5][5]
const 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.
#define N_CFEBS
Definition: value.py:1
#define N_STATIONS
#define N_HVS
void SetValue(const HWStatusBit bit, const int value=1)
SetValue for the whole of detector.
#define N_SIDES
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_RINGS
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 225 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, overlapproblemtsosanalyzer_cfi::title, cscdqm::AddressBox::xmax, cscdqm::AddressBox::xmin, cscdqm::AddressBox::ymax, and cscdqm::AddressBox::ymin.

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

225  {
226  const AddressBox* box;
227  Address adr, tadr;
228  float area_all = 0.0, area_rep = 0.0;
229 
230  if (station < 1 || station > N_STATIONS)
231  return;
232 
233  adr.mask.side = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
234  adr.mask.station = true;
235  adr.station = station;
236 
237  unsigned int i = 0;
238 
239  while (detector.NextAddressBox(i, box, adr)) {
240  unsigned int x = 1 + (box->adr.side - 1) * 9 + (box->adr.ring - 1) * 3 + (box->adr.hv - 1);
241  unsigned int y = 1 + (box->adr.chamber - 1) * 5 + (box->adr.cfeb - 1);
242 
243  tadr = box->adr;
245 
246  float area_box = fabs((box->xmax - box->xmin) * (box->ymax - box->ymin));
247 
248  if (status.test(MASKED)) {
249  h2->SetBinContent(x, y, 2.0);
250  } else {
251  area_all += area_box;
252  if (HWSTATUSANYERROR(status)) {
253  h2->SetBinContent(x, y, -1.0);
254  } else {
255  area_rep += area_box;
256  if (status.test(DATA)) {
257  h2->SetBinContent(x, y, 1.0);
258  } else {
259  h2->SetBinContent(x, y, 0.0);
260  }
261  }
262  }
263  }
264 
265  TString title = Form("ME%d Status: Physics Efficiency %.2f%%", station, (area_rep / area_all) * 100.0);
266  h2->SetTitle(title);
267  }
#define HWSTATUSANYERROR(s)
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.
Data available (reporting)
#define N_STATIONS
std::bitset< 14 > HWStatusBitSet
Hardware Status Bits structure used in Summary efficiency calculation and storage.
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 333 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, cscdqm::Address::mask, N_SIDES, N_STATIONS, 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 getDetector(), cscdqm::EventProcessor::standbyEfficiencyHistos(), and cscdqm::EventProcessor::writeShifterHistograms().

333  {
334  if (h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >= 36 && h2->GetYaxis()->GetXmin() <= 1 &&
335  h2->GetYaxis()->GetXmax() >= 18) {
336  unsigned int x, y;
337  Address adr;
338 
339  adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = true;
340  adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
341 
342  for (adr.side = 1; adr.side <= N_SIDES; adr.side++) {
343  for (adr.station = 1; adr.station <= N_STATIONS; adr.station++) {
344  for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++) {
345  for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++) {
346  if (ChamberAddressToCoords(adr, x, y)) {
347  HWStatusBitSet hwValue = GetValue(adr);
348  bool hit = (op_any ? HWSTATUSANY(hwValue, mask) : HWSTATUSEQUALS(hwValue, mask));
349 
350  // std::cout << "x = " << x << ", y = " << y << ", value = " << GetValue(adr) << std::endl;
351  // std::cout << "adr = " << detector.AddressName(adr) << ", x = " << x << ", y = " << y << ", value = " << GetValue(adr) << std::endl;
352  if (hit) {
353  h2->SetBinContent(x, y, 1.0 * value);
354  } else if (reset) {
355  h2->SetBinContent(x, y, 0.0);
356  }
357  }
358  }
359  }
360  }
361  }
362 
363  } else {
364  LOG_WARN << "cscdqm::Summary.WriteChamberState routine. Wrong histogram dimensions!";
365  }
366  }
const HWStatusBitSet GetValue(Address adr) const
Get value of some address.
#define HWSTATUSANY(s, m)
const unsigned int NumberOfRings(const unsigned int station) const
Returns the number of rings for the given station.
#define HWSTATUSEQUALS(s, m)
const bool ChamberAddressToCoords(const Address &adr, unsigned int &x, unsigned int &y) const
Calculate CSCChamberMap histogram coordinates from Address.
Definition: value.py:1
#define N_STATIONS
#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 unsigned int NumberOfChambers(const unsigned int station, const unsigned int ring) const
Returns the number of chambers for the given station and ring.
void reset(double vett[256])
Definition: TPedValues.cc:11
void cscdqm::Summary::WriteMap ( TH2 *&  h2)

Write PhysicsReady Map to H2 histogram.

Parameters
h2Histogram to write map to

Definition at line 273 of file CSCDQM_Summary.cc.

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

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

273  {
274  unsigned int rep_el = 0, csc_el = 0;
275 
276  if (h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >= NTICS && h2->GetYaxis()->GetXmin() <= 1 &&
277  h2->GetYaxis()->GetXmax() >= NTICS) {
278  float xd = 5.0 / NTICS;
279 
280  float xmin, xmax;
281 
282  for (unsigned int x = 0; x < NTICS; x++) {
283  xmin = -2.5 + xd * x;
284  xmax = xmin + xd;
285 
286  for (unsigned int y = 0; y < NTICS; y++) {
287  double value = 0.0;
288 
289  if (xmin == -2.5 || xmax == 2.5)
290  continue;
291  if (xmin >= -1 && xmax <= 1)
292  continue;
293 
294  switch (IsPhysicsReady(x, y)) {
295  case -1:
296  value = -1.0;
297  break;
298  case 0:
299  value = 0.0;
300  rep_el++;
301  break;
302  case 1:
303  value = 1.0;
304  rep_el++;
305  break;
306  case 2:
307  value = 2.0;
308  rep_el++;
309  }
310 
311  h2->SetBinContent(x + 1, y + 1, value);
312  csc_el++;
313  }
314  }
315 
316  } else {
317  LOG_WARN << "cscdqm::Summary.WriteMap routine. Wrong histogram dimensions!";
318  }
319 
320  TString title =
321  Form("EMU Status: Physics Efficiency %.2f%%", (csc_el == 0 ? 0.0 : (1.0 * rep_el) / csc_el) * 100.0);
322  h2->SetTitle(title);
323  }
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 cscdqm::Summary::detector
private
HWStatusBitSet cscdqm::Summary::map[2][4][3][36][6][5][5]
private