CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
PixelRegions::PixelRegionContainers Class Reference

#include <PixelRegionContainers.h>

Public Member Functions

void beautify (const int linecolor=kBlack, const int fillcolor=kRed)
 
void bookAll (std::string title_label, std::string x_label, std::string y_label, const int nbins, const float xmin, const float xmax)
 
void draw (TCanvas &canv, bool isBarrel, const char *option="bar2", bool isPhase1Comparison=false)
 
void fill (const unsigned int detid, const float value)
 
std::shared_ptr< TH1F > & getHistoFromMap (const PixelRegions::PixelId &theId)
 
 PixelRegionContainers (const TrackerTopology *t_topo, const bool isPhase1)
 
void rescaleMax (PixelRegionContainers &the2ndContainer)
 
void setLogScale ()
 
void stats (int index=0)
 
 ~PixelRegionContainers ()
 

Private Attributes

bool m_isLog
 
bool m_isPhase1
 
int m_nbins
 
std::map< PixelId, std::shared_ptr< TH1F > > m_theMap
 
const TrackerTopologym_trackerTopo
 
float m_xim
 
float m_xmax
 

Detailed Description

Definition at line 160 of file PixelRegionContainers.h.

Constructor & Destructor Documentation

◆ PixelRegionContainers()

PixelRegions::PixelRegionContainers::PixelRegionContainers ( const TrackerTopology t_topo,
const bool  isPhase1 
)
inline

Definition at line 162 of file PixelRegionContainers.h.

163  : m_trackerTopo(t_topo), m_isPhase1(isPhase1) {
164  // set log scale by default to false
165  m_isLog = false;
166  }

References m_isLog.

◆ ~PixelRegionContainers()

PixelRegions::PixelRegionContainers::~PixelRegionContainers ( )
inline

Definition at line 168 of file PixelRegionContainers.h.

168 {}

Member Function Documentation

◆ beautify()

void PixelRegions::PixelRegionContainers::beautify ( const int  linecolor = kBlack,
const int  fillcolor = kRed 
)
inline

Definition at line 248 of file PixelRegionContainers.h.

248  {
249  for (const auto& plot : m_theMap) {
250  plot.second->SetTitle("");
251  if (!m_isLog) {
252  plot.second->GetYaxis()->SetRangeUser(0., plot.second->GetMaximum() * 1.30);
253  } else {
254  plot.second->GetYaxis()->SetRangeUser(0.1, plot.second->GetMaximum() * 100.);
255  }
256  plot.second->SetLineColor(linecolor);
257  if (fillcolor > 0) {
258  plot.second->SetFillColor(fillcolor);
259  }
260  plot.second->SetMarkerStyle(20);
261  plot.second->SetMarkerSize(1);
262  SiPixelPI::makeNicePlotStyle(plot.second.get());
263  plot.second->SetStats(true);
264  }
265  }

References m_isLog, m_theMap, SiPixelPI::makeNicePlotStyle(), and plotFactory::plot.

◆ bookAll()

void PixelRegions::PixelRegionContainers::bookAll ( std::string  title_label,
std::string  x_label,
std::string  y_label,
const int  nbins,
const float  xmin,
const float  xmax 
)
inline

Definition at line 171 of file PixelRegionContainers.h.

176  {
177  for (const auto& pixelId : PixelIDs | boost::adaptors::indexed(0)) {
178  m_theMap[pixelId.value()] = std::make_shared<TH1F>((title_label + itoa(pixelId.value())).c_str(),
179  Form("%s %s;%s;%s",
180  (IDlabels.at(pixelId.index())).c_str(),
181  title_label.c_str(),
182  x_label.c_str(),
183  y_label.c_str()),
184  nbins,
185  xmin,
186  xmax);
187  }
188  }

References PixelRegions::IDlabels, PixelRegions::itoa(), m_theMap, LaserClient_cfi::nbins, PixelRegions::PixelIDs, TrackerOfflineValidation_Dqm_cff::xmax, and TrackerOfflineValidation_Dqm_cff::xmin.

◆ draw()

void PixelRegions::PixelRegionContainers::draw ( TCanvas &  canv,
bool  isBarrel,
const char *  option = "bar2",
bool  isPhase1Comparison = false 
)
inline

Definition at line 203 of file PixelRegionContainers.h.

