5#if defined(FLATTEN) && defined(__GNUC__)
7#pragma GCC optimize "-fno-var-tracking-assignments"
17#include <unordered_map>
23 const std::string& name,
24 const IInterface* parent)
25 : base_class(
type, name, parent)
43 const std::vector<Acts::Experimental::GbtsLayerDescription>& layers =
50 ATH_MSG_ERROR(
"Neither pixel nor strip layers are enabled, there is "
51 "nothing to seed on.");
52 return StatusCode::FAILURE;
55 std::vector<Acts::Experimental::GbtsLayerConnection> connections;
56 float etaBinWidth = 0.0f;
71 auto gbtsGeo = std::make_shared<Acts::Experimental::GbtsGeometry>(
72 layers, connections, etaBinWidth, Acts::Experimental::GbtsZ0Range{},
logger());
74 m_finder = Acts::Experimental::GraphBasedTrackSeeder(
75 Acts::Experimental::GraphBasedTrackSeeder::DerivedConfig(
m_finderCfg),
76 gbtsGeo,
logger().cloneWithSuffix(
"gbtsFinder"));
79 logger().cloneWithSuffix(
"gbtsGraphBuilder"));
83 return StatusCode::SUCCESS;
88 const EventContext& ctx,
89 const std::vector<const xAOD::SpacePointContainer*>& spacePointCollections,
90 const Eigen::Vector3f& beamSpotPos,
float bFieldInZ,
96 const Acts::Experimental::GraphBasedTrackSeeder::Options options{
97 .bFieldInZ = bFieldInZ};
100 std::vector<const xAOD::SpacePoint*> tmpSpacePoints;
105 tmpSpacePoints.emplace_back(
sp);
111 Acts::Experimental::GbtsNodeStorage nodeStorage =
m_finder->makeNodeStorage();
117 std::size_t nPixelNodes = 0;
118 std::size_t nStripNodes = 0;
122 std::size_t nUnmappedHashes = 0;
123 std::size_t nUngroupedModules = 0;
126 for(std::size_t idx = 0; idx < tmpSpacePoints.size(); ++idx){
129 const std::vector<xAOD::DetectorIDHashType>& elementlist =
sp->elementIdList();
132 const bool isPixel(elementlist.size() == 1);
138 const std::vector<short>& hashToLayer =
140 const auto hash =
static_cast<std::size_t
>(elementlist[0]);
141 if (hash >= hashToLayer.size()) [[
unlikely]] {
146 const short layer = hashToLayer[hash];
153 float clusterWidth = 0.0f;
154 float localPositionY = 0.0f;
163 Acts::OuterStripSpacePointCalibrationDetails stripDetails{};
164 const Acts::OuterStripSpacePointCalibrationDetails*
strip =
nullptr;
167 Eigen::Map<Eigen::Vector3f>(stripDetails.outerCenter.data()) =
168 sp->topStripCenter() - Eigen::Vector3f(offsetX, offsetY, 0.0f);
169 Eigen::Map<Eigen::Vector3f>(stripDetails.innerToOuterSeparation.data()) =
170 sp->stripCenterDistance();
171 Eigen::Map<Eigen::Vector3f>(stripDetails.outerHalfVector.data()) =
172 sp->topHalfStripLength() *
sp->topStripDirection();
173 Eigen::Map<Eigen::Vector3f>(stripDetails.innerHalfVector.data()) =
174 sp->bottomHalfStripLength() *
sp->bottomStripDirection();
175 strip = &stripDetails;
178 const float x =
static_cast<float>(
sp->x()) - offsetX;
179 const float y =
static_cast<float>(
sp->y()) - offsetY;
180 const std::optional<std::uint32_t>
bin = nodeStorage.insert(
181 static_cast<Acts::SpacePointIndex
>(idx),
x,
y,
182 static_cast<float>(
sp->z()), std::hypot(
x,
y), std::atan2(
y,
x),
183 static_cast<Acts::Experimental::GbtsLayerIndex
>(layer), clusterWidth,
184 localPositionY,
strip);
186 if (
bin.has_value()) {
187 ++(isPixel ? nPixelNodes : nStripNodes);
191 ATH_MSG_DEBUG(
"Inserted " << nPixelNodes <<
" pixel and " << nStripNodes
192 <<
" strip nodes; the graph "
193 << (nodeStorage.hasStrips() ?
"carries" :
"does not carry")
196 if (nUnmappedHashes != 0) [[
unlikely]] {
197 ATH_MSG_WARNING(nUnmappedHashes <<
" space points sit on a wafer hash "
198 "outside the GBTS layer map and were dropped");
200 if (nUngroupedModules != 0) {
201 ATH_MSG_DEBUG(nUngroupedModules <<
" space points sit on a wafer GBTS "
202 "does not group into a layer");
206 nodeStorage.finalize();
210 Acts::SeedContainer seeds;
215 seedContainer.
reserve(seedContainer.
size() + seeds.size(), 7.0f);
216 for (
auto seed : seeds) {
219 [&](
const Acts::SpacePointIndex spIndex) {
220 return tmpSpacePoints[spIndex];
225 return StatusCode::SUCCESS;
229 Acts::Experimental::GbtsTauLookupTable& tauLookupTable)
const
231 std::ifstream lutStream(
m_lutFile.value());
232 if (!lutStream.is_open()) {
234 return StatusCode::FAILURE;
237 tauLookupTable.clear();
241 float clusterWidth = 0.0f;
242 Acts::Experimental::GbtsTauBounds bounds;
243 while (lutStream >> clusterWidth >> bounds.minTau >> bounds.maxTau >>
244 bounds.minTauNearEdge >> bounds.maxTauNearEdge) {
245 tauLookupTable.push_back(bounds);
248 if (!lutStream.eof()) {
251 return StatusCode::FAILURE;
253 if (tauLookupTable.empty()) {
255 return StatusCode::FAILURE;
258 ATH_MSG_DEBUG(
"Read " << tauLookupTable.size() <<
" rows of the GBTS tau lookup table "
261 return StatusCode::SUCCESS;
311 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
std::unique_ptr< const Acts::Logger > makeActsAthenaLogger(IMessageSvc *svc, const std::string &name, int level, std::optional< std::string > parent_name)
float widthInEta() const
Returns the width of the cluster in phi (x) and eta (y) directions, respectively.
ConstVectorMap< N > localPosition() const
Returns the local position of the measurement.
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
SpacePointContainer_v1 SpacePointContainer
Define the version of the space point container.
PixelCluster_v1 PixelCluster
Define the version of the pixel cluster class.
Seed push_back(SpacePointRange spacePoints, float quality, float vertexZ)
void reserve(std::size_t size, float averageSpacePoints=3) noexcept
std::size_t size() const noexcept