CMS 3D CMS Logo

cscdqm::Summary Class Reference

Hardware and Physics Efficiency data structures and routines. More...

#include <DQM/CSCMonitorModule/interface/CSCDQM_Summary.h>

List of all members.

Public Member Functions

const Detector getDetector () const
const double GetEfficiencyArea (Address adr) const
 Get Efficiency area for the address.
const double GetEfficiencyArea (const unsigned int station) const
 Get Efficiency area for the station.
const double GetEfficiencyHW (Address adr) const
 Get efficiency of the detector part supplied by the address.
const double GetEfficiencyHW (const unsigned int station) const
 Get efficiency of the station.
const double GetEfficiencyHW () const
 Get efficiency of the whole detector.
const HWStatusBitSet GetValue (Address adr) const
 Get value of some address.
const int IsPhysicsReady (const unsigned int px, const unsigned int py)
 Check if the current eta/phi polygon has at least 2 active HW elements in the area.
void ReadErrorChambers (const TH2 *&evs, const TH2 *&err, const HWStatusBit bit, const double eps_max=0.1, const double Sfail=5.0)
 Read Error data for Chambers.
void ReadReportingChambers (const TH2 *&h2, const double threshold=1.0)
 Read Reporting Chamber histogram and fill in detector map.
void ReadReportingChambersRef (const TH2 *&h2, const TH2 *&refh2, const double cold_coef=0.1, const double cold_Sfail=5.0, const double hot_coef=2.0, const double hot_Sfail=5.0)
 Read Reporting Chamber histogram and fill in detector map based on reference histogram.
void Reset ()
 Resets all detector map.
void ReSetValue (Address adr, const HWStatusBit bit)
 ReSet value recursivelly by following the supplied address.
void ReSetValue (const HWStatusBit bit)
 ReSetValue for the whole of detector.
const unsigned int setMaskedHWElements (std::vector< std::string > &tokens)
 Read HW element masks (strings), create Address and apply to detector map.
void SetValue (Address adr, const HWStatusBit bit, const int value=1)
 Set value recursivelly by following the supplied address.
void SetValue (const HWStatusBit bit, const int value=1)
 SetValue for the whole of detector.
 Summary ()
 Constructor.
void Write (TH2 *&h2, const unsigned int station) const
 Write detector map to H1 histogram (linear data) for the selected adr.station.
void WriteChamberState (TH2 *&h2, const int mask, const int value=1, const bool reset=true, const bool op_any=false) const
 Write State information to chamber histogram.
void WriteMap (TH2 *&h2)
 Write PhysicsReady Map to H2 histogram.
 ~Summary ()
 Destructor.

Private Member Functions

const bool ChamberAddressToCoords (const Address &adr, unsigned int &x, unsigned int &y) const
 Calculate CSCChamberMap histogram coordinates from Address.
const bool ChamberCoordsToAddress (const unsigned int x, const unsigned int y, Address &adr) const
 Calculate Address from CSCChamberMap histogram coordinates.
const double GetReportingArea (Address adr) const
 Calculate the reporting area for the address.
const double SignificanceLevel (const unsigned int N, const unsigned int n, const double eps) const
 Calculate error significance alpha for the given number of errors.
const double SignificanceLevelHot (const unsigned int N, const unsigned int n) const
 Calculate error significance alpha for the given number of events based on reference number of errors for "hot" elements: actual number of events have to be larger then the reference.

Private Attributes

Detector detector
HWStatusBitSet map [N_SIDES][N_STATIONS][N_RINGS][N_CHAMBERS][N_LAYERS][N_CFEBS][N_HVS]
std::vector< Address * > masked


Detailed Description

Hardware and Physics Efficiency data structures and routines.

Definition at line 73 of file CSCDQM_Summary.h.


Constructor & Destructor Documentation

cscdqm::Summary::Summary (  ) 

Constructor.

Parameters:
@return 

Definition at line 28 of file CSCDQM_Summary.cc.

References Reset().

00028                  : detector(NTICS, NTICS) {
00029   Reset();
00030 }

cscdqm::Summary::~Summary (  ) 

Destructor.

Parameters:
@return 

Definition at line 37 of file CSCDQM_Summary.cc.

References masked, and r.

00037                   {
00038   // Lets delete masked elements
00039   for (unsigned int r = 0; r < masked.size(); r++) { 
00040     delete (Address*) masked.at(r);
00041   }
00042 }


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:
adr Address
x X coordinate of histogram to be returned
y Y coordinate of histogram to be returned
Returns:
true if coords filled, false - otherwise

Definition at line 871 of file CSCDQM_Summary.cc.

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

Referenced by WriteChamberState().

00871                                                                                                      {
00872 
00873   if (!adr.mask.side || !adr.mask.station || !adr.mask.ring || !adr.mask.chamber) return false;
00874 
00875   x = adr.chamber;
00876   y = 0;
00877 
00878   if (adr.side == 1) {
00879     switch (adr.station) {
00880       case 1:
00881         y = 10;
00882         if (adr.ring == 2) y = 11;
00883         if (adr.ring == 3) y = 12;
00884         break;
00885       case 2:
00886         y = 13;
00887         if (adr.ring == 2) y = 14;
00888         break;
00889       case 3:
00890         y = 15;
00891         if (adr.ring == 2) y = 16;
00892         break;
00893       case 4:
00894         y = 17;
00895         if (adr.ring == 2) y = 18;
00896         break;
00897     }
00898   } else
00899   if (adr.side == 2) {
00900     switch (adr.station) {
00901       case 1:
00902         y = 7;
00903         if (adr.ring == 2) y = 8;
00904         if (adr.ring == 1) y = 9;
00905         break;
00906       case 2:
00907         y = 5;
00908         if (adr.ring == 1) y = 6;
00909         break;
00910       case 3:
00911         y = 3;
00912         if (adr.ring == 1) y = 4;
00913         break;
00914       case 4:
00915         y = 1;
00916         if (adr.ring == 1) y = 2;
00917         break;
00918     }
00919   }
00920 
00921   return true;
00922 
00923 }

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