203  {
204  if (isBarrel) {
205  for (int j = 1; j <= 4; j++) {
206  if (!m_isLog) {
207  canv.cd(j);
208  } else {
209  canv.cd(j)->SetLogy();
210  }
211  if ((j == 4) && !m_isPhase1 && !isPhase1Comparison) {
212  m_theMap.at(PixelIDs[j - 1])->Draw("AXIS");
213  TLatex t2;
214  t2.SetTextAlign(22);
215  t2.SetTextSize(0.1);
216  t2.SetTextAngle(45);
217  t2.SetTextFont(61);
218  t2.SetTextColor(kBlack);
219  t2.DrawLatexNDC(0.5, 0.5, "Not in Phase-0!");
220  } else {
221  m_theMap.at(PixelIDs[j - 1])->Draw(option);
222  }
223  }
224  } else { // forward
225  for (int j = 1; j <= 12; j++) {
226  if (!m_isLog) {
227  canv.cd(j);
228  } else {
229  canv.cd(j)->SetLogy();
230  }
231  if ((j % 6 == 5 || j % 6 == 0) && !m_isPhase1 && !isPhase1Comparison) {
232  m_theMap.at(PixelIDs[j + 3])->Draw("AXIS");
233  TLatex t2;
234  t2.SetTextAlign(22);
235  t2.SetTextSize(0.1);
236  t2.SetTextAngle(45);
237  t2.SetTextFont(61);
238  t2.SetTextColor(kBlack);
239  t2.DrawLatexNDC(0.5, 0.5, "Not in Phase-0!");
240  } else {
241  m_theMap.at(PixelIDs[j + 3])->Draw(option);
242  }
243  }
244  }
245  }

References PixelPluginsPhase0_cfi::isBarrel, dqmiolumiharvest::j, m_isLog, m_isPhase1, m_theMap, fileinputsource_cfi::option, PixelRegions::PixelIDs, and RandomServiceHelper::t2.

◆ fill()

void PixelRegions::PixelRegionContainers::fill ( const unsigned int  detid,
const float  value 
)
inline

Definition at line 191 of file PixelRegionContainers.h.

191  {
192  // convert from detid to pixelid
194  if (m_theMap.find(myId) != m_theMap.end()) {
195  m_theMap[myId]->Fill(value);
196  } else {
197  edm::LogError("PixelRegionContainers")
198  << detid << " :=> " << myId << " is not a recongnized PixelId enumerator!" << std::endl;
199  }
200  }

References PixelRegions::detIdToPixelId(), m_isPhase1, m_theMap, and m_trackerTopo.

◆ getHistoFromMap()

std::shared_ptr<TH1F>& PixelRegions::PixelRegionContainers::getHistoFromMap ( const PixelRegions::PixelId theId)
inline

Definition at line 288 of file PixelRegionContainers.h.

288  {
289  auto it = m_theMap.find(theId);
290  if (it != m_theMap.end()) {
291  return it->second;
292  } else {
293  throw cms::Exception("PixelRegionContainer") << "No histogram is available for PixelId" << theId << "\n";
294  }
295  }

References Exception, and m_theMap.

Referenced by rescaleMax().

◆ rescaleMax()

void PixelRegions::PixelRegionContainers::rescaleMax ( PixelRegionContainers the2ndContainer)
inline

Definition at line 298 of file PixelRegionContainers.h.

298  {
299  for (const auto& plot : m_theMap) {
300  auto thePixId = plot.first;
301  auto extrema = SiPixelPI::getExtrema((plot.second).get(), the2ndContainer.getHistoFromMap(thePixId).get());
302  plot.second->GetYaxis()->SetRangeUser(extrema.first, extrema.second);
303  the2ndContainer.getHistoFromMap(thePixId)->GetYaxis()->SetRangeUser(extrema.first, extrema.second);
304  }
305  }

References SiPixelPI::getExtrema(), getHistoFromMap(), m_theMap, and plotFactory::plot.

◆ setLogScale()

void PixelRegions::PixelRegionContainers::setLogScale ( )
inline

Definition at line 268 of file PixelRegionContainers.h.

268 { m_isLog = true; }

References m_isLog.

◆ stats()

void PixelRegions::PixelRegionContainers::stats ( int  index = 0)
inline

Definition at line 271 of file PixelRegionContainers.h.

271  {
272  for (const auto& plot : m_theMap) {
273  TPaveStats* st = (TPaveStats*)plot.second->FindObject("stats");
274  if (st) {
275  st->SetTextSize(0.03);
276  st->SetLineColor(10);
277  if (plot.second->GetFillColor() != 0) {
278  st->SetTextColor(plot.second->GetFillColor());
279  } else {
280  st->SetTextColor(plot.second->GetLineColor());
281  }
282  SiPixelPI::adjustStats(st, 0.13, 0.85 - index * 0.08, 0.36, 0.93 - index * 0.08);
283  }
284  }
285  }

