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) {
27  Reset();
28  }
#define NTICS
void Reset()
Resets all detector map.
cscdqm::Summary::~Summary ( )

Destructor.

Definition at line 33 of file CSCDQM_Summary.cc.

33 { }

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 868 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().

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

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

607  {
608  if (station <= 0 || station > N_STATIONS) return 0.0;
609 
610  Address adr;
611  adr.mask.side = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
612  adr.station = true;
613  adr.station = station;
614 
615  return GetEfficiencyArea(adr);
616  }
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 623 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.

623  {
624  double all_area = 1;
625 
626  if (adr.mask.side == false &&
627  adr.mask.ring == false &&
628  adr.mask.chamber == false &&
629  adr.mask.layer == false &&
630  adr.mask.cfeb == false &&
631  adr.mask.hv == false &&
632  adr.mask.station == true)
633  all_area = detector.Area(adr.station);
634  else
635  all_area = detector.Area(adr);
636 
637  double rep_area = GetReportingArea(adr);
638  return rep_area / all_area;
639  }
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 517 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().

517  {
518 
519  Address adr;
520  adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
521  return GetEfficiencyHW(adr);
522 
523  }
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 530 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.

530  {
531 
532  Address adr;
533  adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
534 
535  if (station > 0 && station <= N_STATIONS) {
536  adr.mask.station = true;
537  adr.station = station;
538  } else {
539  return 0.0;
540  }
541 
542  return GetEfficiencyHW(adr);
543 
544  }
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 551 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.

551  {
552  double sum = 0.0;
553  if (!adr.mask.side) {
554  adr.mask.side = true;
555  for (adr.side = 1; adr.side <= N_SIDES; adr.side++) sum += GetEfficiencyHW(adr);
556  return sum / N_SIDES;
557  }
558 
559  if (!adr.mask.station) {
560  adr.mask.station = true;
561  for (adr.station = 1; adr.station <= N_STATIONS; adr.station++) sum += GetEfficiencyHW(adr);
562  return sum / N_STATIONS;
563  }
564 
565  if (!adr.mask.ring) {
566  adr.mask.ring = true;
567  for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++) sum += GetEfficiencyHW(adr);
568  return sum / detector.NumberOfRings(adr.station);
569  }
570 
571  if (!adr.mask.chamber) {
572  adr.mask.chamber = true;
573  for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++) sum += GetEfficiencyHW(adr);
574  return sum / detector.NumberOfChambers(adr.station, adr.ring);
575  }
576 
577  if (!adr.mask.layer) {
578  adr.mask.layer = true;
579  for (adr.layer = 1; adr.layer <= N_LAYERS; adr.layer++) 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++) sum += GetEfficiencyHW(adr);
586  return sum / detector.NumberOfChamberCFEBs(adr.station, adr.ring);
587  }
588 
589  if (!adr.mask.hv) {
590  adr.mask.hv = true;
591  for (adr.hv = 1; adr.hv <= detector.NumberOfChamberHVs(adr.station, adr.ring); adr.hv++) sum += GetEfficiencyHW(adr);
592  return sum / detector.NumberOfChamberHVs(adr.station, adr.ring);
593  }
594 
597  if (HWSTATUSANYERROR(status)) return 0.0;
598  return 1.0;
599 
600  }
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 HWSTATUSANYERROR(s)
#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 646 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().

646  {
647  double sum = 0.0;
648  if (!adr.mask.side) {
649  adr.mask.side = true;
650  for (adr.side = 1; adr.side <= N_SIDES; adr.side++) 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++) sum += GetReportingArea(adr);
657  return sum;
658  }
659 
660  if (!adr.mask.ring) {
661  adr.mask.ring = true;
662  for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++) sum += GetReportingArea(adr);
663  return sum;
664  }
665 
666  if (!adr.mask.chamber) {
667  adr.mask.chamber = true;
668  for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++) sum += GetReportingArea(adr);
669  return sum;
670  }
671 
672  if (!adr.mask.cfeb) {
673  adr.mask.cfeb = true;
674  for (adr.cfeb = 1; adr.cfeb <= detector.NumberOfChamberCFEBs(adr.station, adr.ring); adr.cfeb++) sum += GetReportingArea(adr);
675  return sum;
676  }
677 
678  if (!adr.mask.hv) {
679  adr.mask.hv = true;
680  for (adr.hv = 1; adr.hv <= detector.NumberOfChamberHVs(adr.station, adr.ring); adr.hv++) sum += GetReportingArea(adr);
681  return sum;
682  }
683 
684  adr.mask.layer = false;
685 
688  if (!HWSTATUSANYERROR(status)) {
689  return detector.Area(adr);
690  }
691  return 0.0;
692 
693  }
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 HWSTATUSANYERROR(s)
#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 732 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().

