Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-11 04:32:29

0001 #ifndef DQM_GEM_INTERFACE_GEMDAQStatusSource_h
0002 #define DQM_GEM_INTERFACE_GEMDAQStatusSource_h
0003 
0004 #include "FWCore/Framework/interface/ESHandle.h"
0005 #include "FWCore/Framework/interface/MakerMacros.h"
0006 #include "FWCore/PluginManager/interface/ModuleDef.h"
0007 #include "FWCore/Framework/interface/Event.h"
0008 #include "FWCore/Framework/interface/EventSetup.h"
0009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0010 #include "FWCore/Utilities/interface/InputTag.h"
0011 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0012 
0013 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0014 #include "DQMServices/Core/interface/DQMStore.h"
0015 #include "DQMServices/Core/interface/MonitorElement.h"
0016 
0017 #include "Validation/MuonGEMHits/interface/GEMValidationUtils.h"
0018 
0019 #include "CondFormats/DataRecord/interface/GEMChMapRcd.h"
0020 #include "CondFormats/GEMObjects/interface/GEMChMap.h"
0021 #include "DataFormats/GEMDigi/interface/GEMDigiCollection.h"
0022 #include "DataFormats/GEMDigi/interface/GEMVFATStatusCollection.h"
0023 #include "DataFormats/GEMDigi/interface/GEMOHStatusCollection.h"
0024 #include "DataFormats/GEMDigi/interface/GEMAMCStatusCollection.h"
0025 #include "DataFormats/GEMDigi/interface/GEMAMC13StatusCollection.h"
0026 
0027 #include "DQM/GEM/interface/GEMDQMBase.h"
0028 
0029 #include <string>
0030 
0031 //----------------------------------------------------------------------------------------------------
0032 
0033 class GEMDAQStatusSource : public GEMDQMBase {
0034 public:
0035   explicit GEMDAQStatusSource(const edm::ParameterSet &cfg);
0036   ~GEMDAQStatusSource() override {}
0037   static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
0038 
0039 protected:
0040   void LoadROMap(edm::EventSetup const &iSetup);
0041 
0042   void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override {}
0043   void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
0044   void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override;
0045 
0046   void FillWithRiseErr(MonitorElement *h, Int_t nX, Int_t nY, Bool_t &bErr) {
0047     h->Fill(nX, nY);
0048     bErr = true;
0049   };
0050 
0051   void FillStatusSummaryPlot(std::map<ME5IdsKey, bool> &mapChamber,
0052                              MonitorElement *h2Plot,
0053                              std::map<ME5IdsKey, bool> *pmapSummary = nullptr) {
0054     for (auto const &[key5, bFlag] : mapChamber) {  // bFlag is not used
0055       ME4IdsKey key4 = key5Tokey4(key5);
0056       Int_t nChamber = keyToChamber(key5);
0057       h2Plot->Fill(nChamber, mapStationToIdx_[key4]);
0058       if (pmapSummary != nullptr)
0059         (*pmapSummary)[key5] = true;
0060     }
0061   };
0062 
0063 private:
0064   int ProcessWithMEMap4(BookingHelper &bh, ME4IdsKey key) override;
0065   int ProcessWithMEMap5WithChamber(BookingHelper &bh, ME5IdsKey key) override;
0066 
0067   void SetLabelAMC13Status(MonitorElement *h2Status);
0068   void SetLabelAMCStatus(MonitorElement *h2Status);
0069   void SetLabelOHStatus(MonitorElement *h2Status);
0070   void SetLabelVFATStatus(MonitorElement *h2Status);
0071 
0072   const edm::ESGetToken<GEMChMap, GEMChMapRcd> gemChMapToken_;
0073 
0074   edm::EDGetToken tagVFAT_;
0075   edm::EDGetToken tagOH_;
0076   edm::EDGetToken tagAMC_;
0077   edm::EDGetToken tagAMC13_;
0078 
0079   Bool_t bWarnedNotFound_;
0080 
0081   MonitorElement *h2AMC13Status_;
0082 
0083   MEMap4Inf mapStatusOH_;
0084   MEMap4Inf mapStatusVFAT_;
0085 
0086   MEMap4Inf mapStatusWarnVFATPerLayer_;
0087   MEMap4Inf mapStatusErrVFATPerLayer_;
0088   MEMap5Inf mapStatusVFATPerCh_;
0089 
0090   MonitorElement *h2SummaryStatusAll;
0091   MonitorElement *h2SummaryStatusWarning;
0092   MonitorElement *h2SummaryStatusError;
0093   MonitorElement *h2SummaryStatusVFATWarning;
0094   MonitorElement *h2SummaryStatusVFATError;
0095   MonitorElement *h2SummaryStatusOHWarning;
0096   MonitorElement *h2SummaryStatusOHError;
0097   MonitorElement *h2SummaryStatusAMCWarning;
0098   MonitorElement *h2SummaryStatusAMCError;
0099   MonitorElement *h2SummaryStatusAMC13Error;
0100 
0101   std::string strFolderMain_;
0102 
0103   Bool_t bFillAMC_;
0104 
0105   Int_t nBXMin_, nBXMax_;
0106 
0107   std::map<UInt_t, int> mapFEDIdToRe_;
0108   std::map<UInt_t, int> mapFEDIdToSt_;
0109   std::map<UInt_t, int> mapFEDIdToPosition_;
0110   std::map<UInt_t, MonitorElement *> mapFEDIdToAMCStatus_;
0111   std::map<int, std::vector<GEMDetId>> mapAMC13ToListChamber_;
0112   std::map<std::tuple<int, int>, std::vector<GEMDetId>> mapAMCToListChamber_;
0113   Int_t nAMCSlots_;
0114   Bool_t useDBEMap_;
0115 
0116   int nBitAMC13_ = 10;
0117   int nBitAMC_ = 12;
0118   int nBitOH_ = 18;
0119   int nBitVFAT_ = 8;
0120 };
0121 
0122 #endif  // DQM_GEM_INTERFACE_GEMDAQStatusSource_h