CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 (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 (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 872 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 WriteChamberState().

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

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

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

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

Definition at line 87 of file CSCDQM_Summary.h.

References detector.

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

87 { return detector; }
const double cscdqm::Summary::GetEfficiencyArea ( const unsigned int  station) const

Get Efficiency area for the station.

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

Definition at line 609 of file CSCDQM_Summary.cc.

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

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

Get Efficiency area for the address.

Parameters
adrAddress
Returns
Area in eta/phi space

Definition at line 625 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.

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

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

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

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

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

552  {
553  double sum = 0.0;
554 
555  if (!adr.mask.side) {
556  adr.mask.side = true;
557  for (adr.side = 1; adr.side <= N_SIDES; adr.side++) sum += GetEfficiencyHW(adr);
558  return sum / N_SIDES;
559  }
560 
561  if (!adr.mask.station) {
562  adr.mask.station = true;
563  for (adr.station = 1; adr.station <= N_STATIONS; adr.station++) sum += GetEfficiencyHW(adr);
564  return sum / N_STATIONS;
565  }
566 
567  if (!adr.mask.ring) {
568  adr.mask.ring = true;
569  for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++) sum += GetEfficiencyHW(adr);
570  return sum / detector.NumberOfRings(adr.station);
571  }
572 
573  if (!adr.mask.chamber) {
574  adr.mask.chamber = true;
575  for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++) sum += GetEfficiencyHW(adr);
576  return sum / detector.NumberOfChambers(adr.station, adr.ring);
577  }
578 
579  if (!adr.mask.layer) {
580  adr.mask.layer = true;
581  for (adr.layer = 1; adr.layer <= N_LAYERS; adr.layer++) sum += GetEfficiencyHW(adr);
582  return sum / N_LAYERS;
583  }
584 
585  if (!adr.mask.cfeb) {
586  adr.mask.cfeb = true;
587  for (adr.cfeb = 1; adr.cfeb <= detector.NumberOfChamberCFEBs(adr.station, adr.ring); adr.cfeb++) sum += GetEfficiencyHW(adr);
588  return sum / detector.NumberOfChamberCFEBs(adr.station, adr.ring);
589  }
590 
591  if (!adr.mask.hv) {
592  adr.mask.hv = true;
593  for (adr.hv = 1; adr.hv <= detector.NumberOfChamberHVs(adr.station, adr.ring); adr.hv++) sum += GetEfficiencyHW(adr);
594  return sum / detector.NumberOfChamberHVs(adr.station, adr.ring);
595  }
596 
599  if (HWSTATUSANYERROR(status)) return 0.0;
600  return 1.0;
601 
602  }
#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.
tuple status
Definition: ntuplemaker.py:245
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 648 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 ntuplemaker::status.

Referenced by GetEfficiencyArea().

648  {
649  double sum = 0.0;
650 
651  if (!adr.mask.side) {
652  adr.mask.side = true;
653  for (adr.side = 1; adr.side <= N_SIDES; adr.side++) sum += GetReportingArea(adr);
654  return sum;
655  }
656 
657  if (!adr.mask.station) {
658  adr.mask.station = true;
659  for (adr.station = 1; adr.station <= N_STATIONS; adr.station++) sum += GetReportingArea(adr);
660  return sum;
661  }
662 
663  if (!adr.mask.ring) {
664  adr.mask.ring = true;
665  for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++) sum += GetReportingArea(adr);
666  return sum;
667  }
668 
669  if (!adr.mask.chamber) {
670  adr.mask.chamber = true;
671  for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++) sum += GetReportingArea(adr);
672  return sum;
673  }
674 
675  if (!adr.mask.cfeb) {
676  adr.mask.cfeb = true;
677  for (adr.cfeb = 1; adr.cfeb <= detector.NumberOfChamberCFEBs(adr.station, adr.ring); adr.cfeb++) sum += GetReportingArea(adr);
678  return sum;
679  }
680 
681  if (!adr.mask.hv) {
682  adr.mask.hv = true;
683  for (adr.hv = 1; adr.hv <= detector.NumberOfChamberHVs(adr.station, adr.ring); adr.hv++) sum += GetReportingArea(adr);
684  return sum;
685  }
686 
687  adr.mask.layer = false;
688 
691  if (!HWSTATUSANYERROR(status)) {
692  return detector.Area(adr);
693  }
694  return 0.0;
695 
696  }
#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.
tuple status
Definition: ntuplemaker.py:245
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 735 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, evf::utils::state, cscdqm::AddressMask::station, and cscdqm::Address::station.

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