732  {
733  HWStatusBitSet state;
734  state.reset();
735 
736  if (!adr.mask.side) {
737  adr.mask.side = true;
738  for (adr.side = 1; adr.side <= N_SIDES; adr.side++) state |= GetValue(adr);
739  return state;
740  }
741 
742  if (!adr.mask.station) {
743  adr.mask.station = true;
744  for (adr.station = 1; adr.station <= N_STATIONS; adr.station++) state |= GetValue(adr);
745  return state;
746  }
747 
748  if (!adr.mask.ring) {
749  adr.mask.ring = true;
750  for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++) state |= GetValue(adr);
751  return state;
752  }
753 
754  if (!adr.mask.chamber) {
755  adr.mask.chamber = true;
756  for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++) state |= GetValue(adr);
757  return state;
758  }
759 
760  if (!adr.mask.layer) {
761  adr.mask.layer = true;
762  for (adr.layer = 1; adr.layer <= N_LAYERS; adr.layer++) 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++) state |= GetValue(adr);
769  return state;
770  }
771 
772  if (!adr.mask.hv) {
773  adr.mask.hv = true;
774  for (adr.hv = 1; adr.hv <= detector.NumberOfChamberHVs(adr.station, adr.ring); adr.hv++) state |= GetValue(adr);
775  return state;
776  }
777 
778  return map[adr.side - 1][adr.station - 1][adr.ring - 1][adr.chamber - 1][adr.layer - 1][adr.cfeb - 1][adr.hv - 1];
779 
780  }
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 703 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().

703  {
704 
705  Address adr;
706  adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = true;
707  adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
708  adr.side = side;
709  adr.station = station;
710  adr.ring = ring;
711  adr.chamber = chamber;
712 
713  //std::cout << adr << " = " << HWSTATUSANY(GetValue(adr), 0x1000) << "\n";
714 
715  return HWSTATUSANY(GetValue(adr), 0x1000);
716  }
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 723 of file CSCDQM_Summary.cc.

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

723  {
724  return isChamberStandby(cid.endcap(), cid.station(), cid.ring(), cid.chamber());
725  }
int chamber() const
Definition: CSCDetId.h:68
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:93
int ring() const
Definition: CSCDetId.h:75
int station() const
Definition: CSCDetId.h:86
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 481 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 PFTauMVAInputDiscriminatorTranslator_cfi::test.

Referenced by getDetector(), and WriteMap().

481  {
482 
483  AddressBox *box;
484 
486 
487  unsigned int i = 0;
488  while(detector.NextAddressBoxByPartition(i, px, py, box)) {
489  status[box->adr.station - 1] |= GetValue(box->adr);
490  }
491 
492  unsigned int cdata = 0, cerror = 0, cmask = 0;
493  for (unsigned int i = 0; i < N_STATIONS; i++) {
494  if (HWSTATUSANYERROR(status[i])) {
495  cerror++;
496  } else {
497  if (status[i].test(MASKED)) cmask++;
498  if (status[i].test(DATA)) cdata++;
499  }
500  }
501 
503  if (cdata > 1) return 1;
505  if (cerror > 0) return -1;
507  if (cmask > 0) return 2;
509  return 0;
510 
511  }
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 HWSTATUSANYERROR(s)
#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 201 of file CSCDQM_Summary.cc.

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

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

