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,
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::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();
87 ATH_MSG_DEBUG(
"\tMaking a proto-track with " << points.size() <<
" clusters");
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::DetectorIdentType, const xAOD::PixelCluster*> & pixelClusterMap,
99 const std::multimap<xAOD::DetectorIdentType, 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.getRdoIdentifier());
112 for (
auto it = range.first; it != range.second; ++it) {
116 else if (
h.isStrip()) {
118 auto range = stripClusterMap.equal_range(
h.getRdoIdentifier());
119 for (
auto it = range.first; it != range.second; ++it) {
125 return StatusCode::FAILURE;
132 return StatusCode::SUCCESS;
136template <
typename XAOD_CLUSTER>
138 const XAOD_CLUSTER& cluster,
140 std::vector<ActsTrk::ATLASUncalibSourceLink>& measurements,
147 if(cluster.identifier() == trackId) {
152 return StatusCode::SUCCESS;
156 using namespace Acts::UnitLiterals;
158 std::shared_ptr<const Acts::Surface> actsSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(Acts::Vector3(0., 0., 0.));
159 Acts::BoundVector params;
161 constexpr double GeVToMeV = 1000;
166 double theta=2*std::atan(std::exp(-
eta));
167 double qop = (std::abs(road.
getY()) > 1E-9) ? road.
getY()/GeVToMeV : 1E-12;
171 params << d0, z0,
phi,
theta, qop, t;
174 Acts::BoundSquareMatrix cov = Acts::BoundSquareMatrix::Identity();
175 cov *= (GeVToMeV*GeVToMeV);
180 Acts::PdgParticle absPdg = Acts::makeAbsolutePdgParticle(Acts::ePionPlus);
181 Acts::ParticleHypothesis actsHypothesis{
182 absPdg, mass, Acts::AnyCharge{1.0f}};
184 return std::make_unique<Acts::BoundTrackParameters>(actsSurface, params,
185 cov, actsHypothesis);
192 using namespace Acts::UnitLiterals;
193 std::shared_ptr<const Acts::Surface> actsSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(Acts::Vector3(0., 0., 0.));
194 Acts::BoundVector params;
196 constexpr double GeVToMeV = 1000.;
197 double d0=track.getD0();
198 double z0=track.getZ0();
199 double phi=track.getPhi();
200 double eta=track.getEta();
201 double theta=track.getTheta();
202 double qopt=track.getQOverPt()*GeVToMeV;
203 double pt=track.getPt()/GeVToMeV;
204 double px=pt*std::cos(
phi);
205 double py=pt*std::sin(
phi);
206 double pz=pt*std::sinh(
eta);
207 double p=std::sqrt(px*px+py*py+pz*pz);
208 double qop=((p > 1e-10) ? (1/p) : 1e10);
209 if (qopt < 0) qop *= -1;
212 params << d0, z0,
phi,
theta, qop, t;
213 ATH_MSG_DEBUG(
"\td0= " << d0 <<
" z0=" <<z0 <<
" phi=" <<
phi <<
" theta=" <<
theta<<
" qoverp=" << qop);
216 Acts::BoundSquareMatrix cov = Acts::BoundSquareMatrix::Identity();
220 (cov)(2,2) *= 0.0008;
221 (cov)(3,3) *= 0.0008;
229 Acts::PdgParticle absPdg = Acts::makeAbsolutePdgParticle(Acts::ePionPlus);
230 Acts::ParticleHypothesis actsHypothesis{
231 absPdg, mass, Acts::AnyCharge{1.0f}};
233 return std::make_unique<Acts::BoundTrackParameters>(actsSurface, params,
234 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.
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 std::vector< FPGATrackSimHit > &hits) const
virtual StatusCode findProtoTracks(const EventContext &ctx, const xAOD::PixelClusterContainer &pixelContainer, const xAOD::StripClusterContainer &stripContainer, std::vector< ActsTrk::ProtoTrack > &foundProtoTracks, const std::vector< std::vector< FPGATrackSimHit > > &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.