CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
Phase1PixelMaps Class Reference

#include <Phase1PixelMaps.h>

Public Member Functions

void beautifyAllHistograms ()
 
void book (const std::string &currentHistoName, const char *what, const char *zaxis)
 
void bookBarrelHistograms (const std::string &currentHistoName, const char *what, const char *zaxis)
 
void bookForwardHistograms (const std::string &currentHistoName, const char *what, const char *zaxis)
 
void drawBarrelMaps (const std::string &currentHistoName, TCanvas &canvas, const char *drawOption=nullptr)
 
void drawForwardMaps (const std::string &currentHistoName, TCanvas &canvas, const char *drawOption=nullptr)
 
void drawSummaryMaps (const std::string &currentHistoName, TCanvas &canvas)
 
void fill (const std::string &currentHistoName, unsigned int id, double value)
 
void fillBarrelBin (const std::string &currentHistoName, unsigned int id, double value)
 
void fillForwardBin (const std::string &currentHistoName, unsigned int id, double value)
 
 Phase1PixelMaps (const char *option)
 
void resetOption (const char *option)
 
void setBarrelScale (const std::string &currentHistoName, std::pair< float, float > extrema)
 
void setForwardScale (const std::string &currentHistoName, std::pair< float, float > extrema)
 
void setNoRescale ()
 
 ~Phase1PixelMaps ()=default
 

Private Member Functions

void adjustCanvasMargins (TVirtualPad *pad, float top, float bottom, float left, float right)
 
void bookBarrelBins (const std::string &currentHistoName)
 
void bookForwardBins (const std::string &currentHistoName)
 
void makeNicePlotStyle (TH1 *hist)
 
void rescaleAllBarrel (const std::string &currentHistoName)
 
void rescaleAllForward (const std::string &currentHistoName)
 
const indexedCorners retrieveCorners (const std::vector< edm::FileInPath > &cornerFiles, const unsigned int reads)
 

Private Attributes

std::map< uint32_t, std::shared_ptr< TGraph > > bins
 
std::map< uint32_t, std::shared_ptr< TGraph > > binsSummary
 
bool m_autorescale
 
std::vector< edm::FileInPathm_cornersBPIX
 
std::vector< edm::FileInPathm_cornersFPIX
 
std::pair< bool, bool > m_isBooked
 
std::vector< std::string > m_knownNames
 
Option_t * m_option
 
TrackerTopology m_trackerTopo
 
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
 

Detailed Description

Definition at line 31 of file Phase1PixelMaps.h.

Constructor & Destructor Documentation

◆ Phase1PixelMaps()

Phase1PixelMaps::Phase1PixelMaps ( const char *  option)
inline

Definition at line 33 of file Phase1PixelMaps.h.

34  : m_option{option},
35  m_isBooked{std::make_pair(false, false)},
36  m_knownNames{{}},
38  edm::FileInPath("Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml").fullPath())} {
39  // set the rescale to true by default
40  m_autorescale = true;
41 
42  // store the file in path for the corners (BPIX)
43  for (unsigned int i = 1; i <= 4; i++) {
44  m_cornersBPIX.push_back(edm::FileInPath(Form("DQM/SiStripMonitorClient/data/Geometry/vertices_barrel_%i", i)));
45  }
46 
47  // store the file in path for the corners (BPIX)
48  for (int j : {-3, -2, -1, 1, 2, 3}) {
49  m_cornersFPIX.push_back(edm::FileInPath(Form("DQM/SiStripMonitorClient/data/Geometry/vertices_forward_%i", j)));
50  }
51  }

References fileinputsource_cfi::option.

◆ ~Phase1PixelMaps()

Phase1PixelMaps::~Phase1PixelMaps ( )
default

Member Function Documentation

◆ adjustCanvasMargins()

void Phase1PixelMaps::adjustCanvasMargins ( TVirtualPad *  pad,
float  top,
float  bottom,
float  left,
float  right 
)
private

Definition at line 512 of file Phase1PixelMaps.cc.

512  {
513  if (top > 0)
514  pad->SetTopMargin(top);
515  if (bottom > 0)
516  pad->SetBottomMargin(bottom);
517  if (left > 0)
518  pad->SetLeftMargin(left);
519  if (right > 0)
520  pad->SetRightMargin(right);
521 }

Referenced by drawBarrelMaps(), drawForwardMaps(), and drawSummaryMaps().

◆ beautifyAllHistograms()

void Phase1PixelMaps::beautifyAllHistograms ( )

Definition at line 288 of file Phase1PixelMaps.cc.

288  {
289  if (!m_isBooked.first && !m_isBooked.second) {
290  edm::LogError("Phase1PixelMaps") << __func__ << ": trying to beautify a histogram not booked";
291  return;
292  }
293 
294  // only if the barrel is booked
295  if (m_isBooked.first) {
296  for (const auto& vec : pxbTh2PolyBarrel) {
297  for (const auto& plot : vec.second) {
298  this->makeNicePlotStyle(plot.get());
299  plot->GetXaxis()->SetTitleOffset(0.9);
300  plot->GetYaxis()->SetTitleOffset(0.9);
301  plot->GetZaxis()->SetTitleOffset(1.2);
302  plot->GetZaxis()->SetTitleSize(0.05);
303  }
304  }
305  }
306 
307  // only if the forwards are booked
308  if (m_isBooked.second) {
309  for (const auto& vec : pxfTh2PolyForward) {
310  for (const auto& plot : vec.second) {
311  this->makeNicePlotStyle(plot.get());
312  plot->GetXaxis()->SetTitleOffset(0.9);
313  plot->GetYaxis()->SetTitleOffset(0.9);
314  plot->GetZaxis()->SetTitleOffset(1.2);
315  plot->GetZaxis()->SetTitleSize(0.05);
316  }
317  }
318  }
319 }

