Skip to content

Commit

Permalink
update the modules after code format
Browse files Browse the repository at this point in the history
  • Loading branch information
sroychow committed Feb 3, 2021
1 parent 08a23c0 commit e97c3d4
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 56 deletions.
13 changes: 6 additions & 7 deletions DQM/SiPixelMonitorDigi/interface/SiPixelDigiSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <DQMServices/Core/interface/DQMOneEDAnalyzer.h>
#include <cstdint>

class SiPixelDigiSource : public DQMOneLumiEDAnalyzer<> {
class SiPixelDigiSource : public DQMOneEDAnalyzer<edm::LuminosityBlockCache<bool>> {
public:
explicit SiPixelDigiSource(const edm::ParameterSet& conf);
~SiPixelDigiSource() override;
Expand All @@ -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<bool> 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);
Expand Down Expand Up @@ -226,7 +225,7 @@ class SiPixelDigiSource : public DQMOneLumiEDAnalyzer<> {
int nDigisB;

//define Token(-s)
edm::EDGetTokenT<edm::DetSetVector<PixelDigi> > srcToken_;
edm::EDGetTokenT<edm::DetSetVector<PixelDigi>> srcToken_;
edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> trackerTopoToken_;
edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> trackerTopoTokenBeginRun_;
edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> trackerGeomTokenBeginRun_;
Expand Down
101 changes: 54 additions & 47 deletions DQM/SiPixelMonitorDigi/src/SiPixelDigiSource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,23 +101,74 @@ SiPixelDigiSource::~SiPixelDigiSource() {
LogInfo("PixelDQM") << "SiPixelDigiSource::~SiPixelDigiSource: Destructor" << endl;
}

void SiPixelDigiSource::dqmBeginLuminosityBlock(const edm::LuminosityBlock& lb, edm::EventSetup const&) {
std::shared_ptr<bool> 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<bool>(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); //<NDigis> vs lumisection for barrel, filled every 10 lumi sections
avgEndcapFedOccvsLumi->setBinContent(
int(thisls / 10), averageFPIXFed); //<NDigis> 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;
for (int i = 0; i != 40; i++)
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++)
Expand Down Expand Up @@ -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); //<NDigis> vs lumisection for barrel, filled every 10 lumi sections
avgEndcapFedOccvsLumi->setBinContent(
int(thisls / 10), averageFPIXFed); //<NDigis> 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <memory>

// 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"
Expand All @@ -38,7 +38,7 @@
#include "Geometry/Records/interface/TrackerTopologyRcd.h"
#include <cstdint>

class SiPixelRawDataErrorSource : public DQMOneLumiEDAnalyzer<> {
class SiPixelRawDataErrorSource : public DQMEDAnalyzer {
public:
explicit SiPixelRawDataErrorSource(const edm::ParameterSet &conf);
~SiPixelRawDataErrorSource() override;
Expand Down

0 comments on commit e97c3d4

Please sign in to comment.