Calculate Address from CSCChamberMap histogram coordinates.

Parameters:
x X coordinate of histogram
y Y coordinate of histogram
adr Address to be filled in and returned
Returns:
true if address was found and filled, false - otherwise

Definition at line 811 of file CSCDQM_Summary.cc.

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

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

00811                                                                                                          {
00812 
00813   if( x < 1 || x > 36 || y < 1 || y > 18) return false;
00814 
00815   adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = true;
00816   adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
00817 
00818   if ( y < 10 ) adr.side = 2;
00819   else adr.side = 1;
00820 
00821   adr.chamber = x;
00822 
00823   if (y == 1 || y == 18) {
00824     adr.station = 4;
00825     adr.ring    = 2;
00826   } else
00827   if (y == 2 || y == 17) {
00828     adr.station = 4;
00829     adr.ring    = 1;
00830   } else
00831   if (y == 3 || y == 16) {
00832     adr.station = 3;
00833     adr.ring    = 2;
00834   } else
00835   if (y == 4 || y == 15) {
00836     adr.station = 3;
00837     adr.ring    = 1;
00838   } else
00839   if (y == 5 || y == 14) {
00840     adr.station = 2;
00841     adr.ring    = 2;
00842   } else
00843   if (y == 6 || y == 13) {
00844     adr.station = 2;
00845     adr.ring    = 1;
00846   } else
00847   if (y == 7 || y == 12) {
00848     adr.station = 1;
00849     adr.ring    = 3;
00850   } else
00851   if (y == 8 || y == 11) {
00852     adr.station = 1;
00853     adr.ring    = 2;
00854   } else
00855   if (y == 9 || y == 10) {
00856     adr.station = 1;
00857     adr.ring    = 1;
00858   }
00859 
00860   return true;
00861 
00862 }

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

Definition at line 82 of file CSCDQM_Summary.h.

References detector.

Referenced by CSCMonitorModule::setup(), cscdqm::EventProcessor::updateEfficiencyHistos(), and CSCMonitorModule::updateFracHistos().

00082 { return detector; }

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

Get Efficiency area for the address.

Parameters:
adr Address
Returns:
Area in eta/phi space

Definition at line 664 of file CSCDQM_Summary.cc.

References cscdqm::Detector::Area(), cscdqm::AddressMask::cfeb, cscdqm::AddressMask::chamber, detector, GetReportingArea(), cscdqm::AddressMask::hv, cscdqm::AddressMask::layer, cscdqm::Address::mask, cscdqm::AddressMask::ring, cscdqm::AddressMask::side, cscdqm::Address::station, and cscdqm::AddressMask::station.

00664                                                          {
00665   double all_area = 1;
00666 
00667   if(adr.mask.side == adr.mask.ring == adr.mask.chamber == adr.mask.layer == adr.mask.cfeb == adr.mask.hv == false && adr.mask.station == true)
00668     all_area = detector.Area(adr.station);
00669   else
00670     all_area = detector.Area(adr);
00671 
00672   double rep_area = GetReportingArea(adr);
00673   return rep_area / all_area;
00674 }

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

Get Efficiency area for the station.

Parameters:
station Station number 1..4
Returns:
Reporting Area for the Station

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

00648                                                                         {
00649   if (station <= 0 || station > N_STATIONS) return 0.0;
00650 
00651   Address adr;
00652   adr.mask.side = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
00653   adr.station   = true;
00654   adr.station   = station;
00655 
00656   return GetEfficiencyArea(adr);
00657 }

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

Get efficiency of the detector part supplied by the address.

Parameters:
adr Address to watch efficiency for
Returns:
Subdetector efficiency rate (0..1)

Definition at line 591 of file CSCDQM_Summary.cc.

References cscdqm::Address::cfeb, cscdqm::AddressMask::cfeb, cscdqm::Address::chamber, cscdqm::AddressMask::chamber, detector, GetEfficiencyHW(), GetValue(), cscdqm::AddressMask::hv, cscdqm::Address::hv, HWSTATUSANYERROR, cscdqm::AddressMask::layer, cscdqm::Address::layer, cscdqm::Address::mask, N_LAYERS, N_SIDES, N_STATIONS, cscdqm::Detector::NumberOfChamberCFEBs(), cscdqm::Detector::NumberOfChamberHVs(), cscdqm::Detector::NumberOfChambers(), cscdqm::Detector::NumberOfRings(), cscdqm::AddressMask::ring, cscdqm::Address::ring, cscdqm::Address::side, cscdqm::AddressMask::side, cscdqm::Address::station, cscdqm::AddressMask::station, StDecayID::status, and sum().