References m_isBooked, makeNicePlotStyle(), plotFactory::plot, pxbTh2PolyBarrel, and pxfTh2PolyForward.

Referenced by templateHelper::SiPixelIDs< PayloadType, myType >::fill().

◆ book()

void Phase1PixelMaps::book ( const std::string &  currentHistoName,
const char *  what,
const char *  zaxis 
)

Definition at line 215 of file Phase1PixelMaps.cc.

215  {
216  bookBarrelHistograms(currentHistoName, what, zaxis);
217  bookForwardHistograms(currentHistoName, what, zaxis);
218  m_isBooked = std::make_pair(true, true);
219 }

References bookBarrelHistograms(), bookForwardHistograms(), m_isBooked, and LaserClient_cfi::zaxis.

◆ bookBarrelBins()

void Phase1PixelMaps::bookBarrelBins ( const std::string &  currentHistoName)
private

Definition at line 123 of file Phase1PixelMaps.cc.

123  {
124  auto theIndexedCorners = this->retrieveCorners(m_cornersBPIX, 4);
125 
126  for (const auto& entry : theIndexedCorners) {
127  auto id = entry.first;
128  auto detid = DetId(id);
129  if (detid.subdetId() != PixelSubdetector::PixelBarrel)
130  continue;
131 
132  int layer = m_trackerTopo.pxbLayer(detid);
133  int ladder = m_trackerTopo.pxbLadder(detid);
134 
135  auto theVectX = entry.second.first;
136  auto theVectY = entry.second.second;
137 
138  float vertX[] = {theVectX[0], theVectX[1], theVectX[2], theVectX[3], theVectX[4]};
139  float vertY[] = {(ladder - 1.0f), (ladder - 1.0f), (float)ladder, (float)ladder, (ladder - 1.0f)};
140 
141  bins[id] = std::make_shared<TGraph>(5, vertX, vertY);
142  bins[id]->SetName(TString::Format("%u", id));
143 
144  // Summary plot
145  for (unsigned k = 0; k < 5; ++k) {
146  vertX[k] += ((layer == 2 || layer == 3) ? 0.0f : -60.0f);
147  vertY[k] += ((layer > 2) ? 30.0f : 0.0f);
148  }
149 
150  binsSummary[id] = std::make_shared<TGraph>(5, vertX, vertY);
151  binsSummary[id]->SetName(TString::Format("%u", id));
152 
153  if (pxbTh2PolyBarrel.find(currentHistoName) != pxbTh2PolyBarrel.end()) {
154  pxbTh2PolyBarrel[currentHistoName][layer - 1]->AddBin(bins[id]->Clone());
155  } else {
156  throw cms::Exception("LogicError") << currentHistoName << " is not found in the Barrel map! Aborting.";
157  }
158 
159  if (pxbTh2PolyBarrelSummary.find(currentHistoName) != pxbTh2PolyBarrelSummary.end()) {
160  pxbTh2PolyBarrelSummary[currentHistoName]->AddBin(binsSummary[id]->Clone());
161  } else {
162  throw cms::Exception("LocalError") << currentHistoName << " is not found in the Barrel Summary map! Aborting.";
163  }
164  }
165 }

References bins, binsSummary, mps_splice::entry, Exception, f, dqmMemoryStats::float, triggerObjects_cff::id, dqmdumpme::k, PVValHelper::ladder, phase1PixelTopology::layer, m_cornersBPIX, m_trackerTopo, PixelSubdetector::PixelBarrel, TrackerTopology::pxbLadder(), TrackerTopology::pxbLayer(), pxbTh2PolyBarrel, pxbTh2PolyBarrelSummary, and retrieveCorners().

Referenced by bookBarrelHistograms().

◆ bookBarrelHistograms()

void Phase1PixelMaps::bookBarrelHistograms ( const std::string &  currentHistoName,
const char *  what,
const char *  zaxis 
)

Definition at line 30 of file Phase1PixelMaps.cc.

