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

[Payload Inspector] Add more SiPixel inspection classes #29864

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
721461e
testing
mmusich Apr 16, 2020
4dba88a
TH2Poly maps WIP
mmusich Apr 17, 2020
1d9ac23
finalize the phase1pixelmaps and use it in the SiPixelTemplate Payloa…
mmusich Apr 20, 2020
41fd432
further improvements to SiPixelTemplateDBObject Payload Inspector
mmusich Apr 21, 2020
53a7589
refinements of the Template plots
mmusich Apr 22, 2020
239e342
add not supported caption for not supported geometries
mmusich Apr 22, 2020
a36e959
several improvements to the Payload Inspector
mmusich Apr 26, 2020
909682b
add PixelRegionContainers class
mmusich Apr 27, 2020
ab1f69d
make us of PixelRegionContainers inside the LorentzAngle Payload Insp…
mmusich Apr 30, 2020
1b12449
update LorentzAngle Payload Inspector test
mmusich Apr 30, 2020
41e4d25
more work on the Lorentz Angle Payload inspector
mmusich May 3, 2020
a16495c
add per region plots for the Gains and Pedestals
mmusich May 10, 2020
b7d0d34
more fine-tuning of the by-Region plots
mmusich May 7, 2020
de076e0
fix filling of layer/ring plots in phase-0 case
mmusich May 8, 2020
9014c1a
add display not supported
mmusich May 10, 2020
948f6fd
move to shared pointers in lieu of raw pointers
mmusich May 11, 2020
0ec0796
remove methods giving compiliation warnings
mmusich May 11, 2020
131c95b
code-checks
mmusich May 11, 2020
ed021b5
add header inspection plots
mmusich May 11, 2020
957f936
few improvements in SiPixelTemplateDBObject PayloadInspector
mmusich May 11, 2020
d5201b0
fix fill method for SiPixelTemplateDBObject_PayloadInspector
mmusich May 13, 2020
f2ea129
add additional plot in the test script
mmusich May 14, 2020
c7e34e1
profit of the new class templates introduced in #29622
mmusich May 14, 2020
6d8d3ad
add check on the setting of user-inputed parameters
mmusich May 15, 2020
9f55baf
add one class to unit test in order to test also PixelRegionContainers.h
mmusich May 15, 2020
66e5bd3
improve testing
mmusich May 15, 2020
06d8b99
include features to do by-region comparisons of one multi-ioved tag a…
mmusich May 15, 2020
f213866
improvements in the SiPixelLorentzAngle_PayloadInspector
mmusich May 15, 2020
0d50e1e
some aesthetical improvements in PixelRegionContainers
mmusich May 15, 2020
0f576b8
support comparison per layer / disk for Gains and Pedestals
mmusich May 15, 2020
908a483
better variable naming
mmusich May 17, 2020
21490dc
better variable naming, add new plots also to HLT Gain Payload Inspector
mmusich May 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
267 changes: 267 additions & 0 deletions CondCore/SiPixelPlugins/interface/Phase1PixelMaps.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
#ifndef CONDCORE_SIPIXELPLUGINS_PHASE1PIXELMAPS_H
#define CONDCORE_SIPIXELPLUGINS_PHASE1PIXELMAPS_H

#include "TH2Poly.h"
#include "CalibTracker/StandaloneTrackerTopology/interface/StandaloneTrackerTopology.h"
#include "CondCore/SiPixelPlugins/interface/SiPixelPayloadInspectorHelper.h"

/*--------------------------------------------------------------------
/ Ancillary class to build pixel phase-1 tracker maps
/--------------------------------------------------------------------*/
class Phase1PixelMaps {
public:
Phase1PixelMaps(const char* option)
: m_option{option},
m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile(
edm::FileInPath("Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml").fullPath())} {
// store the file in path for the corners (BPIX)
for (unsigned int i = 1; i <= 4; i++) {
m_cornersBPIX.push_back(edm::FileInPath(Form("DQM/SiStripMonitorClient/data/Geometry/vertices_barrel_%i", i)));
}

// store the file in path for the corners (BPIX)
for (int j : {-3, -2, -1, 1, 2, 3}) {
m_cornersFPIX.push_back(edm::FileInPath(Form("DQM/SiStripMonitorClient/data/Geometry/vertices_forward_%i", j)));
}
}

~Phase1PixelMaps() {}

