57 int layer,
int ladder,
int module, std::bitset<16> bad_rocs,
bool isFlipped)
60 std::vector<std::tuple<int, int, int>> rocsToMask;
62 int nlad_list[4] = {6, 14, 22, 32};
63 int nlad = nlad_list[layer - 1];
68 int roc0_x = ((layer == 1) || (layer > 1 &&
module > 0)) ? start_x + 7 : start_x;
69 int roc0_y = start_y - 1;
72 while (
idx < bad_rocs.size()) {
73 if (bad_rocs.test(
idx)) {
74 int roc_x(0), roc_y(0);
76 if ((layer == 1) || (layer > 1 &&
module > 0)) {
78 roc_x =
idx < 8 ? roc0_x -
idx : (start_x - 8) +
idx;
79 roc_y =
idx < 8 ? roc0_y + 1 : roc0_y + 2;
81 roc_x =
idx < 8 ? roc0_x -
idx : (start_x - 8) +
idx;
82 roc_y =
idx < 8 ? roc0_y + 2 : roc0_y + 1;
86 roc_x =
idx < 8 ? roc0_x +
idx : (roc0_x + 7) - (
idx - 8);
87 roc_y =
idx < 8 ? roc0_y + 1 : roc0_y + 2;
89 roc_x =
idx < 8 ? roc0_x +
idx : (roc0_x + 7) - (
idx - 8);
90 roc_y =
idx < 8 ? roc0_y + 2 : roc0_y + 1;
94 edm::LogInfo(
"payloadPlotting") << bad_rocs <<
" : (idx)= " <<
idx << std::endl;
95 edm::LogInfo(
"payloadPlotting") <<
" layer: " << layer << std::endl;
96 edm::LogInfo(
"payloadPlotting") <<
"module: " <<
module <<
" roc_x:" << roc_x << std::endl;
97 edm::LogInfo(
"payloadPlotting") <<
"ladder: " <<
ladder <<
" roc_y:" << roc_y << std::endl;
98 edm::LogInfo(
"payloadPlotting") <<
"==================================================================" 101 rocsToMask.push_back(std::make_tuple(roc_x, roc_y,
idx));
110 int ring,
int blade,
int panel,
int disk, std::bitset<16> bad_rocs,
bool isFlipped)
113 std::vector<std::tuple<int, int, int>> rocsToMask;
114 int nybins_list[2] = {92, 140};
115 int nybins = nybins_list[
ring - 1];
117 int start_x = disk > 0 ? ((disk + 3) * 8) + 1 : ((3 - (
std::abs(disk))) * 8) + 1;
118 int start_y = blade > 0 ? (nybins / 2) + (blade * 4) - (panel * 2) + 3
119 : ((nybins / 2) - (
std::abs(blade) * 4) - panel * 2) + 3;
121 int roc0_x = disk > 0 ? start_x + 7 : start_x;
122 int roc0_y = start_y - 1;
125 while (
idx < bad_rocs.size()) {
126 if (bad_rocs.test(
idx)) {
127 int roc_x(0), roc_y(0);
131 roc_x =
idx < 8 ? roc0_x -
idx : (start_x - 8) +
idx;
132 roc_y =
idx < 8 ? roc0_y + 1 : roc0_y + 2;
134 roc_x =
idx < 8 ? roc0_x -
idx : (start_x - 8) +
idx;
135 roc_y =
idx < 8 ? roc0_y + 2 : roc0_y + 1;
139 roc_x =
idx < 8 ? roc0_x +
idx : (roc0_x + 7) - (
idx - 8);
140 roc_y =
idx < 8 ? roc0_y + 1 : roc0_y + 2;
142 roc_x =
idx < 8 ? roc0_x +
idx : (roc0_x + 7) - (
idx - 8);
143 roc_y =
idx < 8 ? roc0_y + 2 : roc0_y + 1;
147 edm::LogInfo(
"payloadPlotting") << bad_rocs <<
" : (idx)= " <<
idx << std::endl;
148 edm::LogInfo(
"payloadPlotting") <<
" panel: " << panel <<
" isFlipped: " << isFlipped << std::endl;
149 edm::LogInfo(
"payloadPlotting") <<
" disk: " << disk <<
" roc_x:" << roc_x << std::endl;
150 edm::LogInfo(
"payloadPlotting") <<
" blade: " << blade <<
" roc_y:" << roc_y << std::endl;
151 edm::LogInfo(
"payloadPlotting") <<
"===============================" << std::endl;
153 rocsToMask.push_back(std::make_tuple(roc_x, roc_y,
idx));
214 useLogScale_(iConfig.getParameter<
bool>(
"useLogScale")),
215 addLumiInfo_(iConfig.getParameter<
bool>(
"addLumiInfo")),
216 analyzedTag_(iConfig.getParameter<
std::
string>(
"analyzedTag")),
217 lastRun_(iConfig.getUntrackedParameter<unsigned
int>(
"maxRun", 999999)),
218 lumiInputTag_(iConfig.getUntrackedParameter<
edm::
InputTag>(
"lumiInputTag")),
219 lumiToken_(consumes<
LumiInfo>(lumiInputTag_)) {
229 int nlad_list[
n_layers] = {6, 14, 22, 32};
232 for (
unsigned int lay = 1; lay <=
n_layers; lay++) {
233 int nlad = nlad_list[lay - 1];
237 " Ladder # ; fraction of bad luminosity per component (%)";
239 name.c_str(),
title.c_str(), 72 * divide_roc, -4.5, 4.5, (nlad * 4 + 2) * divide_roc, -nlad - 0.5, nlad + 0.5);
244 int n =
ring == 1 ? 92 : 140;
245 float y =
ring == 1 ? 11.5 : 17.5;
248 " Blade/Panel # ; fraction of bad luminosity per component (%)";
256 for (
unsigned int lay = 1; lay <=
n_layers; lay++) {
273 unsigned int RunNumber_ =
iEvent.eventAuxiliary().run();
274 unsigned int LuminosityBlockNumber_ =
iEvent.eventAuxiliary().luminosityBlock();
283 if (hasQualityIOV || RunNumber_ >
lastRun_) {
288 <<
"New IOV, Run: " << RunNumber_ <<
" LS:" << LuminosityBlockNumber_ << std::endl;
300 if ((
layer > 1 && s_module < 0))
301 isFlipped = !isFlipped;
306 <<
"layer:" <<
layer <<
" ladder:" <<
ladder <<
" module:" <<
module <<
" signed ladder: " << s_ladder
307 <<
" signed module: " << s_module << std::endl;
310 for (
const auto&
bin : bpix_rocsToMask) {
320 auto panel = m_trackerTopo.pxfPanel(
mod);
322 bool isFlipped = (s_disk > 0) ? (panel == 1) : (panel == 2);
325 <<
"ring:" <<
ring <<
" blade: " << s_blade <<
" panel: " << panel
326 <<
" signed blade/panel: " << s_blade_panel <<
" disk: " << s_disk << std::endl;
328 auto fpix_rocsToMask =
330 for (
const auto&
bin : fpix_rocsToMask) {
336 throw cms::Exception(
"LogicError") <<
"Unknown Pixel SubDet ID " << std::endl;
348 for (
const auto&
mod : theDisabledModules) {
349 int coded_badRocs =
mod.BadRocs;
350 std::bitset<16> bad_rocs(coded_badRocs);
376 <<
"\n=============================================\n" 377 <<
"Last Analyzed LS: " << unpackedtime.first <<
"," << unpackedtime.second << std::endl;
380 gStyle->SetOptStat(0);
382 std::vector<TCanvas*> vCanvasBarrel(
n_layers);
383 TCanvas canvasB(
"SummaryBarrel",
"SummaryBarrel", 1400, 1200);
384 canvasB.Divide(2, 2);
386 canvasB.cd(
i)->SetTopMargin(0.06);
387 canvasB.cd(
i)->SetBottomMargin(0.11);
388 canvasB.cd(
i)->SetLeftMargin(0.12);
389 canvasB.cd(
i)->SetRightMargin(0.16);
390 vCanvasBarrel[
i - 1] =
new TCanvas(Form(
"Layer_%i",
i), Form(
"Layer_%i",
i), 700, 600);
391 vCanvasBarrel[
i - 1]->cd()->SetTopMargin(0.08);
392 vCanvasBarrel[
i - 1]->cd()->SetBottomMargin(0.11);
393 vCanvasBarrel[
i - 1]->cd()->SetLeftMargin(0.12);
394 vCanvasBarrel[
i - 1]->cd()->SetRightMargin(0.16);
397 for (
unsigned int lay = 1; lay <=
n_layers; lay++) {
400 h_bpix_occ[lay - 1]->GetYaxis()->SetTitleOffset(1.2);
401 h_bpix_occ[lay - 1]->GetZaxis()->SetTitleOffset(1.3);
402 h_bpix_occ[lay - 1]->GetZaxis()->SetTitleSize(0.042);
403 h_bpix_occ[lay - 1]->GetZaxis()->CenterTitle();
405 canvasB.cd(lay)->Modified();
409 canvasB.cd(lay)->SetLogz();
412 TPad* current_pad =
static_cast<TPad*
>(canvasB.cd(lay));
416 vCanvasBarrel[lay - 1]->cd()->Modified();
419 vCanvasBarrel[lay - 1]->cd()->SetLogz();
422 TPad* current_pad =
static_cast<TPad*
>(vCanvasBarrel[lay - 1]->cd());
427 for (
unsigned int lay = 1; lay <=
n_layers; lay++) {
432 canvasB.SaveAs((
"SummaryBarrel_" +
analyzedTag_ +
".png").c_str());
433 canvasB.SaveAs((
"SummaryBarrel_" +
analyzedTag_ +
".pdf").c_str());
436 std::vector<TCanvas*> vCanvasForward(2);
437 TCanvas canvasF(
"SummaryForward",
"SummaryForward", 1400, 600);
438 canvasF.Divide(2, 1);
440 canvasF.cd(
i)->SetTopMargin(0.06);
441 canvasF.cd(
i)->SetBottomMargin(0.11);
442 canvasF.cd(
i)->SetLeftMargin(0.12);
443 canvasF.cd(
i)->SetRightMargin(0.16);
444 vCanvasForward[
i - 1] =
new TCanvas(Form(
"Ring_%i",
i), Form(
"Ring_%i",
i), 700, 600);
445 vCanvasForward[
i - 1]->cd()->SetTopMargin(0.08);
446 vCanvasForward[
i - 1]->cd()->SetBottomMargin(0.11);
447 vCanvasForward[
i - 1]->cd()->SetLeftMargin(0.12);
448 vCanvasForward[
i - 1]->cd()->SetRightMargin(0.16);
459 canvasF.cd(
ring)->Modified();
462 canvasF.cd(
ring)->SetLogz();
465 TPad* current_pad =
static_cast<TPad*
>(canvasF.cd(
ring));
469 vCanvasForward[
ring - 1]->cd()->Modified();
473 vCanvasForward[
ring - 1]->cd()->SetLogz();
476 TPad* current_pad =
static_cast<TPad*
>(vCanvasForward[
ring - 1]->cd());
486 canvasF.SaveAs((
"SummaryForward_" +
analyzedTag_ +
".png").c_str());
487 canvasF.SaveAs((
"SummaryForward_" +
analyzedTag_ +
".pdf").c_str());
494 ltx.SetTextSize(0.045);
495 ltx.SetTextAlign(11);
497 sprintf(
str,
"#font[42]{L = %.3f fb^{-1}}",
lumi);
498 ltx.DrawLatexNDC(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.01,
str);
504 desc.add<
bool>(
"useLogScale",
false);
505 desc.add<
bool>(
"addLumiInfo",
true);
507 desc.addUntracked<
unsigned int>(
"maxRun", 999999);
509 descriptions.
add(
"siPixelQualityPlotter",
desc);
Log< level::Info, true > LogVerbatim
std::vector< std::tuple< int, int, int > > maskedForwardRocsToBins(int ring, int blade, int panel, int disk, std::bitset< 16 > bad_rocs, bool isFlipped)
static const int n_layers
std::vector< std::tuple< int, int, int > > maskedBarrelRocsToBins(int layer, int ladder, int module, std::bitset< 16 > bad_rocs, bool isFlipped)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
int signed_blade_panel(const DetId &detid, const TrackerTopology &tTopo_, bool phase_)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
cond::Time_t pack(cond::UnpackedTime iValue)
static std::string to_string(const XMLCh *ch)
int signed_ladder(const DetId &detid, const TrackerTopology &tTopo_, bool phase_)
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoEsToken_
const unsigned int lastRun_
const std::vector< disabledModuleType > getBadComponentList() const
unsigned long long Time_t
int signed_disk(const DetId &detid, const TrackerTopology &tTopo_, bool phase_)
void analyze(const edm::Event &, const edm::EventSetup &) override
int signed_blade(const DetId &detid, const TrackerTopology &tTopo_, bool phase_)
cond::Time_t lastIOVtime_
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
const edm::EDGetTokenT< LumiInfo > lumiToken_
void CMS_lumi(TPad *pad, float lumi)
~SiPixelQualityPlotter() override
const edm::ESGetToken< SiPixelQuality, SiPixelQualityFromDbRcd > qualEsToken_
std::array< TH2D *, n_rings > h_fpix_occ
Log< level::Info, false > LogInfo
int ring(const DetId &detid, const TrackerTopology &tTopo_, bool phase_)
void makeNicePlotStyle(TH1 *hist)
int signed_module(const DetId &detid, const TrackerTopology &tTopo_, bool phase_)
std::map< uint32_t, std::bitset< 16 > > cachedPayload_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool check(const edm::EventSetup &iSetup)
const std::string analyzedTag_
std::array< TH2D *, n_layers > h_bpix_occ
const edm::InputTag lumiInputTag_
std::pair< unsigned int, unsigned int > UnpackedTime
bool isBPixOuterLadder(const DetId &detid, const TrackerTopology &tTopo, bool isPhase0)
edm::ESWatcher< SiPixelQualityFromDbRcd > SiPixelQualityWatcher_
void dress_occup_plot(TCanvas &canv, TH2 *h, int lay, int ring=0, int phase=0, bool half_shift=true, bool mark_zero=true, bool standard_palette=true)
T mod(const T &a, const T &b)
SiPixelQualityPlotter(const edm::ParameterSet &)
cond::UnpackedTime unpack(cond::Time_t iValue)
float lumiSinceLastReset_