fillCaloDimensionsMap fills a map of calorimeter dimensions for each sampling layer.
The map contains minR, maxR, minZ, maxZ and halfLengthZ for each sampling layer.
241 {
242
243
244 double minR = 99999999999999;
245 double maxR = 0.0;
246 double minZ = 99999999999999;
247 double maxZ = -99999999999999;
248
249
250 auto checkMinR = [&minR](
const CaloDetDescrElement* theDDE){
double r = theDDE->r();
if (
r < minR) minR =
r;};
251 auto checkMaxR = [&maxR](
const CaloDetDescrElement* theDDE){
double r = theDDE->r();
if (
r > maxR) maxR =
r;};
252 auto checkMinMaxZ = [&minZ,&maxZ](
const CaloDetDescrElement* theDDE){
double z = theDDE->z();
if (
z > maxZ) maxZ =
z;
if (
z < minZ) minZ =
z;};
253 auto calcHalfLengthZ = [&minZ, &maxZ](){return (maxZ - minZ) / 2.0;};
254
255
256 auto getMinRMaxRHalfLengthZ = [&minR, &maxR, &minZ, &maxZ, &caloSampleDDEElementsMap, &checkMinR, &checkMaxR, &checkMinMaxZ, &calcHalfLengthZ](
CaloCell_ID::CaloSample currentSample) {
257
258 minR = 99999999999999;
259 maxR = 0.0;
260 minZ = 99999999999999;
261 maxZ = -99999999999999;
262
263 for (const CaloDetDescrElement* theDDE : caloSampleDDEElementsMap[currentSample]) {
264 checkMinR(theDDE);
265 checkMaxR(theDDE);
266 checkMinMaxZ(theDDE);
267 }
268
269 return calcHalfLengthZ();
270 };
271
272
273 for (const CaloDetDescrElement* theDDE : caloSampleDDEElementsMap[CaloCell_ID::PreSamplerB]) checkMinR(theDDE);
274
275
276 std::vector<const CaloDetDescrElement*> DDE_TileBar2 = caloSampleDDEElementsMap[CaloCell_ID::TileBar2];
277 std::vector<const CaloDetDescrElement*> DDE_TileGap2 = caloSampleDDEElementsMap[CaloCell_ID::TileGap2];
278 std::vector<const CaloDetDescrElement*> DDE_TileExt2 = caloSampleDDEElementsMap[CaloCell_ID::TileExt2];
279
280 for (auto currentSample : {CaloCell_ID::TileBar2, CaloCell_ID::TileGap2, CaloCell_ID::TileExt2}) {
281 for (const CaloDetDescrElement* theDDE : caloSampleDDEElementsMap[currentSample]) checkMaxR(theDDE);
282 }
283
285 ATH_MSG_DEBUG(
"Max R in TileBar2, TileGap2 and TileExt2 is " << maxR);
286
287 caloDimensionsMap["CaloMinR"] = minR;
288 caloDimensionsMap["CaloMaxR"] = maxR;
289
290
291 for (auto currentSample : {CaloCell_ID::PreSamplerB, CaloCell_ID::EMB1, CaloCell_ID::EMB2, CaloCell_ID::EMB3, CaloCell_ID::TileBar0, CaloCell_ID::TileBar1, CaloCell_ID::TileBar2, CaloCell_ID::TileGap1, CaloCell_ID::TileGap2, CaloCell_ID::TileExt0, CaloCell_ID::TileExt1, CaloCell_ID::TileExt2}) {
292 for (const CaloDetDescrElement* theDDE : caloSampleDDEElementsMap[currentSample]) checkMinMaxZ(theDDE);
293 }
294
295 caloDimensionsMap["CaloMinZ"] = minZ;
296 caloDimensionsMap["CaloMaxZ"] = maxZ;
297
298 double halfLengthZ = calcHalfLengthZ();
299 ATH_MSG_DEBUG(
"Half length in Z for entire barrel is " << halfLengthZ);
300 caloDimensionsMap["CaloHalfLengthZ"] = halfLengthZ;
301
302 auto putMinRMaxRHalfLengthZInMap = [&caloDimensionsMap,&minR,&maxR,&halfLengthZ](const std::string& sampleString){
303
304
305 float smallOffset = 0.1;
306 if (std::fabs((maxR - minR)) < smallOffset) maxR = minR + smallOffset;
307 caloDimensionsMap[sampleString + "MinR"] = minR;
308 caloDimensionsMap[sampleString + "MaxR"] = maxR;
309 caloDimensionsMap[sampleString + "HalfLengthZ"] = halfLengthZ;
310 };
311
312 halfLengthZ = getMinRMaxRHalfLengthZ(CaloCell_ID::PreSamplerB);
313 putMinRMaxRHalfLengthZInMap("PreSamplerB");
314 halfLengthZ = getMinRMaxRHalfLengthZ(CaloCell_ID::EMB1);
315 putMinRMaxRHalfLengthZInMap("EMB1");
316 halfLengthZ = getMinRMaxRHalfLengthZ(CaloCell_ID::EMB2);
317 putMinRMaxRHalfLengthZInMap("EMB2");
318 halfLengthZ = getMinRMaxRHalfLengthZ(CaloCell_ID::EMB3);
319 putMinRMaxRHalfLengthZInMap("EMB3");
320 halfLengthZ = getMinRMaxRHalfLengthZ(CaloCell_ID::TileBar0);
321 putMinRMaxRHalfLengthZInMap("TileBar0");
322 halfLengthZ = getMinRMaxRHalfLengthZ(CaloCell_ID::TileBar1);
323 putMinRMaxRHalfLengthZInMap("TileBar1");
324 halfLengthZ = getMinRMaxRHalfLengthZ(CaloCell_ID::TileBar2);
325 putMinRMaxRHalfLengthZInMap("TileBar2");
326 halfLengthZ = getMinRMaxRHalfLengthZ(CaloCell_ID::TileGap1);
327
328}
CaloSampling::CaloSample CaloSample