Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
FPGATrackSimRoadUnionTool.cxx
Go to the documentation of this file.
1 // Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
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 
30 FPGATrackSimRoadUnionTool::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 
51 StatusCode FPGATrackSimRoadUnionTool::getRoads(const std::vector<std::shared_ptr<const FPGATrackSimHit>> & hits, std::vector<std::shared_ptr<const FPGATrackSimRoad>> & roads)
52 {
53  ATH_CHECK(m_FPGATrackSimMapping.retrieve());
54 
55  // Create one "tower" per slice for this event.
56  if (m_slicedHitHeader) {
57  for (unsigned ireg = 0; ireg < m_tools.size(); ireg++) {
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 }
FPGATrackSimRoadUnionTool::m_slicedHitHeader
FPGATrackSimLogicalEventInputHeader * m_slicedHitHeader
Definition: FPGATrackSimRoadUnionTool.h:77
beamspotman.r
def r
Definition: beamspotman.py:676
getMenu.algname
algname
Definition: getMenu.py:54
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
TRTCalib_Extractor.hits
hits
Definition: TRTCalib_Extractor.py:35
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
FPGATrackSimPlaneMap.h
Maps physical layers to logical layers.
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
FPGATrackSimTowerInputHeader.h
IFPGATrackSimMappingSvc.h
FPGATrackSimRoadUnionTool::getTruthTracks
std::vector< FPGATrackSimTruthTrack > const * getTruthTracks()
Definition: FPGATrackSimRoadUnionTool.h:51
FPGATrackSimHoughTransformTool.h
Implements road finding using a Hough transform.
FPGATrackSimRoadUnionTool::getRoads
StatusCode getRoads(const std::vector< std::shared_ptr< const FPGATrackSimHit >> &hits, std::vector< std::shared_ptr< const FPGATrackSimRoad >> &roads, std::vector< FPGATrackSimTruthTrack > const &truthtracks)
Definition: FPGATrackSimRoadUnionTool.h:41
FPGATrackSimRoadUnionTool::m_FPGATrackSimMapping
ServiceHandle< IFPGATrackSimMappingSvc > m_FPGATrackSimMapping
Definition: FPGATrackSimRoadUnionTool.h:71
FPGATrackSimConstants.h
FPGATrackSimTowerInputHeader::addHit
void addHit(const FPGATrackSimHit &s)
Definition: FPGATrackSimTowerInputHeader.h:48
FPGATrackSimRegionMap.h
Maps ITK module indices to FPGATrackSim regions.
FPGATrackSimLogicalEventInputHeader::getTower
FPGATrackSimTowerInputHeader * getTower(size_t index)
Definition: FPGATrackSimLogicalEventInputHeader.h:39
FPGATrackSimPlaneMap::map
void map(FPGATrackSimHit &hit) const
Definition: FPGATrackSimPlaneMap.cxx:234
FPGATrackSimRoadUnionTool::m_noHitFilter
Gaudi::Property< bool > m_noHitFilter
Definition: FPGATrackSimRoadUnionTool.h:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
FPGATrackSimRoadUnionTool::FPGATrackSimRoadUnionTool
FPGATrackSimRoadUnionTool(const std::string &, const std::string &, const IInterface *)
Definition: FPGATrackSimRoadUnionTool.cxx:30
FPGATrackSimLogicalEventInputHeader::addTower
void addTower(const FPGATrackSimTowerInputHeader &s)
Definition: FPGATrackSimLogicalEventInputHeader.h:38
FPGATrackSimRoadUnionTool::initialize
virtual StatusCode initialize() override
Definition: FPGATrackSimRoadUnionTool.cxx:38
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
FPGATrackSimPlaneMap
Definition: FPGATrackSimPlaneMap.h:62
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
FPGATrackSimHit.h
: FPGATrackSim-specific class to represent an hit in the detector.
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
IFPGATrackSimEventSelectionSvc.h
FPGATrackSimRoadUnionTool.h
Wrapper class to combine multiple road-finding tools.
IFPGATrackSimBankSvc.h
AthAlgTool
Definition: AthAlgTool.h:26
FPGATrackSimTowerInputHeader
Definition: FPGATrackSimTowerInputHeader.h:18
FPGATrackSimTypes.h
FPGATrackSimSectorBank.h
This file declares a class that stores the module IDs of the sectors.
FPGATrackSimRoadUnionTool::m_tools
ToolHandleArray< IFPGATrackSimRoadFinderTool > m_tools
Definition: FPGATrackSimRoadUnionTool.h:73