00591                                                        { 
00592   double sum = 0.0;
00593 
00594   if (!adr.mask.side) {
00595     adr.mask.side = true;
00596     for (adr.side = 1; adr.side <= N_SIDES; adr.side++) sum += GetEfficiencyHW(adr);
00597     return sum / N_SIDES;
00598   }
00599 
00600   if (!adr.mask.station) {
00601     adr.mask.station = true;
00602     for (adr.station = 1; adr.station <= N_STATIONS; adr.station++) sum += GetEfficiencyHW(adr);
00603     return sum / N_STATIONS;
00604   } 
00605 
00606   if (!adr.mask.ring) {
00607     adr.mask.ring = true;
00608     for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++) sum += GetEfficiencyHW(adr);
00609     return sum / detector.NumberOfRings(adr.station);
00610   }
00611 
00612   if (!adr.mask.chamber) {
00613     adr.mask.chamber = true;
00614     for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++) sum += GetEfficiencyHW(adr);
00615     return sum / detector.NumberOfChambers(adr.station, adr.ring);
00616   }
00617 
00618   if (!adr.mask.layer) {
00619     adr.mask.layer = true;
00620     for (adr.layer = 1; adr.layer <= N_LAYERS; adr.layer++) sum += GetEfficiencyHW(adr);
00621     return sum / N_LAYERS;
00622   }
00623 
00624   if (!adr.mask.cfeb) {
00625     adr.mask.cfeb = true;
00626     for (adr.cfeb = 1; adr.cfeb <= detector.NumberOfChamberCFEBs(adr.station, adr.ring); adr.cfeb++) sum += GetEfficiencyHW(adr);
00627     return sum / detector.NumberOfChamberCFEBs(adr.station, adr.ring);
00628   }
00629 
00630   if (!adr.mask.hv) {
00631     adr.mask.hv = true;
00632     for (adr.hv = 1; adr.hv <= detector.NumberOfChamberHVs(adr.station, adr.ring); adr.hv++) sum += GetEfficiencyHW(adr);
00633     return sum / detector.NumberOfChamberHVs(adr.station, adr.ring);
00634   }
00635 
00636   // if not error - then OK!
00637   HWStatusBitSet status = GetValue(adr); 
00638   if (HWSTATUSANYERROR(status)) return 0.0;
00639   return 1.0;
00640 
00641 }

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

Get efficiency of the station.

Parameters:
@return Detector efficiency rate (0..1)

Definition at line 570 of file CSCDQM_Summary.cc.

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

00570                                                                       {
00571 
00572   Address adr;
00573   adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
00574 
00575   if (station > 0 && station <= N_STATIONS) {
00576     adr.mask.station = true;
00577     adr.station = station;
00578   } else {
00579     return 0.0;
00580   }
00581 
00582   return GetEfficiencyHW(adr);
00583 
00584 }

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

Get efficiency of the whole detector.

Parameters:
@return Detector efficiency rate (0..1)

Definition at line 557 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(), cscdqm::EventProcessor::updateEfficiencyHistos(), and CSCMonitorModule::updateFracHistos().

00557                                             {
00558 
00559   Address adr;
00560   adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
00561   return GetEfficiencyHW(adr);
00562 
00563 }

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

Calculate the reporting area for the address.

Parameters:
adr Address to calculate
Returns:
Area in eta/phi space

Definition at line 681 of file CSCDQM_Summary.cc.

References cscdqm::Detector::Area(), cscdqm::Address::cfeb, cscdqm::AddressMask::cfeb, cscdqm::Address::chamber, cscdqm::AddressMask::chamber, detector, GetValue(), cscdqm::AddressMask::hv, cscdqm::Address::hv, HWSTATUSANYERROR, cscdqm::AddressMask::layer, cscdqm::Address::mask, N_SIDES, N_STATIONS, cscdqm::Detector::NumberOfChamberCFEBs(), cscdqm::Detector::NumberOfChamberHVs(), cscdqm::Detector::NumberOfChambers(), cscdqm::Detector::NumberOfRings(), cscdqm::AddressMask::ring, cscdqm::Address::ring, cscdqm::Address::side, cscdqm::AddressMask::side, cscdqm::Address::station, cscdqm::AddressMask::station, StDecayID::status, and sum().

Referenced by GetEfficiencyArea().

00681                                                         { 
00682   double sum = 0.0;
00683 
00684   if (!adr.mask.side) {
00685     adr.mask.side = true;
00686     for (adr.side = 1; adr.side <= N_SIDES; adr.side++) sum += GetReportingArea(adr);
00687     return sum;
00688   }
00689 
00690   if (!adr.mask.station) {
00691     adr.mask.station = true;
00692     for (adr.station = 1; adr.station <= N_STATIONS; adr.station++) sum += GetReportingArea(adr);
00693     return sum;
00694   } 
00695 
00696   if (!adr.mask.ring) {
00697     adr.mask.ring = true;
00698     for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++) sum += GetReportingArea(adr);
00699     return sum;
00700   }
00701 
00702   if (!adr.mask.chamber) {
00703     adr.mask.chamber = true;
00704     for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++) sum += GetReportingArea(adr);
00705     return sum;
00706   }
00707 
00708   if (!adr.mask.cfeb) {
00709     adr.mask.cfeb = true;
00710     for (adr.cfeb = 1; adr.cfeb <= detector.NumberOfChamberCFEBs(adr.station, adr.ring); adr.cfeb++) sum += GetReportingArea(adr);
00711     return sum;
00712   }
00713 
00714   if (!adr.mask.hv) {
00715     adr.mask.hv = true;
00716     for (adr.hv = 1; adr.hv <= detector.NumberOfChamberHVs(adr.station, adr.ring); adr.hv++) sum += GetReportingArea(adr);
00717     return sum;
00718   }
00719 
00720   adr.mask.layer = false;
00721    
00722   // NOT errorous! 
00723   HWStatusBitSet status = GetValue(adr);
00724   if (!HWSTATUSANYERROR(status)) {
00725     return detector.Area(adr);
00726   }
00727   return 0.0;
00728 
00729 }

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

