File indexing completed on 2024-04-06 12:07:05
0001 #ifndef DTOccupancyTestML_H
0002 #define DTOccupancyTestML_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 "FWCore/ParameterSet/interface/FileInPath.h"
0018 #include "DQMServices/Core/interface/DQMStore.h"
0019 #include "DataFormats/MuonDetId/interface/DTLayerId.h"
0020 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0021 #include "DQMServices/Core/interface/DQMEDHarvester.h"
0022
0023 #include "PhysicsTools/TensorFlow/interface/TensorFlow.h"
0024
0025 #include "TH2F.h"
0026
0027 #include <iostream>
0028 #include <string>
0029 #include <map>
0030
0031 class DTGeometry;
0032 class DTChamberId;
0033
0034 #include "TFile.h"
0035 #include "TNtuple.h"
0036
0037 class DTOccupancyTestML : public DQMEDHarvester {
0038 public:
0039
0040 DTOccupancyTestML(const edm::ParameterSet &ps);
0041
0042
0043 ~DTOccupancyTestML() override;
0044
0045 protected:
0046
0047 void beginRun(edm::Run const &run, edm::EventSetup const &context) override;
0048
0049
0050 void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override;
0051
0052
0053
0054 void dqmEndLuminosityBlock(DQMStore::IBooker &,
0055 DQMStore::IGetter &,
0056 edm::LuminosityBlock const &,
0057 edm::EventSetup const &) override;
0058
0059 private:
0060
0061 void bookHistos(DQMStore::IBooker &, const int wheelId, std::string folder, std::string histoTag);
0062
0063
0064 std::string getMEName(std::string histoTag, const DTChamberId &chId);
0065
0066 int getIntegral(TH2F *histo, int, int, int, int, bool);
0067
0068
0069 int runOccupancyTest(TH2F *histo,
0070 const DTChamberId &chId,
0071 float &chamberPercentage,
0072 tensorflow::GraphDef *graphDef,
0073 tensorflow::Session *session);
0074
0075 std::vector<float> interpolateLayers(std::vector<float> const &inputs, int size, int targetSize);
0076
0077 std::string topFolder(bool isBooking) const;
0078
0079 int nevents;
0080
0081 edm::ESGetToken<DTGeometry, MuonGeometryRecord> muonGeomToken_;
0082 const DTGeometry *muonGeom;
0083
0084
0085 std::map<int, MonitorElement *> wheelHistos;
0086 MonitorElement *summaryHisto;
0087 MonitorElement *glbSummaryHisto;
0088
0089 std::set<DTLayerId> monitoredLayers;
0090
0091 int lsCounter;
0092 int nMinEvts;
0093 int nMinEvtsPC;
0094 int nZeroEvtsPC;
0095
0096 bool writeRootFile;
0097 TFile *rootFile;
0098 TNtuple *ntuple;
0099 bool tpMode;
0100
0101 bool runOnAllHitsOccupancies;
0102 bool runOnNoiseOccupancies;
0103 bool runOnInTimeOccupancies;
0104 std::string nameMonitoredHisto;
0105
0106 bool bookingdone;
0107
0108 int nChannelTotal;
0109 int nChannelDead;
0110 };
0111
0112 #endif