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;
65 Acts::Experimental::GbtsAdaptiveTauRatioCuts tauRatioCuts;
68 Acts::Experimental::assignAdaptiveTauRatioCuts(connections, layers, tauRatioCuts);
77 auto gbtsGeo = std::make_shared<Acts::Experimental::GbtsGeometry>(
78 layers, connections, etaBinWidth, Acts::Experimental::GbtsZ0Range{},
logger());
80 m_finder = Acts::Experimental::GraphBasedTrackSeeder(
81 Acts::Experimental::GraphBasedTrackSeeder::DerivedConfig(
m_finderCfg),
82 gbtsGeo,
logger().cloneWithSuffix(
"gbtsFinder"));
85 logger().cloneWithSuffix(
"gbtsGraphBuilder"));
89 return StatusCode::SUCCESS;
94 const EventContext& ctx,
95 const std::vector<const xAOD::SpacePointContainer*>& spacePointCollections,
96 const Eigen::Vector3f& beamSpotPos,
float bFieldInZ,
102 const Acts::Experimental::GraphBasedTrackSeeder::Options options{
103 .bFieldInZ = bFieldInZ};
106 std::vector<const xAOD::SpacePoint*> tmpSpacePoints;
111 tmpSpacePoints.emplace_back(
sp);
117 Acts::Experimental::GbtsNodeStorage nodeStorage =
m_finder->makeNodeStorage();
123 std::size_t nPixelNodes = 0;
124 std::size_t nStripNodes = 0;
128 std::size_t nUnmappedHashes = 0;
129 std::size_t nUngroupedModules = 0;
132 for(std::size_t idx = 0; idx < tmpSpacePoints.size(); ++idx){
135 const std::vector<xAOD::DetectorIDHashType>& elementlist =
sp->elementIdList();
138 const bool isPixel(elementlist.size() == 1);
144 const std::vector<short>& hashToLayer =
146 const auto hash =
static_cast<std::size_t
>(elementlist[0]);
147 if (hash >= hashToLayer.size()) [[
unlikely]] {
152 const short layer = hashToLayer[hash];
159 float clusterWidth = 0.0f;
160 float localPositionY = 0.0f;
169 Acts::OuterStripSpacePointCalibrationDetails stripDetails{};
170 const Acts::OuterStripSpacePointCalibrationDetails*
strip =
nullptr;
173 Eigen::Map<Eigen::Vector3f>(stripDetails.outerCenter.data()) =
174 sp->topStripCenter() - Eigen::Vector3f(offsetX, offsetY, 0.0f);
175 Eigen::Map<Eigen::Vector3f>(stripDetails.innerToOuterSeparation.data()) =
176 sp->stripCenterDistance();
177 Eigen::Map<Eigen::Vector3f>(stripDetails.outerHalfVector.data()) =
178 sp->topHalfStripLength() *
sp->topStripDirection();
179 Eigen::Map<Eigen::Vector3f>(stripDetails.innerHalfVector.data()) =
180 sp->bottomHalfStripLength() *
sp->bottomStripDirection();
181 strip = &stripDetails;
184 const float x =
static_cast<float>(
sp->x()) - offsetX;
185 const float y =
static_cast<float>(
sp->y()) - offsetY;
186 const std::optional<std::uint32_t>
bin = nodeStorage.insert(
187 static_cast<Acts::SpacePointIndex
>(idx),
x,
y,
188 static_cast<float>(
sp->z()), std::hypot(
x,
y), std::atan2(
y,
x),
189 static_cast<Acts::Experimental::GbtsLayerIndex
>(layer), clusterWidth,
190 localPositionY,
strip);
192 if (
bin.has_value()) {
193 ++(isPixel ? nPixelNodes : nStripNodes);
197 ATH_MSG_DEBUG(
"Inserted " << nPixelNodes <<
" pixel and " << nStripNodes
198 <<
" strip nodes; the graph "
199 << (nodeStorage.hasStrips() ?
"carries" :
"does not carry")
202 if (nUnmappedHashes != 0) [[
unlikely]] {
203 ATH_MSG_WARNING(nUnmappedHashes <<
" space points sit on a wafer hash "
204 "outside the GBTS layer map and were dropped");
206 if (nUngroupedModules != 0) {
207 ATH_MSG_DEBUG(nUngroupedModules <<
" space points sit on a wafer GBTS "
208 "does not group into a layer");
212 nodeStorage.finalize();
216 Acts::SeedContainer seeds;
221 seedContainer.
reserve(seedContainer.
size() + seeds.size(), 7.0f);
222 for (
auto seed : seeds) {
225 [&](
const Acts::SpacePointIndex spIndex) {
226 return tmpSpacePoints[spIndex];
231 return StatusCode::SUCCESS;
235 Acts::Experimental::GbtsTauLookupTable& tauLookupTable)
const
237 std::ifstream lutStream(
m_lutFile.value());
238 if (!lutStream.is_open()) {
240 return StatusCode::FAILURE;
243 tauLookupTable.clear();
247 float clusterWidth = 0.0f;
248 Acts::Experimental::GbtsTauBounds bounds;
249 while (lutStream >> clusterWidth >> bounds.minTau >> bounds.maxTau >>
250 bounds.minTauNearEdge >> bounds.maxTauNearEdge) {
251 tauLookupTable.push_back(bounds);
254 if (!lutStream.eof()) {
257 return StatusCode::FAILURE;
259 if (tauLookupTable.empty()) {
261 return StatusCode::FAILURE;
264 ATH_MSG_DEBUG(
"Read " << tauLookupTable.size() <<
" rows of the GBTS tau lookup table "
267 return StatusCode::SUCCESS;
314 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