CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/DQMOffline/CalibTracker/plugins/SiStripFEDErrorsDQM.h

Go to the documentation of this file.
00001 #ifndef DQMOffline_CalibTracker_SiStripFEDErrorsDQM_H
00002 #define DQMOffline_CalibTracker_SiStripFEDErrorsDQM_H
00003 
00004 #include "FWCore/Framework/interface/Frameworkfwd.h"
00005 #include "FWCore/Framework/interface/EDAnalyzer.h"
00006 #include "FWCore/Framework/interface/Event.h"
00007 #include "FWCore/Framework/interface/EventSetup.h"
00008 #include "FWCore/Framework/interface/ESHandle.h"
00009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00010 #include "FWCore/Utilities/interface/InputTag.h"
00011 #include "FWCore/ServiceRegistry/interface/Service.h"
00012 #include "FWCore/Utilities/interface/Exception.h"
00013 
00014 #include "FWCore/ServiceRegistry/interface/Service.h"
00015 #include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
00016 
00017 #include "CondFormats/SiStripObjects/interface/SiStripBadStrip.h"
00018 #include "CondFormats/SiStripObjects/interface/SiStripFedCabling.h"
00019 #include "CondFormats/DataRecord/interface/SiStripFedCablingRcd.h"
00020 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
00021 #include "CondTools/SiStrip/interface/SiStripCondObjBuilderBase.h"
00022 
00023 #include "DQMServices/Core/interface/DQMStore.h"
00024 #include "DQMServices/Core/interface/MonitorElement.h"
00025 #include "DQMOffline/CalibTracker/interface/SiStripBaseServiceFromDQM.h"
00026 
00027 #include <TFile.h>
00028 #include <string>
00029 #include <map>
00030 
00037 class SiStripFEDErrorsDQM : public edm::EDAnalyzer, public SiStripBaseServiceFromDQM<SiStripBadStrip>
00038 {
00039  public:
00040   SiStripFEDErrorsDQM(const edm::ParameterSet& iConfig);
00041   ~SiStripFEDErrorsDQM();
00042   
00043  private:
00044   virtual void beginJob();
00045   virtual void analyze(const edm::Event&, const edm::EventSetup&);
00046   virtual void endJob() ;
00047 
00048   bool readBadAPVs();
00049 
00050   void readHistogram(MonitorElement* aMe,
00051                      unsigned int & aCounter, 
00052                      const float aNorm,
00053                      const unsigned int aFedId);
00054 
00055   void addBadAPV(const FedChannelConnection & aConnection,
00056                  const unsigned short aAPVNumber,
00057                  const unsigned short aFlag,
00058                  unsigned int & aCounter);
00059 
00060   void addBadStrips(const FedChannelConnection & aConnection,
00061                     const unsigned int aDetId,
00062                     const unsigned short aApvNum,
00063                     const unsigned short aFlag,
00064                     unsigned int & aCounter);
00065 
00067   void addErrors();
00068 
00069   //set corresponding bit to 1 in flag
00070   void setFlagBit(unsigned short & aFlag, const unsigned short aBit);
00071 
00072   //update the cabling if necessary
00073   void updateCabling(const edm::EventSetup& eventSetup);
00074 
00075   edm::ParameterSet iConfig_;
00076   edm::FileInPath fp_;
00077 
00078   uint32_t cablingCacheId_;
00079   const SiStripFedCabling* cabling_;
00080 
00081   double threshold_;
00082   unsigned int debug_;
00083   std::map<uint32_t, std::vector<unsigned int> > detIdErrors_;
00084 };
00085 
00086 #endif