121 {
122 const std::string mapFile = "PixelMapping_Run2.dat";
123
124 std::vector<std::string>
paths =
splitter(std::getenv(
"DATAPATH"),
':');
126 for (
const auto&
x : paths) {
127 std::ifstream
infile((
x+
"/"+mapFile).c_str());
129 ATH_MSG_INFO(
"Mapping file '" << mapFile <<
"' found in " <<
x);
130
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));
140 }
141
144 break;
145 }
146 }
147
148 if (!found) {
149 ATH_MSG_FATAL(
"Mapping file '" << mapFile <<
"' not found in DATAPATH !!!");
150 return StatusCode::FAILURE;
151 }
152
153
154 m_nEventsHist = std::make_unique<TH1F>(
"NEvents",
"NEvents;;# events", 1, 0, 1);
156
157
158
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);
168 }
169 }
170 }
171
173 const InDetDD::SiDetectorElement* element = *
iter;
174 if (!element) continue;
175
177 if (!
m_pixelID->is_pixel(ident))
continue;
178
181 int modPhi =
m_pixelID->phi_module(ident);
182 int modEta =
m_pixelID->eta_module(ident);
183 int modHash =
m_pixelID->wafer_hash(ident);
185
186 if (abs(bec) == 4) continue;
187
188 int iblFeHash = -99;
189
190
191
192
193
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);
198
199 }
200
202
203 std::ostringstream
name;
204 std::string axisTitle;
205
206
207 std::string LBCategory;
208 std::string occ2dDir = "Occupancy2d";
209 std::string occLBDir = "OccupancyLb";
210 std::string totDir = "ToT";
211
212
213 LBCategory = "All";
214 if (bec == 0 && layer == 0 && -6 <= modEta && modEta <= 5) {
215 for (unsigned chipId=0; chipId<=1; chipId++) {
216 int ibl2dHash;
217 if (chipId) {
218 if (modEta <= -1) ibl2dHash = maxHash + iblFeHash;
219 else ibl2dHash = maxHash + iblFeHash + chipId;
220 }
221 else {
222 if (modEta <= -1) ibl2dHash = maxHash + iblFeHash + 1;
223 else ibl2dHash = maxHash + iblFeHash;
224 }
225 std::string histTitle = onlineID + "_" + std::to_string(chipId+1);
226
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;
232
233
234 axisTitle = ";LB;# hits/pixel/event";
236 name <<
"/histfile/" << LBCategory <<
"/" << occLBDir <<
"/" <<
histoSuffix(bec,layer) <<
"/" << onlineID <<
"_" << chipId+1;
238
239
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;
244 }
245 }
246 else {
247
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);
251 }
252 else {
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);
254 }
255 name <<
"/histfile/" << LBCategory <<
"/" << occ2dDir <<
"/" <<
histoSuffix(bec,layer) <<
"/" << onlineID;
258
259
260 axisTitle = ";LB;# hits/pixel/event";
262 name <<
"/histfile/" << LBCategory <<
"/" << occLBDir <<
"/" <<
histoSuffix(bec,layer) <<
"/" << onlineID;
264
265
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);
269 }
270 else {
271 m_TOTdistributions[modHash] = std::make_unique<TH1F>(onlineID.c_str(), (onlineID+axisTitle).c_str(), 256, -0.5, 255.5);
272 }
273 name <<
"/histfile/" << LBCategory <<
"/" << totDir <<
"/" <<
histoSuffix(bec,layer) <<
"/" << onlineID;
275 }
276
277
278 if (0 <= iblFeHash) {
281 if (-6 <= modEta && modEta <= 5) {
282 for (int chipId=0; chipId<=1; chipId++) {
283 int ibl2dHash;
284 if (chipId) {
285 if (modEta <= -1) ibl2dHash =
m_nIblFes*
i + iblFeHash;
286 else ibl2dHash =
m_nIblFes*
i + iblFeHash + chipId;
287 }
288 else {
289 if (modEta <= -1) ibl2dHash =
m_nIblFes*
i + iblFeHash + 1;
291 }
292 std::string histTitle = onlineID + "_" + std::to_string(chipId+1);
293
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;
299
300
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;
305 }
306 }
307 else {
309
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;
315
316
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;
321 }
322 }
323 }
324 }
325
326 return StatusCode::SUCCESS;
327}
std::vector< std::string > & splitter(const std::string &str, char delim, std::vector< std::string > &elems)
l
Printing final latex table to .tex output file.