From e97c3d42d4a961b990638c6cce5bab68ecebcbdd Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury Date: Wed, 3 Feb 2021 16:57:00 +0100 Subject: [PATCH] update the modules after code format --- .../interface/SiPixelDigiSource.h | 13 ++- .../src/SiPixelDigiSource.cc | 101 ++++++++++-------- .../interface/SiPixelRawDataErrorSource.h | 4 +- 3 files changed, 62 insertions(+), 56 deletions(-) diff --git a/DQM/SiPixelMonitorDigi/interface/SiPixelDigiSource.h b/DQM/SiPixelMonitorDigi/interface/SiPixelDigiSource.h index 0ccfb71b4dcfa..99c1eb5c4f9cd 100644 --- a/DQM/SiPixelMonitorDigi/interface/SiPixelDigiSource.h +++ b/DQM/SiPixelMonitorDigi/interface/SiPixelDigiSource.h @@ -25,12 +25,11 @@ #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/CommonTopologies/interface/PixelTopology.h" #include "Geometry/Records/interface/TrackerTopologyRcd.h" -#include "DQMServices/Core/interface/DQMOneEDAnalyzer.h" #include "DQM/SiPixelMonitorDigi/interface/SiPixelDigiModule.h" - +#include #include -class SiPixelDigiSource : public DQMOneLumiEDAnalyzer<> { +class SiPixelDigiSource : public DQMOneEDAnalyzer> { public: explicit SiPixelDigiSource(const edm::ParameterSet& conf); ~SiPixelDigiSource() override; @@ -40,9 +39,9 @@ class SiPixelDigiSource : public DQMOneLumiEDAnalyzer<> { void analyze(const edm::Event&, const edm::EventSetup&) override; void dqmBeginRun(const edm::Run&, edm::EventSetup const&) override; void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; - - void dqmBeginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; - void dqmEndLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; + std::shared_ptr globalBeginLuminosityBlock(const edm::LuminosityBlock& lumi, + const edm::EventSetup& iSetup) const override; + void globalEndLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; virtual void buildStructure(edm::EventSetup const&); virtual void bookMEs(DQMStore::IBooker&, const edm::EventSetup& iSetup); @@ -226,7 +225,7 @@ class SiPixelDigiSource : public DQMOneLumiEDAnalyzer<> { int nDigisB; //define Token(-s) - edm::EDGetTokenT > srcToken_; + edm::EDGetTokenT> srcToken_; edm::ESGetToken trackerTopoToken_; edm::ESGetToken trackerTopoTokenBeginRun_; edm::ESGetToken trackerGeomTokenBeginRun_; diff --git a/DQM/SiPixelMonitorDigi/src/SiPixelDigiSource.cc b/DQM/SiPixelMonitorDigi/src/SiPixelDigiSource.cc index 8f06141a8b76d..400225c3d45bf 100644 --- a/DQM/SiPixelMonitorDigi/src/SiPixelDigiSource.cc +++ b/DQM/SiPixelMonitorDigi/src/SiPixelDigiSource.cc @@ -101,15 +101,66 @@ SiPixelDigiSource::~SiPixelDigiSource() { LogInfo("PixelDQM") << "SiPixelDigiSource::~SiPixelDigiSource: Destructor" << endl; } -void SiPixelDigiSource::dqmBeginLuminosityBlock(const edm::LuminosityBlock& lb, edm::EventSetup const&) { +std::shared_ptr SiPixelDigiSource::globalBeginLuminosityBlock(const edm::LuminosityBlock& lumi, + const edm::EventSetup& iSetup) const { + unsigned int currentLS = lumi.id().luminosityBlock(); + bool resetCounters = (currentLS % 10 == 0) ? true : false; + return std::make_shared(resetCounters); +} + +void SiPixelDigiSource::globalEndLuminosityBlock(const edm::LuminosityBlock& lb, edm::EventSetup const&) { int thisls = lb.id().luminosityBlock(); + const bool resetCounters = luminosityBlockCache(lb.index()); + + float averageBPIXFed = float(nBPIXDigis) / 32.; + float averageFPIXFed = float(nFPIXDigis) / 8.; + + if (averageDigiOccupancy) { + for (int i = 0; i != 40; i++) { + float averageOcc = 0.; + if (i < 32) { + if (averageBPIXFed > 0.) + averageOcc = nDigisPerFed[i] / averageBPIXFed; + } else { + if (averageFPIXFed > 0.) + averageOcc = nDigisPerFed[i] / averageFPIXFed; + } + if (!modOn) { + averageDigiOccupancy->Fill( + i, + nDigisPerFed[i]); //In offline we fill all digis and normalise at the end of the run for thread safe behaviour. + avgfedDigiOccvsLumi->setBinContent(thisls, i + 1, nDigisPerFed[i]); //Same plot vs lumi section + } + if (modOn) { + if (thisls % 10 == 0) + averageDigiOccupancy->Fill( + i, + averageOcc); // "modOn" basically mean Online DQM, in this case fill histos with actual value of digi fraction per fed for each ten lumisections + if (avgfedDigiOccvsLumi && thisls % 5 == 0) + avgfedDigiOccvsLumi->setBinContent( + int(thisls / 5), + i + 1, + averageOcc); //fill with the mean over 5 lumisections, previous code was filling this histo only with last event of each 10th lumisection + } + } - if (modOn && thisls % 10 == 0 && averageDigiOccupancy) { + if (modOn && thisls % 10 == 0) { + avgBarrelFedOccvsLumi->setBinContent( + int(thisls / 10), averageBPIXFed); // vs lumisection for barrel, filled every 10 lumi sections + avgEndcapFedOccvsLumi->setBinContent( + int(thisls / 10), averageFPIXFed); // vs lumisection for endcap, filled every 10 lumi sections + } + } + + //reset counters + + if (modOn && resetCounters && averageDigiOccupancy) { nBPIXDigis = 0; nFPIXDigis = 0; for (int i = 0; i != 40; i++) nDigisPerFed[i] = 0; } + if (!modOn && averageDigiOccupancy) { nBPIXDigis = 0; nFPIXDigis = 0; @@ -117,7 +168,7 @@ void SiPixelDigiSource::dqmBeginLuminosityBlock(const edm::LuminosityBlock& lb, nDigisPerFed[i] = 0; } - if (modOn && thisls % 10 == 0) { + if (modOn && resetCounters) { ROCMapToReset = true; //the ROC map is reset each 10 lumisections for (int i = 0; i < 2; i++) @@ -160,50 +211,6 @@ void SiPixelDigiSource::dqmBeginLuminosityBlock(const edm::LuminosityBlock& lb, } } -void SiPixelDigiSource::dqmEndLuminosityBlock(const edm::LuminosityBlock& lb, edm::EventSetup const&) { - int thisls = lb.id().luminosityBlock(); - - float averageBPIXFed = float(nBPIXDigis) / 32.; - float averageFPIXFed = float(nFPIXDigis) / 8.; - - if (averageDigiOccupancy) { - for (int i = 0; i != 40; i++) { - float averageOcc = 0.; - if (i < 32) { - if (averageBPIXFed > 0.) - averageOcc = nDigisPerFed[i] / averageBPIXFed; - } else { - if (averageFPIXFed > 0.) - averageOcc = nDigisPerFed[i] / averageFPIXFed; - } - if (!modOn) { - averageDigiOccupancy->Fill( - i, - nDigisPerFed[i]); //In offline we fill all digis and normalise at the end of the run for thread safe behaviour. - avgfedDigiOccvsLumi->setBinContent(thisls, i + 1, nDigisPerFed[i]); //Same plot vs lumi section - } - if (modOn) { - if (thisls % 10 == 0) - averageDigiOccupancy->Fill( - i, - averageOcc); // "modOn" basically mean Online DQM, in this case fill histos with actual value of digi fraction per fed for each ten lumisections - if (avgfedDigiOccvsLumi && thisls % 5 == 0) - avgfedDigiOccvsLumi->setBinContent( - int(thisls / 5), - i + 1, - averageOcc); //fill with the mean over 5 lumisections, previous code was filling this histo only with last event of each 10th lumisection - } - } - - if (modOn && thisls % 10 == 0) { - avgBarrelFedOccvsLumi->setBinContent( - int(thisls / 10), averageBPIXFed); // vs lumisection for barrel, filled every 10 lumi sections - avgEndcapFedOccvsLumi->setBinContent( - int(thisls / 10), averageFPIXFed); // vs lumisection for endcap, filled every 10 lumi sections - } - } -} - void SiPixelDigiSource::dqmBeginRun(const edm::Run& r, const edm::EventSetup& iSetup) { LogInfo("PixelDQM") << " SiPixelDigiSource::beginJob - Initialisation ... " << std::endl; LogInfo("PixelDQM") << "Mod/Lad/Lay/Phi " << modOn << "/" << ladOn << "/" << layOn << "/" << phiOn << std::endl; diff --git a/DQM/SiPixelMonitorRawData/interface/SiPixelRawDataErrorSource.h b/DQM/SiPixelMonitorRawData/interface/SiPixelRawDataErrorSource.h index f6214527753ee..d202fb04a99fa 100644 --- a/DQM/SiPixelMonitorRawData/interface/SiPixelRawDataErrorSource.h +++ b/DQM/SiPixelMonitorRawData/interface/SiPixelRawDataErrorSource.h @@ -28,7 +28,7 @@ #include // user include files -#include "DQMServices/Core/interface/DQMOneEDAnalyzer.h" +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" #include "DQM/SiPixelMonitorRawData/interface/SiPixelRawDataErrorModule.h" #include "DataFormats/Common/interface/DetSetVector.h" #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" @@ -38,7 +38,7 @@ #include "Geometry/Records/interface/TrackerTopologyRcd.h" #include -class SiPixelRawDataErrorSource : public DQMOneLumiEDAnalyzer<> { +class SiPixelRawDataErrorSource : public DQMEDAnalyzer { public: explicit SiPixelRawDataErrorSource(const edm::ParameterSet &conf); ~SiPixelRawDataErrorSource() override;