References SiPixelPI::adjustStats(), m_theMap, and plotFactory::plot.

Member Data Documentation

◆ m_isLog

bool PixelRegions::PixelRegionContainers::m_isLog
private

Definition at line 314 of file PixelRegionContainers.h.

Referenced by beautify(), draw(), PixelRegionContainers(), and setLogScale().

◆ m_isPhase1

bool PixelRegions::PixelRegionContainers::m_isPhase1
private

Definition at line 309 of file PixelRegionContainers.h.

Referenced by draw(), and fill().

◆ m_nbins

int PixelRegions::PixelRegionContainers::m_nbins
private

Definition at line 312 of file PixelRegionContainers.h.

◆ m_theMap

std::map<PixelId, std::shared_ptr<TH1F> > PixelRegions::PixelRegionContainers::m_theMap
private

Definition at line 311 of file PixelRegionContainers.h.

Referenced by beautify(), bookAll(), draw(), fill(), getHistoFromMap(), rescaleMax(), and stats().

◆ m_trackerTopo

const TrackerTopology* PixelRegions::PixelRegionContainers::m_trackerTopo
private

Definition at line 308 of file PixelRegionContainers.h.

Referenced by fill().

◆ m_xim

float PixelRegions::PixelRegionContainers::m_xim
private

Definition at line 313 of file PixelRegionContainers.h.

◆ m_xmax

float PixelRegions::PixelRegionContainers::m_xmax
private

Definition at line 313 of file PixelRegionContainers.h.

RandomServiceHelper.t2
t2
Definition: RandomServiceHelper.py:257
PixelRegions::PixelIDs
const std::vector< PixelId > PixelIDs
Definition: PixelRegionContainers.h:46
PixelRegions::PixelRegionContainers::m_trackerTopo
const TrackerTopology * m_trackerTopo
Definition: PixelRegionContainers.h:308
pixelClusterTagInfos_cfi.isPhase1
isPhase1
Definition: pixelClusterTagInfos_cfi.py:7
PixelRegions::PixelId
PixelId
Definition: PixelRegionContainers.h:26
plotFactory.plot
plot
Definition: plotFactory.py:109
fileinputsource_cfi.option
option
Definition: fileinputsource_cfi.py:87
PixelRegions::PixelRegionContainers::m_isPhase1
bool m_isPhase1
Definition: PixelRegionContainers.h:309
LaserClient_cfi.nbins
nbins
Definition: LaserClient_cfi.py:51
PixelPluginsPhase0_cfi.isBarrel
isBarrel
Definition: PixelPluginsPhase0_cfi.py:17
edm::LogError
Definition: MessageLogger.h:183
PixelRegions::PixelRegionContainers::m_theMap
std::map< PixelId, std::shared_ptr< TH1F > > m_theMap
Definition: PixelRegionContainers.h:311
PixelRegions::IDlabels
const std::vector< std::string > IDlabels
Definition: PixelRegionContainers.h:64
value
Definition: value.py:1
SiPixelPI::adjustStats
void adjustStats(TPaveStats *stats, float X1, float Y1, float X2, float Y2)
Definition: SiPixelPayloadInspectorHelper.h:449
PixelRegions::detIdToPixelId
static const PixelId detIdToPixelId(const unsigned int detid, const TrackerTopology *trackTopo, const bool phase1)
Definition: PixelRegionContainers.h:97
TrackerOfflineValidation_Dqm_cff.xmax
xmax
Definition: TrackerOfflineValidation_Dqm_cff.py:11
Exception
Definition: hltDiff.cc:246
SiPixelPI::makeNicePlotStyle
void makeNicePlotStyle(TH1 *hist)
Definition: SiPixelPayloadInspectorHelper.h:475
PixelRegions::PixelRegionContainers::m_isLog
bool m_isLog
Definition: PixelRegionContainers.h:314
SiPixelPI::getExtrema
std::pair< float, float > getExtrema(TH1 *h1, TH1 *h2)
Definition: SiPixelPayloadInspectorHelper.h:459
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
PixelRegions::itoa
std::string itoa(int i)
Definition: PixelRegionContainers.h:16
TrackerOfflineValidation_Dqm_cff.xmin
xmin
Definition: TrackerOfflineValidation_Dqm_cff.py:10
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66