Get value of some address.

Parameters:
adr Address of atomic element to return value from
Returns:
Value of the requested element

Definition at line 735 of file CSCDQM_Summary.cc.

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

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

00735                                                         {
00736 
00737   HWStatusBitSet state;
00738   state.reset();
00739 
00740   if (!adr.mask.side) {
00741     adr.mask.side = true;
00742     for (adr.side = 1; adr.side <= N_SIDES; adr.side++) state |= GetValue(adr);
00743     return state;
00744   }
00745 
00746   if (!adr.mask.station) {
00747     adr.mask.station = true;
00748     for (adr.station = 1; adr.station <= N_STATIONS; adr.station++) state |= GetValue(adr);
00749     return state;
00750   } 
00751 
00752   if (!adr.mask.ring) {
00753     adr.mask.ring = true;
00754     for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++) state |= GetValue(adr);
00755     return state;
00756   }
00757 
00758   if (!adr.mask.chamber) {
00759     adr.mask.chamber = true;
00760     for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++) state |= GetValue(adr);
00761     return state;
00762   }
00763 
00764   if (!adr.mask.layer) {
00765     adr.mask.layer = true;
00766     for (adr.layer = 1; adr.layer <= N_LAYERS; adr.layer++) state |= GetValue(adr);
00767     return state;
00768   }
00769 
00770   if (!adr.mask.cfeb) {
00771     adr.mask.cfeb = true;
00772     for (adr.cfeb = 1; adr.cfeb <= detector.NumberOfChamberCFEBs(adr.station, adr.ring); adr.cfeb++) state |= GetValue(adr);
00773     return state;
00774   }
00775 
00776   if (!adr.mask.hv) {
00777     adr.mask.hv = true;
00778     for (adr.hv = 1; adr.hv <= detector.NumberOfChamberHVs(adr.station, adr.ring); adr.hv++) state |= GetValue(adr);
00779     return state;
00780   }
00781 
00782   return map[adr.side - 1][adr.station - 1][adr.ring - 1][adr.chamber - 1][adr.layer - 1][adr.cfeb - 1][adr.hv - 1];
00783 
00784 }

const int cscdqm::Summary::IsPhysicsReady ( const unsigned int  px,
const unsigned int  py 
)

Check if the current eta/phi polygon has at least 2 active HW elements in the area.

Parameters:
xmin Eta min coordinate of the polygon
xmax Eta max coordinate of the polygon
ymin Phi min coordinate of the polygon
ymax Phi max coordinate of the polygon
Returns:
1 if this polygon is ok for physics and reporting, 0 - if it is ok but does not report, -1 - otherwise

Definition at line 520 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, StDecayID::status, and parsecf::pyparsing::test().

Referenced by WriteMap().

00520                                                                               {
00521 
00522   AddressBox *box;
00523 
00524   HWStatusBitSet status[N_STATIONS];
00525 
00526   unsigned int i = 0;
00527   while(detector.NextAddressBoxByPartition(i, px, py, box)) {
00528     status[box->adr.station - 1] |= GetValue(box->adr);
00529   }
00530 
00531   unsigned int cdata = 0, cerror = 0, cmask = 0;
00532   for (unsigned int i = 0; i < N_STATIONS; i++) {
00533     if (HWSTATUSANYERROR(status[i])) {
00534       cerror++;
00535     } else {
00536       if (status[i].test(MASKED)) cmask++;
00537       if (status[i].test(DATA)) cdata++;
00538     }
00539   }
00540 
00541   // If at least 2 stations with data and without errors = OK
00542   if (cdata > 1)  return 1;
00543   // Else, if at least one station errorous = ERROR
00544   if (cerror > 0) return -1;
00545   // Else, if at least one station masked = MASKED
00546   if (cmask > 0)  return 2;
00547   // Else, not sufficient data = OK
00548   return 0;
00549 
00550 }

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:
evs Histogram for number of events (total)
err Histogram for number of errors
bit Error bit to set
eps_max Maximum tolerance of errors (rate)
Sfail Significance threshold for failure report
Returns:

Definition at line 233 of file CSCDQM_Summary.cc.

References ChamberCoordsToAddress(), int, LOG_WARN, N, n, ReSetValue(), SetValue(), SignificanceLevel(), x, and y.

Referenced by cscdqm::EventProcessor::updateEfficiencyHistos(), and CSCMonitorModule::updateFracHistos().

