10 #include "GaudiKernel/ITHistSvc.h"
35 m_tHistSvc(
"THistSvc",
name),
37 m_pixelRDOKey(
"PixelRDOs"),
39 m_nEventsHist(nullptr),
40 m_nEventsLBHist(nullptr),
41 m_disabledModules(nullptr),
42 m_overlayedPixelNoiseMap(nullptr),
43 m_overlayedIBLDCNoiseMap(nullptr),
44 m_overlayedIBLSCNoiseMap(nullptr),
57 m_longPixelMultiplier(1.5),
58 m_gangedPixelMultiplier(2.),
59 m_occupancyPerBC(true),
63 m_calculateNoiseMaps(false),
64 m_mapFile(
"PixelMapping_Run2.dat")
115 return std::string(
"Error!");
124 return std::string(
"Error!");
128 std::ostringstream
out;
134 else if(
layer==1) {
out <<
"B-layer"; }
137 case +2:
out <<
"endcapA/Disk" <<
layer+1;
break;
138 case -2:
out <<
"endcapC/Disk" <<
layer+1;
break;
139 case +4:
out <<
"DBMA/Layer" <<
layer+1;
break;
140 case -4:
out <<
"DBMC/Layer" <<
layer+1;
break;
148 std::vector<std::string> &elems) {
149 std::stringstream
ss(
str);
151 while (std::getline(
ss,
item, delim)) {
152 elems.push_back(
item);
159 std::vector<std::string> elems;
167 const unsigned int maxPathStringLength{3000};
168 if((not getenvPath) or (strlen(getenvPath) > maxPathStringLength) ){
169 ATH_MSG_FATAL(
"Unable to retrieve environmental DATAPATH" );
170 return StatusCode::FAILURE;
172 std::stringstream tmpSstr{};
174 std::string tmppath(tmpSstr.str());
178 for(
const auto&
x :
paths){
183 int tmp_barrel_ec;
int tmp_layer;
int tmp_modPhi;
int tmp_module_eta; std::string tmp_module_name;
184 std::vector<int> tmp_position;
185 tmp_position.resize(4);
186 while(
infile >> tmp_barrel_ec >> tmp_layer >> tmp_modPhi >> tmp_module_eta >> tmp_module_name) {
187 tmp_position[0] = tmp_barrel_ec;
188 tmp_position[1] = tmp_layer;
189 tmp_position[2] = tmp_modPhi;
190 tmp_position[3] = tmp_module_eta;
191 m_pixelMapping.push_back(std::make_pair(tmp_module_name, tmp_position));
202 return StatusCode::FAILURE;
225 std::string onlineID =
228 std::ostringstream
name;
232 m_hitMaps[modHash] =
new TH2D(onlineID.c_str(), onlineID.c_str(), 160, 0, 160, 336, 0, 336);
233 else if( abs(
bec) == 4 )
234 m_hitMaps[modHash] =
new TH2D(onlineID.c_str(), onlineID.c_str(), 80, 0, 80, 336, 0, 336);
236 m_hitMaps[modHash] =
new TH2D(onlineID.c_str(), onlineID.c_str(), 144, 0, 144, 328, 0, 328);
249 m_BCIDdependence[modHash] =
new TH1D(onlineID.c_str(), onlineID.c_str(), 301, -0.5, 300.5);
256 m_TOTdistributions[modHash] =
new TH1D(onlineID.c_str(), onlineID.c_str(), 19, -0.5, 18.5);
258 m_TOTdistributions[modHash] =
new TH1D(onlineID.c_str(), onlineID.c_str(), 256, -0.5, 255.5);
266 m_noiseMaps[modHash] =
new TH2C(onlineID.c_str(), onlineID.c_str(), 160, 0, 160, 336, 0, 336);
267 else if( abs(
bec) == 4 )
268 m_noiseMaps[modHash] =
new TH2C(onlineID.c_str(), onlineID.c_str(), 80, 0, 80, 336, 0, 336);
270 m_noiseMaps[modHash] =
new TH2C(onlineID.c_str(), onlineID.c_str(), 144, 0, 144, 328, 0, 328);
277 m_disabledModules =
new TH1D(
"DisabledModules",
"Number of events disabled vs. IdentifierHash", 2048, 0, 2048);
281 m_overlayedPixelNoiseMap =
new TH2D(
"overlayedPixelNoiseMap",
"Noisy pixel map overlayed all Pixel modules", 144, 0, 144, 328, 0, 328);
284 m_overlayedIBLDCNoiseMap =
new TH2D(
"overlayedIBLDCNoiseMap",
"Noisy pixel map overlayed all IBL Planar modules", 160, 0, 160, 336, 0, 336);
287 m_overlayedIBLSCNoiseMap =
new TH2D(
"overlayedIBLSCNoiseMap",
"Noisy pixel map overlayed all IBL 3D modules", 80, 0, 80, 336, 0, 336);
291 return StatusCode::SUCCESS;
302 const EventContext& ctx = Gaudi::Hive::currentContext();
305 unsigned int LB = ctx.eventID().lumi_block();
309 return StatusCode::SUCCESS;
315 if( !
sc.isSuccess() ){
317 return StatusCode::FAILURE;
322 coll!=pixelRDOs->
end(); ++coll){
325 if(PixelRDOCollection != 0){
328 ATH_MSG_VERBOSE(
"moduleID, modHash = " << moduleID <<
" , " << modHash);
332 ATH_MSG_VERBOSE(
"Module excluded as reported not good by PixelConditionsSummaryTool");
343 rdo!=PixelRDOCollection->
end(); ++rdo){
348 int TOT = (*rdo)->getToT();
349 int BCID = (*rdo)->getBCID();
351 m_hitMaps[modHash]->Fill(pixel_eta, pixel_phi);
371 return StatusCode::SUCCESS;
386 const int minLogOccupancy = 8;
387 const double minOccupancy =
pow(10.,-minLogOccupancy);
389 TH1D* globalOccupancy=
new TH1D(
"occupancy",
"Pixel occupancy", minLogOccupancy*10, -minLogOccupancy, 0.);
390 m_tHistSvc->regHist(
"/histfile/occupancy",globalOccupancy).ignore();
392 std::map<std::string, TH1D*> h_occupancy;
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");
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();
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();
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();
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();
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();
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();
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();
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();
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();
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();
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();
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();
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();
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();
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();
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();
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();
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();
510 TH1D* maskedPlot=
new TH1D(
"maskedPlot",
"Disabled pixel per module",50,0.5,50.5);
511 m_tHistSvc->regHist(
"/histfile/maskedPlot",maskedPlot).ignore();
513 int totalDisabledPixels=0;
514 int totalDisabledModules=0;
515 int modulesWithHits=0;
516 int modulesWithDisabledPixels=0;
518 const EventContext& ctx{Gaudi::Hive::currentContext()};
531 TH2F* nhitsNoNoisePlot=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); }
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); }
568 totalDisabledModules++;
586 int thisModuleCut = 0;
587 bool isIBL3D = (
bec==0 &&
layer==0 && (modEta <= -7 || modEta >= 6) ) ? true :
false;
589 for(
int pixel_eta=0; pixel_eta<=eta_max; pixel_eta++){
590 for(
int pixel_phi=0; pixel_phi<=phi_max; pixel_phi++){
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;
599 if( !isIBL3D && (pixel_eta_on_chip == 0 || pixel_eta_on_chip == 80 - 1) ){
606 if(pixel_eta_on_chip > 0 && pixel_eta_on_chip < 18 - 1){
608 for(
int kk = 0;
kk < 3;
kk++){
611 if(pixel_phi_on_chip == (153 + 2 *
kk + 1)){
615 if(pixel_phi_on_chip == (153 + 2 *
kk) || pixel_phi_on_chip >= 159){
621 else if(pixel_eta_on_chip == 0 || pixel_eta_on_chip == 18 - 1){
623 for(
int kk = 0;
kk < 3;
kk++){
624 if(pixel_phi_on_chip == (153 + 2 *
kk + 1)){
628 if(pixel_phi_on_chip == (153 + 2 *
kk) || pixel_phi_on_chip >= 159){
653 type =
"Long-Ganged";
656 type =
"Long-InterGanged";
659 type =
"InterGanged";
667 double thiscut =
cut;
673 if(
type !=
"Invalid" ){
674 double occupancy = 0;
676 occupancy =
static_cast<double>(
m_hitMaps[modHash]->GetBinContent(pixel_eta+1, pixel_phi+1)) /
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));
684 if( occupancy > thiscut ) {
696 if(
bec == 0) nhitsNoNoisePlot->Fill(modEta, modPhi,
m_hitMaps[modHash]->GetBinContent(pixel_eta+1, pixel_phi+1));
702 if ( thisModuleCut > 0 ) {
703 totalDisabledPixels+=thisModuleCut;
704 maskedPlot->Fill(
static_cast<double>(thisModuleCut) );
705 modulesWithDisabledPixels++;
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); }
713 else if(
bec == 2) { disablePlotEC->Fill(
layer+1, modPhi, thisModuleCut); }
714 else if(
bec == -2) { disablePlotEC->Fill(-(
layer+1), modPhi, thisModuleCut); }
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);
723 return StatusCode::SUCCESS;