ATLAS Offline Software
BoundarySubtractedCylinderSurface.icc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 ///////////////////////////////////////////////////////////////////
6 // BoundarySubtractedCylinderSurface.icc, (c) ATLAS Detector software
7 ///////////////////////////////////////////////////////////////////
8 
9 template<class Tvol>
10 inline const Surface&
11 BoundarySubtractedCylinderSurface<Tvol>::surfaceRepresentation() const
12 {
13  return *this;
14 }
15 
16 template<class Tvol>
17 inline Surface&
18 BoundarySubtractedCylinderSurface<Tvol>::surfaceRepresentation()
19 {
20  return *this;
21 }
22 
23 template<class Tvol>
24 inline const Tvol*
25 BoundarySubtractedCylinderSurface<Tvol>::attachedVolume(
26  const TrackParameters& parms,
27  PropDirection dir) const
28 {
29  const Tvol* attVolume = nullptr;
30  // (ST) buggy line - assumes the parms are at this boundary surface !
31  // const HepGeom::Vector3D<double>* localNormal =
32  // this->surfaceRepresentation().normal(parms.localPosition()); replacing with
33  auto locPos = this->surfaceRepresentation().globalToLocal(parms.position());
34  Amg::Vector3D localNormal{};
35  if (locPos) {
36  localNormal = this->surfaceRepresentation().normal(*locPos);
37  } else {
38  return attVolume;
39  }
40  // (ST) end patch
41 
42  if (localNormal.dot(dir * parms.momentum()) > 0.) {
43  attVolume = BoundarySurface<Tvol>::m_outsideVolume;
44  if (BoundarySurface<Tvol>::m_outsideVolumeArray.get()) {
45  attVolume = BoundarySurface<Tvol>::m_outsideVolumeArray.get()->object(
46  parms.position());
47  }
48  } else {
49  attVolume = BoundarySurface<Tvol>::m_insideVolume;
50  if (BoundarySurface<Tvol>::m_insideVolumeArray.get()) {
51  attVolume = BoundarySurface<Tvol>::m_insideVolumeArray.get()->object(
52  parms.position());
53  }
54  }
55  return attVolume;
56 }
57 
58 template<class Tvol>
59 inline const Tvol*
60 BoundarySubtractedCylinderSurface<Tvol>::attachedVolume(
61  const Amg::Vector3D& pos,
62  const Amg::Vector3D& mom,
63  PropDirection dir) const
64 {
65  const Tvol* attVolume = nullptr;
66  auto lp = Surface::globalToLocal(pos, 2.);
67  if (lp) {
68  const Amg::Vector3D localNormal = CylinderSurface::normal(*lp);
69  if (localNormal.dot(dir * mom) > 0.) {
70  attVolume = BoundarySurface<Tvol>::m_outsideVolume;
71  if (BoundarySurface<Tvol>::m_outsideVolumeArray.get()) {
72  attVolume =
73  BoundarySurface<Tvol>::m_outsideVolumeArray.get()->object(pos);
74  }
75  } else {
76  attVolume = BoundarySurface<Tvol>::m_insideVolume;
77  if (BoundarySurface<Tvol>::m_insideVolumeArray.get()) {
78  attVolume =
79  BoundarySurface<Tvol>::m_insideVolumeArray.get()->object(pos);
80  }
81  }
82  }
83  return attVolume;
84 }
85