00233                                                                                                                                  {
00234 
00235   if(evs->GetXaxis()->GetXmin() <= 1 && evs->GetXaxis()->GetXmax() >= 36 &&
00236      evs->GetYaxis()->GetXmin() <= 1 && evs->GetYaxis()->GetXmax() >= 18 &&
00237      err->GetXaxis()->GetXmin() <= 1 && err->GetXaxis()->GetXmax() >= 36 &&
00238      err->GetYaxis()->GetXmin() <= 1 && err->GetYaxis()->GetXmax() >= 18) {
00239 
00240     Address adr;
00241     unsigned int N = 0, n = 0; 
00242 
00243     for(unsigned int x = 1; x <= 36; x++) {
00244       for(unsigned int y = 1; y <= 18; y++) {
00245         N = int(evs->GetBinContent(x, y));
00246         n = int(err->GetBinContent(x, y));
00247         if (ChamberCoordsToAddress(x, y, adr)) {
00248           double eps_meas = (1.0 * n) / (1.0 * N);
00249           if (eps_meas > eps_max) { 
00250             if(SignificanceLevel(N, n, eps_max) > Sfail) { 
00251               SetValue(adr, bit);
00252             } else {
00253               ReSetValue(adr, bit);
00254             }
00255           }
00256         }
00257       }
00258     }
00259   } else {
00260     LOG_WARN << "cscdqm::Summary.ReadErrorChambers routine. Wrong histogram dimensions!";
00261   }
00262 }

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

Read Reporting Chamber histogram and fill in detector map.

Parameters:
h2 Histogram to read
Returns:

Definition at line 72 of file CSCDQM_Summary.cc.

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

Referenced by cscdqm::EventProcessor::updateEfficiencyHistos(), and CSCMonitorModule::updateFracHistos().

00072                                                                           {
00073 
00074   if(h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >= 36 &&
00075      h2->GetYaxis()->GetXmin() <= 1 && h2->GetYaxis()->GetXmax() >= 18) {
00076 
00077     Address adr;
00078     double z = 0.0;
00079 
00080     for(unsigned int x = 1; x <= 36; x++) {
00081       for(unsigned int y = 1; y <= 18; y++) {
00082         z = h2->GetBinContent(x, y);
00083         if(ChamberCoordsToAddress(x, y, adr)) {
00084           if(z >= threshold) {
00085             SetValue(adr, DATA);
00086           } else {
00087             ReSetValue(adr, DATA);
00088           }
00089         }
00090       }
00091     }
00092   } else {
00093     LOG_WARN << "cscdqm::Summary.ReadReportingChambers routine. Wrong histogram dimensions!";
00094   }
00095 }

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:
h2 Histogram to read
refh2 Reference histogram of hit occupancies
eps_min Minimum tolerance of difference (rate)
Sfail Significance threshold for failure report
Returns:

Definition at line 106 of file CSCDQM_Summary.cc.

References ChamberCoordsToAddress(), cscdqm::COLD, cscdqm::DATA, cscdqm::HOT, int, LOG_WARN, N, n, funct::num(), funct::pow(), ReSetValue(), SetValue(), SignificanceLevel(), SignificanceLevelHot(), x, and y.

Referenced by cscdqm::EventProcessor::updateEfficiencyHistos(), and CSCMonitorModule::updateFracHistos().

00106                                                                                                                                                                         {
00107 
00108   if(h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >= 36 &&
00109      h2->GetYaxis()->GetXmin() <= 1 && h2->GetYaxis()->GetXmax() >= 18 &&
00110      refh2->GetXaxis()->GetXmin() <= 1 && refh2->GetXaxis()->GetXmax() >= 36 &&
00111      refh2->GetYaxis()->GetXmin() <= 1 && refh2->GetYaxis()->GetXmax() >= 18) {
00112 
00113     // Rate Factor calculation
00114     double num = 1.0, denum = 1.0;
00115     for(unsigned int x = 1; x <= 36; x++) {
00116       for(unsigned int y = 1; y <= 18; y++) {
00117         double Nij = h2->GetBinContent(x, y);
00118         double Nrefij = refh2->GetBinContent(x, y);
00119         if (Nij > 0) {
00120           num += Nrefij;
00121           denum += pow(Nrefij, 2.0) / Nij;
00122         }
00123       }
00124     }
00125     double factor = num / denum, eps_meas = 0.0;
00126 
00127     Address adr;
00128     unsigned int N = 0, n = 0;
00129 
00130     for(unsigned int x = 1; x <= 36; x++) {
00131       for(unsigned int y = 1; y <= 18; y++) {
00132         
00133         N = int(refh2->GetBinContent(x, y) * factor);
00134         n = int(h2->GetBinContent(x, y));
00135 
00136         if(ChamberCoordsToAddress(x, y, adr)) {
00137           
00138           // Reset some bits
00139           ReSetValue(adr, HOT);
00140           ReSetValue(adr, COLD);
00141 
00142           /*
00143           std::cout << "adr = " << detector.AddressName(adr);
00144           std::cout << ", x = " << x << ", y = " << y;
00145           std::cout << ", value = " << GetValue(adr);
00146           std::cout << ", refh2 = " << refh2->GetBinContent(x, y);
00147           std::cout << ", factor = " << factor;
00148           std::cout << ", N = " << N;
00149           std::cout << ", n = " << n;
00150           std::cout << ", num = " << num;
00151           std::cout << ", denum = " << denum;
00152           std::cout << "\n";
00153           */
00154 
00155           if (n == 0) {
00156             ReSetValue(adr, DATA);
00157           } else {
00158             SetValue(adr, DATA);
00159           }
00160 
00161           if (N > 0) {
00162 
00163             eps_meas = (1.0 * n) / (1.0 * N);
00164             double S = 0;
00165 
00166             // Chamber is cold? It means error!
00167             if (eps_meas < cold_coef) {
00168 
00169               S = SignificanceLevel(N, n, cold_coef);
00170 
00171               if (S > cold_Sfail) {
00172 
00173                 /*
00174                 std::cout << "!COLD!";
00175                 std::cout << "adr = " << detector.AddressName(adr);
00176                 std::cout << ", n = " << n << ", N = " << N;
00177                 std::cout << ", eps_meas = " << eps_meas;
00178                 std::cout << ", cold_coef = " << cold_coef;
00179                 std::cout << ", cold_Sfail = " << cold_Sfail;
00180                 std::cout << ", S = " << S;
00181                 std::cout << "\n";
00182                 */
00183 
00184                 SetValue(adr, COLD);
00185               }
00186             } else {
00187             
00188               // Chamber is hot? It means error!
00189               if (eps_meas > hot_coef) {
00190 
00191                 S = SignificanceLevelHot(N, n);
00192 
00193                 if (S > hot_Sfail) {
00194 
00195                   /*
00196                   std::cout << "!HOT!";
00197                   std::cout << "adr = " << detector.AddressName(adr);
00198                   std::cout << ", n = " << n << ", N = " << N;
00199                   std::cout << ", eps_meas = " << eps_meas;
00200                   std::cout << ", hot_coef = " << hot_coef;
00201                   std::cout << ", hot_Sfail = " << hot_Sfail;
00202                   std::cout << ", S = " << S;
00203                   std::cout << "\n";
00204                   */
00205 
00206                   SetValue(adr, HOT);
00207                 }
00208               }
00209             }
00210 
00211 
00212           }
00213 
00214         }
00215 
00216       }
00217     }
00218 
00219   } else {
00220     LOG_WARN << "cscdqm::Summary.ReadReportingChambersRef routine. Wrong histogram dimensions!";
00221   }
00222 }