735  {
736 
738  state.reset();
739 
740  if (!adr.mask.side) {
741  adr.mask.side = true;
742  for (adr.side = 1; adr.side <= N_SIDES; adr.side++) state |= GetValue(adr);
743  return state;
744  }
745 
746  if (!adr.mask.station) {
747  adr.mask.station = true;
748  for (adr.station = 1; adr.station <= N_STATIONS; adr.station++) state |= GetValue(adr);
749  return state;
750  }
751 
752  if (!adr.mask.ring) {
753  adr.mask.ring = true;
754  for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++) state |= GetValue(adr);
755  return state;
756  }
757 
758  if (!adr.mask.chamber) {
759  adr.mask.chamber = true;
760  for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++) state |= GetValue(adr);
761  return state;
762  }
763 
764  if (!adr.mask.layer) {
765  adr.mask.layer = true;
766  for (adr.layer = 1; adr.layer <= N_LAYERS; adr.layer++) state |= GetValue(adr);
767  return state;
768  }
769 
770  if (!adr.mask.cfeb) {
771  adr.mask.cfeb = true;
772  for (adr.cfeb = 1; adr.cfeb <= detector.NumberOfChamberCFEBs(adr.station, adr.ring); adr.cfeb++) state |= GetValue(adr);
773  return state;
774  }
775 
776  if (!adr.mask.hv) {
777  adr.mask.hv = true;
778  for (adr.hv = 1; adr.hv <= detector.NumberOfChamberHVs(adr.station, adr.ring); adr.hv++) state |= GetValue(adr);
779  return state;
780  }
781 
782  return map[adr.side - 1][adr.station - 1][adr.ring - 1][adr.chamber - 1][adr.layer - 1][adr.cfeb - 1][adr.hv - 1];
783 
784  }
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
char state
Definition: procUtils.cc:75
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 706 of file CSCDQM_Summary.cc.

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

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

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

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

726  {
727  return isChamberStandby(cid.endcap(), cid.station(), cid.ring(), cid.chamber());
728  }
int chamber() const
Definition: CSCDetId.h:70
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:95
int ring() const
Definition: CSCDetId.h:77
int station() const
Definition: CSCDetId.h:88
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 482 of file CSCDQM_Summary.cc.

References cscdqm::AddressBox::adr, cscdqm::DATA, detector, GetValue(), HWSTATUSANYERROR, i, cscdqm::MASKED, N_STATIONS, cscdqm::Detector::NextAddressBoxByPartition(), cscdqm::Address::station, ntuplemaker::status, and run_regression::test.

Referenced by WriteMap().

482  {
483 
484  AddressBox *box;
485 
487 
488  unsigned int i = 0;
489  while(detector.NextAddressBoxByPartition(i, px, py, box)) {
490  status[box->adr.station - 1] |= GetValue(box->adr);
491  }
492 
493  unsigned int cdata = 0, cerror = 0, cmask = 0;
494  for (unsigned int i = 0; i < N_STATIONS; i++) {
495  if (HWSTATUSANYERROR(status[i])) {
496  cerror++;
497  } else {
498  if (status[i].test(MASKED)) cmask++;
499  if (status[i].test(DATA)) cdata++;
500  }
501  }
502 
504  if (cdata > 1) return 1;
506  if (cerror > 0) return -1;
508  if (cmask > 0) return 2;
510  return 0;
511 
512  }
int i
Definition: DBlmapReader.cc:9
#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.
tuple status
Definition: ntuplemaker.py:245
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(), LOG_WARN, N, n, ReSetValue(), SetValue(), vdt::x, and detailsBasic3DVector::y.