30  {
31  std::string histName;
32  std::shared_ptr<TH2Poly> th2p;
33 
34  // check if the passed histogram name already exists, if not store it
35  if (std::find(m_knownNames.begin(), m_knownNames.end(), currentHistoName) == m_knownNames.end()) {
36  m_knownNames.emplace_back(currentHistoName);
37  }
38 
39  for (unsigned i = 0; i < 4; ++i) {
40  histName = "barrel_layer_";
41 
42  th2p = std::make_shared<TH2Poly>(
43  (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);
44 
45  th2p->SetFloat();
46 
47  th2p->GetXaxis()->SetTitle("z [cm]");
48  th2p->GetYaxis()->SetTitle("ladder");
49  th2p->GetZaxis()->SetTitle(zaxis);
50  th2p->GetZaxis()->CenterTitle();
51  th2p->SetStats(false);
52  th2p->SetOption(m_option);
53  pxbTh2PolyBarrel[currentHistoName].push_back(th2p);
54  }
55 
56  th2p = std::make_shared<TH2Poly>("barrel_summary", Form("Barrel Pixel Map of %s", what), -5.0, 5.0, 0.0, 15.0);
57  th2p->SetFloat();
58 
59  th2p->GetXaxis()->SetTitle("");
60  th2p->GetYaxis()->SetTitle("");
61  th2p->GetZaxis()->SetTitle(zaxis);
62  th2p->GetZaxis()->CenterTitle();
63  th2p->SetStats(false);
64  th2p->SetOption(m_option);
65  pxbTh2PolyBarrelSummary[currentHistoName] = th2p;
66 
67  // book the bins
68  bookBarrelBins(currentHistoName);
69 
70  // set the isBooked bit to true;
71  m_isBooked.first = true;
72 }

References bookBarrelBins(), spr::find(), mps_fire::i, m_isBooked, m_knownNames, m_option, pxbTh2PolyBarrel, pxbTh2PolyBarrelSummary, AlCaHLTBitMon_QueryRunRegistry::string, and LaserClient_cfi::zaxis.

Referenced by book(), and templateHelper::SiPixelIDs< PayloadType, myType >::fill().

◆ bookForwardBins()

void Phase1PixelMaps::bookForwardBins ( const std::string &  currentHistoName)
private

Definition at line 168 of file Phase1PixelMaps.cc.

168  {
169  auto theIndexedCorners = this->retrieveCorners(m_cornersFPIX, 3);
170 
171  for (const auto& entry : theIndexedCorners) {
172  auto id = entry.first;
173  auto detid = DetId(id);
174  if (detid.subdetId() != PixelSubdetector::PixelEndcap)
175  continue;
176 
177  int disk = m_trackerTopo.pxfDisk(detid);
178  int side = m_trackerTopo.pxfSide(detid);
179 
180  unsigned mapIdx = disk + (side - 1) * 3 - 1;
181 
182  auto theVectX = entry.second.first;
183  auto theVectY = entry.second.second;
184 
185  float vertX[] = {theVectX[0], theVectX[1], theVectX[2], theVectX[3]};
186  float vertY[] = {theVectY[0], theVectY[1], theVectY[2], theVectY[3]};
187 
188  bins[id] = std::make_shared<TGraph>(4, vertX, vertY);
189  bins[id]->SetName(TString::Format("%u", id));
190 
191  // Summary plot
192  for (unsigned k = 0; k < 4; ++k) {
193  vertX[k] += (float(side) - 1.5f) * 40.0f;
194  vertY[k] += (disk - 1) * 35.0f;
195  }
196 
197  binsSummary[id] = std::make_shared<TGraph>(4, vertX, vertY);
198  binsSummary[id]->SetName(TString::Format("%u", id));
199 
200  if (pxfTh2PolyForward.find(currentHistoName) != pxfTh2PolyForward.end()) {
201  pxfTh2PolyForward[currentHistoName][mapIdx]->AddBin(bins[id]->Clone());
202  } else {
203  throw cms::Exception("LogicError") << currentHistoName << " is not found in the Forward map! Aborting.";
204  }
205 
206  if (pxfTh2PolyForwardSummary.find(currentHistoName) != pxfTh2PolyForwardSummary.end()) {
207  pxfTh2PolyForwardSummary[currentHistoName]->AddBin(binsSummary[id]->Clone());
208  } else {
209  throw cms::Exception("LogicError") << currentHistoName << " is not found in the Forward Summary map! Aborting.";
210  }
211  }
212 }

References bins, binsSummary, mps_splice::entry, Exception, f, dqmMemoryStats::float, triggerObjects_cff::id, dqmdumpme::k, m_cornersFPIX, m_trackerTopo, PixelSubdetector::PixelEndcap, TrackerTopology::pxfDisk(), TrackerTopology::pxfSide(), pxfTh2PolyForward, pxfTh2PolyForwardSummary, and retrieveCorners().

Referenced by bookForwardHistograms().

◆ bookForwardHistograms()

void Phase1PixelMaps::bookForwardHistograms ( const std::string &  currentHistoName,
const char *  what,
const char *  zaxis 
)

Definition at line 75 of file Phase1PixelMaps.cc.

75  {
76  std::string histName;
77  std::shared_ptr<TH2Poly> th2p;
78 
79  // check if the passed histogram name already exists, if not store it
80  if (std::find(m_knownNames.begin(), m_knownNames.end(), currentHistoName) == m_knownNames.end()) {
81  m_knownNames.emplace_back(currentHistoName);
82  }
83 
84  for (unsigned side = 1; side <= 2; ++side) {
85  for (unsigned disk = 1; disk <= 3; ++disk) {
86  histName = "forward_disk_";
87 
88  th2p = std::make_shared<TH2Poly>((histName + std::to_string((side == 1 ? -(int(disk)) : (int)disk))).c_str(),
89  Form("PXFMap of %s - Side %i Disk %i", what, side, disk),
90  -15.0,
91  15.0,
92  -15.0,
93  15.0);
94  th2p->SetFloat();
95  th2p->GetXaxis()->SetTitle("x [cm]");
96  th2p->GetYaxis()->SetTitle("y [cm]");
97  th2p->GetZaxis()->SetTitle(zaxis);
98  th2p->GetZaxis()->CenterTitle();
99  th2p->SetStats(false);
100  th2p->SetOption(m_option);
101  pxfTh2PolyForward[currentHistoName].push_back(th2p);
102  }
103  }
104 
105  th2p = std::make_shared<TH2Poly>("forward_summary", Form("Forward Pixel Map of %s", what), -40.0, 40.0, -20.0, 90.0);
106  th2p->SetFloat();
107 
108  th2p->GetXaxis()->SetTitle("");
109  th2p->GetYaxis()->SetTitle("");
110  th2p->GetZaxis()->SetTitle(zaxis);
111  th2p->GetZaxis()->CenterTitle();
112  th2p->SetStats(false);
113  th2p->SetOption(m_option);
114  pxfTh2PolyForwardSummary[currentHistoName] = th2p;
115 
116  // book the bins
117  bookForwardBins(currentHistoName);
118 
119  m_isBooked.second = true;
120 }

References bookForwardBins(), spr::find(), m_isBooked, m_knownNames, m_option, pxfTh2PolyForward, pxfTh2PolyForwardSummary, AlCaHLTBitMon_QueryRunRegistry::string, and LaserClient_cfi::zaxis.

Referenced by book(), and templateHelper::SiPixelIDs< PayloadType, myType >::fill().

◆ drawBarrelMaps()

void Phase1PixelMaps::drawBarrelMaps ( const std::string &  currentHistoName,
TCanvas &  canvas,
const char *  drawOption = nullptr 
)

Definition at line 336 of file Phase1PixelMaps.cc.

336  {
337  canvas.Divide(2, 2);
338  auto found = (std::find(m_knownNames.begin(), m_knownNames.end(), currentHistoName) != m_knownNames.end());
339 
340  if (!m_isBooked.first || !found) {
341  edm::LogError("Phase1PixelMaps") << __func__ << ": trying to draw a histogram not booked";
342  return;
343  }
344 
345  for (int i = 1; i <= 4; i++) {
346  canvas.cd(i);
347  if (strcmp(m_option, "text") == 0) {
348  canvas.cd(i)->SetRightMargin(0.02);
349  pxbTh2PolyBarrel[currentHistoName].at(i - 1)->SetMarkerColor(kRed);
350  } else {
351  if (m_autorescale)
352  rescaleAllBarrel(currentHistoName);
353  adjustCanvasMargins(canvas.cd(i), 0.07, 0.12, 0.10, 0.18);
354  }
355  if (drawOption) {
356  pxbTh2PolyBarrel[currentHistoName].at(i - 1)->Draw("L");
357  pxbTh2PolyBarrel[currentHistoName].at(i - 1)->Draw(fmt::sprintf("%s%ssame", m_option, drawOption).c_str());
358  } else {
359  pxbTh2PolyBarrel[currentHistoName].at(i - 1)->Draw("L");
360  pxbTh2PolyBarrel[currentHistoName].at(i - 1)->Draw(fmt::sprintf("%ssame", m_option).c_str());
361  }
362  }
363 }

References adjustCanvasMargins(), svgfig::canvas(), histoStyle::drawOption, spr::find(), newFWLiteAna::found, mps_fire::i, m_autorescale, m_isBooked, m_knownNames, m_option, pxbTh2PolyBarrel, and rescaleAllBarrel().

Referenced by templateHelper::SiPixelIDs< PayloadType, myType >::fill().

◆ drawForwardMaps()

void Phase1PixelMaps::drawForwardMaps ( const std::string &  currentHistoName,
TCanvas &  canvas,
const char *  drawOption = nullptr 
)

Definition at line 366 of file Phase1PixelMaps.cc.

366  {
367  canvas.Divide(3, 2);
368  auto found = (std::find(m_knownNames.begin(), m_knownNames.end(), currentHistoName) != m_knownNames.end());
369 
370  if (!m_isBooked.second || !found) {
371  edm::LogError("Phase1PixelMaps") << __func__ << ": trying to draw a histogram not booked";
372  return;
373  }
374 
375  for (int i = 1; i <= 6; i++) {
376  canvas.cd(i);
377  if (strcmp(m_option, "text") == 0) {
378  canvas.cd(i)->SetRightMargin(0.02);
379  pxfTh2PolyForward[currentHistoName].at(i - 1)->SetMarkerColor(kRed);
380  } else {
381  if (m_autorescale)
382  rescaleAllForward(currentHistoName);
383  adjustCanvasMargins(canvas.cd(i), 0.07, 0.12, 0.10, 0.18);
384  }
385  if (drawOption) {
386  pxfTh2PolyForward[currentHistoName].at(i - 1)->Draw("L");
387  pxfTh2PolyForward[currentHistoName].at(i - 1)->Draw(fmt::sprintf("%s%ssame", m_option, drawOption).c_str());
388  } else {
389  pxfTh2PolyForward[currentHistoName].at(i - 1)->Draw("L");
390  pxfTh2PolyForward[currentHistoName].at(i - 1)->Draw(fmt::sprintf("%ssame", m_option).c_str());
391  }
392  }
393 }

References adjustCanvasMargins(), svgfig::canvas(), histoStyle::drawOption, spr::find(), newFWLiteAna::found, mps_fire::i, m_autorescale, m_isBooked, m_knownNames, m_option, pxfTh2PolyForward, and rescaleAllForward().

Referenced by templateHelper::SiPixelIDs< PayloadType, myType >::fill().

◆ drawSummaryMaps()

void Phase1PixelMaps::drawSummaryMaps ( const std::string &  currentHistoName,
TCanvas &  canvas 
)

Definition at line 396 of file Phase1PixelMaps.cc.

396  {
397  auto found = (std::find(m_knownNames.begin(), m_knownNames.end(), currentHistoName) != m_knownNames.end());
398 
399  if (!m_isBooked.second || !m_isBooked.first || !found) {
400  edm::LogError("Phase1PixelMaps") << __func__ << ": trying to draw a histogram not booked";
401  return;
402  }
403 
404  canvas.Divide(2, 1);
405  canvas.cd(1);
406  std::string temp(m_option); // create a std string
407  auto isText = (temp.find("text") != std::string::npos);
408  adjustCanvasMargins(canvas.cd(1), 0.07, 0.02, 0.01, isText ? 0.05 : 0.15);
409  if (isText) {
410  pxbTh2PolyBarrelSummary[currentHistoName]->SetMarkerColor(kRed);
411  pxbTh2PolyBarrelSummary[currentHistoName]->SetMarkerSize(0.5);
412  }
413  pxbTh2PolyBarrelSummary[currentHistoName]->GetZaxis()->SetTitleOffset(1.4);
414  pxbTh2PolyBarrelSummary[currentHistoName]->Draw();
415 
416  canvas.cd(2);
417  adjustCanvasMargins(canvas.cd(2), 0.07, 0.02, 0.01, isText ? 0.05 : 0.15);
418  if (isText) {
419  pxfTh2PolyForwardSummary[currentHistoName]->SetMarkerColor(kRed);
420  pxfTh2PolyForwardSummary[currentHistoName]->SetMarkerSize(0.5);
421  }
422  pxfTh2PolyForwardSummary[currentHistoName]->GetZaxis()->SetTitleOffset(1.4);
423  pxfTh2PolyForwardSummary[currentHistoName]->Draw();
424 }

References adjustCanvasMargins(), svgfig::canvas(), spr::find(), newFWLiteAna::found, m_isBooked, m_knownNames, m_option, pxbTh2PolyBarrelSummary, pxfTh2PolyForwardSummary, AlCaHLTBitMon_QueryRunRegistry::string, and groupFilesInBlocks::temp.

◆ fill()

void Phase1PixelMaps::fill ( const std::string &  currentHistoName,
unsigned int  id,
double  value 
)

Definition at line 222 of file Phase1PixelMaps.cc.

222  {
223  auto detid = DetId(id);
224  if (detid.subdetId() == PixelSubdetector::PixelBarrel) {
225  int layer = m_trackerTopo.pxbLayer(id);
226  if (!m_isBooked.first) {
227  edm::LogError("Phase1PixelMaps") << __func__ << ": trying to fill a histogram not booked";
228  return;
229  }
230 
231  LogDebug("Phase1PixelMaps") << __func__ << " filling barrel with value: " << value << std::endl;
232 
233  pxbTh2PolyBarrel[currentHistoName][layer - 1]->Fill(TString::Format("%u", id), value);
234  pxbTh2PolyBarrelSummary[currentHistoName]->Fill(TString::Format("%u", id), value);
235  } else if (detid.subdetId() == PixelSubdetector::PixelEndcap) {
236  int disk = m_trackerTopo.pxfDisk(id);
237  int side = m_trackerTopo.pxfSide(id);
238  unsigned mapIdx = disk + (side - 1) * 3 - 1;
239  if (!m_isBooked.second) {
240  edm::LogError("Phase1PixelMaps") << __func__ << ": trying to fill a histogram not booked";
241  return;
242  }
243 
244  LogDebug("Phase1PixelMaps") << __func__ << " filling endcaps with value: " << value << std::endl;
245 
246  pxfTh2PolyForward[currentHistoName][mapIdx]->Fill(TString::Format("%u", id), value);
247  pxfTh2PolyForwardSummary[currentHistoName]->Fill(TString::Format("%u", id), value);
248  }
249 }

References phase1PixelTopology::layer, LogDebug, m_isBooked, m_trackerTopo, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, TrackerTopology::pxbLayer(), pxbTh2PolyBarrel, pxbTh2PolyBarrelSummary, TrackerTopology::pxfDisk(), TrackerTopology::pxfSide(), pxfTh2PolyForward, and pxfTh2PolyForwardSummary.

◆ fillBarrelBin()

void Phase1PixelMaps::fillBarrelBin ( const std::string &  currentHistoName,
unsigned int  id,
double  value 
)

Definition at line 252 of file Phase1PixelMaps.cc.

252  {
253  auto detid = DetId(id);
254  if (detid.subdetId() != PixelSubdetector::PixelBarrel) {
255  edm::LogError("Phase1PixelMaps") << "fillBarrelBin() The following detid " << id << " is not Pixel Barrel!"
256  << std::endl;
257  return;
258  }
259  if (!m_isBooked.first) {
260  edm::LogError("Phase1PixelMaps") << __func__ << ": trying to fill a histogram not booked";
261  return;
262  }
263  int layer = m_trackerTopo.pxbLayer(id);
264  pxbTh2PolyBarrel[currentHistoName][layer - 1]->Fill(TString::Format("%u", id), value);
265  pxbTh2PolyBarrelSummary[currentHistoName]->Fill(TString::Format("%u", id), value);
266 }

References phase1PixelTopology::layer, m_isBooked, m_trackerTopo, PixelSubdetector::PixelBarrel, TrackerTopology::pxbLayer(), pxbTh2PolyBarrel, and pxbTh2PolyBarrelSummary.

Referenced by templateHelper::SiPixelIDs< PayloadType, myType >::fill().

◆ fillForwardBin()

void Phase1PixelMaps::fillForwardBin ( const std::string &  currentHistoName,
unsigned int  id,
double  value 
)

Definition at line 269 of file Phase1PixelMaps.cc.

269  {
270  auto detid = DetId(id);
271  if (detid.subdetId() != PixelSubdetector::PixelEndcap) {
272  edm::LogError("Phase1PixelMaps") << "fillForwardBin() The following detid " << id << " is not Pixel Forward!"
273  << std::endl;
274  return;
275  }
276  if (!m_isBooked.second) {
277  edm::LogError("Phase1PixelMaps") << __func__ << ": trying to fill a histogram not booked";
278  return;
279  }
280  int disk = m_trackerTopo.pxfDisk(id);
281  int side = m_trackerTopo.pxfSide(id);
282  unsigned mapIdx = disk + (side - 1) * 3 - 1;
283  pxfTh2PolyForward[currentHistoName][mapIdx]->Fill(TString::Format("%u", id), value);
284  pxfTh2PolyForwardSummary[currentHistoName]->Fill(TString::Format("%u", id), value);
285 }

References m_isBooked, m_trackerTopo, PixelSubdetector::PixelEndcap, TrackerTopology::pxfDisk(), TrackerTopology::pxfSide(), pxfTh2PolyForward, and pxfTh2PolyForwardSummary.

Referenced by templateHelper::SiPixelIDs< PayloadType, myType >::fill().

◆ makeNicePlotStyle()

void Phase1PixelMaps::makeNicePlotStyle ( TH1 *  hist)
private

Definition at line 487 of file Phase1PixelMaps.cc.

487  {
488  hist->SetStats(kFALSE);
489  hist->SetLineWidth(2);
490  hist->GetXaxis()->CenterTitle(true);
491  hist->GetYaxis()->CenterTitle(true);
492  hist->GetXaxis()->SetTitleFont(42);
493  hist->GetYaxis()->SetTitleFont(42);
494  hist->GetXaxis()->SetTitleSize(0.05);
495  hist->GetYaxis()->SetTitleSize(0.05);
496  hist->GetXaxis()->SetTitleOffset(1.1);
497  hist->GetYaxis()->SetTitleOffset(1.3);
498  hist->GetXaxis()->SetLabelFont(42);
499  hist->GetYaxis()->SetLabelFont(42);
500  hist->GetYaxis()->SetLabelSize(.05);
501  hist->GetXaxis()->SetLabelSize(.05);
502 
503  if (hist->InheritsFrom(TH2::Class())) {
504  hist->GetZaxis()->SetLabelFont(42);
505  hist->GetZaxis()->SetLabelFont(42);
506  hist->GetZaxis()->SetLabelSize(.05);
507  hist->GetZaxis()->SetLabelSize(.05);
508  }
509 }

References HLT_FULL_cff::Class, and gpuVertexFinder::hist.

Referenced by beautifyAllHistograms().

◆ rescaleAllBarrel()

void Phase1PixelMaps::rescaleAllBarrel ( const std::string &  currentHistoName)
private

Definition at line 524 of file Phase1PixelMaps.cc.

524  {
525  if (std::find(m_knownNames.begin(), m_knownNames.end(), currentHistoName) == m_knownNames.end()) {
526  edm::LogError("Phase1PixelMaps") << __func__ << ": trying to manipulate a histogram not booked";
527  return;
528  }
529 
530  std::vector<float> maxima;
531  std::transform(pxbTh2PolyBarrel[currentHistoName].begin(),
532  pxbTh2PolyBarrel[currentHistoName].end(),
533  std::back_inserter(maxima),
534  [](std::shared_ptr<TH2Poly> thp) -> float { return thp->GetMaximum(); });
535  std::vector<float> minima;
536  std::transform(pxbTh2PolyBarrel[currentHistoName].begin(),
537  pxbTh2PolyBarrel[currentHistoName].end(),
538  std::back_inserter(minima),
539  [](std::shared_ptr<TH2Poly> thp) -> float { return thp->GetMinimum(); });
540 
541  auto globalMax = *std::max_element(maxima.begin(), maxima.end());
542  auto globalMin = *std::min_element(minima.begin(), minima.end());
543 
544  for (auto& histo : pxbTh2PolyBarrel[currentHistoName]) {
545  histo->GetZaxis()->SetRangeUser(globalMin, globalMax);
546  }
547 }

References mps_fire::end, spr::find(), timingPdfMaker::histo, m_knownNames, pxbTh2PolyBarrel, and HcalDetIdTransform::transform().

Referenced by drawBarrelMaps().

◆ rescaleAllForward()

void Phase1PixelMaps::rescaleAllForward ( const std::string &  currentHistoName)
private

Definition at line 550 of file Phase1PixelMaps.cc.

550  {
551  if (std::find(m_knownNames.begin(), m_knownNames.end(), currentHistoName) == m_knownNames.end()) {
552  edm::LogError("Phase1PixelMaps") << __func__ << ": trying to manipulate a histogram not booked";
553  return;
554  }
555 
556  std::vector<float> maxima;
557  std::transform(pxfTh2PolyForward[currentHistoName].begin(),
558  pxfTh2PolyForward[currentHistoName].end(),
559  std::back_inserter(maxima),
560  [](std::shared_ptr<TH2Poly> thp) -> float { return thp->GetMaximum(); });
561  std::vector<float> minima;
562  std::transform(pxfTh2PolyForward[currentHistoName].begin(),
563  pxfTh2PolyForward[currentHistoName].end(),
564  std::back_inserter(minima),
565  [](std::shared_ptr<TH2Poly> thp) -> float { return thp->GetMinimum(); });
566 
567  auto globalMax = *std::max_element(maxima.begin(), maxima.end());
568  auto globalMin = *std::min_element(minima.begin(), minima.end());
569 
570  for (auto& histo : pxfTh2PolyForward[currentHistoName]) {
571  histo->GetZaxis()->SetRangeUser(globalMin, globalMax);
572  }
573 }

References mps_fire::end, spr::find(), timingPdfMaker::histo, m_knownNames, pxfTh2PolyForward, and HcalDetIdTransform::transform().

Referenced by drawForwardMaps().

◆ resetOption()

void Phase1PixelMaps::resetOption ( const char *  option)

Definition at line 20 of file Phase1PixelMaps.cc.

20  {
21  if (m_option != nullptr && !m_option[0]) {
22  m_option = option;
23  } else {
24  edm::LogError("Phase1PixelMaps") << "Option has already been set to " << m_option
25  << ". It's not possible to reset it.";
26  }
27 }

References m_option, and fileinputsource_cfi::option.

◆ retrieveCorners()

const indexedCorners Phase1PixelMaps::retrieveCorners ( const std::vector< edm::FileInPath > &  cornerFiles,
const unsigned int  reads 
)
private

Definition at line 427 of file Phase1PixelMaps.cc.

428  {
429  indexedCorners theOutMap;
430 
431  for (const auto& file : cornerFiles) {
432  auto cornerFileName = file.fullPath();
433  std::ifstream cornerFile(cornerFileName.c_str());
434  if (!cornerFile.good()) {
435  throw cms::Exception("FileError") << "Problem opening corner file: " << cornerFileName;
436  }
438  while (std::getline(cornerFile, line)) {
439  if (!line.empty()) {
440  std::istringstream iss(line);
441  unsigned int id;
443  std::vector<std::string> corners(reads, "");
444  std::vector<float> xP, yP;
445 
446  iss >> id >> name;
447  for (unsigned int i = 0; i < reads; ++i) {
448  iss >> corners.at(i);
449  }
450 
451  LOGDEBUG("Phase1PixelMaps") << id << " : ";
452  for (unsigned int i = 0; i < reads; i++) {
453  // remove the leading and trailing " signs in the corners list
454  (corners[i]).erase(std::remove(corners[i].begin(), corners[i].end(), '"'), corners[i].end());
455  LOGDEBUG("Phase1PixelMaps") << corners.at(i) << " ";
456  typedef boost::tokenizer<boost::char_separator<char>> tokenizer;
457  boost::char_separator<char> sep{","};
458  tokenizer tok{corners.at(i), sep};
459  for (const auto& t : tok | boost::adaptors::indexed(0)) {
460  if (t.index() == 0) {
461  xP.push_back(atof((t.value()).c_str()));
462  } else if (t.index() == 1) {
463  yP.push_back(atof((t.value()).c_str()));
464  } else {
465  edm::LogError("LogicError") << "There should not be any token with index " << t.index() << std::endl;
466  }
467  }
468  }
469  LOGDEBUG("Phase1PixelMaps") << std::endl;
470 
471  xP.push_back(xP.front());
472  yP.push_back(yP.front());
473 
474  for (unsigned int i = 0; i < xP.size(); i++) {
475  LOGDEBUG("Phase1PixelMaps") << "x[" << i << "]=" << xP[i] << " y[" << i << "]" << yP[i] << std::endl;
476  }
477 
478  theOutMap[id] = std::make_pair(xP, yP);
479 
480  } // if line is empty
481  } // loop on lines
482  } // loop on files
483  return theOutMap;
484 }

References mps_fire::end, Exception, geometryDiff::file, mps_fire::i, triggerObjects_cff::id, mps_splice::line, LOGDEBUG, Skims_PA_cff::name, MatrixUtil::remove(), AlCaHLTBitMon_QueryRunRegistry::string, and submitPVValidationJobs::t.

Referenced by bookBarrelBins(), and bookForwardBins().

◆ setBarrelScale()

void Phase1PixelMaps::setBarrelScale ( const std::string &  currentHistoName,
std::pair< float, float >  extrema 
)

Definition at line 322 of file Phase1PixelMaps.cc.

322  {
323  for (auto& histo : pxbTh2PolyBarrel[currentHistoName]) {
324  histo->GetZaxis()->SetRangeUser(extrema.first, extrema.second);
325  }
326 }

References timingPdfMaker::histo, and pxbTh2PolyBarrel.

◆ setForwardScale()

void Phase1PixelMaps::setForwardScale ( const std::string &  currentHistoName,
std::pair< float, float >  extrema 
)

Definition at line 329 of file Phase1PixelMaps.cc.

329  {
330  for (auto& histo : pxfTh2PolyForward[currentHistoName]) {
331  histo->GetZaxis()->SetRangeUser(extrema.first, extrema.second);
332  }
333 }

References timingPdfMaker::histo, and pxfTh2PolyForward.

◆ setNoRescale()

void Phase1PixelMaps::setNoRescale ( )
inline

Definition at line 56 of file Phase1PixelMaps.h.

56 { m_autorescale = false; }

References m_autorescale.

Member Data Documentation

◆ bins

std::map<uint32_t, std::shared_ptr<TGraph> > Phase1PixelMaps::bins
private

Definition at line 93 of file Phase1PixelMaps.h.

Referenced by bookBarrelBins(), and bookForwardBins().

◆ binsSummary

std::map<uint32_t, std::shared_ptr<TGraph> > Phase1PixelMaps::binsSummary
private

Definition at line 93 of file Phase1PixelMaps.h.

Referenced by bookBarrelBins(), and bookForwardBins().

◆ m_autorescale

bool Phase1PixelMaps::m_autorescale
private

Definition at line 87 of file Phase1PixelMaps.h.

Referenced by drawBarrelMaps(), drawForwardMaps(), and setNoRescale().

◆ m_cornersBPIX

std::vector<edm::FileInPath> Phase1PixelMaps::m_cornersBPIX
private

Definition at line 99 of file Phase1PixelMaps.h.

Referenced by bookBarrelBins().

◆ m_cornersFPIX

std::vector<edm::FileInPath> Phase1PixelMaps::m_cornersFPIX
private

Definition at line 100 of file Phase1PixelMaps.h.

Referenced by bookForwardBins().

◆ m_isBooked

std::pair<bool, bool> Phase1PixelMaps::m_isBooked
private

◆ m_knownNames

std::vector<std::string> Phase1PixelMaps::m_knownNames
private

◆ m_option

Option_t* Phase1PixelMaps::m_option
private

◆ m_trackerTopo

TrackerTopology Phase1PixelMaps::m_trackerTopo
private

◆ pxbTh2PolyBarrel

std::map<std::string, std::vector<std::shared_ptr<TH2Poly> > > Phase1PixelMaps::pxbTh2PolyBarrel
private

◆ pxbTh2PolyBarrelSummary

std::map<std::string, std::shared_ptr<TH2Poly> > Phase1PixelMaps::pxbTh2PolyBarrelSummary
private

◆ pxfTh2PolyForward

std::map<std::string, std::vector<std::shared_ptr<TH2Poly> > > Phase1PixelMaps::pxfTh2PolyForward
private

◆ pxfTh2PolyForwardSummary

std::map<std::string, std::shared_ptr<TH2Poly> > Phase1PixelMaps::pxfTh2PolyForwardSummary
private
Phase1PixelMaps::m_knownNames
std::vector< std::string > m_knownNames
Definition: Phase1PixelMaps.h:89
indexedCorners
std::map< unsigned int, std::pair< std::vector< float >, std::vector< float > >> indexedCorners
Definition: Phase1PixelMaps.h:26
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
Phase1PixelMaps::bins
std::map< uint32_t, std::shared_ptr< TGraph > > bins
Definition: Phase1PixelMaps.h:93
Phase1PixelMaps::m_cornersFPIX
std::vector< edm::FileInPath > m_cornersFPIX
Definition: Phase1PixelMaps.h:100
mps_fire.i
i
Definition: mps_fire.py:428
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
PixelSubdetector::PixelEndcap
Definition: PixelSubdetector.h:11
HLT_FULL_cff.Class
Class
Definition: HLT_FULL_cff.py:8399
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
TrackerTopology::pxfSide
unsigned int pxfSide(const DetId &id) const
Definition: TrackerTopology.h:192
Phase1PixelMaps::makeNicePlotStyle
void makeNicePlotStyle(TH1 *hist)
Definition: Phase1PixelMaps.cc:487
Phase1PixelMaps::bookBarrelHistograms
void bookBarrelHistograms(const std::string &currentHistoName, const char *what, const char *zaxis)
Definition: Phase1PixelMaps.cc:30
contentValuesFiles.fullPath
fullPath
Definition: contentValuesFiles.py:64
mps_splice.entry
entry
Definition: mps_splice.py:68
TrackerTopology::pxbLadder
unsigned int pxbLadder(const DetId &id) const
Definition: TrackerTopology.h:155
Phase1PixelMaps::pxfTh2PolyForward
std::map< std::string, std::vector< std::shared_ptr< TH2Poly > > > pxfTh2PolyForward
Definition: Phase1PixelMaps.h:96
timingPdfMaker.histo
histo
Definition: timingPdfMaker.py:278
Phase1PixelMaps::bookBarrelBins
void bookBarrelBins(const std::string &currentHistoName)
Definition: Phase1PixelMaps.cc:123
LOGDEBUG
#define LOGDEBUG(x)
Definition: Phase1PixelMaps.h:21
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
Phase1PixelMaps::rescaleAllBarrel
void rescaleAllBarrel(const std::string &currentHistoName)
Definition: Phase1PixelMaps.cc:524
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
plotFactory.plot
plot
Definition: plotFactory.py:109
fileinputsource_cfi.option
option
Definition: fileinputsource_cfi.py:94
LaserClient_cfi.zaxis
zaxis
Definition: LaserClient_cfi.py:91
TrackerTopology::pxbLayer
unsigned int pxbLayer(const DetId &id) const
Definition: TrackerTopology.h:144
Phase1PixelMaps::pxbTh2PolyBarrel
std::map< std::string, std::vector< std::shared_ptr< TH2Poly > > > pxbTh2PolyBarrel
Definition: Phase1PixelMaps.h:94
DetId
Definition: DetId.h:17
edm::FileInPath
Definition: FileInPath.h:61
Phase1PixelMaps::bookForwardBins
void bookForwardBins(const std::string &currentHistoName)
Definition: Phase1PixelMaps.cc:168
mps_fire.end
end
Definition: mps_fire.py:242
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
dqmdumpme.k
k
Definition: dqmdumpme.py:60
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
geometryDiff.file
file
Definition: geometryDiff.py:13
Phase1PixelMaps::pxbTh2PolyBarrelSummary
std::map< std::string, std::shared_ptr< TH2Poly > > pxbTh2PolyBarrelSummary
Definition: Phase1PixelMaps.h:95
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
gpuVertexFinder::hist
__shared__ Hist hist
Definition: gpuClusterTracksDBSCAN.h:48
Phase1PixelMaps::bookForwardHistograms
void bookForwardHistograms(const std::string &currentHistoName, const char *what, const char *zaxis)
Definition: Phase1PixelMaps.cc:75
Phase1PixelMaps::binsSummary
std::map< uint32_t, std::shared_ptr< TGraph > > binsSummary
Definition: Phase1PixelMaps.h:93
Phase1PixelMaps::m_isBooked
std::pair< bool, bool > m_isBooked
Definition: Phase1PixelMaps.h:88
value
Definition: value.py:1
TrackerTopology::pxfDisk
unsigned int pxfDisk(const DetId &id) const
Definition: TrackerTopology.h:446
Phase1PixelMaps::pxfTh2PolyForwardSummary
std::map< std::string, std::shared_ptr< TH2Poly > > pxfTh2PolyForwardSummary
Definition: Phase1PixelMaps.h:97
Phase1PixelMaps::rescaleAllForward
void rescaleAllForward(const std::string &currentHistoName)
Definition: Phase1PixelMaps.cc:550
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
Phase1PixelMaps::retrieveCorners
const indexedCorners retrieveCorners(const std::vector< edm::FileInPath > &cornerFiles, const unsigned int reads)
Definition: Phase1PixelMaps.cc:427
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
Phase1PixelMaps::adjustCanvasMargins
void adjustCanvasMargins(TVirtualPad *pad, float top, float bottom, float left, float right)
Definition: Phase1PixelMaps.cc:512
Exception
Definition: hltDiff.cc:245
MatrixUtil.remove
def remove(d, key, TELL=False)
Definition: MatrixUtil.py:219
PVValHelper::ladder
Definition: PVValidationHelpers.h:73
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
Phase1PixelMaps::m_cornersBPIX
std::vector< edm::FileInPath > m_cornersBPIX
Definition: Phase1PixelMaps.h:99
Phase1PixelMaps::m_trackerTopo
TrackerTopology m_trackerTopo
Definition: Phase1PixelMaps.h:91
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
mps_splice.line
line
Definition: mps_splice.py:76
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
Phase1PixelMaps::m_option
Option_t * m_option
Definition: Phase1PixelMaps.h:86
StandaloneTrackerTopology::fromTrackerParametersXMLFile
TrackerTopology fromTrackerParametersXMLFile(const std::string &xmlFileName)
Definition: StandaloneTrackerTopology.cc:168
Phase1PixelMaps::m_autorescale
bool m_autorescale
Definition: Phase1PixelMaps.h:87
histoStyle.drawOption
drawOption
Definition: histoStyle.py:56