void cscdqm::Summary::Reset (  ) 

Resets all detector map.

Returns:

Definition at line 48 of file CSCDQM_Summary.cc.

References cscdqm::Address::cfeb, cscdqm::AddressMask::cfeb, cscdqm::Address::chamber, cscdqm::AddressMask::chamber, cscdqm::AddressMask::hv, cscdqm::Address::hv, HWSTATUSBITSETSIZE, cscdqm::AddressMask::layer, cscdqm::Address::mask, N_CFEBS, N_CHAMBERS, N_HVS, N_RINGS, ReSetValue(), cscdqm::AddressMask::ring, cscdqm::Address::ring, cscdqm::AddressMask::side, and cscdqm::AddressMask::station.

Referenced by Summary().

00048                     {
00049   Address adr;
00050 
00051   // Setting Zeros (no data) for each HW element (and beyond)
00052   adr.mask.side = adr.mask.station = adr.mask.layer = false;
00053   adr.mask.ring = adr.mask.chamber = adr.mask.cfeb = adr.mask.hv = true;
00054   for (adr.ring = 1; adr.ring <= N_RINGS; adr.ring++) { 
00055     for (adr.chamber = 1; adr.chamber <= N_CHAMBERS; adr.chamber++) {
00056        for (adr.cfeb = 1; adr.cfeb <= N_CFEBS; adr.cfeb++) {
00057           for (adr.hv = 1; adr.hv <= N_HVS; adr.hv++) {
00058             for (unsigned int bit = 0; bit < HWSTATUSBITSETSIZE; bit++) { 
00059               ReSetValue(adr, (HWStatusBit) bit);
00060             }
00061           }
00062        }
00063     }
00064   }
00065 }

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

ReSet value recursivelly by following the supplied address.

Parameters:
adr Address to be updated
bit Status bit to set
Returns:

Definition at line 433 of file CSCDQM_Summary.cc.

References SetValue().

00433                                                            {
00434   SetValue(adr, bit, 0);
00435 }

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

ReSetValue for the whole of detector.

Parameters:
bit Status bit to set
Returns:

Definition at line 423 of file CSCDQM_Summary.cc.

References SetValue().

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

00423                                               {
00424   SetValue(bit, 0);
00425 }

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

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

Parameters:
tokens Vector 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, r, and SetValue().

Referenced by CSCMonitorModule::CSCMonitorModule().

00791                                                                             {
00792   unsigned int applied = 0;
00793   for (unsigned int r = 0; r < tokens.size(); r++) {
00794     std::string token = (std::string) tokens.at(r);
00795     Address adr;
00796     if (detector.AddressFromString(token, adr)) {
00797       SetValue(adr, MASKED);
00798       applied++; 
00799     }
00800   }
00801   return applied;
00802 }

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

Set value recursivelly by following the supplied address.

Parameters:
adr Address to be updated
bit Status bit to set
value Value to be set
Returns:

Definition at line 456 of file CSCDQM_Summary.cc.

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

