Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:11:45

0001 #ifndef SiStripMonitorClient_SiStripDcsInfo_h
0002 #define SiStripMonitorClient_SiStripDcsInfo_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     SiStripMonitorClient
0006 // Class  :     SiStripDcsInfo
0007 //
0008 /**\class SiStripDcsInfo SiStripDcsInfo.h
0009    DQM/SiStripMonitorCluster/interface/SiStripDcsInfo.h
0010 
0011    Description:
0012    Checks the # of SiStrip FEDs from DAQ
0013    Usage:
0014    <usage>
0015 
0016 */
0017 //
0018 //          Author:  Suchandra Dutta
0019 //         Created:  Mon Feb 16 19:00:00 CET 2009
0020 //
0021 
0022 #include <string>
0023 
0024 #include "FWCore/Framework/interface/EDAnalyzer.h"
0025 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0026 #include "FWCore/Framework/interface/ESWatcher.h"
0027 #include "FWCore/Framework/interface/LuminosityBlock.h"
0028 #include "FWCore/Framework/interface/Run.h"
0029 #include "FWCore/Framework/interface/EventSetup.h"
0030 #include "DQMServices/Core/interface/DQMStore.h"
0031 
0032 #include "CondFormats/SiStripObjects/interface/SiStripDetVOff.h"
0033 #include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h"
0034 #include "CalibTracker/Records/interface/SiStripDetCablingRcd.h"
0035 #include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h"
0036 #include "Geometry/Records/interface/TrackerTopologyRcd.h"
0037 #include "CondFormats/DataRecord/interface/RunSummaryRcd.h"
0038 
0039 #include <iostream>
0040 #include <fstream>
0041 #include <string>
0042 #include <vector>
0043 #include <map>
0044 #include <unordered_map>
0045 
0046 class SiStripDetVOff;
0047 class SiStripDetCabling;
0048 class RunInfo;
0049 
0050 class SiStripDcsInfo : public edm::EDAnalyzer {
0051 public:
0052   typedef dqm::harvesting::MonitorElement MonitorElement;
0053   typedef dqm::harvesting::DQMStore DQMStore;
0054 
0055   SiStripDcsInfo(const edm::ParameterSet& ps);
0056 
0057 private:
0058   void beginJob() override;
0059   void beginRun(edm::Run const& run, edm::EventSetup const& eSetup) override;
0060   void beginLuminosityBlock(edm::LuminosityBlock const& lumiSeg, edm::EventSetup const& eSetup) override;
0061   void endLuminosityBlock(edm::LuminosityBlock const& lumiSeg, edm::EventSetup const& iSetup) override;
0062   void endRun(edm::Run const& run, edm::EventSetup const& eSetup) override;
0063   void analyze(edm::Event const&, edm::EventSetup const&) override;
0064 
0065   void bookStatus(DQMStore& dqm_store);
0066   void readStatus(edm::EventSetup const&, int transition);
0067   void readCabling(edm::EventSetup const&);
0068   void addBadModules(DQMStore& dqm_store);
0069   void fillStatus(DQMStore& dqm_store);
0070   void fillDummyStatus(DQMStore& dqm_store);
0071 
0072   MonitorElement* DcsFraction_{nullptr};
0073 
0074   struct SubDetMEs {
0075     std::string folder_name;
0076     MonitorElement* DcsFractionME;
0077     int TotalDetectors;
0078     std::vector<uint32_t> FaultyDetectors;
0079     std::unordered_map<uint32_t, uint16_t> NLumiDetectorIsFaulty;
0080   };
0081 
0082   std::map<std::string, SubDetMEs> SubDetMEsMap{};
0083   unsigned long long m_cacheIDDcs_{};
0084   bool bookedStatus_{false};
0085 
0086   int nFEDConnected_{};
0087 
0088   int nLumiAnalysed_{};
0089 
0090   bool IsLumiGoodDcs_{false};
0091   int nGoodDcsLumi_{};
0092   static constexpr float MinAcceptableDcsDetFrac_{0.90};
0093   static constexpr float MaxAcceptableBadDcsLumi_{2};
0094 
0095   const SiStripDetCabling* detCabling_;
0096   edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tTopoToken0_, tTopoToken1_, tTopoToken2_, tTopoToken3_;
0097   edm::ESGetToken<SiStripDetVOff, SiStripDetVOffRcd> detVOffToken0_, detVOffToken1_, detVOffToken2_;
0098   edm::ESWatcher<SiStripFedCablingRcd> fedCablingWatcher_;
0099   edm::ESGetToken<SiStripDetCabling, SiStripDetCablingRcd> detCablingToken_;  // beginRun
0100   edm::ESGetToken<RunInfo, RunInfoRcd> runInfoToken_;
0101 };
0102 #endif