201  {
202 
203  if(evs->GetXaxis()->GetXmin() <= 1 && evs->GetXaxis()->GetXmax() >= 36 &&
204  evs->GetYaxis()->GetXmin() <= 1 && evs->GetYaxis()->GetXmax() >= 18 &&
205  err->GetXaxis()->GetXmin() <= 1 && err->GetXaxis()->GetXmax() >= 36 &&
206  err->GetYaxis()->GetXmin() <= 1 && err->GetYaxis()->GetXmax() >= 18) {
207 
208  Address adr;
209  unsigned int N = 0, n = 0;
210 
211  for(unsigned int x = 1; x <= 36; x++) {
212  for(unsigned int y = 1; y <= 18; y++) {
213  N = int(evs->GetBinContent(x, y));
214  n = int(err->GetBinContent(x, y));
215  if (ChamberCoordsToAddress(x, y, adr)) {
216  if(Utility::checkError(N, n, eps_max, Sfail)) {
217  SetValue(adr, bit);
218  } else {
219  ReSetValue(adr, bit);
220  }
221  }
222  }
223  }
224  } else {
225  LOG_WARN << "cscdqm::Summary.ReadErrorChambers routine. Wrong histogram dimensions!";
226  }
227  }
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:42
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 62 of file CSCDQM_Summary.cc.

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

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

62  {
63 
64  if(h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >= 36 &&
65  h2->GetYaxis()->GetXmin() <= 1 && h2->GetYaxis()->GetXmax() >= 18) {
66 
67  Address adr;
68  double z = 0.0;
69 
70  for(unsigned int x = 1; x <= 36; x++) {
71  for(unsigned int y = 1; y <= 18; y++) {
72  z = h2->GetBinContent(x, y);
73  if(ChamberCoordsToAddress(x, y, adr)) {
74  if(z >= threshold) {
75  SetValue(adr, DATA);
76  } else {
77  ReSetValue(adr, DATA);
78  }
79  }
80  }
81  }
82  } else {
83  LOG_WARN << "cscdqm::Summary.ReadReportingChambers routine. Wrong histogram dimensions!";
84  }
85  }
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:42
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 97 of file CSCDQM_Summary.cc.

References ChamberCoordsToAddress(), cscdqm::Utility::checkOccupancy(), cscdqm::COLD, cscdqm::DATA, cscdqm::HOT, createfilelist::int, LOG_WARN, N, gen::n, pileupDistInMC::num, funct::pow(), ReSetValue(), and SetValue().

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

97  {
98 
99  if(h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >= 36 &&
100  h2->GetYaxis()->GetXmin() <= 1 && h2->GetYaxis()->GetXmax() >= 18 &&
101  refh2->GetXaxis()->GetXmin() <= 1 && refh2->GetXaxis()->GetXmax() >= 36 &&
102  refh2->GetYaxis()->GetXmin() <= 1 && refh2->GetYaxis()->GetXmax() >= 18) {
103 
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  unsigned int N = 0, n = 0;
120 
121  for(unsigned int x = 1; x <= 36; x++) {
122  for(unsigned int y = 1; y <= 18; y++) {
123 
124  N = int(refh2->GetBinContent(x, y) * factor);
125  n = int(h2->GetBinContent(x, y));
126 
127  if(ChamberCoordsToAddress(x, y, adr)) {
128 
130  ReSetValue(adr, HOT);
131  ReSetValue(adr, COLD);
132 
133  if (n == 0) {
134  ReSetValue(adr, DATA);
135  } else {
136  SetValue(adr, DATA);
137  }
138 
139  switch (Utility::checkOccupancy(N, n, cold_coef, hot_coef, cold_Sfail, hot_Sfail)) {
140  case -1:
141  SetValue(adr, COLD);
142 
143  /*
144  std::cout << "adr = " << detector.AddressName(adr);
145  std::cout << ", x = " << x << ", y = " << y;
146  std::cout << ", value = " << GetValue(adr);
147  std::cout << ", refh2 = " << refh2->GetBinContent(x, y);
148  std::cout << ", factor = " << factor;
149  std::cout << ", N = " << N;
150  std::cout << ", n = " << n;
151  std::cout << ", num = " << num;
152  std::cout << ", denum = " << denum;
153  std::cout << ", rate = " << (N > 0 ? n / N : 0);
154  std::cout << ", cold_coef = " << cold_coef;
155  std::cout << ", = COLD";
156  std::cout << "\n";
157  */
158 
159  break;
160  case 1:
161  SetValue(adr, HOT);
162 
163  /*
164  std::cout << "adr = " << detector.AddressName(adr);
165  std::cout << ", x = " << x << ", y = " << y;
166  std::cout << ", value = " << GetValue(adr);
167  std::cout << ", refh2 = " << refh2->GetBinContent(x, y);
168  std::cout << ", factor = " << factor;
169  std::cout << ", N = " << N;
170  std::cout << ", n = " << n;
171  std::cout << ", num = " << num;
172  std::cout << ", denum = " << denum;
173  std::cout << ", rate = " << (N > 0 ? n / N : 0);
174  std::cout << ", hot_coef = " << hot_coef;
175  std::cout << ", = HOT";
176  std::cout << "\n";
177  */
178 
179  break;
180  };
181 
182 
183  }
184 
185  }
186  }
187 
188  } else {
189  LOG_WARN << "cscdqm::Summary.ReadReportingChambersRef routine. Wrong histogram dimensions!";
190  }
191  }
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:42
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:40
void cscdqm::Summary::Reset ( )

