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