Skip to content

Commit

Permalink
Merge pull request #34516 from arossi83/PixelDRnR_v2
Browse files Browse the repository at this point in the history
Add DRnR plots to PixelPhase1 DQM
  • Loading branch information
cmsbuild authored Jul 21, 2021
2 parents 2739d11 + 80973f9 commit c6d0025
Show file tree
Hide file tree
Showing 9 changed files with 603 additions and 214 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
+ RunQTests_offline
+ SiPixelPhase1SummaryOffline
+ SiPixelBarycenterOffline
+ SiPixelPhase1ResidualsExtra
)

siPixelPhase1OfflineDQM_harvesting_cosmics = siPixelPhase1OfflineDQM_harvesting.copyAndExclude([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from DQM.SiPixelPhase1Track.SiPixelPhase1RecHits_cfi import *
# Residuals
from DQM.SiPixelPhase1Track.SiPixelPhase1TrackResiduals_cfi import *
from DQM.SiPixelPhase1Track.SiPixelPhase1ResidualsExtra_cfi import *
# Clusters ontrack/offtrack (also general tracks)
from DQM.SiPixelPhase1Track.SiPixelPhase1TrackClusters_cfi import *
# Hit Efficiencies
Expand All @@ -22,6 +23,8 @@
#Barycenter plots
from DQM.SiPixelPhase1Summary.SiPixelBarycenter_cfi import *



from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import *
from RecoLocalTracker.SiStripClusterizer.SiStripClusterChargeCut_cfi import *

Expand Down
1 change: 0 additions & 1 deletion DQM/SiPixelPhase1Summary/interface/SiPixelPhase1Summary.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ class SiPixelPhase1Summary : public DQMEDHarvester {

std::map<std::string, MonitorElement*> summaryMap_;
MonitorElement* deadROCSummary;
std::map<std::string, MonitorElement*> residuals_;
MonitorElement* reportSummary; //Float value of the average of the ins in the grand summary

std::map<std::string, std::string> summaryPlotName_;
Expand Down
211 changes: 0 additions & 211 deletions DQM/SiPixelPhase1Summary/src/SiPixelPhase1Summary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,106 +145,6 @@ void SiPixelPhase1Summary::bookSummaries(DQMStore::IBooker& iBooker) {
deadROCSummary->setBinLabel(i + 1, xAxisLabelsReduced_[i]);
}

//New residual plots for the PXBarrel separated by inner and outer modules per layer
iBooker.setCurrentFolder("PixelPhase1/Tracks/PXBarrel");
for (std::string layer : {"1", "2", "3", "4"}) {
float mean_range = 100.;
float rms_range = 200.;
if (layer == "1") {
mean_range = 200.;
rms_range = 1000.;
}
residuals_["residual_mean_x_Inner_PXLayer_" + layer] =
iBooker.book1D("residual_mean_x_Inner_PXLayer_" + layer,
"Mean Track Residuals X Inner Modules for Layer " + layer + ";mean(x_rec-x_pred)[#mum]",
100,
-1 * mean_range,
mean_range);
residuals_["residual_mean_x_Outer_PXLayer_" + layer] =
iBooker.book1D("residual_mean_x_Outer_PXLayer_" + layer,
"Mean Track Residuals X Outer Modules for Layer " + layer + ";mean(x_rec-x_pred)[#mum]",
100,
-1 * mean_range,
mean_range);
residuals_["residual_mean_y_Inner_PXLayer_" + layer] =
iBooker.book1D("residual_mean_y_Inner_PXLayer_" + layer,
"Mean Track Residuals Y Inner Modules for Layer " + layer + ";mean(y_rec-y_pred)[#mum]",
100,
-1 * mean_range,
mean_range);
residuals_["residual_mean_y_Outer_PXLayer_" + layer] =
iBooker.book1D("residual_mean_y_Outer_PXLayer_" + layer,
"Mean Track Residuals Y Outer Modules for Layer " + layer + ";mean(y_rec-y_pred)[#mum]",
100,
-1 * mean_range,
mean_range);

residuals_["residual_rms_x_Inner_PXLayer_" + layer] =
iBooker.book1D("residual_rms_x_Inner_PXLayer_" + layer,
"RMS of Track Residuals X Inner Modules for Layer " + layer + ";rms(x_rec-x_pred)[#mum]",
100,
0.,
rms_range);
residuals_["residual_rms_x_Outer_PXLayer_" + layer] =
iBooker.book1D("residual_rms_x_Outer_PXLayer_" + layer,
"RMS of Track Residuals X Outer Modules for Layer " + layer + ";rms(x_rec-x_pred)[#mum]",
100,
0.,
rms_range);
residuals_["residual_rms_y_Inner_PXLayer_" + layer] =
iBooker.book1D("residual_rms_y_Inner_PXLayer_" + layer,
"RMS of Track Residuals Y Inner Modules for Layer " + layer + ";rms(y_rec-y_pred)[#mum]",
100,
0.,
rms_range);
residuals_["residual_rms_y_Outer_PXLayer_" + layer] =
iBooker.book1D("residual_rms_y_Outer_PXLayer_" + layer,
"RMS of Track Residuals Y Outer Modules for Layer " + layer + ";rms(y_rec-y_pred)[#mum]",
100,
0.,
rms_range);
}

//New residual plots for the PXForward separated by inner and outer modules
iBooker.setCurrentFolder("PixelPhase1/Tracks/PXForward");
residuals_["residual_mean_x_Inner"] = iBooker.book1D(
"residual_mean_x_Inner", "Mean Track Residuals X Inner Modules;mean(x_rec-x_pred)[#mum]", 100, -100., 100.);
residuals_["residual_mean_x_Outer"] = iBooker.book1D(
"residual_mean_x_Outer", "Mean Track Residuals X Outer Modules;mean(x_rec-x_pred)[#mum]", 100, -100., 100.);
residuals_["residual_mean_y_Inner"] = iBooker.book1D(
"residual_mean_y_Inner", "Mean Track Residuals Y Inner Modules;mean(y_rec-y_pred)[#mum]", 100, -100., 100.);
residuals_["residual_mean_y_Outer"] = iBooker.book1D(
"residual_mean_y_Outer", "Mean Track Residuals Y Outer Modules;mean(y_rec-y_pred)[#mum]", 100, -100., 100.);

residuals_["residual_rms_x_Inner"] = iBooker.book1D(
"residual_rms_x_Inner", "RMS of Track Residuals X Inner Modules;rms(x_rec-x_pred)[#mum]", 100, 0., 200.);
residuals_["residual_rms_x_Outer"] = iBooker.book1D(
"residual_rms_x_Outer", "RMS of Track Residuals X Outer Modules;rms(x_rec-x_pred)[#mum]", 100, 0., 200.);
residuals_["residual_rms_y_Inner"] = iBooker.book1D(
"residual_rms_y_Inner", "RMS of Track Residuals Y Inner Modules;rms(y_rec-y_pred)[#mum]", 100, 0., 200.);
residuals_["residual_rms_y_Outer"] = iBooker.book1D(
"residual_rms_y_Outer", "RMS of Track Residuals Y Outer Modules;rms(y_rec-y_pred)[#mum]", 100, 0., 200.);

//New residual plots for the PXForward separated by positive and negative side
iBooker.setCurrentFolder("PixelPhase1/Tracks/PXForward");
residuals_["residual_mean_x_pos"] = iBooker.book1D(
"residual_mean_x_pos", "Mean Track Residuals X pos. Side;mean(x_rec-x_pred)[#mum]", 100, -100., 100.);
residuals_["residual_mean_x_neg"] = iBooker.book1D(
"residual_mean_x_neg", "Mean Track Residuals X neg. Side;mean(x_rec-x_pred)[#mum]", 100, -100., 100.);
residuals_["residual_mean_y_pos"] = iBooker.book1D(
"residual_mean_y_pos", "Mean Track Residuals Y pos. Side;mean(y_rec-y_pred)[#mum]", 100, -100., 100.);
residuals_["residual_mean_y_neg"] = iBooker.book1D(
"residual_mean_y_neg", "Mean Track Residuals Y neg. Side;mean(y_rec-y_pred)[#mum]", 100, -100., 100.);

residuals_["residual_rms_x_pos"] =
iBooker.book1D("residual_rms_x_pos", "RMS of Track Residuals X pos. Side;rms(x_rec-x_pred)[#mum]", 100, 0., 200.);
residuals_["residual_rms_x_neg"] =
iBooker.book1D("residual_rms_x_neg", "RMS of Track Residuals X neg. Side;rms(x_rec-x_pred)[#mum]", 100, 0., 200.);
residuals_["residual_rms_y_pos"] =
iBooker.book1D("residual_rms_y_pos", "RMS of Track Residuals Y pos. Side;rms(y_rec-y_pred)[#mum]", 100, 0., 200.);
residuals_["residual_rms_y_neg"] =
iBooker.book1D("residual_rms_y_neg", "RMS of Track Residuals Y neg. Side;rms(y_rec-y_pred)[#mum]", 100, 0., 200.);

//Book the summary plot
iBooker.setCurrentFolder("PixelPhase1/EventInfo");

Expand Down Expand Up @@ -384,117 +284,6 @@ void SiPixelPhase1Summary::fillSummaries(DQMStore::IBooker& iBooker, DQMStore::I
deadROCSummary->setBinContent(xBin, yBin, nROCs / nRocsPerTrend[i]);
}

//Fill additional residuals plots
//PXBarrel

constexpr int minHits = 30; //Miniminal number of hits needed for module to be filled in histograms

for (std::string layer : {"1", "2", "3", "4"}) {
MonitorElement* me_x =
iGetter.get("PixelPhase1/Tracks/PXBarrel/residual_x_per_SignedModule_per_SignedLadder_PXLayer_" + layer);
MonitorElement* me_y =
iGetter.get("PixelPhase1/Tracks/PXBarrel/residual_y_per_SignedModule_per_SignedLadder_PXLayer_" + layer);

for (int i = 1; i <= me_x->getNbinsY(); i++) {
if (i == (me_x->getNbinsY() / 2 + 1))
continue; //Middle bin of y axis is empty

if (i <= me_x->getNbinsY() / 2) {
bool iAmInner = (i % 2 == 0); //Check whether current ladder is inner or outer ladder
if (iAmInner) {
for (int j : {1, 2, 3, 4, 6, 7, 8, 9}) {
if (me_x->getBinEntries(j, i) < minHits) //Fill only if number of hits is above threshold
continue;
residuals_["residual_mean_x_Inner_PXLayer_" + layer]->Fill(me_x->getBinContent(j, i) * 1e4);
residuals_["residual_mean_y_Inner_PXLayer_" + layer]->Fill(me_y->getBinContent(j, i) * 1e4);
residuals_["residual_rms_x_Inner_PXLayer_" + layer]->Fill(me_x->getBinError(j, i) * 1e4);
residuals_["residual_rms_y_Inner_PXLayer_" + layer]->Fill(me_y->getBinError(j, i) * 1e4);
}
} else {
for (int j : {1, 2, 3, 4, 6, 7, 8, 9}) {
if (me_x->getBinEntries(j, i) < minHits) //Fill only if number of hits is above threshold
continue;
residuals_["residual_mean_x_Outer_PXLayer_" + layer]->Fill(me_x->getBinContent(j, i) * 1e4);
residuals_["residual_mean_y_Outer_PXLayer_" + layer]->Fill(me_y->getBinContent(j, i) * 1e4);
residuals_["residual_rms_x_Outer_PXLayer_" + layer]->Fill(me_x->getBinError(j, i) * 1e4);
residuals_["residual_rms_y_Outer_PXLayer_" + layer]->Fill(me_y->getBinError(j, i) * 1e4);
}
}
} else {
bool iAmInner = (i % 2 == 1); //Check whether current ladder is inner or outer ladder
if (iAmInner) {
for (int j : {1, 2, 3, 4, 6, 7, 8, 9}) {
if (me_x->getBinEntries(j, i) < minHits) //Fill only if number of hits is above threshold
continue;
residuals_["residual_mean_x_Inner_PXLayer_" + layer]->Fill(me_x->getBinContent(j, i) * 1e4);
residuals_["residual_mean_y_Inner_PXLayer_" + layer]->Fill(me_y->getBinContent(j, i) * 1e4);
residuals_["residual_rms_x_Inner_PXLayer_" + layer]->Fill(me_x->getBinError(j, i) * 1e4);
residuals_["residual_rms_y_Inner_PXLayer_" + layer]->Fill(me_y->getBinError(j, i) * 1e4);
}
} else {
for (int j : {1, 2, 3, 4, 6, 7, 8, 9}) {
if (me_x->getBinEntries(j, i) < minHits) //Fill only if number of hits is above threshold
continue;
residuals_["residual_mean_x_Outer_PXLayer_" + layer]->Fill(me_x->getBinContent(j, i) * 1e4);
residuals_["residual_mean_y_Outer_PXLayer_" + layer]->Fill(me_y->getBinContent(j, i) * 1e4);
residuals_["residual_rms_x_Outer_PXLayer_" + layer]->Fill(me_x->getBinError(j, i) * 1e4);
residuals_["residual_rms_y_Outer_PXLayer_" + layer]->Fill(me_y->getBinError(j, i) * 1e4);
}
}
}
}
}

//PXForward separating outer and inner modules as well as positive and negative side
for (std::string ring : {"1", "2"}) {
MonitorElement* me_x =
iGetter.get("PixelPhase1/Tracks/PXForward/residual_x_per_PXDisk_per_SignedBladePanel_PXRing_" + ring);
MonitorElement* me_y =
iGetter.get("PixelPhase1/Tracks/PXForward/residual_y_per_PXDisk_per_SignedBladePanel_PXRing_" + ring);
bool posSide = false;
for (int j = 1; j <= me_x->getNbinsX(); j++) {
if (j == 4)
continue; //fourth x-bin in profile plots is empty

if (j == 5)
posSide = true; //change to postive side

for (int i = 1; i <= me_x->getNbinsY(); i++) {
if (i == me_x->getNbinsY() / 2)
continue; //Middle bins of y axis is empty
if (i == (me_x->getNbinsY() / 2) + 1)
continue;
if (me_x->getBinEntries(j, i) < minHits) //Fill only if number of hits is above threshold
continue;

bool iAmInner = (i % 2 == 0); //separate inner and outer modules
if (iAmInner) {
residuals_["residual_mean_x_Inner"]->Fill(me_x->getBinContent(j, i) * 1e4);
residuals_["residual_mean_y_Inner"]->Fill(me_y->getBinContent(j, i) * 1e4);
residuals_["residual_rms_x_Inner"]->Fill(me_x->getBinError(j, i) * 1e4);
residuals_["residual_rms_y_Inner"]->Fill(me_y->getBinError(j, i) * 1e4);
} else {
residuals_["residual_mean_x_Outer"]->Fill(me_x->getBinContent(j, i) * 1e4);
residuals_["residual_mean_y_Outer"]->Fill(me_y->getBinContent(j, i) * 1e4);
residuals_["residual_rms_x_Outer"]->Fill(me_x->getBinError(j, i) * 1e4);
residuals_["residual_rms_y_Outer"]->Fill(me_y->getBinError(j, i) * 1e4);
}

if (!posSide) { //separate postive and negative side
residuals_["residual_mean_x_neg"]->Fill(me_x->getBinContent(j, i) * 1e4);
residuals_["residual_mean_y_neg"]->Fill(me_y->getBinContent(j, i) * 1e4);
residuals_["residual_rms_x_neg"]->Fill(me_x->getBinError(j, i) * 1e4);
residuals_["residual_rms_y_neg"]->Fill(me_y->getBinError(j, i) * 1e4);
} else {
residuals_["residual_mean_x_pos"]->Fill(me_x->getBinContent(j, i) * 1e4);
residuals_["residual_mean_y_pos"]->Fill(me_y->getBinContent(j, i) * 1e4);
residuals_["residual_rms_x_pos"]->Fill(me_x->getBinError(j, i) * 1e4);
residuals_["residual_rms_y_pos"]->Fill(me_y->getBinError(j, i) * 1e4);
}
}
}
}

//Sum of non-negative bins for the reportSummary
float sumOfNonNegBins = 0.;
//Now we will use the other summary maps to create the overall map.
Expand Down
63 changes: 63 additions & 0 deletions DQM/SiPixelPhase1Track/interface/SiPixelPhase1ResidualsExtra.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#ifndef SiPixelPhase1ResidualsExtra_SiPixelPhase1ResidualsExtra_h
#define SiPixelPhase1ResidualsExtra_SiPixelPhase1ResidualsExtra_h
// -*- C++ -*-
//
// Package: SiPixelPhase1ResidualsExtra
// Class : SiPixelPhase1ResidualsExtra
//
/*
Description: Introduce some computation over the PixelPhase1 residuals distributions
Usage:
<usage>
*/
//
// Original Author: Alessandro Rossi
// Created: 21st May 2021
//

//#include <memory>

// user include files
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/MakerMacros.h"

#include "DQMServices/Core/interface/DQMStore.h"
#include "DQMServices/Core/interface/DQMEDHarvester.h"

#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"

#include "FWCore/ParameterSet/interface/ParameterSet.h"

class SiPixelPhase1ResidualsExtra : public DQMEDHarvester {
public:
explicit SiPixelPhase1ResidualsExtra(const edm::ParameterSet& conf);
~SiPixelPhase1ResidualsExtra() override;

protected:
// BeginRun
void beginRun(edm::Run const& run, edm::EventSetup const& eSetup) override;

// EndJob
void dqmEndJob(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter) override;

private:
std::string topFolderName_;
int minHits_;
edm::ParameterSet conf_;

std::map<std::string, MonitorElement*> residuals_;
std::map<std::string, MonitorElement*> DRnR_;

//Book Monitoring Elements
void bookMEs(DQMStore::IBooker& iBooker);

//Fill Monitoring Elements
void fillMEs(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter);
};

#endif
Loading

0 comments on commit c6d0025

Please sign in to comment.