CMS 3D CMS Logo

HcalDataFormatMonitor.h

Go to the documentation of this file.
00001 #ifndef DQM_HCALMONITORTASKS_HCALDATAFORMATMONITOR_H
00002 #define DQM_HCALMONITORTASKS_HCALDATAFORMATMONITOR_H
00003 
00004 #define  IETAMIN     -43
00005 #define  IETAMAX      43
00006 #define  IPHIMIN       0
00007 #define  IPHIMAX      71
00008 #define  HBHE_LO_DCC 700
00009 #define  HBHE_HI_DCC 717
00010 #define  HF_LO_DCC   718
00011 #define  HF_HI_DCC   724
00012 #define  HO_LO_DCC   725
00013 #define  HO_HI_DCC   731
00014 #define  NUMDCCS      32
00015 #define  HTRCHANMAX   24
00016 //The four Data Integrity Plots & Arrays
00017 #define  RCDIX        55
00018 #define  RCDIY        22
00019 #define  HHDIX        97
00020 #define  HHDIY        61
00021 #define  CSDIX        97
00022 // CSDIY == HHDIY.
00023 #define  CIX          73
00024 #define  CIY          46
00025 
00026 #include "DQM/HcalMonitorTasks/interface/HcalBaseMonitor.h"
00027 #include "EventFilter/HcalRawToDigi/interface/HcalUnpacker.h"
00028 #include "EventFilter/HcalRawToDigi/interface/HcalHTRData.h"
00029 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
00030 #include "DQMServices/Core/interface/DQMStore.h"
00031 #include "DQMServices/Core/interface/MonitorElement.h"
00032 
00039 class HcalDataFormatMonitor: public HcalBaseMonitor {
00040  public:
00041   HcalDataFormatMonitor();
00042   ~HcalDataFormatMonitor();
00043   
00044   void setup(const edm::ParameterSet& ps, DQMStore* dbe);
00045   //  void setup(const edm::ParameterSet& ps, DQMStore* dbe,const HcalElectronicsMap& emap );
00046   void processEvent(const FEDRawDataCollection& rawraw, const
00047                     HcalUnpackerReport& report, const HcalElectronicsMap& emap);
00048   void unpack(const FEDRawData& raw, const HcalElectronicsMap& emap);
00049   void clearME();
00050   void reset();
00051 
00052   void HTRPrint(const HcalHTRData& htr,int prtlvl);
00053   void labelHTRBits(MonitorElement* mePlot,unsigned int axisType);
00054   void labelthezoo (MonitorElement* zoo);
00055 
00056  public: //Electronics map -> geographic channel map
00057   void smuggleMaps(std::map<uint32_t, std::vector<HcalDetId> >& givenDCCtoCell,
00058                    std::map<pair <int,int> , std::vector<HcalDetId> >& givenHTRtoCell);
00059   std::map<uint32_t, std::vector<HcalDetId> > DCCtoCell;
00060   std::map<uint32_t, std::vector<HcalDetId> > ::iterator thisDCC;
00061   std::map<pair <int,int> , std::vector<HcalDetId> > HTRtoCell;
00062   std::map<pair <int,int> , std::vector<HcalDetId> > ::iterator thisHTR;
00063 
00064  private: 
00065   //backstage accounting mechanisms for the ProblemMap
00066   static size_t iphirange; // = IPHIMAX - IPHIMIN;
00067   static size_t ietarange; // = IETAMAX - IETAMIN;
00068   std::vector<std::vector<bool> > problemhere;  // Whole HCAL
00069   std::vector<std::vector<bool> > problemHB;    //  
00070   std::vector<std::vector<bool> > problemHE;    //  
00071   std::vector<std::vector<bool> > problemHF;    // Includes ZDC?
00072   std::vector<std::vector<bool> > problemHO;    //  
00073   void mapHTRproblem (int dcc, int spigot) ;
00074   void mapDCCproblem(int dcc) ;
00075   void fillzoos(int bin, int dccid);
00076   std::vector<std::vector<uint64_t> > phatmap;  // iphi/ieta projection of all hcal cells
00077   std::vector<std::vector<uint64_t> > HBmap;    // iphi/ieta projection of hb
00078   std::vector<std::vector<uint64_t> > HEmap;    // iphi/ieta projection of he
00079   std::vector<std::vector<uint64_t> > HFmap;    // iphi/ieta projection of hf
00080   std::vector<std::vector<uint64_t> > HOmap;    // iphi/ieta projection of ho
00081   void UpdateMap();
00082 
00083   // Data accessors
00084   vector<int> fedUnpackList_;
00085   vector<int> dccCrate_;
00086   vector<HcalSubdetector> dccSubdet_;
00087   int firstFED_;
00088   int ievt_;
00089   int lastEvtN_;
00090   int lastBCN_;
00091   //   int dccnum_;
00092   //int cratenum_;
00093 
00094   int prtlvl_;
00095   int dfmon_checkNevents;
00096 
00097  private:  //Monitoring elements
00098    
00099   MonitorElement* meEVT_;
00100   MonitorElement* DATAFORMAT_PROBLEM_MAP;
00101   MonitorElement* DATAFORMAT_PROBLEM_ZOO;
00102   MonitorElement* HB_DATAFORMAT_PROBLEM_MAP;
00103   MonitorElement* HBHE_DATAFORMAT_PROBLEM_ZOO;
00104   MonitorElement* HE_DATAFORMAT_PROBLEM_MAP;
00105   MonitorElement* HF_DATAFORMAT_PROBLEM_MAP;
00106   MonitorElement* HF_DATAFORMAT_PROBLEM_ZOO;
00107   MonitorElement* HO_DATAFORMAT_PROBLEM_MAP;
00108   MonitorElement* HO_DATAFORMAT_PROBLEM_ZOO;
00109    
00110   //MEs for hcalunpacker report info
00111   MonitorElement* meSpigotFormatErrors_;
00112   MonitorElement* meBadQualityDigis_;
00113   MonitorElement* meUnmappedDigis_;
00114   MonitorElement* meUnmappedTPDigis_;
00115   MonitorElement* meFEDerrorMap_;
00116 
00117   MonitorElement* meFEDRawDataSizes_;
00118   MonitorElement* meUSFractSpigs_;
00119   MonitorElement* meUSEvtSizes2D_;// implement me!
00120   MonitorElement* meUSEvtSizes1D_;// implement me!
00121   
00122   MonitorElement* me_HBHE_ZS_SlidingSum;
00123   MonitorElement* me_HF_ZS_SlidingSum;
00124   MonitorElement* me_HO_ZS_SlidingSum;
00125   MonitorElement* me_HBHE_ZS_SlidingSum_US;
00126   MonitorElement* me_HF_ZS_SlidingSum_US;
00127   MonitorElement* me_HO_ZS_SlidingSum_US;
00128 
00129   MonitorElement* fedEntries_;
00130   MonitorElement* fedFatal_;
00131 
00132   //Check that evt numbers are synchronized across all HTRs
00133   MonitorElement* meEvtNumberSynch_;
00134   MonitorElement* meBCNSynch_;
00135   MonitorElement* meBCN_;
00136   MonitorElement* medccBCN_;
00137 
00138   MonitorElement* meDCC_DataIntegrityCheck_;
00139   MonitorElement* meHalfHTR_DataIntegrityCheck_;
00140   MonitorElement* meChannSumm_DataIntegrityCheck_;
00141   float DCC_DataIntegrityCheck_      [RCDIX][RCDIY];      
00142   float HalfHTR_DataIntegrityCheck_  [HHDIX][HHDIY];  
00143   float ChannSumm_DataIntegrityCheck_[CSDIX][HHDIY];
00144   float Chann_DataIntegrityCheck_    [NUMDCCS][CIX][CIY];
00145   void UpdateMEs ();  //Prescalable copy into MonitorElements
00146 
00147   //Histogram labelling functions
00148   void label_ySpigots(MonitorElement* me_ptr,int ybins);
00149   void label_xFEDs   (MonitorElement* me_ptr,int xbins);
00150   void label_xChanns (MonitorElement* me_ptr,int xbins);
00151 
00152   MonitorElement* meInvHTRData_;
00153   MonitorElement* meBCNCheck_; // htr BCN compared to dcc BCN
00154   MonitorElement* meEvtNCheck_; // htr Evt # compared to dcc Evt #
00155   MonitorElement* meFibBCN_;
00156 
00157   MonitorElement* meFWVersion_;
00158   MonitorElement* meEvFragSize_;
00159   MonitorElement* meEvFragSize2_;
00160 
00161   MonitorElement* meErrWdCrate_;  //HTR error bits by crate
00162 
00163   // The following MEs map specific conditons from the EventFragment headers as specified in
00164   //   https://cmsdoc.cern.ch/cms/HCAL/document/CountingHouse/DCC/DCC_1Jul06.pdf
00165 
00166   MonitorElement* meFEDId_;               //All of HCAL, as a stupidcheck.
00167   MonitorElement* meCDFErrorFound_;       //Summary histo of Common Data Format violations by FED ID
00168   MonitorElement* meDCCEventFormatError_; //Summary histo of DCC Event Format violations by FED ID 
00169   //Summary histo for HTR Status bits, DCC Error&Warn Counters Flagged Nonzero
00170   MonitorElement* meDCCErrorAndWarnConditions_;  
00171   MonitorElement* meDCCStatusFlags_;
00172   MonitorElement* meDCCSummariesOfHTRs_;  //Summary histo of HTR Summaries from DCC
00173 
00174   // The following MEs map specific conditons from the HTR/DCC headers as specified in
00175   //   https://cmsdoc.cern.ch/cms/HCAL/document/CountingHouse/HTR/design/Rev4MainFPGA.pdf
00176 
00177   MonitorElement* meCrate0HTRErr_;   //Map of HTR errors into Crate 0
00178   MonitorElement* meCrate1HTRErr_;   //Map of HTR errors into Crate 1
00179   MonitorElement* meCrate2HTRErr_;   //Map of HTR errors into Crate 2
00180   MonitorElement* meCrate3HTRErr_;   //Map of HTR errors into Crate 3
00181   MonitorElement* meCrate4HTRErr_;   //Map of HTR errors into Crate 4
00182   MonitorElement* meCrate5HTRErr_;   //Map of HTR errors into Crate 5
00183   MonitorElement* meCrate6HTRErr_;   //Map of HTR errors into Crate 6
00184   MonitorElement* meCrate7HTRErr_;   //Map of HTR errors into Crate 7
00185   MonitorElement* meCrate8HTRErr_;   //Map of HTR errors into Crate 8
00186   MonitorElement* meCrate9HTRErr_;   //Map of HTR errors into Crate 9
00187   MonitorElement* meCrate10HTRErr_;   //Map of HTR errors into Crate 10
00188   MonitorElement* meCrate11HTRErr_;   //Map of HTR errors into Crate 11
00189   MonitorElement* meCrate12HTRErr_;   //Map of HTR errors into Crate 12
00190   MonitorElement* meCrate13HTRErr_;   //Map of HTR errors into Crate 13
00191   MonitorElement* meCrate14HTRErr_;   //Map of HTR errors into Crate 14
00192   MonitorElement* meCrate15HTRErr_;   //Map of HTR errors into Crate 15
00193   MonitorElement* meCrate16HTRErr_;   //Map of HTR errors into Crate 16
00194   MonitorElement* meCrate17HTRErr_;   //Map of HTR errors into Crate 17
00195 
00196   MonitorElement* meCh_DataIntegrityFED00_;   //DataIntegrity for channels in FED 00
00197   MonitorElement* meCh_DataIntegrityFED01_;   //DataIntegrity for channels in FED 01
00198   MonitorElement* meCh_DataIntegrityFED02_;   //DataIntegrity for channels in FED 02
00199   MonitorElement* meCh_DataIntegrityFED03_;   //DataIntegrity for channels in FED 03
00200   MonitorElement* meCh_DataIntegrityFED04_;   //DataIntegrity for channels in FED 04
00201   MonitorElement* meCh_DataIntegrityFED05_;   //DataIntegrity for channels in FED 05
00202   MonitorElement* meCh_DataIntegrityFED06_;   //DataIntegrity for channels in FED 06
00203   MonitorElement* meCh_DataIntegrityFED07_;   //DataIntegrity for channels in FED 07
00204   MonitorElement* meCh_DataIntegrityFED08_;   //DataIntegrity for channels in FED 08
00205   MonitorElement* meCh_DataIntegrityFED09_;   //DataIntegrity for channels in FED 09
00206   MonitorElement* meCh_DataIntegrityFED10_;   //DataIntegrity for channels in FED 10
00207   MonitorElement* meCh_DataIntegrityFED11_;   //DataIntegrity for channels in FED 11
00208   MonitorElement* meCh_DataIntegrityFED12_;   //DataIntegrity for channels in FED 12
00209   MonitorElement* meCh_DataIntegrityFED13_;   //DataIntegrity for channels in FED 13
00210   MonitorElement* meCh_DataIntegrityFED14_;   //DataIntegrity for channels in FED 14
00211   MonitorElement* meCh_DataIntegrityFED15_;   //DataIntegrity for channels in FED 15
00212   MonitorElement* meCh_DataIntegrityFED16_;   //DataIntegrity for channels in FED 16
00213   MonitorElement* meCh_DataIntegrityFED17_;   //DataIntegrity for channels in FED 17
00214   MonitorElement* meCh_DataIntegrityFED18_;   //DataIntegrity for channels in FED 18
00215   MonitorElement* meCh_DataIntegrityFED19_;   //DataIntegrity for channels in FED 19
00216   MonitorElement* meCh_DataIntegrityFED20_;   //DataIntegrity for channels in FED 20
00217   MonitorElement* meCh_DataIntegrityFED21_;   //DataIntegrity for channels in FED 21
00218   MonitorElement* meCh_DataIntegrityFED22_;   //DataIntegrity for channels in FED 22
00219   MonitorElement* meCh_DataIntegrityFED23_;   //DataIntegrity for channels in FED 23
00220   MonitorElement* meCh_DataIntegrityFED24_;   //DataIntegrity for channels in FED 24
00221   MonitorElement* meCh_DataIntegrityFED25_;   //DataIntegrity for channels in FED 25
00222   MonitorElement* meCh_DataIntegrityFED26_;   //DataIntegrity for channels in FED 26
00223   MonitorElement* meCh_DataIntegrityFED27_;   //DataIntegrity for channels in FED 27
00224   MonitorElement* meCh_DataIntegrityFED28_;   //DataIntegrity for channels in FED 28
00225   MonitorElement* meCh_DataIntegrityFED29_;   //DataIntegrity for channels in FED 29
00226   MonitorElement* meCh_DataIntegrityFED30_;   //DataIntegrity for channels in FED 30
00227   MonitorElement* meCh_DataIntegrityFED31_;   //DataIntegrity for channels in FED 31
00228   // handy array of pointers to pointers...
00229   MonitorElement* meChann_DataIntegrityCheck_[32];
00230 
00231   MonitorElement* meFib1OrbMsgBCN_;  //BCN of Fiber 1 Orb Msg
00232   MonitorElement* meFib2OrbMsgBCN_;  //BCN of Fiber 2 Orb Msg
00233   MonitorElement* meFib3OrbMsgBCN_;  //BCN of Fiber 3 Orb Msg
00234   MonitorElement* meFib4OrbMsgBCN_;  //BCN of Fiber 4 Orb Msg
00235   MonitorElement* meFib5OrbMsgBCN_;  //BCN of Fiber 5 Orb Msg
00236   MonitorElement* meFib6OrbMsgBCN_;  //BCN of Fiber 6 Orb Msg
00237   MonitorElement* meFib7OrbMsgBCN_;  //BCN of Fiber 7 Orb Msg
00238   MonitorElement* meFib8OrbMsgBCN_;  //BCN of Fiber 8 Orb Msg
00239 
00240   MonitorElement* DCC_ErrWd_HBHE;
00241   MonitorElement* DCC_ErrWd_HF;
00242   MonitorElement* DCC_ErrWd_HO;
00243 
00244   int currFiberChan;
00245   void LabelChannInteg(MonitorElement* me_ptr);
00246   bool isUnsuppressed (HcalHTRData& payload); //Return the US bit: ExtHdr7[bit 15]
00247   uint64_t UScount[32][15];
00248 
00249   //Member variables for reference values to be used in consistency checks.
00250   std::map<int, short> CDFversionNumber_list;
00251   std::map<int, short>::iterator CDFvers_it;
00252   std::map<int, short> CDFEventType_list;
00253   std::map<int, short>::iterator CDFEvT_it;
00254   std::map<int, short> CDFReservedBits_list;
00255   std::map<int, short>::iterator CDFReservedBits_it;
00256   std::map<int, short> DCCEvtFormat_list;
00257   std::map<int, short>::iterator DCCEvtFormat_it;
00258   std::map<int, short> DCCRsvdBits_list;
00259   std::map<int, short>::iterator DCCRsvdBits_it;
00260   
00261   //static member variables 
00262   static float DIMbin[32];
00263 };
00264 
00265 // For crate numbers:
00266 float HcalDataFormatMonitor::DIMbin[]={ 4, 4.5, // FED 700, 701
00267                        0, 0.5, // FED 702, 703
00268                        1, 1.5, // FED 704, 705
00269                        5, 5.5, // FED 706, 707
00270                        11, 11.5, // FED 708, 709
00271                        15, 15.5, // FED 710, 711
00272                        17, 17.5, // FED 712, 713
00273                        14, 14.5, // FED 714, 715
00274                        10, 10.5, // FED 716, 717
00275                        2, 2.5, // FED 718, 719
00276                        9, 9.5, // FED 720, 721
00277                        12, 12.5, // FED 722, 723
00278                        3, 3.5, // FED 724, 725
00279                        7, 7.5, // FED 726, 727
00280                        6, 6.5, // FED 728, 729
00281                        13, 13.5 // FED 730, 731
00282 };
00283 
00284 #endif

Generated on Tue Jun 9 17:32:57 2009 for CMSSW by  doxygen 1.5.4