ATLAS Offline Software
Loading...
Searching...
No Matches
FPGAActsTrkConverter Class Reference

#include <FPGAActsTrkConverter.h>

Inheritance diagram for FPGAActsTrkConverter:
Collaboration diagram for FPGAActsTrkConverter:

Public Member Functions

 FPGAActsTrkConverter (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~FPGAActsTrkConverter ()=default
virtual StatusCode initialize () override final
virtual StatusCode findProtoTracks (const EventContext &ctx, const xAOD::PixelClusterContainer &pixelContainer, const xAOD::StripClusterContainer &stripContainer, std::vector< ActsTrk::ProtoTrack > &foundProtoTracks, const std::vector< FPGATrackSimRoad > &roads) const override final
virtual StatusCode findProtoTracks (const EventContext &ctx, const xAOD::PixelClusterContainer &pixelContainer, const xAOD::StripClusterContainer &stripContainer, std::vector< ActsTrk::ProtoTrack > &foundProtoTracks, const std::vector< FPGATrackSimTrack > &tracks) const override final

Protected Member Functions

std::unique_ptr< Acts::BoundTrackParameters > makeParams (const FPGATrackSimRoad &road) const
std::unique_ptr< Acts::BoundTrackParameters > makeParams (const FPGATrackSimTrack &track) const
template<typename XAOD_CLUSTER>
StatusCode matchTrackMeasurements (const EventContext &ctx, const XAOD_CLUSTER &cluster, const FPGATrackSimHit &trackHit, std::vector< const xAOD::UncalibratedMeasurement * > &measurements, const DataVector< XAOD_CLUSTER > &clusterContainer) const

Private Attributes

const PixelIDm_pixelId {nullptr}
const SCT_IDm_SCTId {nullptr}

Detailed Description

Definition at line 17 of file FPGAActsTrkConverter.h.

Constructor & Destructor Documentation

◆ FPGAActsTrkConverter()

FPGAActsTrkConverter::FPGAActsTrkConverter ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 12 of file FPGAActsTrkConverter.cxx.

14 : base_class(type,name,parent) { }

◆ ~FPGAActsTrkConverter()

virtual FPGAActsTrkConverter::~FPGAActsTrkConverter ( )
virtualdefault

Member Function Documentation

◆ findProtoTracks() [1/2]

StatusCode FPGAActsTrkConverter::findProtoTracks ( const EventContext & ctx,
const xAOD::PixelClusterContainer & pixelContainer,
const xAOD::StripClusterContainer & stripContainer,
std::vector< ActsTrk::ProtoTrack > & foundProtoTracks,
const std::vector< FPGATrackSimRoad > & roads ) const
finaloverridevirtual

Definition at line 29 of file FPGAActsTrkConverter.cxx.

33 {
34
35 ATH_MSG_INFO("Creating Acts proto-tracks from FPGA roads...");
36
37 if (roads.size() > 0) {
38 std::unordered_map<xAOD::DetectorIdentType, const xAOD::PixelCluster*> pixelClusterMap;
39 for (const xAOD::PixelCluster* cluster : pixelContainer) {
40 pixelClusterMap.emplace(cluster->identifier(), cluster);
41 }
42
43 std::unordered_map<xAOD::DetectorIdentType, const xAOD::StripCluster*> stripClusterMap;
44 for (const xAOD::StripCluster* cluster : stripContainer) {
45 stripClusterMap.emplace(cluster->identifier(), cluster);
46
47 }
48 for (const FPGATrackSimRoad& road : roads) {
49 std::vector<const xAOD::UncalibratedMeasurement* > points;
50
51 // Process measurements directly from road's shared_ptr hits
52 for (size_t l = 0; l < road.getNLayers(); ++l) {
53 for (const auto& layerH : road.getHitPtrs(l)) {
54 if (!layerH || !layerH->isReal()) continue;
55
56 if (layerH->isPixel()) {
57 ATH_MSG_DEBUG("Looking for Pixel cluster to match");
58 auto it = pixelClusterMap.find(layerH->getRdoIdentifier());
59 if (it != pixelClusterMap.end()) {
60 ATH_CHECK(matchTrackMeasurements<xAOD::PixelCluster>(ctx, *(it->second), *layerH, points, pixelContainer));
61 }
62 }
63 else if (layerH->isStrip()) {
64 ATH_MSG_DEBUG("Looking for Strip cluster to match");
65 auto it = stripClusterMap.find(layerH->getRdoIdentifier());
66 if (it != stripClusterMap.end()) {
67 ATH_CHECK(matchTrackMeasurements<xAOD::StripCluster>(ctx, *(it->second), *layerH, points, stripContainer));
68 }
69 }
70 else {
71 ATH_MSG_ERROR("FPGA hit not classified as pixel or strip");
72 return StatusCode::FAILURE;
73 }
74 }
75 }
76
77 if (points.size()) {
78 std::unique_ptr<Acts::BoundTrackParameters> inputPerigee = makeParams(road);
79 foundProtoTracks.emplace_back(points, std::move(inputPerigee));
80 ATH_MSG_INFO("Made a prototrack with " << points.size() << " measurements");
81 }
82 }
83 }
84
85 return StatusCode::SUCCESS;
86}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
StatusCode matchTrackMeasurements(const EventContext &ctx, const XAOD_CLUSTER &cluster, const FPGATrackSimHit &trackHit, std::vector< const xAOD::UncalibratedMeasurement * > &measurements, const DataVector< XAOD_CLUSTER > &clusterContainer) const
std::unique_ptr< Acts::BoundTrackParameters > makeParams(const FPGATrackSimRoad &road) const
l
Printing final latex table to .tex output file.
StripCluster_v1 StripCluster
Define the version of the strip cluster class.
PixelCluster_v1 PixelCluster
Define the version of the pixel cluster class.

◆ findProtoTracks() [2/2]

StatusCode FPGAActsTrkConverter::findProtoTracks ( const EventContext & ctx,
const xAOD::PixelClusterContainer & pixelContainer,
const xAOD::StripClusterContainer & stripContainer,
std::vector< ActsTrk::ProtoTrack > & foundProtoTracks,
const std::vector< FPGATrackSimTrack > & tracks ) const
finaloverridevirtual

Definition at line 88 of file FPGAActsTrkConverter.cxx.

92 {
93
94 ATH_MSG_INFO("Creating Acts proto-tracks from FPGA tracks...");
95 // Initialize unordered maps for pixel and strip clusters
96 std::unordered_map<xAOD::DetectorIdentType, const xAOD::PixelCluster*> pixelClusterMap;
97 for (const xAOD::PixelCluster* cluster : pixelContainer) {
98 pixelClusterMap.emplace(cluster->identifier(), cluster);
99 }
100
101 std::unordered_map<xAOD::DetectorIdentType, const xAOD::StripCluster*> stripClusterMap;
102 for (const xAOD::StripCluster* cluster : stripContainer) {
103 stripClusterMap.emplace(cluster->identifier(), cluster);
104 }
105 for (const FPGATrackSimTrack& track : tracks) {
106 if (not track.passedOR()) continue;
107 std::vector<const xAOD::UncalibratedMeasurement* > points;
108 const auto& hits = track.getFPGATrackSimHitPtrs();
109 for (const auto& hit : hits) {
110 if (!hit->isReal()) continue;
111
112 if (hit->isPixel()) {
113 ATH_MSG_DEBUG("Looking for Pixel cluster to match");
114 auto it = pixelClusterMap.find(hit->getRdoIdentifier());
115 if (it != pixelClusterMap.end()) {
116 ATH_CHECK(matchTrackMeasurements<xAOD::PixelCluster>(ctx, *(it->second), *hit, points, pixelContainer));
117 }
118 }
119 else if (hit->isStrip()) {
120 ATH_MSG_DEBUG("Looking for Strip cluster to match");
121 auto it = stripClusterMap.find(hit->getRdoIdentifier());
122 if (it != stripClusterMap.end()) {
123 ATH_CHECK(matchTrackMeasurements<xAOD::StripCluster>(ctx, *(it->second), *hit, points, stripContainer));
124 }
125 }
126 else {
127 ATH_MSG_ERROR("FPGA hit not classified as pixel or strip");
128 return StatusCode::FAILURE;
129 }
130 }
131
132 if (points.size()) {
133 ATH_MSG_DEBUG("\tMaking a proto-track with " << points.size() << " clusters");
134 std::unique_ptr<Acts::BoundTrackParameters> inputPerigee = makeParams(track);
135 foundProtoTracks.emplace_back(points, std::move(inputPerigee));
136 }
137 }
138 return StatusCode::SUCCESS;
139}

◆ initialize()

StatusCode FPGAActsTrkConverter::initialize ( )
finaloverridevirtual

Definition at line 17 of file FPGAActsTrkConverter.cxx.

17 {
18
19 ATH_MSG_DEBUG("Initializing FPGAActsTrkConverter...");
20
21 // Get SCT & pixel Identifier helpers
22 ATH_CHECK(detStore()->retrieve(m_pixelId, "PixelID"));
23 ATH_CHECK(detStore()->retrieve(m_SCTId, "SCT_ID"));
24
25 return StatusCode::SUCCESS;
26
27}

◆ makeParams() [1/2]

std::unique_ptr< Acts::BoundTrackParameters > FPGAActsTrkConverter::makeParams ( const FPGATrackSimRoad & road) const
protected

Definition at line 161 of file FPGAActsTrkConverter.cxx.

161 {
162 using namespace Acts::UnitLiterals;
163
164 std::shared_ptr<const Acts::Surface> actsSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(Acts::Vector3(0., 0., 0.));
165 Acts::BoundVector params;
166
167 constexpr double GeVToMeV = 1000;
168 double d0=0.; //?
169 double z0=0.; //?
170 double phi=road.getX();
171 double eta=0.2;
172 double theta=2*std::atan(std::exp(-eta));
173 double qop = (std::abs(road.getY()) > 1E-9) ? road.getY()/GeVToMeV : 1E-12;
174 double t=0.; //?
175 ATH_MSG_DEBUG("\tphi=" <<phi << " eta=" << eta << " qop=" << qop);
176
177 params << d0, z0, phi, theta, qop, t;
178
179 // Covariance - TODO
180 Acts::BoundMatrix cov = Acts::BoundMatrix::Identity();
181 cov *= (GeVToMeV*GeVToMeV);
182
183 // some ACTS paperwork
185 float mass = Trk::ParticleMasses::mass[hypothesis] * Acts::UnitConstants::MeV;
186 Acts::PdgParticle absPdg = Acts::makeAbsolutePdgParticle(Acts::ePionPlus);
187 Acts::ParticleHypothesis actsHypothesis{
188 absPdg, mass, 1.0f};
189
190 return std::make_unique<Acts::BoundTrackParameters>(actsSurface, params,
191 cov, actsHypothesis);
192
193}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
Scalar theta() const
theta method
float getY() const
float getX() const
void GeVToMeV(HepMC::GenEvent *evt)
constexpr double mass[PARTICLEHYPOTHESES]
the array of masses
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.

◆ makeParams() [2/2]

std::unique_ptr< Acts::BoundTrackParameters > FPGAActsTrkConverter::makeParams ( const FPGATrackSimTrack & track) const
protected

Definition at line 196 of file FPGAActsTrkConverter.cxx.

196 {
197
198 using namespace Acts::UnitLiterals;
199 std::shared_ptr<const Acts::Surface> actsSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(Acts::Vector3(0., 0., 0.));
200 Acts::BoundVector params;
201
202 constexpr double GeVToMeV = 1000.;
203 double d0=track.getD0();
204 double z0=track.getZ0();
205 double phi=track.getPhi();
206 double eta=track.getEta();
207 double theta=track.getTheta();
208 double qopt=track.getQOverPt()*GeVToMeV;
209 double pt=track.getPt()/GeVToMeV;
210 double px=pt*std::cos(phi);
211 double py=pt*std::sin(phi);
212 double pz=pt*std::sinh(eta);
213 double p=std::sqrt(px*px+py*py+pz*pz);
214 double qop=((p > 1e-10) ? (1/p) : 1e10);
215 if (qopt < 0) qop *= -1;
216 double t=0.;
217
218 params << d0, z0, phi, theta, qop, t;
219 ATH_MSG_DEBUG("\td0= " << d0 << " z0=" <<z0 << " phi=" <<phi << " theta=" << theta<< " qoverp=" << qop);
220
221 // Covariance - let's be honest and say we have no clue ;-)
222 Acts::BoundMatrix cov = Acts::BoundMatrix::Identity();
223
224 (cov)(0,0) *= 0.16; // d0: 0.4 **2 (conservative)
225 (cov)(1,1) *= 25; // z0: 5**2 = 25 (conservative)
226 (cov)(2,2) *= 0.0008; // phi: 0.02**2 = 0.0004, increase a bit = double
227 (cov)(3,3) *= 0.0008; // width in eta is nearly 0.2, but width in theta = 2*atan(e^-eta) will vary. Take biggest one, which is at eta of 0 when width is 0.02, so get 0.02**2 = 0.0004, increase a bit = double
228 (cov)(4,4) *= 0.36; // qop also varies with eta. Error on q/pt conservatively = 0.0003 in mev ^-1, or 0.3 in gev ^-1, double to start giving us 0.6. then square that to get 0.36
229
230
231
232 // some ACTS paperwork
234 float mass = Trk::ParticleMasses::mass[hypothesis] * Acts::UnitConstants::MeV;
235 Acts::PdgParticle absPdg = Acts::makeAbsolutePdgParticle(Acts::ePionPlus);
236 Acts::ParticleHypothesis actsHypothesis{
237 absPdg, mass, 1.0f};
238
239 return std::make_unique<Acts::BoundTrackParameters>(actsSurface, params,
240 cov, actsHypothesis);
241
242}

◆ matchTrackMeasurements()

template<typename XAOD_CLUSTER>
StatusCode FPGAActsTrkConverter::matchTrackMeasurements ( const EventContext & ctx,
const XAOD_CLUSTER & cluster,
const FPGATrackSimHit & trackHit,
std::vector< const xAOD::UncalibratedMeasurement * > & measurements,
const DataVector< XAOD_CLUSTER > & clusterContainer ) const
protected

Definition at line 143 of file FPGAActsTrkConverter.cxx.

148{
149 const Identifier::value_type trackId = (trackHit.getHitType() == HitType::spacepoint)
150 ? trackHit.getOriginalHit().getRdoIdentifier()
151 : trackHit.getRdoIdentifier();
152
153 if(cluster.identifier() == trackId) {
154 measurements.emplace_back(clusterContainer.at(cluster.index()));
155 ATH_MSG_DEBUG("Matched FPGATrackSimHit to xAOD cluster");
156 }
157
158 return StatusCode::SUCCESS;
159}
const T * at(size_type n) const
Access an element, as an rvalue.
Identifier::value_type getRdoIdentifier() const
const FPGATrackSimHit getOriginalHit() const
HitType getHitType() const

Member Data Documentation

◆ m_pixelId

const PixelID* FPGAActsTrkConverter::m_pixelId {nullptr}
private

Definition at line 47 of file FPGAActsTrkConverter.h.

47{nullptr};

◆ m_SCTId

const SCT_ID* FPGAActsTrkConverter::m_SCTId {nullptr}
private

Definition at line 48 of file FPGAActsTrkConverter.h.

48{nullptr};

The documentation for this class was generated from the following files: