ATLAS Offline Software
Loading...
Searching...
No Matches
CaloSurfaceBuilder.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5//****************************************************************************
6// CaloSurfacaBuilder.cxx, (c) ATLAS detector software
7//****************************************************************************
8
10
11#include "Gaudi/Property.h"
12#include "GaudiKernel/Bootstrap.h"
13#include "GaudiKernel/IMessageSvc.h"
14#include "GaudiKernel/IService.h"
15#include "GaudiKernel/ISvcLocator.h"
16#include "GaudiKernel/IToolSvc.h"
17#include "GaudiKernel/MsgStream.h"
18#include "GaudiKernel/SystemOfUnits.h"
19
23
27
30
31// Amg
33
34// Calo specific stuff :
35#include "CaloDetDescr/CaloDetDescrElement.h"
41
42// Tile specific stuff :
46
52
53#include <algorithm> //for std::min, std::max
54#include <cmath>
55
57 const std::string& name,
58 const IInterface* parent)
59 : base_class(type, name, parent)
60 , m_tile_dd(nullptr)
61 , m_lar_mat("LArRecoMaterialTool")
62 , m_lar_simplegeom("LArRecoSimpleGeomTool")
63{
64 declareProperty("LArRecoMaterialTool", m_lar_mat);
65 declareProperty("LarRecoSimpleGeometryTool", m_lar_simplegeom);
66}
67
69
70StatusCode
72{
73 if (m_lar_mat.retrieve().isFailure()) {
74 ATH_MSG_FATAL("Failed to retrieve " << m_lar_mat << ". Aborting.");
75 return StatusCode::FAILURE;
76 }
77
78 if (m_lar_simplegeom.retrieve().isFailure()) {
79 ATH_MSG_FATAL("Failed to retrieve " << m_lar_simplegeom << ". Aborting.");
80 return StatusCode::FAILURE;
81 }
82
83 if (m_calodepth.retrieve().isFailure()) {
84 ATH_MSG_FATAL("Failed to retrieve " << m_calodepth << ". Aborting.");
85 return StatusCode::FAILURE;
86 }
87
88 if (detStore()->retrieve(m_tile_dd).isFailure()) {
89 ATH_MSG_FATAL("Could not find TileDetDescrManager in DetStore");
90 return StatusCode::FAILURE;
91 }
92
93 return StatusCode::SUCCESS;
94}
95
96StatusCode
98{
99 // clear surface cash
100 for (auto & layerEntry : m_layerEntries) {
101 delete layerEntry.first;
102 delete layerEntry.second;
103 }
104
105 if (!m_layerExits.empty()) {
106 delete m_layerExits[CaloCell_ID::TileBar2].first;
107 delete m_layerExits[CaloCell_ID::TileBar2].second;
108 delete m_layerExits[CaloCell_ID::TileExt2].first;
109 delete m_layerExits[CaloCell_ID::TileExt2].second;
110 delete m_layerExits[CaloCell_ID::TileGap2].first;
111 delete m_layerExits[CaloCell_ID::TileGap2].second;
112 delete m_layerExits[CaloCell_ID::TileGap3].first;
113 delete m_layerExits[CaloCell_ID::TileGap3].second;
114 delete m_layerExits[CaloCell_ID::HEC3].first;
115 delete m_layerExits[CaloCell_ID::HEC3].second;
116 }
117
118 StatusCode sc = StatusCode::SUCCESS;
119 return sc;
120}
121
124 const double offset,
125 const double etaCaloLocal,
126 const CaloDetDescrManager* calo_dd) const
127{
128
129 if (sample == CaloCell_ID::Unknown) {
130 return nullptr;
131 }
132
134 Trk::Surface* surf = nullptr;
135
136 bool result = false;
137 double rmin = 0.;
138 double z = 0.;
139 double rmax = 0.;
140 double radius = 0.;
141 double hphi = 0.;
142 double hlen = 0.;
143 double depth = 0.;
144 int side = 1;
145
146 bool tile = false;
147 if (sample == CaloCell_ID::TileBar0 || sample == CaloCell_ID::TileBar1 ||
148 sample == CaloCell_ID::TileBar2 || sample == CaloCell_ID::TileExt0 ||
149 sample == CaloCell_ID::TileExt1 || sample == CaloCell_ID::TileExt2 ||
150 sample == CaloCell_ID::TileGap1 || sample == CaloCell_ID::TileGap2 ||
151 sample == CaloCell_ID::TileGap3)
152 tile = true;
153
154 bool HEC3 = false;
155 if (sample == CaloCell_ID::HEC3)
156 HEC3 = true;
157
158 if (etaCaloLocal < 0)
159 side = -1;
160
161 // Specific hack for the testbeam : even if tracks have eta<0, ask for the
162 // positive side
163 if (calo_dd->lar_geometry() == "H8")
164 side = 1;
165
166 // too bad, I need this ugly if to decide which type of surface should be
167 // built cylinder of disk ?
168 // Note: TileGap3 is in the barrel but is a disk!!
169 bool barrel = true;
170 if (sample == CaloCell_ID::PreSamplerE || sample == CaloCell_ID::EME1 ||
171 sample == CaloCell_ID::EME2 || sample == CaloCell_ID::EME3 ||
172 sample == CaloCell_ID::HEC0 || sample == CaloCell_ID::HEC1 ||
173 sample == CaloCell_ID::HEC2 || sample == CaloCell_ID::HEC3 ||
174 sample == CaloCell_ID::FCAL0 || sample == CaloCell_ID::FCAL1 ||
175 sample == CaloCell_ID::FCAL2 || sample == CaloCell_ID::TileGap3) {
176 barrel = false;
177 }
178
179 if (barrel) {
180
181 /*To avoid the funny numbers given by the CaloDescriptors to TileBar2, (due
182 to the cell D type)
183 we'll take only the radius from them, the rest we copy from TileBar1 */
184 if (sample == CaloCell_ID::TileBar2) {
185 double radius2 = 0;
188 sample, side, pos2, radius, hphi, hlen, depth, calo_dd);
189 result = this->get_cylinder_surface(CaloCell_ID::TileBar1,
190 side,
191 pos,
192 radius2,
193 hphi,
194 hlen,
195 depth,
196 calo_dd);
197 } else {
199 sample, side, pos, radius, hphi, hlen, depth, calo_dd);
200 }
201 if (!result) {
202 return nullptr;
203 }
204
205 // this correction will only work for LAr
206 double betterrad = 0;
207 if (!tile) {
208 betterrad = m_calodepth->radius(sample, etaCaloLocal, 0., calo_dd);
209 radius = offset + betterrad;
210 }
211 if (tile)
212 hlen = hlen / 2;
213 // for Atlas configuration, avoid to create a hole at phi ~ pi by hphi
214 // rounding effects (the phi range was introduced for the testbeam)
215 if (hphi < 0.9 * M_PI) {
216 surf = new Trk::CylinderSurface(pos, radius, hphi, hlen);
217 } else {
218 surf = new Trk::CylinderSurface(pos, radius, hlen);
219 }
220 } else {
221 bool result = this->get_disk_surface(
222 sample, side, pos, z, rmin, rmax, hphi, depth, calo_dd);
223 if (!result) {
224 return nullptr;
225 }
226
227 double betterz = 0;
228
229 if (!tile && !HEC3) {
230 betterz = m_calodepth->radius(sample, etaCaloLocal, 0., calo_dd);
231 z = offset + betterz - (pos)(2, 3);
232 Amg::Translation3D vec(0., 0., z);
233 pos = (pos) * vec;
234 }
235 // for Atlas configuration, avoid to create a hole a phi ~ pi by hphi
236 // rounding effects. the phi range was introduced for the testbeam
237 if (hphi < 0.9 * M_PI) {
238 surf = new Trk::DiscSurface(pos, rmin, rmax, hphi);
239 } else {
240 surf = new Trk::DiscSurface(pos, rmin, rmax);
241 }
242 }
243
244 return surf;
245}
246
249 const double offset,
250 const double etaCaloLocal,
251 const CaloDetDescrManager* calo_dd) const
252{
253
254 Trk::Surface* surf = nullptr;
255
256 bool tile = false;
257 if (sample == CaloCell_ID::TileBar0 || sample == CaloCell_ID::TileBar1 ||
258 sample == CaloCell_ID::TileBar2 || sample == CaloCell_ID::TileExt0 ||
259 sample == CaloCell_ID::TileExt1 || sample == CaloCell_ID::TileExt2 ||
260 sample == CaloCell_ID::TileGap1 || sample == CaloCell_ID::TileGap2 ||
261 sample == CaloCell_ID::TileGap3)
262 tile = true;
263
265
266 bool result = false;
267 double rmin = 0.;
268 double z = 0.;
269 double rmax = 0.;
270 double radius = 0.;
271 double hphi = 0.;
272 double hlen = 0.;
273 double depth = 0.;
274 int side = 1;
275
276 if (etaCaloLocal < 0)
277 side = -1;
278
279 if (sample == CaloCell_ID::TileBar2 || sample == CaloCell_ID::TileExt2 ||
280 sample == CaloCell_ID::TileGap2) {
281
282 /*To avoid the funny numbers given by the CaloDescriptors to TileBar2, (due
283 to the cell D type)
284 we'll take only the radius from them, the rest we copy from TileBar1 */
285 if (sample == CaloCell_ID::TileBar2) {
286 double radius2 = 0;
289 sample, side, pos2, radius, hphi, hlen, depth, calo_dd);
290 result = this->get_cylinder_surface(CaloCell_ID::TileBar1,
291 side,
292 pos,
293 radius2,
294 hphi,
295 hlen,
296 depth,
297 calo_dd);
298 } else {
299
301 sample, side, pos, radius, hphi, hlen, depth, calo_dd);
302 }
303 if (!result) {
304 return nullptr;
305 }
306
307 // for Atlas configuration, avoid to create a hole at phi ~ pi by hphi
308 // rounding effects (the phi range was introduced for the testbeam)
309 else {
310 std::vector<TileDetDescriptor*>::const_iterator Tile_first =
311 m_tile_dd->tile_descriptors_begin();
312 TileDetDescriptor* TileBar_descr = *(Tile_first + 1);
313 TileDetDescriptor* TileExt_descr = *(Tile_first + 3);
314 TileDetDescriptor* TileGap_descr = *(Tile_first + 5);
315 if (sample == CaloCell_ID::TileBar2) {
316 radius = TileBar_descr->rcenter(2) + .5 * TileBar_descr->dr(2);
317 } else if (sample == CaloCell_ID::TileExt2) {
318 radius = TileExt_descr->rcenter(2) + .5 * TileExt_descr->dr(2);
319 } else if (sample == CaloCell_ID::TileGap2) {
320 radius = TileGap_descr->rcenter(2) + .5 * TileGap_descr->dr(2);
321 } else {
322 ATH_MSG_DEBUG("Not a considered cylinder tile");
323 }
324
325 if (tile) {
326 hlen = hlen / 2;
327 }
328
329 if (hphi < 0.9 * M_PI) {
330 return surf = new Trk::CylinderSurface(pos, radius, hphi, hlen);
331 } else {
332 return surf = new Trk::CylinderSurface(pos, radius, hlen);
333 }
334 }
335 } else if (sample == CaloCell_ID::TileGap3 || sample == CaloCell_ID::HEC3) {
336
337 bool result = this->get_disk_surface(
338 sample, side, pos, z, rmin, rmax, hphi, depth, calo_dd);
339 if (!result) {
340 return nullptr;
341 }
342 double zend = 0;
343 if (sample == CaloCell_ID::TileGap3) {
344 std::vector<TileDetDescriptor*>::const_iterator Tile_first =
345 m_tile_dd->tile_descriptors_begin();
346 TileDetDescriptor* TileGap_descr = *(Tile_first + 5);
347 zend = TileGap_descr->zcenter(2) + .5 * TileGap_descr->dz(2);
348 zend = zend * side;
349 }
350 if (sample == CaloCell_ID::HEC3) {
351 for (const CaloDetDescriptor* descr : calo_dd->calo_descriptors_range()) {
352 if (descr) {
353 if (descr->getSampling(0) == CaloCell_ID::HEC3) {
354 zend = descr->calo_z_max();
355 zend = zend * side;
356 }
357 }
358 }
359 }
360
361 z = offset + zend - (pos)(2, 3);
362
363 Amg::Translation3D vec(0., 0., z);
364 pos = (pos) * vec;
365
366 // for Atlas configuration, avoid to create a hole a phi ~ pi by hphi
367 // rounding effects. the phi range was introduced for the testbeam
368 if (hphi < 0.9 * M_PI) {
369 return new Trk::DiscSurface(pos, rmin, rmax, hphi);
370 } else {
371 return new Trk::DiscSurface(pos, rmin, rmax);
372 }
373 } else {
375 "This sample is not a 'LAST' surface... returning dummy surface");
376 return surf;
377 }
378
379 return nullptr;
380}
381
384{
385 return &(*m_calodepth); // from ToolHandle to pointer
386}
387
388// End of the general user methods :
389
390bool
393 int side,
394 Amg::Transform3D& htrans,
395 double& radius,
396 double& hphi,
397 double& hlength,
398 double& depth,
399 const CaloDetDescrManager* calo_dd) const
400{
401 bool result = false;
402
403 // strips are spread on several descriptor, which all have the same
404 // htrans, radius, hphi, but not the same hlength
405 double hl{};
406 hlength = 0;
407
408 // these ones are definitely not cylinders :
409 if (sample == CaloCell_ID::PreSamplerE || sample == CaloCell_ID::EME1 ||
410 sample == CaloCell_ID::EME2 || sample == CaloCell_ID::EME3 ||
411 sample == CaloCell_ID::HEC0 || sample == CaloCell_ID::HEC1 ||
412 sample == CaloCell_ID::HEC2 || sample == CaloCell_ID::HEC3 ||
413 sample == CaloCell_ID::FCAL0 || sample == CaloCell_ID::FCAL1 ||
414 sample == CaloCell_ID::FCAL2 || sample == CaloCell_ID::Unknown ||
415 sample == CaloCell_ID::TileGap3) {
416 return false;
417 }
418 if (sample == CaloCell_ID::PreSamplerB || sample == CaloCell_ID::EMB1 ||
419 sample == CaloCell_ID::EMB2 || sample == CaloCell_ID::EMB3) {
420
421 for (const CaloDetDescriptor* reg : calo_dd->calo_descriptors_range()) {
422 if (reg) {
423 if (reg->getSampling(0) == sample && reg->calo_sign() * side > 0) {
424 result = reg->get_cylinder_surface(htrans, radius, hphi, hl, depth);
425 hlength = std::max(hl, hlength);
426 }
427 }
428 }
429 }
430
431 else {
432 // these are not cylinders
433 switch (sample) {
434 case CaloCell_ID::TileBar0:
435 case CaloCell_ID::TileBar1:
436 case CaloCell_ID::TileBar2:
437 case CaloCell_ID::TileExt0:
438 case CaloCell_ID::TileExt1:
439 case CaloCell_ID::TileExt2:
440 case CaloCell_ID::TileGap1:
441 case CaloCell_ID::TileGap2:
442 break;
443 default:
444 ATH_MSG_ERROR(" get_cylinder_surface Not Cylindrical Tile found!!! ");
445 return 0;
446 }
447
448 for (const CaloDetDescriptor* reg : calo_dd->tile_descriptors_range()) {
449 if (reg) {
450 if (reg->getSampling(0) == sample && reg->calo_sign() * side > 0) {
451 result = reg->get_cylinder_surface(htrans, radius, hphi, hl, depth);
452 if (hl > hlength)
453 hlength = hl;
454 hphi = .5 * reg->dphi() * reg->n_phi();
455 }
456 }
457 }
458 result = true;
459 }
460 return result;
461}
462
463bool
465 int side,
466 Amg::Transform3D& htrans,
467 double& z,
468 double& rmin,
469 double& rmax,
470 double& hphisec,
471 double& depth,
472 const CaloDetDescrManager* calo_dd) const
473{
474
475 // set defaults :
476 bool result = false;
477 z = 0.;
478 rmin = 999999.;
479 rmax = 0.;
480
481 // strips are spread on several descriptor, which all have the same
482 // htrans, hphisec, but not the same rmin and rmax
483 // + for EMEC2 and EMEC3, the InnerWeel entrance z is different :-(
484 // ==> as CaloCell_ID::CaloSample does not allow to distinguish,
485 // take OW z and fix the HepTransform accordingly
486
487 // these ones are definitely not disks :
488 if (sample == CaloCell_ID::PreSamplerB || sample == CaloCell_ID::EMB1 ||
489 sample == CaloCell_ID::EMB2 || sample == CaloCell_ID::EMB3 ||
490 sample == CaloCell_ID::TileBar0 || sample == CaloCell_ID::TileBar1 ||
491 sample == CaloCell_ID::TileBar2 || sample == CaloCell_ID::TileGap1 ||
492 sample == CaloCell_ID::TileGap2 || sample == CaloCell_ID::TileExt0 ||
493 sample == CaloCell_ID::TileExt1 || sample == CaloCell_ID::TileExt2) {
494 return false;
495 }
496
497 double ri;
498 double ra;
499 double zow;
500 for (const CaloDetDescriptor* reg : calo_dd->calo_descriptors_range()) {
501 if (reg) {
502 if (reg->getSampling(0) == sample && reg->calo_sign() * side > 0) {
503 result = reg->get_disk_surface(htrans, zow, ri, ra, hphisec, depth);
504 if (!reg->is_lar_em_endcap_inner())
505 z = zow;
506 rmin = std::min(ri, rmin);
507 rmax = std::max(rmax, ra);
508 }
509 }
510 }
511
512 if (sample == CaloCell_ID::TileGap3) {
513 for (const CaloDetDescriptor* reg : calo_dd->tile_descriptors_range()) {
514 if (reg) {
515 if (reg->getSampling(0) == sample && reg->calo_sign() * side > 0) {
516 result = reg->get_disk_surface(htrans, zow, ri, ra, hphisec, depth);
517 if (!reg->is_lar_em_endcap_inner())
518 z = zow;
519 rmin = std::min(ri, rmin);
520 rmax = std::max(rmax, ra);
521 }
522 }
523 }
524 }
525
526 if (rmin > rmax) {
527 rmin = 0.;
528 }
529 // Fix the z ( convention is different in Calo's and Tracking )
530 Amg::Translation3D vec(0., 0., z - (htrans)(2, 3));
531 htrans = (htrans) * vec;
532 return result;
533}
534
535bool
537 Amg::Transform3D& htrans,
538 double& hphi,
539 std::vector<double>& radius,
540 std::vector<double>& depth,
541 std::vector<double>& hlength) const
542{
543 bool result = m_lar_simplegeom->get_cylinder_surface(
544 alvol, htrans, hphi, radius, depth, hlength);
545
546 // Shift the POS/NEG sides ( htrans convention is different in Calo's and
547 // Tracking )
548 // FIXME : for this, assume that the 1rst hlength is the good one
549
550 if (alvol == CaloSubdetNames::EMB_POS ||
552 result = m_lar_simplegeom->get_cylinder_surface(
553 alvol, htrans, hphi, radius, depth, hlength);
554 Amg::Translation3D vec(0., 0., hlength[0]);
555 htrans = (htrans) * vec;
556 return result;
557 } else if (alvol == CaloSubdetNames::EMB_NEG ||
559 result = m_lar_simplegeom->get_cylinder_surface(
560 alvol, htrans, hphi, radius, depth, hlength);
561 Amg::Translation3D vec(0., 0., -1. * hlength[0]);
562 htrans = (htrans) * vec;
563 return result;
564 }
565
566 return result;
567}
568
569bool
571 Amg::Transform3D& htrans,
572 double& hphi,
573 std::vector<double>& z,
574 std::vector<double>& depth,
575 std::vector<double>& rmin,
576 std::vector<double>& rmax) const
577{
578 bool result = m_lar_simplegeom->get_disk_surface(
579 alvol, htrans, hphi, z, depth, rmin, rmax);
580
581 // Fix the z ( htrans convention is different in Calo's and Tracking ) ?
582 // = left to the CreateDDEClayer method, because z is a vector => 1 fix per
583 // disk element
584
585 return result;
586}
587
588// store all the surfaces into a vector
589void
591{
592
593 // entry surfaces ( id<24 to avoid error messages )
594 for (CaloCell_ID::CaloSample sample = CaloCell_ID::PreSamplerB; sample < 24;
595 sample = CaloCell_ID::CaloSample(sample + 1)) {
596 float etaRef = (sample < 4 || std::abs(sample - 13) < 2) ? 1. : 2.;
597 Trk::Surface* spos = CreateUserSurface(sample, 0., etaRef, calo_dd);
598 Trk::Surface* sneg = CreateUserSurface(sample, 0., -etaRef, calo_dd);
599 if (spos)
600 spos->setOwner(Trk::TGOwn);
601 if (sneg)
602 sneg->setOwner(Trk::TGOwn);
603 m_layerEntries.emplace_back(spos, sneg);
604 }
605 // turn into SlidingSurfaces
606 // EMB2 neg
607 float etaMin = -1.5;
608 float etaMax = 0.;
609 float deta = 0.05;
610 unsigned int neta = (etaMax - etaMin) / deta;
611 std::vector<float> offset(neta);
612 float rbase = m_layerEntries[CaloCell_ID::EMB2].second->bounds().r();
613 for (unsigned int ie = 0; ie < neta; ie++) {
614 float eta = etaMin + (ie + 0.5) * deta;
615 const Trk::Surface* surf =
616 CreateUserSurface(CaloCell_ID::EMB2, 0., eta, calo_dd);
617 offset[ie] = surf->bounds().r() - rbase;
618 delete surf;
619 }
620 const Trk::CylinderSurface* cyl = dynamic_cast<const Trk::CylinderSurface*>(
621 m_layerEntries[CaloCell_ID::EMB2].second);
622 if (!cyl) {
623 std::abort();
624 }
626 *cyl,
627 Trk::BinUtility(neta, etaMin, etaMax, Trk::open, Trk::binEta),
628 offset);
629 tmpSlidCyl->setOwner(Trk::TGOwn);
630 m_layerEntries[CaloCell_ID::EMB2].second = tmpSlidCyl;
631 delete cyl;
632 // EMB2 pos
633 etaMin = 0.;
634 etaMax = 1.5;
635 deta = 0.05;
636 neta = (etaMax - etaMin) / deta;
637 offset.resize(neta);
638 rbase = m_layerEntries[CaloCell_ID::EMB2].first->bounds().r();
639 for (unsigned int ie = 0; ie < neta; ie++) {
640 float eta = etaMin + (ie + 0.5) * deta;
641 Trk::Surface* surf = CreateUserSurface(CaloCell_ID::EMB2, 0., eta, calo_dd);
642 offset[ie] = surf->bounds().r() - rbase;
643 delete surf;
644 }
645 cyl = dynamic_cast<const Trk::CylinderSurface*>(
646 m_layerEntries[CaloCell_ID::EMB2].first);
647 if (!cyl) {
648 std::abort();
649 }
650 tmpSlidCyl = new Trk::SlidingCylinderSurface(
651 *cyl,
652 Trk::BinUtility(neta, etaMin, etaMax, Trk::open, Trk::binEta),
653 offset);
654 tmpSlidCyl->setOwner(Trk::TGOwn);
655 m_layerEntries[CaloCell_ID::EMB2].first = tmpSlidCyl;
656 delete cyl;
657 // EMB3 neg
658 etaMin = -1.5;
659 etaMax = 0.;
660 deta = 0.05;
661 neta = (etaMax - etaMin) / deta;
662 offset.resize(neta);
663 rbase = m_layerEntries[CaloCell_ID::EMB3].second->bounds().r();
664 for (unsigned int ie = 0; ie < neta; ie++) {
665 float eta = etaMin + (ie + 0.5) * deta;
666 Trk::Surface* surf = CreateUserSurface(CaloCell_ID::EMB3, 0., eta, calo_dd);
667 offset[ie] = surf->bounds().r() - rbase;
668 delete surf;
669 }
670 cyl = dynamic_cast<const Trk::CylinderSurface*>(
671 m_layerEntries[CaloCell_ID::EMB3].second);
672 if (!cyl) {
673 std::abort();
674 }
675 tmpSlidCyl = new Trk::SlidingCylinderSurface(
676 *cyl,
677 Trk::BinUtility(neta, etaMin, etaMax, Trk::open, Trk::binEta),
678 offset);
679 tmpSlidCyl->setOwner(Trk::TGOwn);
680 m_layerEntries[CaloCell_ID::EMB3].second = tmpSlidCyl;
681 delete cyl;
682
683 // EMB3 pos
684 etaMin = 0.;
685 etaMax = 1.5;
686 deta = 0.05;
687 neta = (etaMax - etaMin) / deta;
688 offset.resize(neta);
689 rbase = m_layerEntries[CaloCell_ID::EMB3].first->bounds().r();
690 for (unsigned int ie = 0; ie < neta; ie++) {
691 float eta = etaMin + (ie + 0.5) * deta;
692 const Trk::Surface* surf =
693 CreateUserSurface(CaloCell_ID::EMB3, 0., eta, calo_dd);
694 offset[ie] = surf->bounds().r() - rbase;
695 delete surf;
696 }
697 cyl = dynamic_cast<const Trk::CylinderSurface*>(
698 m_layerEntries[CaloCell_ID::EMB3].first);
699 if (!cyl) {
700 std::abort();
701 }
702 tmpSlidCyl = new Trk::SlidingCylinderSurface(
703 *cyl,
704 Trk::BinUtility(neta, etaMin, etaMax, Trk::open, Trk::binEta),
705 offset);
706 tmpSlidCyl->setOwner(Trk::TGOwn);
707 m_layerEntries[CaloCell_ID::EMB3].first = tmpSlidCyl;
708 delete cyl;
709
710 // EME2 neg
711 etaMin = -3.2;
712 etaMax = -1.35;
713 deta = 0.05;
714 neta = (etaMax - etaMin) / deta;
715 offset.resize(neta);
716 float zbase = m_layerEntries[CaloCell_ID::EME2].second->center().z();
717 for (unsigned int ie = 0; ie < neta; ie++) {
718 float eta = etaMin + (ie + 0.5) * deta;
719 const Trk::Surface* surf =
720 CreateUserSurface(CaloCell_ID::EME2, 0., eta, calo_dd);
721 offset[ie] = surf->center().z() - zbase;
722 delete surf;
723 }
724 const Trk::DiscSurface* disc = dynamic_cast<const Trk::DiscSurface*>(
725 m_layerEntries[CaloCell_ID::EME2].second);
726 if (!disc) {
727 std::abort();
728 }
730 *disc,
731 Trk::BinUtility(neta, etaMin, etaMax, Trk::open, Trk::binEta),
732 offset);
733 tmpSlidDisc->setOwner(Trk::TGOwn);
734 m_layerEntries[CaloCell_ID::EME2].second = tmpSlidDisc;
735 delete disc;
736
737 // EME2 pos
738 etaMin = 1.35;
739 etaMax = 3.2;
740 deta = 0.05;
741 neta = (etaMax - etaMin) / deta;
742 offset.resize(neta);
743 zbase = m_layerEntries[CaloCell_ID::EME2].first->center().z();
744 for (unsigned int ie = 0; ie < neta; ie++) {
745 float eta = etaMin + (ie + 0.5) * deta;
746 Trk::Surface* surf = CreateUserSurface(CaloCell_ID::EME2, 0., eta, calo_dd);
747 offset[ie] = surf->center().z() - zbase;
748 delete surf;
749 }
750 disc = dynamic_cast<const Trk::DiscSurface*>(
751 m_layerEntries[CaloCell_ID::EME2].first);
752 if (!disc) {
753 std::abort();
754 }
755 tmpSlidDisc = new Trk::SlidingDiscSurface(
756 *disc,
757 Trk::BinUtility(neta, etaMin, etaMax, Trk::open, Trk::binEta),
758 offset);
759 tmpSlidDisc->setOwner(Trk::TGOwn);
760 m_layerEntries[CaloCell_ID::EME2].first = tmpSlidDisc;
761 delete disc;
762
763 // EME3 neg
764 etaMin = -3.2;
765 etaMax = -1.35;
766 deta = 0.05;
767 neta = (etaMax - etaMin) / deta;
768 offset.resize(neta);
769 zbase = m_layerEntries[CaloCell_ID::EME3].second->center().z();
770 for (unsigned int ie = 0; ie < neta; ie++) {
771 float eta = etaMin + (ie + 0.5) * deta;
772 const Trk::Surface* surf =
773 CreateUserSurface(CaloCell_ID::EME3, 0., eta, calo_dd);
774 offset[ie] = surf->center().z() - zbase;
775 delete surf;
776 }
777 disc = dynamic_cast<const Trk::DiscSurface*>(
778 m_layerEntries[CaloCell_ID::EME3].second);
779 if (!disc) {
780 std::abort();
781 }
782 tmpSlidDisc = new Trk::SlidingDiscSurface(
783 *disc,
784 Trk::BinUtility(neta, etaMin, etaMax, Trk::open, Trk::binEta),
785 offset);
786 tmpSlidDisc->setOwner(Trk::TGOwn);
787 m_layerEntries[CaloCell_ID::EME3].second = tmpSlidDisc;
788 delete disc;
789
790 // EME3 pos
791 etaMin = 1.35;
792 etaMax = 3.2;
793 deta = 0.05;
794 neta = (etaMax - etaMin) / deta;
795 offset.resize(neta);
796 zbase = m_layerEntries[CaloCell_ID::EME3].first->center().z();
797 for (unsigned int ie = 0; ie < neta; ie++) {
798 float eta = etaMin + (ie + 0.5) * deta;
799 Trk::Surface* surf = CreateUserSurface(CaloCell_ID::EME3, 0., eta, calo_dd);
800 offset[ie] = surf->center().z() - zbase;
801 delete surf;
802 }
803 disc = dynamic_cast<const Trk::DiscSurface*>(
804 m_layerEntries[CaloCell_ID::EME3].first);
805 if (!disc) {
806 std::abort();
807 }
808 tmpSlidDisc = new Trk::SlidingDiscSurface(
809 *disc,
810 Trk::BinUtility(neta, etaMin, etaMax, Trk::open, Trk::binEta),
811 offset);
812 tmpSlidDisc->setOwner(Trk::TGOwn);
813 m_layerEntries[CaloCell_ID::EME3].first = tmpSlidDisc;
814 delete disc;
815
816 // exit surfaces
817 for (CaloCell_ID::CaloSample sample = CaloCell_ID::PreSamplerB;
818 sample + 1 < static_cast<int>(m_layerEntries.size());
819 sample = CaloCell_ID::CaloSample(sample + 1)) {
820 m_layerExits.push_back(m_layerEntries[sample + 1]);
821 }
822
823 // fix exit for outer layers
824 Trk::Surface* lpos =
825 CreateLastSurface(CaloCell_ID::TileBar2, 0., 1., calo_dd);
826 Trk::Surface* lneg =
827 CreateLastSurface(CaloCell_ID::TileBar2, 0., -1., calo_dd);
828 if (lpos) {
829 lpos->setOwner(Trk::TGOwn);
830 }
831 if (lneg) {
832 lneg->setOwner(Trk::TGOwn);
833 }
834 m_layerExits[CaloCell_ID::TileBar2] =
835 std::pair<const Trk::Surface*, const Trk::Surface*>(lpos, lneg);
836
837 lpos = CreateLastSurface(CaloCell_ID::TileExt2, 0., 1., calo_dd);
838 lneg = CreateLastSurface(CaloCell_ID::TileExt2, 0., -1., calo_dd);
839 if (lpos) {
840 lpos->setOwner(Trk::TGOwn);
841 }
842 if (lneg) {
843 lneg->setOwner(Trk::TGOwn);
844 }
845 m_layerExits[CaloCell_ID::TileExt2] =
846 std::pair<const Trk::Surface*, const Trk::Surface*>(lpos, lneg);
847
848 lpos = CreateLastSurface(CaloCell_ID::TileGap2, 0., 1., calo_dd);
849 lneg = CreateLastSurface(CaloCell_ID::TileGap2, 0., -1., calo_dd);
850 if (lpos) {
851 lpos->setOwner(Trk::TGOwn);
852 }
853 if (lneg) {
854 lneg->setOwner(Trk::TGOwn);
855 }
856 m_layerExits[CaloCell_ID::TileGap2] =
857 std::pair<const Trk::Surface*, const Trk::Surface*>(lpos, lneg);
858
859 lpos = CreateLastSurface(CaloCell_ID::TileGap3, 0., 1., calo_dd);
860 lneg = CreateLastSurface(CaloCell_ID::TileGap3, 0., -1., calo_dd);
861 if (lpos) {
862 lpos->setOwner(Trk::TGOwn);
863 }
864 if (lneg) {
865 lneg->setOwner(Trk::TGOwn);
866 }
867 m_layerExits[CaloCell_ID::TileGap3] =
868 std::pair<const Trk::Surface*, const Trk::Surface*>(lpos, lneg);
869
870 lpos = CreateLastSurface(CaloCell_ID::HEC3, 0., 1., calo_dd);
871 lneg = CreateLastSurface(CaloCell_ID::HEC3, 0., -1., calo_dd);
872 if (lpos) {
873 lpos->setOwner(Trk::TGOwn);
874 }
875 if (lneg) {
876 lneg->setOwner(Trk::TGOwn);
877 }
878 m_layerExits[CaloCell_ID::HEC3] =
879 std::pair<const Trk::Surface*, const Trk::Surface*>(lpos, lneg);
880}
881
#define M_PI
Scalar eta() const
pseudorapidity method
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_DEBUG(x)
Definition of CaloDetDescrManager.
Definition of CaloDetDescriptor.
std::vector< size_t > vec
ICaloCoordinateTool interface declaration 30.9.2004 Creation of the class TBCalocoordinate by claire....
ICaloSimpleGeomTool interface declaration 19.9.2005 Creation of the interface CaloDetDescr/ICaloSimpl...
static Double_t sc
#define z
CaloSampling::CaloSample CaloSample
Definition CaloCell_ID.h:53
Implementation of the ICaloDepthTool interface.Given a Track direction, checks if it is in the Calori...
const std::string & lar_geometry() const
get lar geometry label, distinguish between full atlas and TB
calo_descr_range calo_descriptors_range() const
Range over descriptors.
calo_descr_range tile_descriptors_range() const
Range over tile descriptors.
This class provides the client interface for accessing the detector description information common to...
This is a base class for LAr and Tile Descriptors The primary goal is to speed up loops over all the ...
ALIGNVOL
LAr Alignable volumes.
CaloSurfaceBuilder(const std::string &type, const std::string &name, const IInterface *parent)
void fill_tg_surfaces(const CaloDetDescrManager *calo_dd) const
virtual bool get_cylinder_surface(CaloCell_ID::CaloSample sample, int side, Amg::Transform3D &htrans, double &radius, double &hphi, double &hlength, double &depth, const CaloDetDescrManager *calo_dd) const override final
These methods provide the default parameters used by the CaloTrackingGeometry and Surface Builders,...
virtual Trk::Surface * CreateUserSurface(const CaloCell_ID::CaloSample sample, const double offset, const double etaCaloLocal, const CaloDetDescrManager *calo_dd) const override final
overwrite DD radius/z by CaloDepth radius, and an offset can be added
const TileDetDescrManager * m_tile_dd
virtual Trk::Surface * CreateLastSurface(const CaloCell_ID::CaloSample sample, const double offset, const double etaCaloLocal, const CaloDetDescrManager *calo_dd) const override final
end of the sample for the last layers of the Calo
ToolHandle< CaloDepthTool > m_calodepth
virtual StatusCode initialize() override final
virtual bool get_disk_surface(CaloCell_ID::CaloSample sample, int side, Amg::Transform3D &htrans, double &z, double &rmin, double &rmax, double &hphisec, double &depth, const CaloDetDescrManager *calo_dd) const override final
virtual CaloDepthTool * getCaloDepth() override final
ToolHandle< ICaloRecoSimpleGeomTool > m_lar_simplegeom
virtual StatusCode finalize() override final
virtual ~CaloSurfaceBuilder()
ToolHandle< ICaloRecoMaterialTool > m_lar_mat
float zcenter(unsigned int samp) const
float rcenter(unsigned int samp) const
float dz(unsigned int samp) const
float dr(unsigned int samp) const
A generic symmetric BinUtility, for fully symmetric binning in terms of binning grid and binning type...
Definition BinUtility.h:39
Class for a CylinderSurface in the ATLAS detector.
Class for a DiscSurface in the ATLAS detector.
Definition DiscSurface.h:54
Class for a Calo CylinderSurface with variable depth in the ATLAS detector.
Class for a Calo DiscSurface with variable depth in the ATLAS detector.
Abstract Base Class for tracking surfaces.
void setOwner(SurfaceOwner x)
set Ownership
std::string depth
tag string for intendation
Definition fastadd.cxx:46
Eigen::Affine3d Transform3D
Eigen::Translation< double, 3 > Translation3D
static const Amg::Transform3D s_idTransform
idendity transformation
@ open
Definition BinningType.h:40
@ binEta
Definition BinningType.h:54