00456                                                                           {
00457 
00458   if (!adr.mask.side) {
00459     adr.mask.side = true;
00460     for (adr.side = 1; adr.side <= N_SIDES; adr.side++) SetValue(adr, bit, value);
00461     return;
00462   }
00463 
00464   if (!adr.mask.station) {
00465     adr.mask.station = true;
00466     for (adr.station = 1; adr.station <= N_STATIONS; adr.station++) SetValue(adr, bit, value);
00467     return;
00468   }
00469 
00470   if (!adr.mask.ring) {
00471     adr.mask.ring = true;
00472     for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++) SetValue(adr, bit, value);
00473     return;
00474   }
00475 
00476   if (!adr.mask.chamber) {
00477     adr.mask.chamber = true;
00478     for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++) SetValue(adr, bit, value);
00479     return;
00480   }
00481 
00482   if (!adr.mask.layer) {
00483     adr.mask.layer = true;
00484     for (adr.layer = 1; adr.layer <= N_LAYERS; adr.layer++) SetValue(adr, bit, value);
00485     return;
00486   }
00487 
00488   if (!adr.mask.cfeb) {
00489     adr.mask.cfeb = true;
00490     for (adr.cfeb = 1; adr.cfeb <= detector.NumberOfChamberCFEBs(adr.station, adr.ring); adr.cfeb++) SetValue(adr, bit, value);
00491     return;
00492   }
00493 
00494   if (!adr.mask.hv) {
00495     adr.mask.hv = true;
00496     for (adr.hv = 1; adr.hv <= detector.NumberOfChamberHVs(adr.station, adr.ring); adr.hv++) SetValue(adr, bit, value);
00497     return;
00498   }
00499 
00500   if( adr.side > 0 && adr.side <= N_SIDES && adr.station > 0 && adr.station <= N_STATIONS && 
00501       adr.ring > 0 && adr.ring <= N_RINGS && adr.chamber > 0 && adr.chamber <= N_CHAMBERS && 
00502       adr.layer > 0 && adr.layer <= N_LAYERS && adr.cfeb > 0 && adr.cfeb <= N_CFEBS && adr.hv > 0 && adr.hv <= N_HVS) {
00503 
00504     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);
00505 
00506   }
00507 
00508 }

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

SetValue for the whole of detector.

Parameters:
bit Status bit to set
value Value to set
Returns:

Definition at line 443 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(), and SetValue().

00443                                                              {
00444   Address adr;
00445   adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
00446   SetValue(adr, bit, value);
00447 }

const double cscdqm::Summary::SignificanceLevel ( const unsigned int  N,
const unsigned int  n,
const double  eps 
) const [private]

Calculate error significance alpha for the given number of errors.

Parameters:
N Number of events
n Number of errors
eps Rate of tolerance
Returns:
Significance level

Definition at line 932 of file CSCDQM_Summary.cc.

References a, b, funct::log(), r, and funct::sqrt().

Referenced by ReadErrorChambers(), and ReadReportingChambersRef().

00932                                                                                                           {
00933 
00934   //std::cout << "N = " << N << ", n = " << n << ", eps = " << eps << "\n";
00935 
00936   double l_eps = eps;
00937   if (l_eps <= 0.0) l_eps = 0.000001;
00938   if (l_eps >= 1.0) l_eps = 0.999999;
00939 
00940   double eps_meas = (1.0 * n) / (1.0 * N);
00941   double a = 1.0, b = 1.0;
00942 
00943   if (n > 0) {
00944     for (unsigned int r = 0; r < n; r++) a = a * (eps_meas / l_eps);
00945   }
00946 
00947   if (n < N) {
00948     for (unsigned int r = 0; r < (N - n); r++) b = b * (1 - eps_meas) / (1 - l_eps);
00949   }
00950 
00951   return sqrt(2.0 * log(a * b));
00952 
00953 }

const double cscdqm::Summary::SignificanceLevelHot ( const unsigned int  N,
const unsigned int  n 
) const [private]

Calculate error significance alpha for the given number of events based on reference number of errors for "hot" elements: actual number of events have to be larger then the reference.

Parameters:
N number of reference events
n number of actual events
Returns:
error significance

Definition at line 963 of file CSCDQM_Summary.cc.

References funct::log(), and funct::sqrt().

Referenced by ReadReportingChambersRef().

00963                                                                                            {
00964   if (N > n) return 0.0;
00965   // no - n observed, ne - n expected
00966   double no = 1.0 * n, ne = 1.0 * N;
00967   return sqrt(2.0 * (no * (log(no / ne) - 1) + ne));
00968 }

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:
h1 Histogram to write data to
adr.station adr.station number (0-3) to write data for
Returns:

Definition at line 270 of file CSCDQM_Summary.cc.

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

Referenced by cscdqm::EventProcessor::updateEfficiencyHistos(), and CSCMonitorModule::updateFracHistos().

00270                                                               {
00271   const AddressBox* box;
00272   Address adr, tadr;
00273   float area_all = 0.0, area_rep = 0.0;
00274 
00275   if(station < 1 || station > N_STATIONS) return; 
00276 
00277   adr.mask.side = adr.mask.ring = adr.mask.chamber = adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
00278   adr.mask.station = true;
00279   adr.station = station;
00280 
00281   unsigned int i = 0;
00282 
00283   while (detector.NextAddressBox(i, box, adr)) { 
00284 
00285     unsigned int x = 1 + (box->adr.side - 1) * 9 + (box->adr.ring - 1) * 3 + (box->adr.hv - 1);
00286     unsigned int y = 1 + (box->adr.chamber - 1) * 5 + (box->adr.cfeb - 1);
00287 
00288     tadr = box->adr;
00289     HWStatusBitSet status = GetValue(tadr);
00290 
00291     float area_box = fabs((box->xmax - box->xmin) * (box->ymax - box->ymin));
00292     area_all += area_box;
00293 
00294     if (HWSTATUSANYERROR(status)) {
00295       h2->SetBinContent(x, y, -1.0);
00296     } else {
00297       area_rep += area_box;
00298       if (status.test(DATA)) {
00299         h2->SetBinContent(x, y, 1.0);
00300       } else {
00301         h2->SetBinContent(x, y, 0.0);
00302       }
00303     }
00304 
00305   }
00306 
00307   TString title = Form("ME%d Status: Physics Efficiency %.2f%%", station, (area_rep / area_all) * 100.0);
00308   h2->SetTitle(title);
00309 
00310 }

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:
h2 histogram to write to
mask mask of errors to check while writing
value to write to if state fits mask
reset should all chamber states be reseted to 0?
Returns:

