380 {
382
385
386 const int minLogOccupancy = 8;
387 const double minOccupancy =
pow(10.,-minLogOccupancy);
388
389 TH1D* globalOccupancy= new TH1D("occupancy", "Pixel occupancy", minLogOccupancy*10, -minLogOccupancy, 0.);
390 m_tHistSvc->regHist(
"/histfile/occupancy",globalOccupancy).ignore();
391
392 std::map<std::string, TH1D*> h_occupancy;
393
394
395 std::vector<std::string> vcomponent;
396 vcomponent.push_back("Disk1A");
397 vcomponent.push_back("Disk2A");
398 vcomponent.push_back("Disk3A");
399 vcomponent.push_back("Disk1C");
400 vcomponent.push_back("Disk2C");
401 vcomponent.push_back("Disk3C");
402 vcomponent.push_back("IBL");
403 vcomponent.push_back("B-layer");
404 vcomponent.push_back("Layer1");
405 vcomponent.push_back("Layer2");
406 vcomponent.push_back("DBMA");
407 vcomponent.push_back("DBMC");
408
409 for(std::vector<std::string>::const_iterator cit=vcomponent.begin(); cit!=vcomponent.end(); ++cit) {
410 const std::string
comp = (*cit);
411 h_occupancy[
comp] =
new TH1D( (
"occupancy"+comp).c_str(), (
"Pixel occupancy "+comp).c_str(),
412 minLogOccupancy*10, -minLogOccupancy, 0);
413 m_tHistSvc->regHist((
"/histfile/occupancy"+comp).c_str(), h_occupancy[comp]).ignore();
414 }
415 vcomponent.clear();
416
417
418 std::vector<std::string> vtype;
419 vtype.push_back("Normal");
420 vtype.push_back("Ganged");
421 vtype.push_back("InterGanged");
422 vtype.push_back("Long");
423 vtype.push_back("Long-Ganged");
424 vtype.push_back("Long-InterGanged");
425 for(std::vector<std::string>::const_iterator cit=vtype.begin(); cit!=vtype.end(); ++cit){
426 const std::string
type = (*cit);
428 new TH1D( ("occupancy"+type).c_str(), ("Pixel occupancy "+type).c_str(),
429 minLogOccupancy*10, -minLogOccupancy, 0);
430 m_tHistSvc->regHist((
"/histfile/occupancy"+type).c_str(), h_occupancy[type]).ignore();
431 }
432 vtype.clear();
433
434
435
436
437
438
439 TH2F* nhitsPlotBI=
new TH2F(
"nhitsPlotBI",
"Number of hits BI;module_eta;module_phi", 20, -10, 10, 14, -0.5, 13.5);
440 m_tHistSvc->regHist(
"/histfile/nhitsPlotBI",nhitsPlotBI).ignore();
441
442
443 TH2F* nhitsPlotB0=
new TH2F(
"nhitsPlotB0",
"Number of hits B0;module_eta;module_phi", 13, -6.5, 6.5, 22, -0.5, 21.5);
444 m_tHistSvc->regHist(
"/histfile/nhitsPlotB0",nhitsPlotB0).ignore();
445
446
447 TH2F* nhitsPlotB1=
new TH2F(
"nhitsPlotB1",
"Number of hits B1;module_eta;module_phi", 13, -6.5, 6.5, 38, -0.5, 37.5);
448 m_tHistSvc->regHist(
"/histfile/nhitsPlotB1",nhitsPlotB1).ignore();
449
450
451 TH2F* nhitsPlotB2=
new TH2F(
"nhitsPlotB2",
"Number of hits B2;module_eta;module_phi", 13,- 6.5, 6.5, 52, -0.5, 51.5);
452 m_tHistSvc->regHist(
"/histfile/nhitsPlotB2",nhitsPlotB2).ignore();
453
454
455 TH2F* nhitsPlotEC=
new TH2F(
"nhitsPlotEC",
"Number of hits Endcap;Disk;module_phi", 7, -3.5, 3.5, 48, -0.5, 47.5);
456 m_tHistSvc->regHist(
"/histfile/nhitsPlotEC",nhitsPlotEC).ignore();
457
458
459 TH2F* nhitsPlotDBM=
new TH2F(
"nhitsPlotDBM",
"Number of hits DBM;Layer;module_phi",7,-3.5,3.5,4,-0.5,3.5);
460 m_tHistSvc->regHist(
"/histfile/nhitsPlotDBM",nhitsPlotDBM).ignore();
461
462
463
464
465
466
467 TH2F* nhitsNoNoisePlotBI=
new TH2F(
"nhitsNoNoisePlotBI",
"Number of hits without Noise BI;module_eta;module_phi", 20, -10, 10, 14, -0.5, 13.5);
468 m_tHistSvc->regHist(
"/histfile/nhitsNoNoisePlotBI",nhitsNoNoisePlotBI).ignore();
469
470
471 TH2F* nhitsNoNoisePlotB0=
new TH2F(
"nhitsNoNoisePlotB0",
"Number of hits without Noise B0;module_eta;module_phi", 13, -6.5, 6.5, 22, -0.5, 21.5);
472 m_tHistSvc->regHist(
"/histfile/nhitsNoNoisePlotB0",nhitsNoNoisePlotB0).ignore();
473
474
475 TH2F* nhitsNoNoisePlotB1=
new TH2F(
"nhitsNoNoisePlotB1",
"Number of hits without Noise B1;module_eta;module_phi", 13, -6.5, 6.5, 38, -0.5, 37.5);
476 m_tHistSvc->regHist(
"/histfile/nhitsNoNoisePlotB1",nhitsNoNoisePlotB1).ignore();
477
478
479 TH2F* nhitsNoNoisePlotB2=
new TH2F(
"nhitsNoNoisePlotB2",
"Number of hits without Noise B2;module_eta;module_phi", 13, -6.5, 6.5, 52, -0.5, 51.5);
480 m_tHistSvc->regHist(
"/histfile/nhitsNoNoisePlotB2",nhitsNoNoisePlotB2).ignore();
481
482
483
484
485
486
487 TH2F* disablePlotBI=
new TH2F(
"disablePlotBI",
"Disabled pixels BI;module_eta;module_phi", 20, -10, 10, 14, -0.5, 13.5);
488 m_tHistSvc->regHist(
"/histfile/disablePlotBI",disablePlotBI).ignore();
489
490
491 TH2F* disablePlotB0=
new TH2F(
"disablePlotB0",
"Disabled pixels B0;module_eta;module_phi", 13,- 6.5, 6.5, 22, -0.5, 21.5);
492 m_tHistSvc->regHist(
"/histfile/disablePlotB0",disablePlotB0).ignore();
493
494
495 TH2F* disablePlotB1=
new TH2F(
"disablePlotB1",
"Disabled pixels B1;module_eta;module_phi", 13, -6.5, 6.5, 38, -0.5, 37.5);
496 m_tHistSvc->regHist(
"/histfile/disablePlotB1",disablePlotB1).ignore();
497
498
499 TH2F* disablePlotB2=
new TH2F(
"disablePlotB2",
"Disabled pixels B2;module_eta;module_phi", 13, -6.5, 6.5, 52, -0.5, 51.5);
500 m_tHistSvc->regHist(
"/histfile/disablePlotB2",disablePlotB2).ignore();
501
502
503 TH2F* disablePlotEC=
new TH2F(
"disablePlotEC",
"Disabled pixels Endcap;Disk;module_phi", 7, -3.5, 3.5, 48, -0.5, 47.5);
504 m_tHistSvc->regHist(
"/histfile/disablePlotEC",disablePlotEC).ignore();
505
506
507 TH2F* disablePlotDBM=
new TH2F(
"disablePlotDBM",
"Disabled pixels DBM;Layer;module_phi", 7, -3.5, 3.5, 4, -0.5, 3.5);
508 m_tHistSvc->regHist(
"/histfile/disablePlotDBM",disablePlotDBM).ignore();
509
510 TH1D* maskedPlot= new TH1D("maskedPlot","Disabled pixel per module",50,0.5,50.5);
511 m_tHistSvc->regHist(
"/histfile/maskedPlot",maskedPlot).ignore();
512
513 int totalDisabledPixels=0;
514 int totalDisabledModules=0;
515 int modulesWithHits=0;
516 int modulesWithDisabledPixels=0;
517
518 const EventContext& ctx{Gaudi::Hive::currentContext()};
520 Identifier
ident = *wafer_it;
521 if(!
m_pixelID->is_pixel(ident))
continue;
522
525 int modPhi =
m_pixelID->phi_module(ident);
526 int modEta =
m_pixelID->eta_module(ident);
527 int modHash =
m_pixelID->wafer_hash(ident);
528 int phi_max =
m_pixelID->phi_index_max(ident);
529 int eta_max =
m_pixelID->eta_index_max(ident);
530
531 TH2F* nhitsNoNoisePlot=0;
534
535 if(bec != 0) {
536 if(bec == 2) {
540 }
541 else if(bec == -2) {
545 }
548 }
549 else if(bec == 0) {
550 if(layer == 0) {
cut=
m_iblCut; nhitsNoNoisePlot=nhitsNoNoisePlotBI;
comp=
"IBL"; }
551 else if(layer == 1) {
cut=
m_bLayerCut; nhitsNoNoisePlot=nhitsNoNoisePlotB0;
comp=
"B-layer"; }
552 else if(layer == 2) {
cut=
m_layer1Cut; nhitsNoNoisePlot=nhitsNoNoisePlotB1;
comp=
"Layer1"; }
553 else if(layer == 3) {
cut=
m_layer2Cut; nhitsNoNoisePlot=nhitsNoNoisePlotB2;
comp=
"Layer2"; }
554 }
555
557 if(bec == 0) {
558 if(layer == 0) { disablePlotBI->Fill(modEta, modPhi, -1); }
559 else if(layer == 1) { disablePlotB0->Fill(modEta, modPhi, -1); }
560 else if(layer == 2) { disablePlotB1->Fill(modEta, modPhi, -1); }
561 else if(layer == 3) { disablePlotB2->Fill(modEta, modPhi, -1); }
562 }
563 else if(bec == 2) { disablePlotEC->Fill(layer+1, modPhi, -1); }
564 else if(bec == -2) { disablePlotEC->Fill(-(layer+1), modPhi, -1); }
565 else if(bec == 4) { disablePlotDBM->Fill(layer+1, modPhi, -1); }
566 else if(bec == -4) { disablePlotDBM->Fill(-(layer+1), modPhi, -1); }
567
568 totalDisabledModules++;
569 continue;
570 }
572 if(bec == 0) {
574 else if(layer == 1) { nhitsPlotB0->Fill(modEta, modPhi,
m_hitMaps[modHash]->
GetEntries()); }
575 else if(layer == 2) { nhitsPlotB1->Fill(modEta, modPhi,
m_hitMaps[modHash]->
GetEntries()); }
576 else if(layer == 3) { nhitsPlotB2->Fill(modEta, modPhi,
m_hitMaps[modHash]->
GetEntries()); }
577 }
578 else if(bec == 2) { nhitsPlotEC->Fill(layer+1, modPhi,
m_hitMaps[modHash]->
GetEntries()); }
579 else if(bec == -2) { nhitsPlotEC->Fill(-(layer+1), modPhi,
m_hitMaps[modHash]->
GetEntries()); }
580 else if(bec == 4) { nhitsPlotDBM->Fill(layer+1, modPhi,
m_hitMaps[modHash]->
GetEntries()); }
581 else if(bec == -4) { nhitsPlotDBM->Fill(-(layer+1), modPhi,
m_hitMaps[modHash]->
GetEntries()); }
582
583 modulesWithHits++;
584 }
585
586 int thisModuleCut = 0;
587 bool isIBL3D = (
bec==0 &&
layer==0 && (modEta <= -7 || modEta >= 6) ) ?
true : false;
588
589 for(int pixel_eta=0; pixel_eta<=eta_max; pixel_eta++){
590 for(int pixel_phi=0; pixel_phi<=phi_max; pixel_phi++){
591
592
593 int pixel_eta_on_chip = (
bec==0 &&
layer==0) ? pixel_eta % 80 : pixel_eta % 18;
594 int pixel_phi_on_chip = (pixel_phi <= 163) ? pixel_phi : 327 - pixel_phi;
595 if (bec == 0 && layer == 0) pixel_phi_on_chip = pixel_phi;
596 int pixelType = 0;
597
598 if (bec == 0 && layer == 0) {
599 if( !isIBL3D && (pixel_eta_on_chip == 0 || pixel_eta_on_chip == 80 - 1) ){
600 pixelType = 1;
601 }
602 else {
603 pixelType = 0;
604 }
605 } else {
606 if(pixel_eta_on_chip > 0 && pixel_eta_on_chip < 18 - 1){
607 pixelType = 0;
608 for(
int kk = 0;
kk < 3;
kk++){
609
610
611 if(pixel_phi_on_chip == (153 + 2 * kk + 1)){
612 pixelType = 5;
613 break;
614 }
615 if(pixel_phi_on_chip == (153 + 2 * kk) || pixel_phi_on_chip >= 159){
616 pixelType = 2;
617 break;
618 }
619 }
620 }
621 else if(pixel_eta_on_chip == 0 || pixel_eta_on_chip == 18 - 1){
622 pixelType = 1;
623 for(
int kk = 0;
kk < 3;
kk++){
624 if(pixel_phi_on_chip == (153 + 2 * kk + 1)){
625 pixelType = 6;
626 break;
627 }
628 if(pixel_phi_on_chip == (153 + 2 * kk) || pixel_phi_on_chip >= 159){
629 pixelType = 3;
630 break;
631 }
632 }
633 }
634 else
635 pixelType = 8;
636 }
637
638
640
641
642 switch(pixelType) {
643 case 0:
645 break;
646 case 1:
648 break;
649 case 2:
651 break;
652 case 3:
653 type =
"Long-Ganged";
654 break;
655 case 5:
656 type =
"Long-InterGanged";
657 break;
658 case 6:
659 type =
"InterGanged";
660 break;
661 case 8:
662 default:
664 break;
665 }
666
667 double thiscut =
cut;
672
673 if( type != "Invalid" ){
674 double occupancy = 0;
676 occupancy =
static_cast<double>(
m_hitMaps[modHash]->GetBinContent(pixel_eta+1, pixel_phi+1)) /
678
679 if( occupancy < minOccupancy ) occupancy = minOccupancy;
680 globalOccupancy->Fill(log10(occupancy));
681 h_occupancy[
comp]->Fill(log10(occupancy));
682 h_occupancy[
type]->Fill(log10(occupancy));
683
684 if( occupancy > thiscut ) {
685 thisModuleCut++;
686
689 if (comp == "IBL") {
692 }
694 }
695 } else {
696 if(bec == 0) nhitsNoNoisePlot->Fill(modEta, modPhi,
m_hitMaps[modHash]->GetBinContent(pixel_eta+1, pixel_phi+1));
697 }
698 }
699 }
700 }
701
702 if ( thisModuleCut > 0 ) {
703 totalDisabledPixels+=thisModuleCut;
704 maskedPlot->Fill( static_cast<double>(thisModuleCut) );
705 modulesWithDisabledPixels++;
706
707 if(bec == 0) {
708 if(layer == 0) { disablePlotBI->Fill(modEta, modPhi, thisModuleCut); }
709 else if(layer == 1) { disablePlotB0->Fill(modEta, modPhi, thisModuleCut); }
710 else if(layer == 2) { disablePlotB1->Fill(modEta, modPhi, thisModuleCut); }
711 else if(layer == 3) { disablePlotB2->Fill(modEta, modPhi, thisModuleCut); }
712 }
713 else if(bec == 2) { disablePlotEC->Fill(layer+1, modPhi, thisModuleCut); }
714 else if(bec == -2) { disablePlotEC->Fill(-(layer+1), modPhi, thisModuleCut); }
715 }
716 }
717
718 ATH_MSG_INFO(
"Modules disabled = " << totalDisabledModules);
719 ATH_MSG_INFO(
"Modules with hits = " << modulesWithHits);
720 ATH_MSG_INFO(
"Modules with disabled pixels = " << modulesWithDisabledPixels);
721 ATH_MSG_INFO(
"Total disabled pixels = " << totalDisabledPixels);
722
723 return StatusCode::SUCCESS;
724
725}
TGraphErrors * GetEntries(TH2F *histo)
constexpr int pow(int base, int exp) noexcept
std::vector< TH2C * > m_noiseMaps
std::vector< Identifier >::const_iterator const_id_iterator
cut
This script demonstrates how to call a C++ class from Python Also how to use PyROOT is shown.
TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)