Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Pixel DQM modules prohibiting concurrent lumis #32805

Merged
merged 1 commit into from
Feb 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Being picky here, I think <> are reserved to system includes and cmssw includes should use ""

#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.;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For future memory and readability 32 and 8 can be made named constants.

float averageFPIXFed = float(nFPIXDigis) / 8.;

if (averageDigiOccupancy) {
for (int i = 0; i != 40; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This 40 can be taken from here

MAXSiPixelFEDID = 40, // increase from 39 for the pilot blade fed

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