//============================================================================
void bookBarrelHistograms(const std::string& currentHistoName, const char* what) {
std::string histName;
std::shared_ptr<TH2Poly> th2p;

for (unsigned i = 0; i < 4; ++i) {
histName = "barrel_layer_";

th2p = std::make_shared<TH2Poly>((histName + std::to_string(i + 1)).c_str(),
Form("PXBMap of %s - Layer %i", what, i + 1),
-15.0,
15.0,
0.0,
5.0);
Comment on lines +40 to +43
Copy link
Contributor

Choose a reason for hiding this comment

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

numbers


th2p->SetFloat();

th2p->GetXaxis()->SetTitle("z [cm]");
th2p->GetYaxis()->SetTitle("ladder");
//th2p->GetXaxis()->SetTitleOffset(0.09);
//th2p->GetYaxis()->SetTitleOffset(0.09);
th2p->SetStats(false);
th2p->SetOption(m_option);
pxbTh2PolyBarrel[currentHistoName].push_back(th2p);
}

th2p = std::make_shared<TH2Poly>("barrel_summary", "PXBMap", -5.0, 5.0, 0.0, 5.0);
th2p->SetFloat();

th2p->GetXaxis()->SetTitle("");
th2p->GetYaxis()->SetTitle("~ladder");
th2p->SetStats(false);
th2p->SetOption(m_option);
pxbTh2PolyBarrelSummary[currentHistoName] = th2p;
}

//============================================================================
void bookForwardHistograms(const std::string& currentHistoName, const char* what) {
std::string histName;
std::shared_ptr<TH2Poly> th2p;

for (unsigned side = 1; side <= 2; ++side) {
for (unsigned disk = 1; disk <= 3; ++disk) {
histName = "forward_disk_";

th2p = std::make_shared<TH2Poly>((histName + std::to_string((side == 1 ? -(int(disk)) : (int)disk))).c_str(),
Form("PXFMap of %s - Side %i Disk %i", what, side, disk),
-15.0,
15.0,
-15.0,
15.0);
Comment on lines +77 to +80
Copy link
Contributor

Choose a reason for hiding this comment

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

numbers

th2p->SetFloat();
th2p->GetXaxis()->SetTitle("x [cm]");
th2p->GetYaxis()->SetTitle("y [cm]");
//th2p->GetXaxis()->SetTitleOffset(0.09);
//th2p->GetYaxis()->SetTitleOffset(0.09);
mmusich marked this conversation as resolved.
Show resolved Hide resolved
th2p->SetStats(false);
th2p->SetOption(m_option);
pxfTh2PolyForward[currentHistoName].push_back(th2p);
}
}

th2p = std::make_shared<TH2Poly>("forward_summary", "PXFMap", -40.0, 50.0, -20.0, 90.0);
Copy link
Contributor

Choose a reason for hiding this comment

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

numbers

th2p->SetFloat();

th2p->GetXaxis()->SetTitle("");
th2p->GetYaxis()->SetTitle("");
th2p->SetStats(false);
th2p->SetOption(m_option);
pxfTh2PolyForwardSummary[currentHistoName] = th2p;
}

//============================================================================
void bookBarrelBins(const std::string& currentHistoName) {
auto theIndexedCorners = SiPixelPI::retrieveCorners(m_cornersBPIX, 4);

for (const auto& entry : theIndexedCorners) {
auto id = entry.first;
auto detid = DetId(id);
if (detid.subdetId() != PixelSubdetector::PixelBarrel)
continue;

int layer = m_trackerTopo.pxbLayer(detid);
int ladder = m_trackerTopo.pxbLadder(detid);

auto theVectX = entry.second.first;
auto theVectY = entry.second.second;

float vertX[] = {theVectX[0], theVectX[1], theVectX[2], theVectX[3], theVectX[4]};
float vertY[] = {(ladder - 1.0f), (ladder - 1.0f), (float)ladder, (float)ladder, (ladder - 1.0f)};

bins[id] = std::make_shared<TGraph>(5, vertX, vertY);
bins[id]->SetName(TString::Format("%u", id));

// Summary plot
for (unsigned k = 0; k < 5; ++k) {
vertX[k] += ((layer == 2 || layer == 3) ? 0.0f : -60.0f);
vertY[k] += ((layer > 2) ? 30.0f : 0.0f);
Comment on lines +126 to +127
Copy link
Contributor

Choose a reason for hiding this comment

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

numbers

}

binsSummary[id] = std::make_shared<TGraph>(5, vertX, vertY);
binsSummary[id]->SetName(TString::Format("%u", id));

pxbTh2PolyBarrel[currentHistoName][layer - 1]->AddBin(bins[id]->Clone());
pxbTh2PolyBarrelSummary[currentHistoName]->AddBin(binsSummary[id]->Clone());
}
}

