Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:07:03

0001 #ifndef DTMonitorModule_DTBlockedROChannelsTest_H
0002 #define DTMonitorModule_DTBlockedROChannelsTest_H
0003 
0004 /** \class DTBlockedROChannelsTest
0005  * *
0006  *  DQM Client to Summarize LS by LS the status of the Read-Out channels.
0007  *
0008  *  \author G. Cerminara - University and INFN Torino
0009  *   
0010  */
0011 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0012 #include "FWCore/Framework/interface/Event.h"
0013 #include "FWCore/Framework/interface/ESHandle.h"
0014 #include "FWCore/Framework/interface/EventSetup.h"
0015 #include "FWCore/Framework/interface/LuminosityBlock.h"
0016 #include "DataFormats/MuonDetId/interface/DTChamberId.h"
0017 #include "CondFormats/DataRecord/interface/DTReadOutMappingRcd.h"
0018 #include "DQMServices/Core/interface/DQMStore.h"
0019 #include "DQMServices/Core/interface/DQMEDHarvester.h"
0020 
0021 class DTReadOutMapping;
0022 class DTTimeEvolutionHisto;
0023 
0024 class DTBlockedROChannelsTest : public DQMEDHarvester {
0025 public:
0026   /// Constructor
0027   DTBlockedROChannelsTest(const edm::ParameterSet& ps);
0028 
0029   /// Destructor
0030   ~DTBlockedROChannelsTest() override;
0031 
0032 protected:
0033   /// BeginRun
0034   void beginRun(const edm::Run&, const edm::EventSetup&) override;
0035 
0036   void fillChamberMap(DQMStore::IGetter& igetter, const edm::EventSetup& c);
0037 
0038   /// DQM Client operations
0039   void performClientDiagnostic(DQMStore::IGetter& igetter);
0040 
0041   /// DQM Client Diagnostic in online mode
0042   void dqmEndLuminosityBlock(DQMStore::IBooker&,
0043                              DQMStore::IGetter&,
0044                              edm::LuminosityBlock const&,
0045                              edm::EventSetup const&) override;
0046   void dqmEndJob(DQMStore::IBooker&, DQMStore::IGetter&) override;
0047 
0048 private:
0049   int readOutToGeometry(int dduId, int rosNumber, int robNumber, int& wheel, int& station, int& sector);
0050 
0051   int theDDU(int crate, int slot, int link, bool tenDDU);
0052   int theROS(int slot, int link);
0053   int theROB(int slot, int link);
0054 
0055   //Number of onUpdates
0056   int nupdates;
0057 
0058   // prescale on the # of LS to update the test
0059   int prescaleFactor;
0060   bool offlineMode;
0061   bool checkUros;
0062   int nevents;
0063   int neventsPrev;
0064   unsigned int nLumiSegs;
0065   unsigned int prevNLumiSegs;
0066   double prevTotalPerc;
0067 
0068   int run;
0069 
0070   edm::ESGetToken<DTReadOutMapping, DTReadOutMappingRcd> mappingToken_;
0071   const DTReadOutMapping* mapping;
0072 
0073   // Monitor Elements
0074   std::map<int, MonitorElement*> wheelHistos;
0075   MonitorElement* summaryHisto;
0076 
0077   std::map<int, double> resultsPerLumi;
0078   DTTimeEvolutionHisto* hSystFractionVsLS;
0079 
0080   class DTRobBinsMap {
0081   public:
0082     DTRobBinsMap(DQMStore::IGetter& igetter, const int fed, const int ros);
0083 
0084     DTRobBinsMap();
0085 
0086     ~DTRobBinsMap();
0087 
0088     // add a rob to the set of robs
0089     void addRobBin(int robBin);
0090     void init(bool v) { init_ = v; }
0091 
0092     bool robChanged(int robBin);
0093 
0094     double getChamberPercentage(DQMStore::IGetter&);
0095 
0096     void readNewValues(DQMStore::IGetter& igetter);
0097 
0098   private:
0099     int getValueRobBin(int robBin) const;
0100     int getValueRos() const;
0101 
0102     int rosBin;
0103     bool init_;
0104 
0105     std::map<int, int> robsAndValues;
0106     int rosValue;
0107 
0108     const MonitorElement* meROS;
0109     const MonitorElement* meDDU;
0110 
0111     std::string rosHName;
0112     std::string dduHName;
0113   };
0114 
0115   std::map<DTChamberId, DTRobBinsMap> chamberMap;
0116 
0117   // For uROS starting in Year 2018
0118   class DTLinkBinsMap {
0119   public:
0120     DTLinkBinsMap(DQMStore::IGetter& igetter, const int fed, const int mapSlot);
0121 
0122     DTLinkBinsMap();
0123 
0124     ~DTLinkBinsMap();
0125 
0126     // add a rob to the set of robs
0127     void addLinkBin(int linkBin);
0128     void init(bool v) { init_ = v; }
0129 
0130     bool linkChanged(int linkBin);
0131 
0132     double getChamberPercentage(DQMStore::IGetter&);
0133 
0134     void readNewValues(DQMStore::IGetter& igetter);
0135 
0136   private:
0137     int getValueLinkBin(int linkBin) const;
0138 
0139     bool init_;
0140 
0141     std::map<int, int> linksAndValues;
0142 
0143     const MonitorElement* meuROS;
0144 
0145     std::string urosHName;
0146   };
0147 
0148   std::map<DTChamberId, DTLinkBinsMap> chamberMapUros;
0149 };
0150 
0151 #endif