ATLAS Offline Software
SpacePoint_v1.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // EDM include(s):
7 // Local include(s):
9 
10 // replace by handwritten version to avoid vector copy
11 // AUXSTORE_OBJECT_SETTER_AND_GETTER( xAOD::SpacePoint_v1, std::vector< xAOD::DetectorIDHashType >,
12 // elementIdList, setElementIdList )
13 
14 const std::vector< xAOD::DetectorIDHashType > & xAOD::SpacePoint_v1::elementIdList() const {
15  static const Accessor< std::vector< xAOD::DetectorIDHashType > > acc( "elementIdList" );
16  return acc( *this );
17 }
18 void xAOD::SpacePoint_v1::setElementIdList(std::vector< xAOD::DetectorIDHashType > && value ) {
19  static const Accessor< std::vector< xAOD::DetectorIDHashType > > acc( "elementIdList" );
20  acc( *this ) = std::move(value);
21 }
22 
23 static const SG::AuxElement::Accessor< std::array< float, 3 > > globalPosAcc("globalPosition");
24 
26  const auto& values = globalPosAcc(*this);
27  return ConstVectorMap{values.data()};
28 }
29 
31  auto& values = globalPosAcc(*this);
32  return VectorMap{values.data()};
33 }
34 
36  radius, setRadius )
37 
38 float xAOD::SpacePoint_v1::x() const
39 {
40  return globalPosAcc(*this)[0];
41 }
42 
43 float xAOD::SpacePoint_v1::y() const
44 {
45  return globalPosAcc(*this)[1];
46 }
47 
48 float xAOD::SpacePoint_v1::z() const
49 {
50  return globalPosAcc(*this)[2];
51 }
52 
54  varianceR, setVarianceR )
55 
57  varianceZ, setVarianceZ )
58 
59 // replace by handwritten version to avoid vector copy
60 // AUXSTORE_OBJECT_SETTER_AND_GETTER( xAOD::SpacePoint_v1, std::vector< const xAOD::UncalibratedMeasurement* >,
61 // measurements, setMeasurements )
62 
63 const std::vector< const xAOD::UncalibratedMeasurement* > & xAOD::SpacePoint_v1::measurements() const {
64  static const Accessor< std::vector< const xAOD::UncalibratedMeasurement* > > acc( "measurements" );
65  return acc( *this );
66 }
67 void xAOD::SpacePoint_v1::setMeasurements(std::vector< const xAOD::UncalibratedMeasurement* > && value ) {
68  static const Accessor< std::vector< const xAOD::UncalibratedMeasurement* > > acc( "measurements" );
69  acc( *this ) = std::move(value);
70 }
71 
73  topHalfStripLength, setTopHalfStripLength )
74 
76  bottomHalfStripLength, setBottomHalfStripLength )
77 
78 static const SG::AuxElement::Accessor< xAOD::ArrayFloat3 > topStripDirectionAcc( "topStripDirection" );
79 static const SG::AuxElement::Accessor< xAOD::ArrayFloat3 > bottomStripDirectionAcc( "bottomStripDirection" );
80 static const SG::AuxElement::Accessor< xAOD::ArrayFloat3 > stripCenterDistanceAcc( "stripCenterDistance" );
81 static const SG::AuxElement::Accessor< xAOD::ArrayFloat3 > topStripCenterAcc( "topStripCenter" );
82 
84  const auto& values = topStripDirectionAcc(*this);
85  return ConstVectorMap{values.data()};
86 }
87 
89  const auto& values = bottomStripDirectionAcc(*this);
90  return ConstVectorMap{values.data()};
91 }
92 
94  const auto& values = stripCenterDistanceAcc(*this);
95  return ConstVectorMap{values.data()};
96 }
97 
99  const auto& values = topStripCenterAcc(*this);
100  return ConstVectorMap{values.data()};
101 }
102 
104  auto& values = topStripDirectionAcc(*this);
105  return VectorMap{values.data()};
106 }
107 
109  auto& values = bottomStripDirectionAcc(*this);
110  return VectorMap{values.data()};
111 }
112 
114  auto& values = stripCenterDistanceAcc(*this);
115  return VectorMap{values.data()};
116 }
117 
119  auto& values = topStripCenterAcc(*this);
120  return VectorMap{values.data()};
121 }
122 
124  const Eigen::Matrix<float,3,1>& globPos,
125  float cov_r, float cov_z,
126  std::vector< const xAOD::UncalibratedMeasurement* >&& measurements)
127 {
128  this->setElementIdList({idHash});
129  this->globalPosition() = globPos;
130  this->setRadius( std::sqrt( globPos(0,0) * globPos(0,0) + globPos(1,0) * globPos(1,0) ) );
131  this->setVarianceR(cov_r);
132  this->setVarianceZ(cov_z);
133  this->setMeasurements(std::move(measurements));
134 }
135 
136 void xAOD::SpacePoint_v1::setSpacePoint(std::vector<DetectorIDHashType>&& idHashes,
137  const Eigen::Matrix<float,3,1>& globPos,
138  float cov_r, float cov_z,
139  std::vector< const xAOD::UncalibratedMeasurement* >&& measurements,
140  float topHalfStripLength,
141  float bottomHalfStripLength,
142  const Eigen::Matrix<float,3,1>& topStripDirection,
143  const Eigen::Matrix<float,3,1>& bottomStripDirection,
144  const Eigen::Matrix<float,3,1>& stripCenterDistance,
145  const Eigen::Matrix<float,3,1>& topStripCenter)
146 {
147  this->setElementIdList(std::move(idHashes));
148  this->globalPosition() = globPos;
149  this->setRadius( std::sqrt( globPos(0,0) * globPos(0,0) + globPos(1,0) * globPos(1,0) ) );
150  this->setVarianceR(cov_r);
151  this->setVarianceZ(cov_z);
152  this->setMeasurements(std::move(measurements));
153 
154  this->setTopHalfStripLength(topHalfStripLength);
155  this->setBottomHalfStripLength(bottomHalfStripLength);
156 
157  this->topStripDirection() = topStripDirection;
158  this->bottomStripDirection() = bottomStripDirection;
159  this->stripCenterDistance() = stripCenterDistance;
160  this->topStripCenter() = topStripCenter;
161 }
162 
xAOD::AUXSTORE_PRIMITIVE_SETTER_AND_GETTER
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, IP2D_pb, setIP2D_pb) AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1
xAOD::SpacePoint_v1::stripCenterDistance
ConstVectorMap stripCenterDistance() const
Definition: SpacePoint_v1.cxx:93
xAOD::SpacePoint_v1::topStripDirection
ConstVectorMap topStripDirection() const
Definition: SpacePoint_v1.cxx:83
xAOD::SpacePoint_v1::elementIdList
const std::vector< DetectorIDHashType > & elementIdList() const
Returns the IdentifierHash of the spacepoint (corresponds to the detector element IdentifierHash)
Definition: SpacePoint_v1.cxx:14
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
AuxStoreAccessorMacros.h
SpacePoint_v1.h
xAOD::SpacePoint_v1::globalPosition
ConstVectorMap globalPosition() const
Returns the global position of the pixel cluster.
Definition: SpacePoint_v1.cxx:25
xAOD::SpacePoint_v1::ConstVectorMap
Eigen::Map< const Eigen::Matrix< float, 3, 1 > > ConstVectorMap
Definition: SpacePoint_v1.h:31
athena.value
value
Definition: athena.py:124
xAOD::SpacePoint_v1
Definition: SpacePoint_v1.h:29
xAOD::SpacePoint_v1::z
float z() const
xAOD::SpacePoint_v1::bottomStripDirection
ConstVectorMap bottomStripDirection() const
Definition: SpacePoint_v1.cxx:88
xAOD::SpacePoint_v1::VectorMap
Eigen::Map< Eigen::Matrix< float, 3, 1 > > VectorMap
Definition: SpacePoint_v1.h:32
xAOD::SpacePoint_v1::setSpacePoint
void setSpacePoint(DetectorIDHashType idHash, const Eigen::Matrix< float, 3, 1 > &globPos, float cov_r, float cov_z, std::vector< const xAOD::UncalibratedMeasurement * > &&measurementIndexes)
Definition: SpacePoint_v1.cxx:123
AthenaPoolTestRead.acc
acc
Definition: AthenaPoolTestRead.py:16
xAOD::SpacePoint_v1::measurements
const std::vector< const xAOD::UncalibratedMeasurement * > & measurements() const
Returns the index of the measurements.
xAOD::SpacePoint_v1::setMeasurements
void setMeasurements(std::vector< const xAOD::UncalibratedMeasurement * > &&value)
Sets the index of the measurements.
xAOD::DetectorIDHashType
unsigned int DetectorIDHashType
@ detector ID element hash
Definition: MeasurementDefs.h:43
xAOD::SpacePoint_v1::y
float y() const
ParticleGun_SamplingFraction.radius
radius
Definition: ParticleGun_SamplingFraction.py:96
xAOD::SpacePoint_v1::x
float x() const
xAOD::SpacePoint_v1::topStripCenter
ConstVectorMap topStripCenter() const
Definition: SpacePoint_v1.cxx:98
xAOD::SpacePoint_v1::setElementIdList
void setElementIdList(std::vector< DetectorIDHashType > &&idHash)
Sets the IdentifierHash of the measurement (corresponds to the detector element IdentifierHash)
Definition: SpacePoint_v1.cxx:18