File indexing completed on 2024-04-06 12:07:05
0001 #ifndef DTOccupancyTest_H
0002 #define DTOccupancyTest_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include "FWCore/Framework/interface/Frameworkfwd.h"
0016 #include "FWCore/Framework/interface/ESHandle.h"
0017 #include "DQMServices/Core/interface/DQMStore.h"
0018 #include "DataFormats/MuonDetId/interface/DTLayerId.h"
0019 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0020 #include "DQMServices/Core/interface/DQMEDHarvester.h"
0021
0022 #include "TH2F.h"
0023
0024 #include <iostream>
0025 #include <string>
0026 #include <map>
0027
0028 class DTGeometry;
0029 class DTChamberId;
0030
0031 #include "TFile.h"
0032 #include "TNtuple.h"
0033
0034 class DTOccupancyTest : public DQMEDHarvester {
0035 public:
0036
0037 DTOccupancyTest(const edm::ParameterSet &ps);
0038
0039
0040 ~DTOccupancyTest() override;
0041
0042 protected:
0043
0044 void beginRun(edm::Run const &run, edm::EventSetup const &context) override;
0045
0046
0047 void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override;
0048
0049
0050
0051 void dqmEndLuminosityBlock(DQMStore::IBooker &,
0052 DQMStore::IGetter &,
0053 edm::LuminosityBlock const &,
0054 edm::EventSetup const &) override;
0055
0056 private:
0057
0058 void bookHistos(DQMStore::IBooker &, const int wheelId, std::string folder, std::string histoTag);
0059
0060
0061 std::string getMEName(std::string histoTag, const DTChamberId &chId);
0062
0063 int getIntegral(TH2F *histo, int, int, int, int, bool);
0064
0065
0066 int runOccupancyTest(TH2F *histo, const DTChamberId &chId, float &chamberPercentage);
0067
0068 std::string topFolder() const;
0069
0070 int nevents;
0071
0072 edm::ESGetToken<DTGeometry, MuonGeometryRecord> muonGeomToken_;
0073 const DTGeometry *muonGeom;
0074
0075
0076 std::map<int, MonitorElement *> wheelHistos;
0077 MonitorElement *summaryHisto;
0078 MonitorElement *glbSummaryHisto;
0079
0080 std::set<DTLayerId> monitoredLayers;
0081
0082 int lsCounter;
0083 int nMinEvts;
0084 int nMinEvtsPC;
0085 int nZeroEvtsPC;
0086
0087 bool writeRootFile;
0088 TFile *rootFile;
0089 TNtuple *ntuple;
0090 bool tpMode;
0091
0092 bool runOnAllHitsOccupancies;
0093 bool runOnNoiseOccupancies;
0094 bool runOnInTimeOccupancies;
0095 std::string nameMonitoredHisto;
0096
0097 bool bookingdone;
0098
0099 int nChannelTotal;
0100 int nChannelDead;
0101 };
0102
0103 #endif