ATLAS Offline Software
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 
9 #include "CaloSurfaceBuilder.h"
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 
24 #include "TrkGeometry/DiscLayer.h"
25 #include "TrkSurfaces/DiscBounds.h"
27 
30 
31 // Amg
33 
34 // Calo specific stuff :
35 #include "CaloDetDescr/CaloDetDescrElement.h"
41 
42 // Tile specific stuff :
43 #include "CaloIdentifier/TileID.h"
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 
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 
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 
133  auto pos = Amg::Transform3D(Trk::s_idTransform);
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;
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;
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;
186  auto pos2 = Amg::Transform3D(Trk::s_idTransform);
188  sample, side, pos2, radius, hphi, hlen, depth, calo_dd);
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;
262  tile = true;
263 
264  auto pos = Amg::Transform3D(Trk::s_idTransform);
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 
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;
287  auto pos2 = Amg::Transform3D(Trk::s_idTransform);
289  sample, side, pos2, radius, hphi, hlen, depth, calo_dd);
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 =
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  }
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 =
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 
390 bool
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 :
416  return false;
417  }
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) {
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 
463 bool
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 :
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 
535 bool
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 
569 bool
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
589 void
591 {
592 
593  // entry surfaces ( id<24 to avoid error messages )
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,
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,
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,
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,
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,
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,
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,
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,
811  offset);
812  tmpSlidDisc->setOwner(Trk::TGOwn);
813  m_layerEntries[CaloCell_ID::EME3].first = tmpSlidDisc;
814  delete disc;
815 
816  // exit surfaces
818  sample + 1 < static_cast<int>(m_layerEntries.size());
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 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
TileDetDescrManager::tile_descriptors_begin
tile_descr_const_iterator tile_descriptors_begin() const
Definition: TileDetDescrManager.h:101
CaloDepthTool
Implementation of the ICaloDepthTool interface.Given a Track direction, checks if it is in the Calori...
Definition: CaloDepthTool.h:47
CaloSurfaceBuilder::m_lar_mat
ToolHandle< ICaloRecoMaterialTool > m_lar_mat
Definition: CaloSurfaceBuilder.h:151
GetLCDefs::Unknown
@ Unknown
Definition: GetLCDefs.h:21
SlidingCylinderSurface.h
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
egammaParameters::depth
@ depth
pointing depth of the shower as calculated in egammaqgcld
Definition: egammaParamDefs.h:276
CaloCell_ID_FCS::TileExt2
@ TileExt2
Definition: FastCaloSim_CaloCell_ID.h:39
Trk::SlidingDiscSurface
Definition: SlidingDiscSurface.h:45
get_generator_info.result
result
Definition: get_generator_info.py:21
constants.EMB1
int EMB1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:53
DiscBounds.h
CaloSurfaceBuilder::m_lar_simplegeom
ToolHandle< ICaloRecoSimpleGeomTool > m_lar_simplegeom
Definition: CaloSurfaceBuilder.h:152
ITrackingVolumeBuilder.h
Trk::Surface::setOwner
void setOwner(SurfaceOwner x)
set Ownership
MaterialProperties.h
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
CaloSubdetNames::EMB_POS
@ EMB_POS
Definition: CaloSubdetNames.h:38
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
CaloCell_ID_FCS::TileExt0
@ TileExt0
Definition: FastCaloSim_CaloCell_ID.h:37
CaloSubdetNames::PRESAMPLER_B_NEG
@ PRESAMPLER_B_NEG
Definition: CaloSubdetNames.h:37
CaloCell_ID_FCS::TileBar1
@ TileBar1
Definition: FastCaloSim_CaloCell_ID.h:32
CaloSurfaceBuilder::m_calodepth
ToolHandle< CaloDepthTool > m_calodepth
Definition: CaloSurfaceBuilder.h:155
CaloSurfaceBuilder.h
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
DiscLayer.h
M_PI
#define M_PI
Definition: ActiveFraction.h:11
CaloCell_ID_FCS::FCAL1
@ FCAL1
Definition: FastCaloSim_CaloCell_ID.h:41
CaloSurfaceBuilder::~CaloSurfaceBuilder
virtual ~CaloSurfaceBuilder()
xAOD::etaMax
etaMax
Definition: HIEventShape_v2.cxx:46
HomogeneousLayerMaterial.h
Trk::binEta
@ binEta
Definition: BinningType.h:54
Trk::DiscSurface
Definition: DiscSurface.h:54
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:9
CaloCell_ID_FCS::HEC2
@ HEC2
Definition: FastCaloSim_CaloCell_ID.h:29
Trk::Surface::center
const Amg::Vector3D & center() const
Returns the center position of the Surface.
CaloSurfaceBuilder::CreateUserSurface
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
Definition: CaloSurfaceBuilder.cxx:123
TileDetDescriptor::dz
float dz(unsigned int samp) const
Definition: TileDetDescriptor.h:212
CaloCell_ID_FCS::TileGap3
@ TileGap3
Definition: FastCaloSim_CaloCell_ID.h:36
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
CaloDetDescrManager.h
Definition of CaloDetDescrManager.
TileID.h
TileDetDescrManager.h
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
ReadCellNoiseFromCool.tile
tile
Definition: ReadCellNoiseFromCool.py:92
PlotCalibFromCool.ie
ie
Definition: PlotCalibFromCool.py:420
CaloDetDescrManager_Base::lar_geometry
const std::string & lar_geometry() const
get lar geometry label, distinguish between full atlas and TB
Definition: CaloDetDescrManager.h:168
TRT::Hit::side
@ side
Definition: HitInfo.h:83
TileDetDescriptor::dr
float dr(unsigned int samp) const
Definition: TileDetDescriptor.h:198
CaloSurfaceBuilder::CreateLastSurface
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
Definition: CaloSurfaceBuilder.cxx:248
CxxUtils::vec
typename vecDetail::vec_typedef< T, N >::type vec
Define a nice alias for the vectorized type.
Definition: vec.h:207
CaloDetDescriptor.h
Definition of CaloDetDescriptor.
GeoPrimitives.h
CaloSubdetNames::PRESAMPLER_B_POS
@ PRESAMPLER_B_POS
Definition: CaloSubdetNames.h:37
CylinderVolumeBounds.h
TileDetDescriptor::rcenter
float rcenter(unsigned int samp) const
Definition: TileDetDescriptor.h:191
CaloCell_ID_FCS::HEC1
@ HEC1
Definition: FastCaloSim_CaloCell_ID.h:28
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
constants.EMB2
int EMB2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:54
SlidingDiscSurface.h
FullCPAlgorithmsTest_eljob.sample
sample
Definition: FullCPAlgorithmsTest_eljob.py:116
CaloCell_ID::CaloSample
CaloSampling::CaloSample CaloSample
Definition: CaloCell_ID.h:53
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
z
#define z
CaloSurfaceBuilder::getCaloDepth
virtual CaloDepthTool * getCaloDepth() override final
Definition: CaloSurfaceBuilder.cxx:383
TileDetDescriptor::zcenter
float zcenter(unsigned int samp) const
Definition: TileDetDescriptor.h:205
CaloCell_ID_FCS::TileBar0
@ TileBar0
Definition: FastCaloSim_CaloCell_ID.h:31
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CaloCell_ID_FCS::TileGap2
@ TileGap2
Definition: FastCaloSim_CaloCell_ID.h:35
Trk::CylinderSurface
Definition: CylinderSurface.h:55
TileDetDescriptor
Definition: TileDetDescriptor.h:46
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
CylinderSurface.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CaloSurfaceBuilder::initialize
virtual StatusCode initialize() override final
Definition: CaloSurfaceBuilder.cxx:71
constants.EME1
int EME1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:55
CylinderLayer.h
python.TransformConfig.descr
descr
print "%s.properties()" % self.__name__
Definition: TransformConfig.py:360
CaloCell_ID_FCS::TileGap1
@ TileGap1
Definition: FastCaloSim_CaloCell_ID.h:34
ICaloRecoSimpleGeomTool.h
ICaloSimpleGeomTool interface declaration 19.9.2005 Creation of the interface CaloDetDescr/ICaloSimpl...
Trk::BinUtility
Definition: BinUtility.h:39
CaloSurfaceBuilder::CaloSurfaceBuilder
CaloSurfaceBuilder(const std::string &type, const std::string &name, const IInterface *parent)
Definition: CaloSurfaceBuilder.cxx:56
Trk::TGOwn
@ TGOwn
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:58
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
ICaloCoordinateTool.h
ICaloCoordinateTool interface declaration 30.9.2004 Creation of the class TBCalocoordinate by claire....
Trk::Surface::bounds
virtual const SurfaceBounds & bounds() const =0
Surface Bounds method.
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
CaloSubdetNames::EMB_NEG
@ EMB_NEG
Definition: CaloSubdetNames.h:38
CaloCell_ID_FCS::TileExt1
@ TileExt1
Definition: FastCaloSim_CaloCell_ID.h:38
CaloCell_ID_FCS::EME3
@ EME3
Definition: FastCaloSim_CaloCell_ID.h:26
ParticleGun_SamplingFraction.radius
radius
Definition: ParticleGun_SamplingFraction.py:96
CaloSurfaceBuilder::finalize
virtual StatusCode finalize() override final
Definition: CaloSurfaceBuilder.cxx:97
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:16
CaloCell_ID_FCS::HEC0
@ HEC0
Definition: FastCaloSim_CaloCell_ID.h:27
CaloDetDescrManager_Base::calo_descriptors_range
calo_descr_range calo_descriptors_range() const
Range over descriptors.
Definition: CaloDetDescrManager.cxx:535
Trk::open
@ open
Definition: BinningType.h:40
CaloSurfaceBuilder::get_cylinder_surface
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,...
Definition: CaloSurfaceBuilder.cxx:391
CylinderBounds.h
TrackingVolume.h
LArCellBinning.etaMin
etaMin
Definition: LArCellBinning.py:84
CaloDetDescrManager
This class provides the client interface for accessing the detector description information common to...
Definition: CaloDetDescrManager.h:473
CaloDetDescriptor
This is a base class for LAr and Tile Descriptors The primary goal is to speed up loops over all the ...
Definition: CaloDetDescriptor.h:58
CaloSurfaceBuilder::m_tile_dd
const TileDetDescrManager * m_tile_dd
Definition: CaloSurfaceBuilder.h:138
CaloCell_ID_FCS::PreSamplerE
@ PreSamplerE
Definition: FastCaloSim_CaloCell_ID.h:23
CaloCell_ID_FCS::PreSamplerB
@ PreSamplerB
Definition: FastCaloSim_CaloCell_ID.h:19
Amg::Translation3D
Eigen::Translation< double, 3 > Translation3D
Definition: GeoPrimitives.h:44
CaloSurfaceBuilder::get_disk_surface
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
Definition: CaloSurfaceBuilder.cxx:464
DetectorZone::barrel
@ barrel
TileDetDescriptor.h
CaloDetDescrManager_Base::tile_descriptors_range
calo_descr_range tile_descriptors_range() const
Range over tile descriptors.
Definition: CaloDetDescrManager.cxx:565
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
CaloSurfaceBuilder::fill_tg_surfaces
void fill_tg_surfaces(const CaloDetDescrManager *calo_dd) const
Definition: CaloSurfaceBuilder.cxx:590
DiscSurface.h
Trk::SlidingCylinderSurface
Definition: SlidingCylinderSurface.h:34
CaloCell_ID_FCS::FCAL2
@ FCAL2
Definition: FastCaloSim_CaloCell_ID.h:42
CaloCell_ID_FCS::HEC3
@ HEC3
Definition: FastCaloSim_CaloCell_ID.h:30
Trk::Surface
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:79
CaloCell_ID_FCS::FCAL0
@ FCAL0
Definition: FastCaloSim_CaloCell_ID.h:40
CaloCell_ID_FCS::EMB3
@ EMB3
Definition: FastCaloSim_CaloCell_ID.h:22
ICaloRecoMaterialTool.h
CaloCell_ID_FCS::TileBar2
@ TileBar2
Definition: FastCaloSim_CaloCell_ID.h:33
constants.EME2
int EME2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:56
CaloSubdetNames::ALIGNVOL
ALIGNVOL
LAr Alignable volumes.
Definition: CaloSubdetNames.h:36
Trk::SurfaceBounds::r
virtual double r() const =0
Interface method for the maximal extension or the radius.