DTBlockedROChannelsTest

DTLinkBinsMap

DTRobBinsMap

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
#ifndef DTMonitorModule_DTBlockedROChannelsTest_H
#define DTMonitorModule_DTBlockedROChannelsTest_H

/** \class DTBlockedROChannelsTest
 * *
 *  DQM Client to Summarize LS by LS the status of the Read-Out channels.
 *
 *  \author G. Cerminara - University and INFN Torino
 *   
 */
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/LuminosityBlock.h"
#include "DataFormats/MuonDetId/interface/DTChamberId.h"
#include "CondFormats/DataRecord/interface/DTReadOutMappingRcd.h"
#include "DQMServices/Core/interface/DQMStore.h"
#include "DQMServices/Core/interface/DQMEDHarvester.h"

class DTReadOutMapping;
class DTTimeEvolutionHisto;

class DTBlockedROChannelsTest : public DQMEDHarvester {
public:
  /// Constructor
  DTBlockedROChannelsTest(const edm::ParameterSet& ps);

  /// Destructor
  ~DTBlockedROChannelsTest() override;

protected:
  /// BeginRun
  void beginRun(const edm::Run&, const edm::EventSetup&) override;

  void fillChamberMap(DQMStore::IGetter& igetter, const edm::EventSetup& c);

  /// DQM Client operations
  void performClientDiagnostic(DQMStore::IGetter& igetter);

  /// DQM Client Diagnostic in online mode
  void dqmEndLuminosityBlock(DQMStore::IBooker&,
                             DQMStore::IGetter&,
                             edm::LuminosityBlock const&,
                             edm::EventSetup const&) override;
  void dqmEndJob(DQMStore::IBooker&, DQMStore::IGetter&) override;

private:
  int readOutToGeometry(int dduId, int rosNumber, int robNumber, int& wheel, int& station, int& sector);

  int theDDU(int crate, int slot, int link, bool tenDDU);
  int theROS(int slot, int link);
  int theROB(int slot, int link);

  //Number of onUpdates
  int nupdates;

  // prescale on the # of LS to update the test
  int prescaleFactor;
  bool offlineMode;
  bool checkUros;
  int nevents;
  int neventsPrev;
  unsigned int nLumiSegs;
  unsigned int prevNLumiSegs;
  double prevTotalPerc;

  int run;

  edm::ESGetToken<DTReadOutMapping, DTReadOutMappingRcd> mappingToken_;
  const DTReadOutMapping* mapping;

  // Monitor Elements
  std::map<int, MonitorElement*> wheelHistos;
  MonitorElement* summaryHisto;

  std::map<int, double> resultsPerLumi;
  DTTimeEvolutionHisto* hSystFractionVsLS;

  class DTRobBinsMap {
  public:
    DTRobBinsMap(DQMStore::IGetter& igetter, const int fed, const int ros);

    DTRobBinsMap();

    ~DTRobBinsMap();

    // add a rob to the set of robs
    void addRobBin(int robBin);
    void init(bool v) { init_ = v; }

    bool robChanged(int robBin);

    double getChamberPercentage(DQMStore::IGetter&);

    void readNewValues(DQMStore::IGetter& igetter);

  private:
    int getValueRobBin(int robBin) const;
    int getValueRos() const;

    int rosBin;
    bool init_;

    std::map<int, int> robsAndValues;
    int rosValue;

    const MonitorElement* meROS;
    const MonitorElement* meDDU;

    std::string rosHName;
    std::string dduHName;
  };

  std::map<DTChamberId, DTRobBinsMap> chamberMap;

  // For uROS starting in Year 2018
  class DTLinkBinsMap {
  public:
    DTLinkBinsMap(DQMStore::IGetter& igetter, const int fed, const int mapSlot);

    DTLinkBinsMap();

    ~DTLinkBinsMap();

    // add a rob to the set of robs
    void addLinkBin(int linkBin);
    void init(bool v) { init_ = v; }

    bool linkChanged(int linkBin);

    double getChamberPercentage(DQMStore::IGetter&);

    void readNewValues(DQMStore::IGetter& igetter);

  private:
    int getValueLinkBin(int linkBin) const;

    bool init_;

    std::map<int, int> linksAndValues;

    const MonitorElement* meuROS;

    std::string urosHName;
  };

  std::map<DTChamberId, DTLinkBinsMap> chamberMapUros;
};

#endif