Resets all detector map.

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

Definition at line 38 of file CSCDQM_Summary.cc.

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

38  {
39  Address adr;
40 
42  adr.mask.side = adr.mask.station = adr.mask.layer = false;
43  adr.mask.ring = adr.mask.chamber = adr.mask.cfeb = adr.mask.hv = true;
44  for (adr.ring = 1; adr.ring <= N_RINGS; adr.ring++) {
45  for (adr.chamber = 1; adr.chamber <= N_CHAMBERS; adr.chamber++) {
46  for (adr.cfeb = 1; adr.cfeb <= N_CFEBS; adr.cfeb++) {
47  for (adr.hv = 1; adr.hv <= N_HVS; adr.hv++) {
48  for (unsigned int bit = 0; bit < HWSTATUSBITSETSIZE; bit++) {
49  ReSetValue(adr, (HWStatusBit) bit);
50  }
51  }
52  }
53  }
54  }
55  }
#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 390 of file CSCDQM_Summary.cc.

References SetValue().

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

390  {
391  SetValue(bit, 0);
392  }
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 399 of file CSCDQM_Summary.cc.

References SetValue().

399  {
400  SetValue(adr, bit, 0);
401  }
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 787 of file CSCDQM_Summary.cc.

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

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

787  {
788  unsigned int applied = 0;
789 
790  for (unsigned int r = 0; r < tokens.size(); r++) {
791  std::string token = (std::string) tokens.at(r);
792  Address adr;
793  if (detector.AddressFromString(token, adr)) {
794  SetValue(adr, MASKED);
795  applied++;
796  }
797  }
798  return applied;
799  }
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 408 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().

408  {
409  Address adr;
410  adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
411  SetValue(adr, bit, value);
412  }
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 420 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.

420  {
421  if (!adr.mask.side) {
422  adr.mask.side = true;
423  for (adr.side = 1; adr.side <= N_SIDES; adr.side++) SetValue(adr, bit, value);
424  return;
425  }
426 
427  if (!adr.mask.station) {
428  adr.mask.station = true;
429  for (adr.station = 1; adr.station <= N_STATIONS; adr.station++) SetValue(adr, bit, value);
430  return;
431  }
432 
433  if (!adr.mask.ring) {
434  adr.mask.ring = true;
435  for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++) SetValue(adr, bit, value);
436  return;
437  }
438 
439  if (!adr.mask.chamber) {
440  adr.mask.chamber = true;
441  for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++) SetValue(adr, bit, value);
442  return;
443  }
444 
445  if (!adr.mask.layer) {
446  adr.mask.layer = true;
447  for (adr.layer = 1; adr.layer <= N_LAYERS; adr.layer++) SetValue(adr, bit, value);
448  return;
449  }
450 
451  if (!adr.mask.cfeb) {
452  adr.mask.cfeb = true;
453  for (adr.cfeb = 1; adr.cfeb <= detector.NumberOfChamberCFEBs(adr.station, adr.ring); adr.cfeb++) SetValue(adr, bit, value);
454  return;
455  }
456 
457  if (!adr.mask.hv) {
458  adr.mask.hv = true;
459  for (adr.hv = 1; adr.hv <= detector.NumberOfChamberHVs(adr.station, adr.ring); adr.hv++) SetValue(adr, bit, value);
460  return;
461  }
462 
463  if( adr.side > 0 && adr.side <= N_SIDES && adr.station > 0 && adr.station <= N_STATIONS &&
464  adr.ring > 0 && adr.ring <= N_RINGS && adr.chamber > 0 && adr.chamber <= N_CHAMBERS &&
465  adr.layer > 0 && adr.layer <= N_LAYERS && adr.cfeb > 0 && adr.cfeb <= N_CFEBS && adr.hv > 0 && adr.hv <= N_HVS) {
466 
467  map[adr.side - 1][adr.station - 1][adr.ring - 1][adr.chamber - 1][adr.layer - 1][adr.cfeb - 1][adr.hv - 1].set(bit, value);
468 
469  }
470 
471  }
#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 234 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, cscdqm::AddressBox::xmax, cscdqm::AddressBox::xmin, cscdqm::AddressBox::ymax, and cscdqm::AddressBox::ymin.

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

