ATLAS Offline Software
Loading...
Searching...
No Matches
FPGATrackSimRoadUnionTool.cxx
Go to the documentation of this file.
1// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2
9
10
12//one of the includes are needed below or all of them dont know for sure
25
26#include <sstream>
27#include <cmath>
28#include <algorithm>
29
30FPGATrackSimRoadUnionTool::FPGATrackSimRoadUnionTool(const std::string& algname, const std::string &name, const IInterface *ifc) :
31 AthAlgTool(algname,name,ifc),
32 m_tools(this)
33{
34 declareProperty("tools", m_tools, "Array of FPGATrackSimRoadFinderTools");
35}
36
37
39{
40 // Retrieve
41 ATH_MSG_INFO("Using " << m_tools.size() << " tools");
42 ATH_CHECK(m_tools.retrieve());
43
44 if (m_tools.empty()) {
45 ATH_MSG_FATAL("initialize() Tool list empty");
46 return StatusCode::FAILURE;
47 }
48 return StatusCode::SUCCESS;
49}
50
51StatusCode FPGATrackSimRoadUnionTool::getRoads(const std::vector<std::shared_ptr<const FPGATrackSimHit>> & hits, std::vector<std::shared_ptr<const FPGATrackSimRoad>> & roads)
52{
54
55 // Create one "tower" per slice for this event.
57 for (unsigned ireg = 0; ireg < m_tools.size(); ireg++) {
59 m_slicedHitHeader->addTower(tower);
60 }
61 }
62
63 // We separately need to pass a vector of *pointers* to hit objects to the road finder tools.
64 // Makes a vector of slices that have a vector of hits assiociated with that slice
65 std::vector<std::vector<std::shared_ptr<const FPGATrackSimHit>>> sliceHits(m_tools.size());
66 const FPGATrackSimPlaneMap *pmap = nullptr;
67 int toolNum = 0;//same as sliceNum
68 for (auto &tool : m_tools) {
69 pmap = m_FPGATrackSimMapping->PlaneMap_1st(toolNum);
70 auto *subrmap = m_FPGATrackSimMapping->SubRegionMap();
71 for (auto & iHit:hits)
72 {
73 std::shared_ptr<FPGATrackSimHit> hitCopy = std::make_shared<FPGATrackSimHit>(*iHit);
74 pmap->map(*hitCopy);
75 if ((subrmap->isInRegion(tool->getSubRegion(), *hitCopy)) || m_noHitFilter) {
76 // Do we really need to do both of these? can we make the tower class produce a vector of shared pointers?
77 if (m_slicedHitHeader) m_slicedHitHeader->getTower(toolNum)->addHit(*hitCopy);
78 sliceHits[toolNum].push_back(hitCopy);
79 }
80 }
81 toolNum++;
82 }
83 roads.clear();
84 for (auto & tool : m_tools)
85 {
86 std::vector<std::shared_ptr<const FPGATrackSimRoad>> r;
87 ATH_CHECK(tool->getRoads(sliceHits[tool->getSubRegion()], r, *getTruthTracks()));
88 roads.insert(roads.end(), std::make_move_iterator(r.begin()), std::make_move_iterator(r.end()));
89 }
90
91
92 return StatusCode::SUCCESS;
93}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
: FPGATrackSim-specific class to represent an hit in the detector.
Implements road finding using a Hough transform.
Maps physical layers to logical layers.
Maps ITK module indices to FPGATrackSim regions.
Wrapper class to combine multiple road-finding tools.
This file declares a class that stores the module IDs of the sectors.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
void map(FPGATrackSimHit &hit) const
FPGATrackSimRoadUnionTool(const std::string &, const std::string &, const IInterface *)
FPGATrackSimLogicalEventInputHeader * m_slicedHitHeader
virtual StatusCode initialize() override
ToolHandleArray< IFPGATrackSimRoadFinderTool > m_tools
ServiceHandle< IFPGATrackSimMappingSvc > m_FPGATrackSimMapping
std::vector< FPGATrackSimTruthTrack > const * getTruthTracks()
StatusCode getRoads(const std::vector< std::shared_ptr< const FPGATrackSimHit > > &hits, std::vector< std::shared_ptr< const FPGATrackSimRoad > > &roads, std::vector< FPGATrackSimTruthTrack > const &truthtracks)
Gaudi::Property< bool > m_noHitFilter
int r
Definition globals.cxx:22