122 const std::string mapFile =
"PixelMapping_Run2.dat";
124 std::vector<std::string> paths =
splitter(std::getenv(
"DATAPATH"),
':');
126 for (
const auto&
x : paths) {
127 std::ifstream infile((
x+
"/"+mapFile).c_str());
128 if (infile.is_open()) {
129 ATH_MSG_INFO(
"Mapping file '" << mapFile <<
"' found in " <<
x);
131 int tmp_barrel_ec;
int tmp_layer;
int tmp_modPhi;
int tmp_module_eta; std::string tmp_module_name;
132 std::vector<int> tmp_position;
133 tmp_position.resize(4);
134 while(infile >> tmp_barrel_ec >> tmp_layer >> tmp_modPhi >> tmp_module_eta >> tmp_module_name) {
135 tmp_position[0] = tmp_barrel_ec;
136 tmp_position[1] = tmp_layer;
137 tmp_position[2] = tmp_modPhi;
138 tmp_position[3] = tmp_module_eta;
139 m_pixelMapping.push_back(std::make_pair(tmp_module_name, tmp_position));
149 ATH_MSG_FATAL(
"Mapping file '" << mapFile <<
"' not found in DATAPATH !!!");
150 return StatusCode::FAILURE;
154 m_nEventsHist = std::make_unique<TH1F>(
"NEvents",
"NEvents;;# events", 1, 0, 1);
159 std::vector<std::pair<int, int>> temp_bec_layer{std::make_pair(2, 3), std::make_pair(-2, 3), std::make_pair(0, 4)};
160 std::vector<std::string> temp_dir{
"Occupancy2d",
"OccupancyLb",
"ToT"};
161 for (
auto const& bl : temp_bec_layer) {
162 for (
int l=0; l<bl.second; l++) {
163 for (
auto const& d: temp_dir) {
164 std::string temp_str =
"/histfile/All/" + d +
"/" +
histoSuffix(bl.first, l) +
"/" + d +
histoSuffix(bl.first, l);
165 std::unique_ptr<TH1F>temp_h1d = std::make_unique<TH1F>((d+
histoSuffix(bl.first, l)).c_str(), (d+
histoSuffix(bl.first, l)).c_str(), 1, 0, 1);
174 if (!element)
continue;
177 if (!
m_pixelID->is_pixel(ident))
continue;
180 int layer =
m_pixelID->layer_disk(ident);
181 int modPhi =
m_pixelID->phi_module(ident);
182 int modEta =
m_pixelID->eta_module(ident);
183 int modHash =
m_pixelID->wafer_hash(ident);
184 const Identifier::size_type maxHash =
m_pixelID->wafer_hash_max();
186 if (abs(bec) == 4)
continue;
194 if (bec == 0 && layer == 0) {
195 if (modEta <= -7) iblFeHash = modPhi*32 + (modEta+10);
196 else if (-6<=modEta && modEta<=5) iblFeHash = modPhi*32 + ((modEta+6)*2+4);
197 else iblFeHash = modPhi*32 + (modEta+22);
203 std::ostringstream name;
204 std::string axisTitle;
207 std::string LBCategory;
208 std::string occ2dDir =
"Occupancy2d";
209 std::string occLBDir =
"OccupancyLb";
210 std::string totDir =
"ToT";
214 if (bec == 0 && layer == 0 && -6 <= modEta && modEta <= 5) {
215 for (
unsigned chipId=0; chipId<=1; chipId++) {
218 if (modEta <= -1) ibl2dHash = maxHash + iblFeHash;
219 else ibl2dHash = maxHash + iblFeHash + chipId;
222 if (modEta <= -1) ibl2dHash = maxHash + iblFeHash + 1;
223 else ibl2dHash = maxHash + iblFeHash;
225 std::string histTitle = onlineID +
"_" + std::to_string(chipId+1);
227 axisTitle =
";pixel_eta;pixel_phi;# hits/pixel/event";
228 m_occupancyMaps[ibl2dHash] = std::make_unique<TH2F>(histTitle.c_str(), (histTitle+axisTitle).c_str(), 80, -0.5, 79.5, 336, -0.5, 335.5);
229 name <<
"/histfile/" << LBCategory <<
"/" << occ2dDir <<
"/" <<
histoSuffix(bec,layer) <<
"/" << onlineID <<
"_" << chipId+1;
230 name.str(
""); name.clear();
234 axisTitle =
";LB;# hits/pixel/event";
236 name <<
"/histfile/" << LBCategory <<
"/" << occLBDir <<
"/" <<
histoSuffix(bec,layer) <<
"/" << onlineID <<
"_" << chipId+1;
237 name.str(
""); name.clear();
240 axisTitle =
";ToT;# hits";
241 m_TOTdistributions[ibl2dHash] = std::make_unique<TH1F>(histTitle.c_str(), (histTitle+axisTitle).c_str(), 19, -0.5, 18.5);
242 name <<
"/histfile/" << LBCategory <<
"/" << totDir <<
"/" <<
histoSuffix(bec,layer) <<
"/" << onlineID <<
"_" << chipId+1;
243 name.str(
""); name.clear();
248 axisTitle =
";pixel_eta;pixel_phi;# hits/pixel/event";
249 if (bec == 0 && layer == 0) {
250 m_occupancyMaps[modHash] = std::make_unique<TH2F>(onlineID.c_str(), (onlineID+axisTitle).c_str(), 80, -0.5, 79.5, 336, -0.5, 335.5);
253 m_occupancyMaps[modHash] = std::make_unique<TH2F>(onlineID.c_str(), (onlineID+axisTitle).c_str(), 144, -0.5, 143.5, 328, -0.5, 327.5);
255 name <<
"/histfile/" << LBCategory <<
"/" << occ2dDir <<
"/" <<
histoSuffix(bec,layer) <<
"/" << onlineID;
256 name.str(
""); name.clear();
260 axisTitle =
";LB;# hits/pixel/event";
262 name <<
"/histfile/" << LBCategory <<
"/" << occLBDir <<
"/" <<
histoSuffix(bec,layer) <<
"/" << onlineID;
263 name.str(
""); name.clear();
266 axisTitle =
";ToT;# hits";
267 if (bec == 0 && layer == 0) {
268 m_TOTdistributions[modHash] = std::make_unique<TH1F>(onlineID.c_str(), (onlineID+axisTitle).c_str(), 19, -0.5, 18.5);
271 m_TOTdistributions[modHash] = std::make_unique<TH1F>(onlineID.c_str(), (onlineID+axisTitle).c_str(), 256, -0.5, 255.5);
273 name <<
"/histfile/" << LBCategory <<
"/" << totDir <<
"/" <<
histoSuffix(bec,layer) <<
"/" << onlineID;
274 name.str(
""); name.clear();
278 if (0 <= iblFeHash) {
281 if (-6 <= modEta && modEta <= 5) {
282 for (
int chipId=0; chipId<=1; chipId++) {
285 if (modEta <= -1) ibl2dHash =
m_nIblFes*i + iblFeHash;
286 else ibl2dHash =
m_nIblFes*i + iblFeHash + chipId;
289 if (modEta <= -1) ibl2dHash =
m_nIblFes*i + iblFeHash + 1;
290 else ibl2dHash =
m_nIblFes*i + iblFeHash;
292 std::string histTitle = onlineID +
"_" + std::to_string(chipId+1);
294 axisTitle =
";pixel_eta;pixel_phi;# hits/pixel/event";
295 m_occupancyMapsIBL2dLB[ibl2dHash] = std::make_unique<TH2F>(histTitle.c_str(), (histTitle+axisTitle).c_str(), 80, -0.5, 79.5, 336, -0.5, 335.5);
296 name <<
"/histfile/" << LBCategory <<
"/" << occ2dDir <<
"/" <<
histoSuffix(bec,layer) <<
"/" << histTitle;
297 name.str(
""); name.clear();
301 axisTitle =
";ToT;# hits";
302 m_TOTdistributionsIBL2dLB[ibl2dHash] = std::make_unique<TH1F>(histTitle.c_str(), (histTitle+axisTitle).c_str(), 19, -0.5, 18.5);
303 name <<
"/histfile/" << LBCategory <<
"/" << totDir <<
"/" <<
histoSuffix(bec,layer) <<
"/" << histTitle;
304 name.str(
""); name.clear();
310 axisTitle =
";pixel_eta;pixel_phi;# hits/pixel/event";
311 m_occupancyMapsIBL2dLB[ibl2dHash] = std::make_unique<TH2F>(onlineID.c_str(), (onlineID+axisTitle).c_str(), 80, -0.5, 79.5, 336, -0.5, 335.5);
312 name <<
"/histfile/" << LBCategory <<
"/" << occ2dDir <<
"/" <<
histoSuffix(bec,layer) <<
"/" << onlineID;
313 name.str(
""); name.clear();
317 axisTitle =
";ToT;# hits";
318 m_TOTdistributionsIBL2dLB[ibl2dHash] = std::make_unique<TH1F>(onlineID.c_str(), (onlineID+axisTitle).c_str(), 19, -0.5, 18.5);
319 name <<
"/histfile/" << LBCategory <<
"/" << totDir <<
"/" <<
histoSuffix(bec,layer) <<
"/" << onlineID;
320 name.str(
""); name.clear();
326 return StatusCode::SUCCESS;
337 const EventContext& ctx = Gaudi::Hive::currentContext();
340 int LB =
static_cast<int>(ctx.eventID().lumi_block());
343 return StatusCode::SUCCESS;
353 for (
const auto pPixelRDOCollection: *pixelRDOs) {
354 if (pPixelRDOCollection) {
355 Identifier moduleID = pPixelRDOCollection->identify();
357 ATH_MSG_VERBOSE(
"moduleID, modHash = " << moduleID <<
" , " << modHash);
363 if (std::abs(bec) == 4)
continue;
365 unsigned int pixel_eta =
m_pixelID->eta_index(rdoID);
366 unsigned int pixel_phi =
m_pixelID->phi_index(rdoID);
367 int layer =
m_pixelID->layer_disk(rdoID);
368 int modPhi =
m_pixelID->phi_module(rdoID);
369 int modEta =
m_pixelID->eta_module(rdoID);
370 const Identifier::size_type maxHash =
m_pixelID->wafer_hash_max();
375 if (bec==0 && layer==0) {
376 if (modEta <= -7) iblFeHash = modPhi*32 + (modEta+10);
377 else if (-6<=modEta && modEta<=5) iblFeHash = modPhi*32 + ((modEta+6)*2+4);
378 else iblFeHash = modPhi*32 + (modEta+22);
379 if (pixel_eta/80) iblFeHash++;
382 int TOT = (*rdo)->getToT();
385 if (bec == 0 && layer == 0 && -6 <= modEta && modEta <= 5) {
386 int ibl2dHash = maxHash + iblFeHash;
398 if (0 <= iblFeHash) {
417 return StatusCode::SUCCESS;
436 if (element == 0)
continue;
439 if (!
m_pixelID->is_pixel(ident))
continue;
442 int layer =
m_pixelID->layer_disk(ident);
443 int modPhi =
m_pixelID->phi_module(ident);
444 int modEta =
m_pixelID->eta_module(ident);
445 int modHash =
m_pixelID->wafer_hash(ident);
446 const Identifier::size_type maxHash =
m_pixelID->wafer_hash_max();
448 if (abs(bec) == 4)
continue;
451 if (bec==0 && layer==0) {
452 if (modEta <= -7) iblFeHash = modPhi*32 + (modEta+10);
453 else if (-6<=modEta && modEta<=5) iblFeHash = modPhi*32 + ((modEta+6)*2+4);
454 else iblFeHash = modPhi*32 + (modEta+22);
459 if (bec == 0 && layer == 0 && -6 <= modEta && modEta <= 5) {
460 int ibl2dHash = maxHash + iblFeHash;
461 for (
int chipId=0; chipId<2; chipId++) {
488 std::ostringstream name;
489 std::string axisTitle;
492 std::string LBCategory;
493 std::string occ2dDir =
"Occupancy2d";
494 std::string occLBDir =
"OccupancyLb";
495 std::string totDir =
"ToT";
499 if (bec == 0 && layer == 0 && -6 <= modEta && modEta <= 5) {
500 for (
unsigned chipId=0; chipId<=1; chipId++) {
503 if (modEta <= -1) ibl2dHash = maxHash + iblFeHash;
504 else ibl2dHash = maxHash + iblFeHash + chipId;
507 if (modEta <= -1) ibl2dHash = maxHash + iblFeHash + 1;
508 else ibl2dHash = maxHash + iblFeHash;
511 axisTitle =
";pixel_eta;pixel_phi;# hits/pixel/event";
512 name <<
"/histfile/" << LBCategory <<
"/" << occ2dDir <<
"/" <<
histoSuffix(bec,layer) <<
"/" << onlineID <<
"_" << chipId+1;
514 name.str(
""); name.clear();
517 axisTitle =
";LB;# hits/pixel/event";
518 name <<
"/histfile/" << LBCategory <<
"/" << occLBDir <<
"/" <<
histoSuffix(bec,layer) <<
"/" << onlineID <<
"_" << chipId+1;
520 name.str(
""); name.clear();
523 axisTitle =
";ToT;# hits";
524 name <<
"/histfile/" << LBCategory <<
"/" << totDir <<
"/" <<
histoSuffix(bec,layer) <<
"/" << onlineID <<
"_" << chipId+1;
526 name.str(
""); name.clear();
531 axisTitle =
";pixel_eta;pixel_phi;# hits/pixel/event";
532 name <<
"/histfile/" << LBCategory <<
"/" << occ2dDir <<
"/" <<
histoSuffix(bec,layer) <<
"/" << onlineID;
534 name.str(
""); name.clear();
537 axisTitle =
";LB;# hits/pixel/event";
538 name <<
"/histfile/" << LBCategory <<
"/" << occLBDir <<
"/" <<
histoSuffix(bec,layer) <<
"/" << onlineID;
540 name.str(
""); name.clear();
543 axisTitle =
";ToT;# hits";
544 name <<
"/histfile/" << LBCategory <<
"/" << totDir <<
"/" <<
histoSuffix(bec,layer) <<
"/" << onlineID;
546 name.str(
""); name.clear();
550 if (0 <= iblFeHash) {
553 if (-6 <= modEta && modEta <= 5) {
554 for (
int chipId=0; chipId<=1; chipId++) {
557 if (modEta <= -1) ibl2dHash =
m_nIblFes*i + iblFeHash;
558 else ibl2dHash =
m_nIblFes*i + iblFeHash + chipId;
561 if (modEta <= -1) ibl2dHash =
m_nIblFes*i + iblFeHash + 1;
562 else ibl2dHash =
m_nIblFes*i + iblFeHash;
564 std::string histTitle = onlineID +
"_" + std::to_string(chipId+1);
566 axisTitle =
";pixel_eta;pixel_phi;# hits/pixel/event";
567 name <<
"/histfile/" << LBCategory <<
"/" << occ2dDir <<
"/" <<
histoSuffix(bec,layer) <<
"/" << histTitle;
569 name.str(
""); name.clear();
572 axisTitle =
";ToT;# hits";
573 name <<
"/histfile/" << LBCategory <<
"/" << totDir <<
"/" <<
histoSuffix(bec,layer) <<
"/" << histTitle;
575 name.str(
""); name.clear();
581 axisTitle =
";pixel_eta;pixel_phi;# hits/pixel/event";
582 name <<
"/histfile/" << LBCategory <<
"/" << occ2dDir <<
"/" <<
histoSuffix(bec,layer) <<
"/" << onlineID;
584 name.str(
""); name.clear();
587 axisTitle =
";ToT;# hits";
588 name <<
"/histfile/" << LBCategory <<
"/" << totDir <<
"/" <<
histoSuffix(bec,layer) <<
"/" << onlineID;
590 name.str(
""); name.clear();
596 return StatusCode::SUCCESS;