1 #ifndef CONDCORE_SIPIXELPLUGINS_PIXELREGIONCONTAINERS_H 2 #define CONDCORE_SIPIXELPLUGINS_PIXELREGIONCONTAINERS_H 11 #include <boost/range/adaptor/indexed.hpp> 20 sprintf(
temp,
"%d",
i);
62 const std::vector<std::string>
IDlabels = {
"Barrel Pixel L1",
66 "FPIX(-) Disk 1 inner ring",
67 "FPIX(-) Disk 1 outer ring",
68 "FPIX(-) Disk 2 inner ring",
69 "FPIX(-) Disk 2 outer ring",
70 "FPIX(-) Disk 3 inner ring",
71 "FPIX(-) Disk 3 outer ring",
72 "FPIX(+) Disk 1 inner ring",
73 "FPIX(+) Disk 1 outer ring",
74 "FPIX(+) Disk 2 inner ring",
75 "FPIX(+) Disk 2 outer ring",
76 "FPIX(+) Disk 3 inner ring",
77 "FPIX(+) Disk 3 outer ring",
100 std::vector<std::string>
out;
103 if (
label.find(
"Barrel") != std::string::npos) {
108 if (
label.find(
"Ring") != std::string::npos) {
112 if (
label.find(
"ring") != std::string::npos) {
130 const unsigned int side,
131 const unsigned int disk,
132 const unsigned int ring) {
135 unsigned int prefix(2000);
136 unsigned int disk_(0);
156 unsigned int subid = detId.
subdetId();
157 unsigned int pixid = 0;
162 int side = trackTopo->
pxfSide(detId);
163 int disk = trackTopo->
pxfDisk(detId);
178 throw cms::Exception(
"LogicalError") <<
" there is not such phase as " << ph;
191 std::vector<uint32_t>
out = {};
197 m_fp =
edm::FileInPath(
"CalibTracker/SiPixelESProducers/data/PixelSkimmedGeometry.txt");
201 m_fp =
edm::FileInPath(
"SLHCUpgradeSimulations/Geometry/data/PhaseI/PixelSkimmedGeometry_phase1.txt");
204 m_fp =
edm::FileInPath(
"SLHCUpgradeSimulations/Geometry/data/PhaseII/Tilted/PixelSkimmedGeometryT14.txt");
207 throw cms::Exception(
"LogicalError") <<
" there is not such phase as " << ph;
211 const std::vector<uint32_t>& pxldetids = pxlreader.
getAllDetIds();
212 for (
const auto&
d : pxldetids) {
223 out.push_back(0xFFFFFFFF);
226 COUT <<
"ID:" << theId <<
" ";
270 for (
const auto& pixelId :
PixelIDs | boost::adaptors::indexed(0)) {
278 m_theMap[pixelId.value()] = std::make_shared<TH1F>((title_label +
itoa(pixelId.value())).c_str(),
280 (
IDlabels.at(pixelId.index())).c_str(),
291 void fill(
const unsigned int detid,
const float value) {
301 << detid <<
" :=> " << myId <<
" is not a recongnized PixelId enumerator! \n" 307 void draw(TCanvas& canv,
bool isBarrel,
const char*
option =
"bar2",
bool isPhase1Comparison =
false) {
310 if (canv.GetListOfPrimitives()->GetSize() == 0) {
314 for (
int j = 1;
j <= 4;
j++) {
318 canv.cd(
j)->SetLogy();
320 if ((
j == 4) && (
m_Phase < 1) && !isPhase1Comparison) {
327 t2.SetTextColor(kBlack);
328 t2.DrawLatexNDC(0.5, 0.5,
"Not in Phase-0!");
336 const std::array<int, 18> phase2Pattern = {{1, 2, 3, 4,
339 16, 17, 18, 19, 20}};
342 if (canv.GetListOfPrimitives()->GetSize() == 0) {
346 for (
int j = 1;
j <= maxPads;
j++) {
347 unsigned int mapIndex =
m_Phase == 2 ?
j + 15 :
j + 3;
352 canv.cd(
j)->SetLogy();
354 if ((
j % 6 == 5 ||
j % 6 == 0) && (
m_Phase < 1) && !isPhase1Comparison) {
361 t2.SetTextColor(kBlack);
362 t2.DrawLatexNDC(0.5, 0.5,
"Not in Phase-0!");
371 void beautify(
const int linecolor = kBlack,
const int fillcolor = kRed) {
373 plot.second->SetTitle(
"");
375 plot.second->GetYaxis()->SetRangeUser(0.,
plot.second->GetMaximum() * 1.30);
377 plot.second->GetYaxis()->SetRangeUser(0.1,
plot.second->GetMaximum() * 100.);
379 plot.second->SetLineColor(linecolor);
381 plot.second->SetFillColor(fillcolor);
383 plot.second->SetMarkerStyle(20);
384 plot.second->SetMarkerSize(1);
386 plot.second->SetStats(
true);
396 TPaveStats* st = (TPaveStats*)
plot.second->FindObject(
"stats");
398 st->SetTextSize(0.03);
399 st->SetLineColor(10);
400 if (
plot.second->GetFillColor() != 0) {
401 st->SetTextColor(
plot.second->GetFillColor());
403 st->SetTextColor(
plot.second->GetLineColor());
417 <<
"PixelRegionContainer::getHistoFromMap(): No histogram is available for PixelId: " << theId <<
"\n";
424 auto thePixId =
plot.first;
426 plot.second->GetYaxis()->SetRangeUser(extrema.first, extrema.second);
427 the2ndContainer.
getHistoFromMap(thePixId)->GetYaxis()->SetRangeUser(extrema.first, extrema.second);
std::map< PixelId, std::shared_ptr< TH1F > > m_theMap
unsigned int pxbLayer(const DetId &id) const
bool m_isTrackerTopologySet
std::string fullPath() const
unsigned int pxfBlade(const DetId &id) const
const std::vector< std::string > IDlabels
void rescaleMax(PixelRegionContainers &the2ndContainer)
std::string print(DetId detid) const
void beautify(const int linecolor=kBlack, const int fillcolor=kRed)
const TrackerTopology * m_trackerTopo
Log< level::Error, false > LogError
std::pair< float, float > getExtrema(TH1 *h1, TH1 *h2)
constexpr std::array< uint8_t, layerIndexSize > layer
std::shared_ptr< TH1F > & getHistoFromMap(const PixelRegions::PixelId &theId)
void draw(TCanvas &canv, bool isBarrel, const char *option="bar2", bool isPhase1Comparison=false)
void setTheTopo(const TrackerTopology *t_topo)
unsigned int pxfDisk(const DetId &id) const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
const std::vector< PixelId > PixelIDs
void fill(const unsigned int detid, const float value)
void adjustStats(TPaveStats *stats, float X1, float Y1, float X2, float Y2)
void bookAll(std::string title_label, std::string x_label, std::string y_label, const int nbins, const float xmin, const float xmax)
int ring(const DetId &detid, const TrackerTopology &tTopo_, bool phase_)
unsigned int pxfSide(const DetId &id) const
void makeNicePlotStyle(TH1 *hist)
static const std::vector< std::string > getIDLabels(const SiPixelPI::phase &ph, bool isBarrel)
const std::vector< uint32_t > & getAllDetIds() const
static const PixelId calculateFPixID(const SiPixelPI::phase &ph, const unsigned int side, const unsigned int disk, const unsigned int ring)
const TrackerTopology * getTheTopo()
static const PixelId detIdToPixelId(const unsigned int detid, const TrackerTopology *trackTopo, const SiPixelPI::phase &ph)
static const char disk_[]
static const std::vector< uint32_t > attachedDets(const PixelRegions::PixelId theId, const TrackerTopology *trackTopo, const SiPixelPI::phase &ph)
PixelRegionContainers(const TrackerTopology *t_topo, const SiPixelPI::phase &ph)
static const PixelId calculateBPixID(const unsigned int layer)