234  {
235  const AddressBox* box;
236  Address adr, tadr;
237  float area_all = 0.0, area_rep = 0.0;
238 
239  if(station < 1 || station > N_STATIONS) return;
240 
241  adr.mask.side = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
242  adr.mask.station = true;
243  adr.station = station;
244 
245  unsigned int i = 0;
246 
247  while (detector.NextAddressBox(i, box, adr)) {
248 
249  unsigned int x = 1 + (box->adr.side - 1) * 9 + (box->adr.ring - 1) * 3 + (box->adr.hv - 1);
250  unsigned int y = 1 + (box->adr.chamber - 1) * 5 + (box->adr.cfeb - 1);
251 
252  tadr = box->adr;
254 
255  float area_box = fabs((box->xmax - box->xmin) * (box->ymax - box->ymin));
256 
257  if (status.test(MASKED)) {
258  h2->SetBinContent(x, y, 2.0);
259  } else {
260  area_all += area_box;
261  if (HWSTATUSANYERROR(status)) {
262  h2->SetBinContent(x, y, -1.0);
263  } else {
264  area_rep += area_box;
265  if (status.test(DATA)) {
266  h2->SetBinContent(x, y, 1.0);
267  } else {
268  h2->SetBinContent(x, y, 0.0);
269  }
270  }
271  }
272 
273  }
274 
275  TString title = Form("ME%d Status: Physics Efficiency %.2f%%", station, (area_rep / area_all) * 100.0);
276  h2->SetTitle(title);
277 
278  }
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 HWSTATUSANYERROR(s)
#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 348 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().

348  {
349 
350  if(h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >= 36 &&
351  h2->GetYaxis()->GetXmin() <= 1 && h2->GetYaxis()->GetXmax() >= 18) {
352 
353  unsigned int x, y;
354  Address adr;
355 
356  adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = true;
357  adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
358 
359  for (adr.side = 1; adr.side <= N_SIDES; adr.side++) {
360  for (adr.station = 1; adr.station <= N_STATIONS; adr.station++) {
361  for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++) {
362  for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++) {
363  if (ChamberAddressToCoords(adr, x, y)) {
364  HWStatusBitSet hwValue = GetValue(adr);
365  bool hit = (op_any ? HWSTATUSANY(hwValue, mask) : HWSTATUSEQUALS(hwValue, mask));
366 
367  // std::cout << "x = " << x << ", y = " << y << ", value = " << GetValue(adr) << std::endl;
368  // std::cout << "adr = " << detector.AddressName(adr) << ", x = " << x << ", y = " << y << ", value = " << GetValue(adr) << std::endl;
369  if (hit) {
370  h2->SetBinContent(x, y, 1.0 * value);
371  } else if (reset) {
372  h2->SetBinContent(x, y, 0.0);
373  }
374  }
375  }
376  }
377  }
378  }
379 
380  } else {
381  LOG_WARN << "cscdqm::Summary.WriteChamberState routine. Wrong histogram dimensions!";
382  }
383 
384  }
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.
#define HWSTATUSEQUALS(s, m)
const bool ChamberAddressToCoords(const Address &adr, unsigned int &x, unsigned int &y) const
Calculate CSCChamberMap histogram coordinates from Address.
#define HWSTATUSANY(s, m)
Definition: value.py:1
#define N_STATIONS
#define N_SIDES
#define LOG_WARN
Definition: CSCDQM_Logger.h:42
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 284 of file CSCDQM_Summary.cc.

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

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

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

Member Data Documentation

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