5 #include "Acts/Surfaces/PerigeeSurface.hpp"
14 const std::string&
name,
26 return StatusCode::SUCCESS;
33 std::vector<ActsTrk::ProtoTrack> & foundProtoTracks,
34 const std::vector<std::vector<FPGATrackSimHit>>& hitsInRoads,
35 const std::vector<FPGATrackSimRoad>& roads)
const {
37 ATH_MSG_INFO(
"Creating Acts proto-tracks from FPGA roads...");
39 if (hitsInRoads.size() > 0) {
40 std::multimap<xAOD::DetectorIDHashType, const xAOD::PixelCluster*> pixelClusterMap;
42 pixelClusterMap.emplace(cluster->identifierHash(), cluster);
45 std::multimap<IdentifierHash, const xAOD::StripCluster*> stripClusterMap;
47 stripClusterMap.emplace(cluster->identifierHash(), cluster);
50 for(
size_t roadIndex=0; roadIndex<=hitsInRoads.size()-1;roadIndex++) {
51 std::vector<ActsTrk::ATLASUncalibSourceLink>
points;
54 std::unique_ptr<Acts::BoundTrackParameters> inputPerigee =
makeParams(roads.at(roadIndex));
55 foundProtoTracks.emplace_back(
points, std::move(inputPerigee));
61 return StatusCode::SUCCESS;
67 std::vector<ActsTrk::ProtoTrack>& foundProtoTracks,
68 const std::vector<FPGATrackSimTrack>& tracks)
const {
70 ATH_MSG_INFO(
"Creating Acts proto-tracks from FPGA tracks...");
72 std::multimap<xAOD::DetectorIDHashType, const xAOD::PixelCluster*> pixelClusterMap;
74 pixelClusterMap.emplace(cluster->identifierHash(), cluster);
77 std::multimap<IdentifierHash, const xAOD::StripCluster*> stripClusterMap;
79 stripClusterMap.emplace(cluster->identifierHash(), cluster);
82 if (not
track.passedOR())
continue;
83 std::vector<ActsTrk::ATLASUncalibSourceLink>
points;
84 const std::vector <FPGATrackSimHit>&
hits =
track.getFPGATrackSimHits();
88 std::unique_ptr<Acts::BoundTrackParameters> inputPerigee =
makeParams(
track);
89 foundProtoTracks.emplace_back(
points, std::move(inputPerigee));
92 return StatusCode::SUCCESS;
98 const std::multimap<xAOD::DetectorIDHashType, const xAOD::PixelCluster*> & pixelClusterMap,
99 const std::multimap<IdentifierHash, const xAOD::StripCluster*> & stripClusterMap,
100 std::vector<ActsTrk::ATLASUncalibSourceLink>& measurements,
101 const std::vector <FPGATrackSimHit>&
hits)
const {
104 return StatusCode::FAILURE;
111 auto range = pixelClusterMap.equal_range(
h.getIdentifierHash());
116 else if (
h.isStrip()) {
118 auto range = stripClusterMap.equal_range(
h.getIdentifierHash());
125 return StatusCode::FAILURE;
132 return StatusCode::SUCCESS;
137 std::vector<Identifier>
ids;
142 ids.reserve(idHashVec.size());
146 for (
size_t i = 0;
i < idHashVec.size(); ++
i)
157 for (
size_t i = 0;
i < idHashVec.size(); ++
i)
169 template <
typename XAOD_CLUSTER>
171 const XAOD_CLUSTER& cluster,
173 std::vector<ActsTrk::ATLASUncalibSourceLink>& measurements,
176 std::vector<Identifier> rdoIDs;
182 const auto& rdoList = cluster.rdoList();
183 if (rdoIDs.size() != rdoList.size())
return StatusCode::SUCCESS;
184 size_t matchedCounter = 0;
186 if (
std::find(rdoList.begin(), rdoList.end(),
id) != rdoList.end()) matchedCounter++;
189 if (matchedCounter == rdoList.size()) {
192 else if (matchedCounter > 0) {
193 std::stringstream
ss;
194 ss <<
"List of xAOD cluster rdoIDs:\n";
197 ATH_MSG_ERROR(
std::format(
"Noticed rdoID mismatch: commonHits = {} | xAODClusterHits = {} | FPGAClusterHits = {}\n{}",
198 matchedCounter, rdoList.size(), rdoIDs.size(),
ss.str()));
199 return StatusCode::SUCCESS;
201 return StatusCode::SUCCESS;
205 using namespace Acts::UnitLiterals;
207 std::shared_ptr<const Acts::Surface> actsSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(Acts::Vector3(0., 0., 0.));
210 constexpr
double GeVToMeV = 1000;
216 double qop = (std::abs(road.
getY()) > 1
E-9) ? road.
getY()/GeVToMeV : 1
E-12;
223 Acts::BoundSquareMatrix
cov = Acts::BoundSquareMatrix::Identity();
224 cov *= (GeVToMeV*GeVToMeV);
229 Acts::PdgParticle absPdg = Acts::makeAbsolutePdgParticle(Acts::ePionPlus);
231 absPdg,
mass, Acts::AnyCharge{1.0f}};
233 return std::make_unique<Acts::BoundTrackParameters>(actsSurface,
params,
234 cov, actsHypothesis);
241 using namespace Acts::UnitLiterals;
242 std::shared_ptr<const Acts::Surface> actsSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(Acts::Vector3(0., 0., 0.));
245 constexpr
double GeVToMeV = 1000.;
251 double qopt=
track.getQOverPt()*GeVToMeV;
252 double pt=
track.getPt()/GeVToMeV;
257 double qop=((
p > 1
e-10) ? (1/
p) : 1e10);
258 if (qopt < 0) qop *= -1;
265 Acts::BoundSquareMatrix
cov = Acts::BoundSquareMatrix::Identity();
269 (
cov)(2,2) *= 0.0008;
270 (
cov)(3,3) *= 0.0008;
278 Acts::PdgParticle absPdg = Acts::makeAbsolutePdgParticle(Acts::ePionPlus);
280 absPdg,
mass, Acts::AnyCharge{1.0f}};
282 return std::make_unique<Acts::BoundTrackParameters>(actsSurface,
params,
283 cov, actsHypothesis);