10 #include "GaudiKernel/ITHistSvc.h"
31 return std::string(
"Error!");
40 return std::string(
"Error!");
44 std::ostringstream
out;
50 case +2:
out <<
"Disk" <<
layer+1 <<
"A";
break;
51 case -2:
out <<
"Disk" <<
layer+1 <<
"C";
break;
52 case +4:
out <<
"DBM" <<
layer+1 <<
"A";
break;
53 case -4:
out <<
"DBM" <<
layer+1 <<
"C";
break;
60 std::stringstream
ss(
str);
62 while (std::getline(
ss,
item, delim)) {
63 elems.push_back(
item);
69 std::vector<std::string> elems;
86 if (!
sc.isSuccess()) {
88 return StatusCode::FAILURE;
92 if (!
sc.isSuccess()) {
94 return StatusCode::FAILURE;
99 if (!
sc.isSuccess()) {
101 return StatusCode::FAILURE;
122 const std::string mapFile =
"PixelMapping_Run2.dat";
126 for (
const auto&
x :
paths) {
127 std::ifstream
infile((
x+
"/"+mapFile).c_str());
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) {
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;
186 if (abs(
bec) == 4)
continue;
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;
234 axisTitle =
";LB;# hits/pixel/event";
236 name <<
"/histfile/" << LBCategory <<
"/" << occLBDir <<
"/" <<
histoSuffix(
bec,
layer) <<
"/" << onlineID <<
"_" << chipId+1;
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;
248 axisTitle =
";pixel_eta;pixel_phi;# hits/pixel/event";
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);
260 axisTitle =
";LB;# hits/pixel/event";
266 axisTitle =
";ToT;# hits";
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);
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;
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);
301 axisTitle =
";ToT;# hits";
302 m_TOTdistributionsIBL2dLB[ibl2dHash] = std::make_unique<TH1F>(histTitle.c_str(), (histTitle+axisTitle).c_str(), 19, -0.5, 18.5);
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);
317 axisTitle =
";ToT;# hits";
318 m_TOTdistributionsIBL2dLB[ibl2dHash] = std::make_unique<TH1F>(onlineID.c_str(), (onlineID+axisTitle).c_str(), 19, -0.5, 18.5);
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;
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;
448 if (abs(
bec) == 4)
continue;
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;
517 axisTitle =
";LB;# hits/pixel/event";
518 name <<
"/histfile/" << LBCategory <<
"/" << occLBDir <<
"/" <<
histoSuffix(
bec,
layer) <<
"/" << onlineID <<
"_" << chipId+1;
523 axisTitle =
";ToT;# hits";
524 name <<
"/histfile/" << LBCategory <<
"/" << totDir <<
"/" <<
histoSuffix(
bec,
layer) <<
"/" << onlineID <<
"_" << chipId+1;
531 axisTitle =
";pixel_eta;pixel_phi;# hits/pixel/event";
537 axisTitle =
";LB;# hits/pixel/event";
543 axisTitle =
";ToT;# hits";
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;
564 std::string histTitle = onlineID +
"_" +
std::to_string(chipId+1);
566 axisTitle =
";pixel_eta;pixel_phi;# hits/pixel/event";
572 axisTitle =
";ToT;# hits";
581 axisTitle =
";pixel_eta;pixel_phi;# hits/pixel/event";
587 axisTitle =
";ToT;# hits";
596 return StatusCode::SUCCESS;