Definition at line 384 of file CSCDQM_Summary.cc.

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

Referenced by cscdqm::EventProcessor::updateEfficiencyHistos(), and CSCMonitorModule::updateFracHistos().

00384                                                                                                                     {
00385 
00386   if(h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >= 36 &&
00387      h2->GetYaxis()->GetXmin() <= 1 && h2->GetYaxis()->GetXmax() >= 18) {
00388 
00389     unsigned int x, y;
00390     Address adr;
00391 
00392     adr.mask.side = adr.mask.station = adr.mask.ring = adr.mask.chamber = true;
00393     adr.mask.layer = adr.mask.cfeb = adr.mask.hv = false;
00394 
00395     for (adr.side = 1; adr.side <= N_SIDES; adr.side++) {
00396       for (adr.station = 1; adr.station <= N_STATIONS; adr.station++) {
00397         for (adr.ring = 1; adr.ring <= detector.NumberOfRings(adr.station); adr.ring++) {
00398           for (adr.chamber = 1; adr.chamber <= detector.NumberOfChambers(adr.station, adr.ring); adr.chamber++) {
00399             if (ChamberAddressToCoords(adr, x, y)) {
00400               bool hit = (op_any ? HWSTATUSANY(GetValue(adr), mask) : HWSTATUSEQUALS(GetValue(adr), mask));
00401               if (hit) {
00402                 h2->SetBinContent(x, y, 1.0 * value);
00403               } else if (reset) {
00404                 h2->SetBinContent(x, y, 0.0);
00405               }
00406             }
00407           }
00408         }
00409       }
00410     }
00411 
00412   } else {
00413     LOG_WARN << "cscdqm::Summary.WriteChamberState routine. Wrong histogram dimensions!";
00414   }
00415 
00416 }

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

Write PhysicsReady Map to H2 histogram.

Parameters:
h2 Histogram to write map to
Returns:

Definition at line 317 of file CSCDQM_Summary.cc.

References IsPhysicsReady(), LOG_WARN, NTICS, indexGen::title, value, x, y, gen_jpsi2muons_cfg::ymax, and gen_jpsi2muons_cfg::ymin.

Referenced by cscdqm::EventProcessor::updateEfficiencyHistos(), and CSCMonitorModule::updateFracHistos().

00317                                {
00318 
00319   unsigned int rep_el = 0, csc_el = 0;
00320 
00321   if(h2->GetXaxis()->GetXmin() <= 1 && h2->GetXaxis()->GetXmax() >= NTICS &&
00322      h2->GetYaxis()->GetXmin() <= 1 && h2->GetYaxis()->GetXmax() >= NTICS) {
00323 
00324     float xd = 5.0 / NTICS, yd = 1.0 * (2.0 * 3.14159) / NTICS;
00325 
00326     float xmin, xmax, ymin, ymax;
00327 
00328     for(unsigned int x = 0; x < NTICS; x++) {
00329 
00330       xmin = -2.5 + xd * x;
00331       xmax = xmin + xd;
00332 
00333       for(unsigned int y = 0; y < NTICS; y++) {
00334 
00335         double value = 0.0; 
00336 
00337         if (xmin == -2.5 || xmax == 2.5) continue;
00338         if (xmin >= -1 && xmax <= 1)     continue;
00339 
00340         ymin = yd * y;
00341         ymax = ymin + yd;
00342 
00343         switch(IsPhysicsReady(x, y)) {
00344           case -1:
00345             value = -1.0;
00346             break;
00347           case 0:
00348             value = 0.0;
00349             rep_el++;
00350             break;
00351           case 1:
00352             value = 1.0;
00353             rep_el++;
00354             break;
00355           case 2:
00356             value = 2.0;
00357             rep_el++;
00358         }
00359 
00360         h2->SetBinContent(x + 1, y + 1, value);
00361         csc_el++;
00362 
00363       }
00364     }
00365 
00366   } else {
00367     LOG_WARN << "cscdqm::Summary.WriteMap routine. Wrong histogram dimensions!";
00368   }
00369 
00370   TString title = Form("EMU Status: Physics Efficiency %.2f%%", (csc_el == 0 ? 0.0 : (1.0 * rep_el) / csc_el) * 100.0);
00371   h2->SetTitle(title);
00372 
00373 }


Member Data Documentation

Detector cscdqm::Summary::detector [private]

Definition at line 122 of file CSCDQM_Summary.h.

Referenced by getDetector(), GetEfficiencyArea(), GetEfficiencyHW(), GetReportingArea(), GetValue(), IsPhysicsReady(), setMaskedHWElements(), SetValue(), Write(), and WriteChamberState().

HWStatusBitSet cscdqm::Summary::map[N_SIDES][N_STATIONS][N_RINGS][N_CHAMBERS][N_LAYERS][N_CFEBS][N_HVS] [private]

Definition at line 118 of file CSCDQM_Summary.h.

Referenced by GetValue(), and SetValue().

std::vector<Address*> cscdqm::Summary::masked [private]

Definition at line 120 of file CSCDQM_Summary.h.

Referenced by ~Summary().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:36:57 2009 for CMSSW by  doxygen 1.5.4