5#include "Acts/Surfaces/PerigeeSurface.hpp"
14 const std::string& name,
15 const IInterface* parent): base_class(
type,name,parent) { }
26 return StatusCode::SUCCESS;
33 std::vector<ActsTrk::ProtoTrack> & foundProtoTracks,
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::DetectorIdentType, const xAOD::PixelCluster*> pixelClusterMap;
42 pixelClusterMap.emplace(cluster->identifier(), cluster);
45 std::multimap<xAOD::DetectorIdentType, const xAOD::StripCluster*> stripClusterMap;
47 stripClusterMap.emplace(cluster->identifier(), 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));
56 ATH_MSG_INFO(
"Made a prototrack with " << points.size() <<
" measurements");
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::DetectorIdentType, const xAOD::PixelCluster*> pixelClusterMap;
74 pixelClusterMap.emplace(cluster->identifier(), cluster);
77 std::multimap<xAOD::DetectorIdentType, const xAOD::StripCluster*> stripClusterMap;
79 stripClusterMap.emplace(cluster->identifier(), cluster);
82 if (not track.passedOR())
continue;
83 std::vector<ActsTrk::ATLASUncalibSourceLink> points;
84 const std::vector <FPGATrackSimHit>& hits = track.getFPGATrackSimHits();
85 auto hitCollection = std::make_unique<FPGATrackSimHitCollection>();
86 hitCollection->reserve(hits.size());
87 for (
const auto& hit : hits) {
92 ATH_MSG_DEBUG(
"\tMaking a proto-track with " << points.size() <<
" clusters");
93 std::unique_ptr<Acts::BoundTrackParameters> inputPerigee =
makeParams(track);
94 foundProtoTracks.emplace_back(points, std::move(inputPerigee));
97 return StatusCode::SUCCESS;
103 const std::multimap<xAOD::DetectorIdentType, const xAOD::PixelCluster*> & pixelClusterMap,
104 const std::multimap<xAOD::DetectorIdentType, const xAOD::StripCluster*> & stripClusterMap,
105 std::vector<ActsTrk::ATLASUncalibSourceLink>& measurements,
109 return StatusCode::FAILURE;
116 auto range = pixelClusterMap.equal_range(
h->getRdoIdentifier());
117 for (
auto it = range.first; it != range.second; ++it) {
121 else if (
h->isStrip()) {
123 auto range = stripClusterMap.equal_range(
h->getRdoIdentifier());
124 for (
auto it = range.first; it != range.second; ++it) {
130 return StatusCode::FAILURE;
137 return StatusCode::SUCCESS;
141template <
typename XAOD_CLUSTER>
143 const XAOD_CLUSTER& cluster,
145 std::vector<ActsTrk::ATLASUncalibSourceLink>& measurements,
152 if(cluster.identifier() == trackId) {
157 return StatusCode::SUCCESS;
161 using namespace Acts::UnitLiterals;
163 std::shared_ptr<const Acts::Surface> actsSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(Acts::Vector3(0., 0., 0.));
164 Acts::BoundVector params;
166 constexpr double GeVToMeV = 1000;
171 double theta=2*std::atan(std::exp(-
eta));
172 double qop = (std::abs(road.
getY()) > 1E-9) ? road.
getY()/GeVToMeV : 1E-12;
176 params << d0, z0,
phi,
theta, qop, t;
179 Acts::BoundSquareMatrix cov = Acts::BoundSquareMatrix::Identity();
180 cov *= (GeVToMeV*GeVToMeV);
185 Acts::PdgParticle absPdg = Acts::makeAbsolutePdgParticle(Acts::ePionPlus);
186 Acts::ParticleHypothesis actsHypothesis{
187 absPdg, mass, Acts::AnyCharge{1.0f}};
189 return std::make_unique<Acts::BoundTrackParameters>(actsSurface, params,
190 cov, actsHypothesis);
197 using namespace Acts::UnitLiterals;
198 std::shared_ptr<const Acts::Surface> actsSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(Acts::Vector3(0., 0., 0.));
199 Acts::BoundVector params;
201 constexpr double GeVToMeV = 1000.;
202 double d0=track.getD0();
203 double z0=track.getZ0();
204 double phi=track.getPhi();
205 double eta=track.getEta();
206 double theta=track.getTheta();
207 double qopt=track.getQOverPt()*GeVToMeV;
208 double pt=track.getPt()/GeVToMeV;
209 double px=pt*std::cos(
phi);
210 double py=pt*std::sin(
phi);
211 double pz=pt*std::sinh(
eta);
212 double p=std::sqrt(px*px+py*py+pz*pz);
213 double qop=((p > 1e-10) ? (1/p) : 1e10);
214 if (qopt < 0) qop *= -1;
217 params << d0, z0,
phi,
theta, qop, t;
218 ATH_MSG_DEBUG(
"\td0= " << d0 <<
" z0=" <<z0 <<
" phi=" <<
phi <<
" theta=" <<
theta<<
" qoverp=" << qop);
221 Acts::BoundSquareMatrix cov = Acts::BoundSquareMatrix::Identity();
225 (cov)(2,2) *= 0.0008;
226 (cov)(3,3) *= 0.0008;
234 Acts::PdgParticle absPdg = Acts::makeAbsolutePdgParticle(Acts::ePionPlus);
235 Acts::ParticleHypothesis actsHypothesis{
236 absPdg, mass, Acts::AnyCharge{1.0f}};
238 return std::make_unique<Acts::BoundTrackParameters>(actsSurface, params,
239 cov, actsHypothesis);
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
Scalar theta() const
theta method
#define ATH_CHECK
Evaluate an expression and check for errors.
DataVector< FPGATrackSimHit > FPGATrackSimHitCollection
std::vector< FPGATrackSimHitCollection > FPGATrackSimHitContainer
Header file for AthHistogramAlgorithm.
FPGAActsTrkConverter(const std::string &type, const std::string &name, const IInterface *parent)
StatusCode findPrototrackMeasurements(const EventContext &ctx, const xAOD::PixelClusterContainer &pixelClusterContainer, const xAOD::StripClusterContainer &stripClusterContainer, const std::multimap< xAOD::DetectorIdentType, const xAOD::PixelCluster * > &pixelClusterMap, const std::multimap< xAOD::DetectorIdentType, const xAOD::StripCluster * > &stripClusterMap, std::vector< ActsTrk::ATLASUncalibSourceLink > &measurements, const FPGATrackSimHitCollection &hits) const
virtual StatusCode findProtoTracks(const EventContext &ctx, const xAOD::PixelClusterContainer &pixelContainer, const xAOD::StripClusterContainer &stripContainer, std::vector< ActsTrk::ProtoTrack > &foundProtoTracks, const FPGATrackSimHitContainer &hitsInRoads, const std::vector< FPGATrackSimRoad > &roads) const override final
std::unique_ptr< Acts::BoundTrackParameters > makeParams(const FPGATrackSimRoad &road) const
const PixelID * m_pixelId
virtual StatusCode initialize() override final
StatusCode matchTrackMeasurements(const EventContext &ctx, const XAOD_CLUSTER &cluster, const FPGATrackSimHit &trackHit, std::vector< ActsTrk::ATLASUncalibSourceLink > &measurements, const DataVector< XAOD_CLUSTER > &clusterContainer) const
Identifier::value_type getRdoIdentifier() const
const FPGATrackSimHit getOriginalHit() const
HitType getHitType() const
ATLASUncalibSourceLink makeATLASUncalibSourceLink(const xAOD::UncalibratedMeasurementContainer *container, std::size_t index, const EventContext &ctx)
constexpr double mass[PARTICLEHYPOTHESES]
the array of masses
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.
PixelClusterContainer_v1 PixelClusterContainer
Define the version of the pixel cluster container.
StripCluster_v1 StripCluster
Define the version of the strip cluster class.
StripClusterContainer_v1 StripClusterContainer
Define the version of the strip cluster container.
PixelCluster_v1 PixelCluster
Define the version of the pixel cluster class.