//============================================================================
void bookForwardBins(const std::string& currentHistoName) {
auto theIndexedCorners = SiPixelPI::retrieveCorners(m_cornersFPIX, 3);

for (const auto& entry : theIndexedCorners) {
auto id = entry.first;
auto detid = DetId(id);
if (detid.subdetId() != PixelSubdetector::PixelEndcap)
continue;

int disk = m_trackerTopo.pxfDisk(detid);
int side = m_trackerTopo.pxfSide(detid);

unsigned mapIdx = disk + (side - 1) * 3 - 1;

auto theVectX = entry.second.first;
auto theVectY = entry.second.second;

float vertX[] = {theVectX[0], theVectX[1], theVectX[2], theVectX[3]};
float vertY[] = {theVectY[0], theVectY[1], theVectY[2], theVectY[3]};

bins[id] = std::make_shared<TGraph>(4, vertX, vertY);
bins[id]->SetName(TString::Format("%u", id));

// Summary plot
for (unsigned k = 0; k < 4; ++k) {
vertX[k] += (float(side) - 1.5f) * 40.0f;
vertY[k] += (disk - 1) * 35.0f;
Comment on lines +164 to +165
Copy link
Contributor

Choose a reason for hiding this comment

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

numbers

}

binsSummary[id] = std::make_shared<TGraph>(4, vertX, vertY);
binsSummary[id]->SetName(TString::Format("%u", id));

pxfTh2PolyForward[currentHistoName][mapIdx]->AddBin(bins[id]->Clone());
pxfTh2PolyForwardSummary[currentHistoName]->AddBin(binsSummary[id]->Clone());
}
}

//============================================================================
template <typename type>
void fillBarrelBin(const std::string& currentHistoName, unsigned int id, type value) {
auto detid = DetId(id);
if (detid.subdetId() != PixelSubdetector::PixelBarrel) {
edm::LogError("Phase1PixelMaps") << "fillBarrelBin() The following detid " << id << " is not Pixel Barrel!"
<< std::endl;
return;
}
int layer = m_trackerTopo.pxbLayer(id);
pxbTh2PolyBarrel[currentHistoName][layer - 1]->Fill(TString::Format("%u", id), value);
}

//============================================================================
template <typename type>
void fillForwardBin(const std::string& currentHistoName, unsigned int id, type value) {
auto detid = DetId(id);
if (detid.subdetId() != PixelSubdetector::PixelEndcap) {
edm::LogError("Phase1PixelMaps") << "fillForwardBin() The following detid " << id << " is not Pixel Forward!"
<< std::endl;
return;
}
int disk = m_trackerTopo.pxfDisk(id);
int side = m_trackerTopo.pxfSide(id);
unsigned mapIdx = disk + (side - 1) * 3 - 1;
pxfTh2PolyForward[currentHistoName][mapIdx]->Fill(TString::Format("%u", id), value);
}

//============================================================================
void beautifyAllHistograms() {
for (const auto& vec : pxbTh2PolyBarrel) {
for (const auto& plot : vec.second) {
SiPixelPI::makeNicePlotStyle(plot.get());
plot->GetXaxis()->SetTitleOffset(0.9);
plot->GetYaxis()->SetTitleOffset(0.9);
}
}

for (const auto& vec : pxfTh2PolyForward) {
for (const auto& plot : vec.second) {
SiPixelPI::makeNicePlotStyle(plot.get());
plot->GetXaxis()->SetTitleOffset(0.9);
plot->GetYaxis()->SetTitleOffset(0.9);
}
}
}

//============================================================================
void DrawBarrelMaps(const std::string& currentHistoName, TCanvas& canvas) {
canvas.Divide(2, 2);
for (int i = 1; i <= 4; i++) {
canvas.cd(i);
if (strcmp(m_option, "text") == 0) {
canvas.cd(i)->SetRightMargin(0.02);
pxbTh2PolyBarrel[currentHistoName].at(i - 1)->SetMarkerColor(kRed);
} else {
SiPixelPI::adjustCanvasMargins(canvas.cd(i), 0.07, 0.12, 0.10, 0.14);
Copy link
Contributor

Choose a reason for hiding this comment

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

numbers

}
pxbTh2PolyBarrel[currentHistoName].at(i - 1)->Draw();
}
}

//============================================================================
void DrawForwardMaps(const std::string& currentHistoName, TCanvas& canvas) {
canvas.Divide(3, 2);
for (int i = 1; i <= 6; i++) {
canvas.cd(i);
if (strcmp(m_option, "text") == 0) {
canvas.cd(i)->SetRightMargin(0.02);
pxfTh2PolyForward[currentHistoName].at(i - 1)->SetMarkerColor(kRed);
} else {
SiPixelPI::adjustCanvasMargins(canvas.cd(i), 0.07, 0.12, 0.10, 0.16);
Copy link
Contributor

Choose a reason for hiding this comment

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

numbers

}
pxfTh2PolyForward[currentHistoName].at(i - 1)->Draw();
}
}

private:
Option_t* m_option;
TrackerTopology m_trackerTopo;

std::map<uint32_t, std::shared_ptr<TGraph>> bins, binsSummary;
std::map<std::string, std::vector<std::shared_ptr<TH2Poly>>> pxbTh2PolyBarrel;
std::map<std::string, std::shared_ptr<TH2Poly>> pxbTh2PolyBarrelSummary;
std::map<std::string, std::vector<std::shared_ptr<TH2Poly>>> pxfTh2PolyForward;
std::map<std::string, std::shared_ptr<TH2Poly>> pxfTh2PolyForwardSummary;

std::vector<edm::FileInPath> m_cornersBPIX;
std::vector<edm::FileInPath> m_cornersFPIX;
};

#endif