Referenced by 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.
x
Definition: VDTMath.h:216
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(), SetValue(), vdt::x, detailsBasic3DVector::y, and detailsBasic3DVector::z.

Referenced by 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  }
double double double z
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.
x
Definition: VDTMath.h:216
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, LOG_WARN, N, n, funct::pow(), ReSetValue(), SetValue(), vdt::x, and detailsBasic3DVector::y.

Referenced by 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
long long int num
Definition: procUtils.cc:71
#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.
x
Definition: VDTMath.h:216
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 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 ( 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 791 of file CSCDQM_Summary.cc.

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

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

791  {
792  unsigned int applied = 0;
793 
794  for (unsigned int r = 0; r < tokens.size(); r++) {
795  std::string token = (std::string) tokens.at(r);
796  Address adr;
797  if (detector.AddressFromString(token, adr)) {
798  SetValue(adr, MASKED);
799  applied++;
800  }
801  }
802  return applied;
803  }
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 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  }
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 
422  if (!adr.mask.side) {
423  adr.mask.side = true;
424  for (adr.side = 1; adr.side <= N_SIDES; adr.side++) SetValue(adr, bit, value);
425  return;
426  }
427 
428  if (!adr.mask.station) {
429  adr.mask.station = true;
430  for (adr.station = 1; adr.station <= N_STATIONS; adr.station++) SetValue(adr, bit, value);
431  return;
432  }
433 
434  if (!adr.mask.ring) {
435  adr.mask.ring = true;
436  for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++) SetValue(adr, bit, value);
437  return;
438  }
439 
440  if (!adr.mask.chamber) {
441  adr.mask.chamber = true;
442  for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++) SetValue(adr, bit, value);
443  return;
444  }
445 
446  if (!adr.mask.layer) {
447  adr.mask.layer = true;
448  for (adr.layer = 1; adr.layer <= N_LAYERS; adr.layer++) SetValue(adr, bit, value);
449  return;
450  }
451 
452  if (!adr.mask.cfeb) {
453  adr.mask.cfeb = true;
454  for (adr.cfeb = 1; adr.cfeb <= detector.NumberOfChamberCFEBs(adr.station, adr.ring); adr.cfeb++) SetValue(adr, bit, value);
455  return;
456  }
457 
458  if (!adr.mask.hv) {
459  adr.mask.hv = true;
460  for (adr.hv = 1; adr.hv <= detector.NumberOfChamberHVs(adr.station, adr.ring); adr.hv++) SetValue(adr, bit, value);
461  return;
462  }
463 
464  if( adr.side > 0 && adr.side <= N_SIDES && adr.station > 0 && adr.station <= N_STATIONS &&
465  adr.ring > 0 && adr.ring <= N_RINGS && adr.chamber > 0 && adr.chamber <= N_CHAMBERS &&
466  adr.layer > 0 && adr.layer <= N_LAYERS && adr.cfeb > 0 && adr.cfeb <= N_CFEBS && adr.hv > 0 && adr.hv <= N_HVS) {
467 
468  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);
469 
470  }
471 
472  }
#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
#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, 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, ntuplemaker::status, indexGen::title, vdt::x, cscdqm::AddressBox::xmax, cscdqm::AddressBox::xmin, detailsBasic3DVector::y, cscdqm::AddressBox::ymax, and cscdqm::AddressBox::ymin.

Referenced by 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  }
int i
Definition: DBlmapReader.cc:9
#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.
tuple status
Definition: ntuplemaker.py:245
x
Definition: VDTMath.h:216
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, cscdqm::Address::station, vdt::x, and detailsBasic3DVector::y.

Referenced by 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.
#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.
#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.
x
Definition: VDTMath.h:216
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, indexGen::title, relativeConstraints::value, vdt::x, and detailsBasic3DVector::y.

Referenced by 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...
#define NTICS
#define LOG_WARN
Definition: CSCDQM_Logger.h:42
x
Definition: VDTMath.h:216

Member Data Documentation

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

Atomic HW element status matrix

Definition at line 124 of file CSCDQM_Summary.h.

Referenced by GetValue(), and SetValue().