Skip to content

Commit

Permalink
Merge pull request #36151 from arossi83/HarvesterFix
Browse files Browse the repository at this point in the history
TkDQM: Add checks to avoid Segfault when a ME is not present at harvesting step
  • Loading branch information
cmsbuild committed Nov 23, 2021
2 parents ba3eb54 + 2b13e67 commit 1943ec8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
13 changes: 13 additions & 0 deletions DQM/SiPixelPhase1Track/plugins/SiPixelPhase1ResidualsExtra.cc
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,12 @@ void SiPixelPhase1ResidualsExtra::fillMEs(DQMStore::IBooker& iBooker, DQMStore::
MonitorElement* me2_y = iGetter.get(
"PixelPhase1/Tracks/ResidualsExtra/PXBarrel/DRnR_y_per_SignedModule_per_SignedLadder_PXLayer_" + layer);

if (me_x == nullptr || me_y == nullptr || me2_x == nullptr || me2_y == nullptr) {
edm::LogWarning("SiPixelPhase1ResidualsExtra")
<< "Residuals plots for Pixel BPIX Layer" << layer << " not found. Skipping ResidualsExtra plots generation.";
continue;
}

for (int i = 1; i <= me_x->getNbinsY(); i++) {
if (i == (me_x->getNbinsY() / 2 + 1))
continue; //Middle bin of y axis is empty
Expand Down Expand Up @@ -389,6 +395,13 @@ void SiPixelPhase1ResidualsExtra::fillMEs(DQMStore::IBooker& iBooker, DQMStore::
"PixelPhase1/Tracks/ResidualsExtra/PXForward/DRnR_x_per_PXDisk_per_SignedBladePanel_PXRing_" + ring);
MonitorElement* me2_y = iGetter.get(
"PixelPhase1/Tracks/ResidualsExtra/PXForward/DRnR_y_per_PXDisk_per_SignedBladePanel_PXRing_" + ring);

if (me_x == nullptr || me_y == nullptr || me2_x == nullptr || me2_y == nullptr) {
edm::LogWarning("SiPixelPhase1ResidualsExtra")
<< "Residuals plots for Pixel FPIX Ring" << ring << " not found. Skipping ResidualsExtra plots generation.";
continue;
}

bool posSide = false;
for (int j = 1; j <= me_x->getNbinsX(); j++) {
if (j == 4)
Expand Down
5 changes: 5 additions & 0 deletions DQM/TrackingMonitor/src/TrackFoldedOccupancyClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ void TrackFoldedOccupancyClient::dqmEndJob(DQMStore::IBooker& ibooker, DQMStore:
hname = "TrackEtaPhiInvertedoutofphase_";
MonitorElement* TrackEtaPhiInvertedoutofphase = igetter.get(inFolder + hname + histTag_);

if (TrackEtaPhi == nullptr || TrackEtaPhiInverted == nullptr || TrackEtaPhiInvertedoutofphase == nullptr) {
edm::LogWarning("TrackFoldedOccupancyClient") << "MEs needed for this module not found. Skipping.";
return;
}

TkEtaPhi_Ratio_byFoldingmap->divide(TrackEtaPhi, TrackEtaPhiInverted, 1., 1., "");
TkEtaPhi_Ratio_byFoldingmap_op->divide(TrackEtaPhi, TrackEtaPhiInvertedoutofphase, 1., 1., "");

Expand Down

0 comments on commit 1943ec8

Please sign in to comment.