CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/DQM/CSCMonitorModule/interface/CSCDQM_Summary.h

Go to the documentation of this file.
00001 /*
00002  * =====================================================================================
00003  *
00004  *       Filename:  Summary.h
00005  *
00006  *    Description:  CSC summary map and appropriate functions.
00007  *
00008  *        Version:  1.0
00009  *        Created:  05/19/2008 10:52:21 AM
00010  *       Revision:  none
00011  *       Compiler:  gcc
00012  *
00013  *         Author:  Valdas Rapsevicius (VR), Valdas.Rapsevicius@cern.ch
00014  *        Company:  CERN, CH
00015  *
00016  * =====================================================================================
00017  */
00018 
00019 #ifndef CSCDQM_Summary_H
00020 #define CSCDQM_Summary_H
00021 
00022 #include <TH2.h>
00023 #include <math.h>
00024 #include <vector>
00025 #include <bitset>
00026 #include <iostream>
00027 
00028 #include "DQM/CSCMonitorModule/interface/CSCDQM_Detector.h"
00029 #include "DQM/CSCMonitorModule/interface/CSCDQM_Logger.h"
00030 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
00031 
00032 #define HWSTATUSBITSETSIZE    14
00033 #define HWSTATUSERRORBITS     0xffc
00034 #define HWSTATUSEQUALS(s, m)  (((std::bitset<HWSTATUSBITSETSIZE>) m & s) == m)
00035 #define HWSTATUSANY(s, m)     (((std::bitset<HWSTATUSBITSETSIZE>) m & s).any())
00036 #define HWSTATUSANYERROR(s)   (HWSTATUSANY(s, HWSTATUSERRORBITS))
00037 
00038 #define NTICS                 100
00039 
00040 namespace cscdqm {
00041 
00045 enum HWStatusBit {
00046 
00047   DATA,         
00048   MASKED,       
00049 
00050   HOT,          
00051   COLD,         
00052 
00053   FORMAT_ERR,   
00054   L1SYNC_ERR,   
00055   FIFOFULL_ERR, 
00056   INPUTTO_ERR,  
00057 
00058   NODATA_ALCT,  
00059   NODATA_CLCT,  
00060   NODATA_CFEB,  
00061   CFEB_BWORDS,  
00062 
00063   STANDBY,      
00064   WAS_ON        
00065 
00066 };
00067 
00072 typedef std::bitset<HWSTATUSBITSETSIZE> HWStatusBitSet;
00073 
00078 class Summary {
00079 
00080   public:
00081 
00082     Summary();
00083     ~Summary();
00084 
00085     void Reset();
00086 
00087     const Detector getDetector() const { return detector; }
00088 
00089     void ReadReportingChambers(const TH2*& h2, const double threshold = 1.0);
00090     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);
00091     void ReadErrorChambers(const TH2*& evs, const TH2*& err, const HWStatusBit bit, const double eps_max = 0.1, const double Sfail = 5.0);
00092 
00093     const unsigned int setMaskedHWElements(std::vector<std::string>& tokens);
00094 
00095     void Write(TH2*& h2, const unsigned int station) const;
00096     void WriteMap(TH2*& h2);
00097     void WriteChamberState(TH2*& h2, const int mask, const int value = 1, const bool reset = true, const bool op_any = false) const;
00098 
00099     void ReSetValue(const HWStatusBit bit);
00100     void ReSetValue(Address adr, const HWStatusBit bit);
00101     void SetValue(const HWStatusBit bit, const int value = 1);
00102     void SetValue(Address adr, const HWStatusBit bit, const int value = 1);
00103 
00104     const HWStatusBitSet GetValue(Address adr) const;
00105     const int IsPhysicsReady(const unsigned int px, const unsigned int py);
00106     //const int IsPhysicsReady(const float xmin, const float xmax, const float ymin, const float ymax) const;
00107 
00108     const double GetEfficiencyHW() const;
00109     const double GetEfficiencyHW(const unsigned int station) const;
00110     const double GetEfficiencyHW(Address adr) const; 
00111     const double GetEfficiencyArea(const unsigned int station) const; 
00112     const double GetEfficiencyArea(Address adr) const; 
00113 
00114     bool isChamberStandby(unsigned int side, unsigned int station, unsigned int ring, unsigned int chamber) const;
00115     bool isChamberStandby(CSCDetId cid) const;
00116 
00117   private:
00118 
00119     const bool ChamberCoordsToAddress(const unsigned int x, const unsigned int y, Address& adr) const;
00120     const bool ChamberAddressToCoords(const Address& adr, unsigned int& x, unsigned int& y) const;
00121     const double GetReportingArea(Address adr) const; 
00122 
00124     HWStatusBitSet map[N_SIDES][N_STATIONS][N_RINGS][N_CHAMBERS][N_LAYERS][N_CFEBS][N_HVS];
00125 
00127     Detector detector;
00128 
00129 };
00130 
00131 }
00132 
00133 #endif