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

#include <FPGADataFormatTool.h>

Inheritance diagram for FPGADataFormatTool:
Collaboration diagram for FPGADataFormatTool:

Public Member Functions

virtual StatusCode initialize () override
virtual StatusCode convertPixelHitsToFPGADataFormat (const PixelRDO_Container &pixelRDO, std::vector< uint64_t > &encodedData, const std::vector< IdentifierHash > &hashList, const EventContext &ctx) const override
 Covert the Pixel RDOs to the test vector format as requited by FPGA EF tracking alogrithms.
virtual StatusCode convertStripHitsToFPGADataFormat (const SCT_RDO_Container &stripRDO, std::vector< uint64_t > &encodedData, const std::vector< IdentifierHash > &hashList, const EventContext &ctx) const override
 Covert the Strip RDOs to the test vector format as requited by FPGA EF tracking alogrithms.
virtual StatusCode convertFPGATracksToFPGADataFormat (const FPGATrackSimTrackCollection *tracks, std::vector< uint64_t > &encodedData, const EventContext &ctx) const override
virtual StatusCode convertFPGASliceToFPGADataFormat (const FPGATrackSimHitCollection *hitsInSlices, bool doPixel, bool doStrip, std::vector< uint64_t > &encodedData, const EventContext &ctx) const override
virtual StatusCode convertFPGAHitsToFPGADataFormat (const FPGATrackSimHitCollection *allHits, bool doPixel, bool doStrip, std::vector< uint64_t > &encodedData, const EventContext &ctx) const override

Private Member Functions

StatusCode convertPixelRDO (const PixelRDO_Container &pixelRDO, std::vector< uint64_t > &encodedData, const std::vector< IdentifierHash > &hashList, const EventContext &ctx) const
StatusCode convertStripRDO (const SCT_RDO_Container &stripRDO, std::vector< uint64_t > &encodedData, const std::vector< IdentifierHash > &hashList, const EventContext &ctx) const
StatusCode convertFPGATracks (const FPGATrackSimTrackCollection *tracks, std::vector< uint64_t > &encodedData, const EventContext &ctx) const
StatusCode convertFPGASlices (const FPGATrackSimHitCollection *hitsInSlices, bool doPixel, bool doStrip, std::vector< uint64_t > &encodedData, const EventContext &ctx) const
StatusCode convertFPGAHits (const FPGATrackSimHitCollection *hits, bool doPixel, bool doStrip, std::vector< uint64_t > &encodedData, const EventContext &ctx) const
StatusCode fillHeader (std::vector< uint64_t > &encodedData) const
StatusCode fillFooter (std::vector< uint64_t > &encodedData) const
StatusCode fillModuleHeader (const InDetDD::SiDetectorElement *sielement, std::vector< uint64_t > &encodedData) const
void fillHit (const FPGATrackSimHit *hit, bool isLast, bool isLastofSlice, std::vector< uint64_t > &encodedData) const

Private Attributes

const PixelIDm_pixelId = nullptr
const SCT_IDm_sctId = nullptr
const InDetDD::SiDetectorManagerm_PIX_mgr = nullptr
const InDetDD::SiDetectorManagerm_SCT_mgr = nullptr

Detailed Description

Definition at line 21 of file FPGADataFormatTool.h.

Member Function Documentation

◆ convertFPGAHits()

StatusCode FPGADataFormatTool::convertFPGAHits ( const FPGATrackSimHitCollection * hits,
bool doPixel,
bool doStrip,
std::vector< uint64_t > & encodedData,
const EventContext & ctx ) const
private

Definition at line 152 of file FPGADataFormatTool.cxx.

158 {
159
160 ATH_MSG_DEBUG("Encodings Hits: ");
161
162 // first organize maps with hits group in module
163 std::map<unsigned int, std::vector<const FPGATrackSimHit*> > organizedHits;
164
165 for (size_t i = 0; i < allHits->size(); i++)
166 {
167 const FPGATrackSimHit& hit = *allHits->at(i);
168
169 if((doPixel && hit.isPixel()) || (doStrip && hit.isStrip()))
170 organizedHits[hit.getIdentifier()].push_back(&hit);
171 }
172
173 // encode the hits
174 for (const auto& hits: organizedHits)
175 {
176 const auto& firstHit = hits.second[0];
177 auto mod_w1 = FPGADataFormatUtilities::fill_M_HDR_w1 (FPGADataFormatUtilities::M_HDR_FLAG, firstHit->getIdentifier(), firstHit->getIdentifierHash(), 0);
178 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_M_HDR_w1(mod_w1));
179
180 unsigned int counter = 0;
181 for(const auto& hit: hits.second)
182 {
183 bool isLast = (counter + 1 == hits.second.size());
184 fillHit(hit, isLast, false, encodedData);
185 counter++;
186 }
187 }
188 return StatusCode::SUCCESS;
189
190}
#define ATH_MSG_DEBUG(x)
void fillHit(const FPGATrackSimHit *hit, bool isLast, bool isLastofSlice, std::vector< uint64_t > &encodedData) const
unsigned int getIdentifier() const
bool isPixel() const
bool isStrip() const
uint64_t get_dataformat_M_HDR_w1(const M_HDR_w1 &in)
M_HDR_w1 fill_M_HDR_w1(const uint64_t &flag, const uint64_t &modid, const uint64_t &modhash, const uint64_t &spare)

◆ convertFPGAHitsToFPGADataFormat()

StatusCode FPGADataFormatTool::convertFPGAHitsToFPGADataFormat ( const FPGATrackSimHitCollection * allHits,
bool doPixel,
bool doStrip,
std::vector< uint64_t > & encodedData,
const EventContext & ctx ) const
overridevirtual

Definition at line 130 of file FPGADataFormatTool.cxx.

135 {
136
137 // Fill the event header
138 ATH_CHECK(fillHeader(encodedData));
139
140 // Convert Slices
141 ATH_CHECK(convertFPGAHits(allHits, doPixel, doStrip, encodedData, ctx));
142
143 // Fill the event footer
144 ATH_CHECK(fillFooter(encodedData));
145
146
147 return StatusCode::SUCCESS;
148}
#define ATH_CHECK
Evaluate an expression and check for errors.
StatusCode convertFPGAHits(const FPGATrackSimHitCollection *hits, bool doPixel, bool doStrip, std::vector< uint64_t > &encodedData, const EventContext &ctx) const
StatusCode fillFooter(std::vector< uint64_t > &encodedData) const
StatusCode fillHeader(std::vector< uint64_t > &encodedData) const

◆ convertFPGASlices()

StatusCode FPGADataFormatTool::convertFPGASlices ( const FPGATrackSimHitCollection * hitsInSlices,
bool doPixel,
bool doStrip,
std::vector< uint64_t > & encodedData,
const EventContext & ctx ) const
private

Definition at line 82 of file FPGADataFormatTool.cxx.

88 {
89
90 ATH_MSG_DEBUG("Encoded Slices: ");
91
93 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_SLICE_HDR_w1(sliceWord_w1));
94
95 std::map<unsigned int, std::vector<const FPGATrackSimHit*> > organizedHits;
96
97 for (size_t i = 0; i < hitsinSlice->size(); i++)
98 {
99 const FPGATrackSimHit& hit = *hitsinSlice->at(i);
100
101 if((doPixel && hit.isPixel()) || (doStrip && hit.isStrip()))
102 organizedHits[hit.getIdentifier()].push_back(&hit);
103 }
104
105 // encode the hits
106 unsigned int moduleCounter = 0;
107 for (const auto& hits: organizedHits)
108 {
109 const auto& firstHit = hits.second[0];
110 auto mod_w1 = FPGADataFormatUtilities::fill_M_HDR_w1 (FPGADataFormatUtilities::M_HDR_FLAG, firstHit->getIdentifier(), firstHit->getIdentifierHash(), 0);
111 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_M_HDR_w1(mod_w1));
112
113 unsigned int counter = 0;
114 for(const auto& hit: hits.second)
115 {
116 bool isLast = (counter + 1 == hits.second.size());
117 bool isLastofSlice = isLast && (moduleCounter + 1 == organizedHits.size()); // Since we are only doing once slice at a time
118 fillHit(hit, isLast, isLastofSlice, encodedData);
119 counter++;
120 }
121 moduleCounter++;
122 }
123
124 return StatusCode::SUCCESS;
125
126}
SLICE_HDR_w1 fill_SLICE_HDR_w1(const uint64_t &flag, const uint64_t &sliceid, const uint64_t &eta_region, const uint64_t &phi_region, const uint64_t &spare)
uint64_t get_dataformat_SLICE_HDR_w1(const SLICE_HDR_w1 &in)

◆ convertFPGASliceToFPGADataFormat()

StatusCode FPGADataFormatTool::convertFPGASliceToFPGADataFormat ( const FPGATrackSimHitCollection * hitsInSlices,
bool doPixel,
bool doStrip,
std::vector< uint64_t > & encodedData,
const EventContext & ctx ) const
overridevirtual

Definition at line 60 of file FPGADataFormatTool.cxx.

65 {
66
67 // Fill the event header
68 ATH_CHECK(fillHeader(encodedData));
69
70 // Convert Slices
71 ATH_CHECK(convertFPGASlices(slices, doPixel, doStrip, encodedData, ctx));
72
73 // Fill the event footer
74 ATH_CHECK(fillFooter(encodedData));
75
76
77 return StatusCode::SUCCESS;
78}
StatusCode convertFPGASlices(const FPGATrackSimHitCollection *hitsInSlices, bool doPixel, bool doStrip, std::vector< uint64_t > &encodedData, const EventContext &ctx) const

◆ convertFPGATracks()

StatusCode FPGADataFormatTool::convertFPGATracks ( const FPGATrackSimTrackCollection * tracks,
std::vector< uint64_t > & encodedData,
const EventContext & ctx ) const
private

Definition at line 214 of file FPGADataFormatTool.cxx.

218 {
219
220 for (const FPGATrackSimTrack& track : *tracks)
221 {
222 int bitmask = 0;
223 for (const auto& hit : track.getFPGATrackSimHitPtrs())
224 {
225 if (!hit){
226 ATH_MSG_ERROR("Null hit pointer from getFPGATrackSimHitPtrs() in convertFPGATracks");
227 return StatusCode::FAILURE;
228 }
229 bitmask |= 2 << hit->getLayer();
230 }
231
232 ATH_MSG_DEBUG("Encoded GTrack: ");
233 ATH_MSG_DEBUG("\tetaregion: " << track.getHoughY());
234 ATH_MSG_DEBUG("\tphiregion: " << track.getHoughX());
235 ATH_MSG_DEBUG("\tlayerbitmask: " << bitmask);
236 ATH_MSG_DEBUG("\td0: " << track.getD0());
237 ATH_MSG_DEBUG("\tz0: " << track.getZ0());
238 ATH_MSG_DEBUG("\tqoverpt: " << track.getQOverPt());
239 ATH_MSG_DEBUG("\tphi: " << track.getPhi());
240 ATH_MSG_DEBUG("\teta: " << track.getEta());
241
242 auto trackBinsIndex = track.getBinIdx();
244 0xee,
245 0,
246 track.getHoughY(),
247 track.getHoughX(),
248 trackBinsIndex[0],
249 trackBinsIndex[1],
250 0,
251 bitmask);
252 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_GTRACK_HDR_w1(gtrackWord_w1));
253
255 trackBinsIndex[2],
256 track.getD0(),
257 track.getZ0(),
258 trackBinsIndex[3]);
259 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_GTRACK_HDR_w2(gtrackWord_w2));
260
262 track.getQOverPt(),
263 track.getPhi(),
264 track.getEta(),
265 trackBinsIndex[3]);
266 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_GTRACK_HDR_w3(gtrackWord_w3));
267
268 std::vector<std::shared_ptr<const FPGATrackSimHit>> hits = track.getFPGATrackSimHitPtrs();
269 hits.erase(
270 std::remove_if(hits.begin(), hits.end(),
271 [](const std::shared_ptr<const FPGATrackSimHit>& hit) { return !hit || !hit->isReal(); }),
272 hits.end());
273
274 for(unsigned int i = 0 ; i < hits.size(); i++)
275 {
276 const auto& hit = hits[i];
277 bool isLast = (i+1 == hits.size());
278 fillHit(hit.get(), isLast, false, encodedData);
279 }
280
281
282 }
283
284
285 return StatusCode::SUCCESS;
286}
#define ATH_MSG_ERROR(x)
uint64_t get_dataformat_GTRACK_HDR_w2(const GTRACK_HDR_w2 &in)
GTRACK_HDR_w3 fill_GTRACK_HDR_w3(const double &qoverpt, const double &phi, const double &eta, const uint64_t &spare)
GTRACK_HDR_w2 fill_GTRACK_HDR_w2(const double &score, const double &d0, const double &z0, const uint64_t &spare)
uint64_t get_dataformat_GTRACK_HDR_w3(const GTRACK_HDR_w3 &in)
GTRACK_HDR_w1 fill_GTRACK_HDR_w1(const uint64_t &flag, const uint64_t &type, const uint64_t &eta_region, const uint64_t &phi_region, const uint64_t &phi_bin, const uint64_t &z_bin, const uint64_t &second_stage, const uint64_t &layer_bitmask)
uint64_t get_dataformat_GTRACK_HDR_w1(const GTRACK_HDR_w1 &in)
DataModel_detail::iterator< DVL > remove_if(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, Predicate pred)
Specialization of remove_if for DataVector/List.

◆ convertFPGATracksToFPGADataFormat()

StatusCode FPGADataFormatTool::convertFPGATracksToFPGADataFormat ( const FPGATrackSimTrackCollection * tracks,
std::vector< uint64_t > & encodedData,
const EventContext & ctx ) const
overridevirtual

Definition at line 196 of file FPGADataFormatTool.cxx.

199 {
200
201 // Fill the event header
202 ATH_CHECK(fillHeader(encodedData));
203
204 // Convert the strip RDO
205 ATH_CHECK(convertFPGATracks(tracks, encodedData, ctx));
206
207 // Fill the event footer
208 ATH_CHECK(fillFooter(encodedData));
209
210
211 return StatusCode::SUCCESS;
212}
StatusCode convertFPGATracks(const FPGATrackSimTrackCollection *tracks, std::vector< uint64_t > &encodedData, const EventContext &ctx) const

◆ convertPixelHitsToFPGADataFormat()

StatusCode FPGADataFormatTool::convertPixelHitsToFPGADataFormat ( const PixelRDO_Container & pixelRDO,
std::vector< uint64_t > & encodedData,
const std::vector< IdentifierHash > & hashList,
const EventContext & ctx ) const
overridevirtual

Covert the Pixel RDOs to the test vector format as requited by FPGA EF tracking alogrithms.

Definition at line 20 of file FPGADataFormatTool.cxx.

24 {
25
26 // Fill the event header
27 ATH_CHECK(fillHeader(encodedData));
28
29 // Convert the strip RDO
30 ATH_CHECK(convertPixelRDO(pixelRDO, encodedData, hashList, ctx));
31
32 // Fill the event footer
33 ATH_CHECK(fillFooter(encodedData));
34
35
36 return StatusCode::SUCCESS;
37}
StatusCode convertPixelRDO(const PixelRDO_Container &pixelRDO, std::vector< uint64_t > &encodedData, const std::vector< IdentifierHash > &hashList, const EventContext &ctx) const

◆ convertPixelRDO()

StatusCode FPGADataFormatTool::convertPixelRDO ( const PixelRDO_Container & pixelRDO,
std::vector< uint64_t > & encodedData,
const std::vector< IdentifierHash > & hashList,
const EventContext & ctx ) const
private

Definition at line 290 of file FPGADataFormatTool.cxx.

295 {
296
297 constexpr int maxChannels = 1000;
298 bool filledHeader = false;
299 for (const InDetRawDataCollection<PixelRDORawData>* pixel_rdoCollection : pixelRDO)
300 {
301 if (pixel_rdoCollection == nullptr) { continue; }
302
303 int nChannels = 0;
304 // loop on all RDOs
305 for (const PixelRDORawData* pixelRawData : *pixel_rdoCollection)
306 {
307 Identifier rdoId = pixelRawData->identify();
308 // get the det element from the det element collection
309 const InDetDD::SiDetectorElement* sielement = m_PIX_mgr->getDetectorElement(rdoId);
310 // if hash list has elements, check if the current Si in the list otherwise, continue
311 if(hashList.size() > 0)
312 {
313 if(std::find(hashList.begin(), hashList.end(), sielement->identifyHash()) == hashList.end()) continue;
314 }
315
316 // Fill the module header
317 if(!filledHeader)
318 {
319 ATH_CHECK(fillModuleHeader(sielement, encodedData));
320 filledHeader = true;
321 }
322
323 // Get the pixel word
325 (pixelRawData == pixel_rdoCollection->back()) || (nChannels == maxChannels), // last
326 m_pixelId->phi_index(rdoId), // ROW
327 m_pixelId->eta_index(rdoId), // COL
328 pixelRawData->getToT(), // TOT
329 pixelRawData->getLVL1A(), // Lvl!
330 0x0F0F0F // Spare
331 );
332
333 // Push the word into the vector
334 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_PIXEL_EF_RDO(pixelWord));
335
336 if(nChannels == maxChannels) break;
337 nChannels++;
338 //}
339 } // end for each RDO in the collection
340
341 // reset the header
342 filledHeader = false;
343
344} // for each pixel RDO collection
345
346return StatusCode::SUCCESS;
347}
StatusCode fillModuleHeader(const InDetDD::SiDetectorElement *sielement, std::vector< uint64_t > &encodedData) const
const InDetDD::SiDetectorManager * m_PIX_mgr
const PixelID * m_pixelId
virtual IdentifierHash identifyHash() const override final
identifier hash (inline)
PIXEL_EF_RDO fill_PIXEL_EF_RDO(const uint64_t &last, const uint64_t &row, const uint64_t &col, const uint64_t &tot, const uint64_t &lvl1, const uint64_t &spare)
uint64_t get_dataformat_PIXEL_EF_RDO(const PIXEL_EF_RDO &in)
unsigned int constexpr nChannels
Definition RPDUtils.h:23

◆ convertStripHitsToFPGADataFormat()

StatusCode FPGADataFormatTool::convertStripHitsToFPGADataFormat ( const SCT_RDO_Container & stripRDO,
std::vector< uint64_t > & encodedData,
const std::vector< IdentifierHash > & hashList,
const EventContext & ctx ) const
overridevirtual

Covert the Strip RDOs to the test vector format as requited by FPGA EF tracking alogrithms.

Definition at line 39 of file FPGADataFormatTool.cxx.

43 {
44
45 // Fill the event header
46 ATH_CHECK(fillHeader(encodedData));
47
48 // Convert the strip RDO
49 ATH_CHECK(convertStripRDO(stripRDO, encodedData, hashList, ctx));
50
51 // Fill the event footer
52 ATH_CHECK(fillFooter(encodedData));
53
54 return StatusCode::SUCCESS;
55}
StatusCode convertStripRDO(const SCT_RDO_Container &stripRDO, std::vector< uint64_t > &encodedData, const std::vector< IdentifierHash > &hashList, const EventContext &ctx) const

◆ convertStripRDO()

StatusCode FPGADataFormatTool::convertStripRDO ( const SCT_RDO_Container & stripRDO,
std::vector< uint64_t > & encodedData,
const std::vector< IdentifierHash > & hashList,
const EventContext & ctx ) const
private

Definition at line 349 of file FPGADataFormatTool.cxx.

354 {
355 constexpr int MaxChannelinStripRow = 128;
356 long unsigned int stripNumber = 0;
357 bool filledHeader = false;
358
359 uint64_t packedWord = 0;
360 bool firstClusterFilled = false;
361
362 for (const InDetRawDataCollection<SCT_RDORawData>* SCT_Collection : stripRDO) {
363 if (SCT_Collection == nullptr) { continue; }
364
365 std::map<int, bool> firedStrips;
366 std::map<int, const SCT_RDORawData*> firedStripsToRDO;
367
368 // Preprocess the SCT collection hits to get information for encoding strip in ITK format
369 // All fired strips are stored in a map to get an overview of the full module that should be
370 // used to encode the data into the ITk format.
371 for (const SCT_RDORawData* sctRawData : *SCT_Collection) {
372 const Identifier rdoId = sctRawData->identify();
373 const int baseLineStrip{m_sctId->strip(rdoId)};
374 for (int i = 0; i < sctRawData->getGroupSize(); i++) {
375 firedStrips[baseLineStrip + i] = true;
376 firedStripsToRDO[baseLineStrip + i] = sctRawData;
377 }
378 }
379 // Loop over the fired hits and encode them in the ITk strips hit map
380 // Finds unique hits in the list that can be encoded and don't overlap
381 std::map<int, int> stripEncodingForITK;
382 std::map<int, const SCT_RDORawData* > stripEncodingForITKToRDO;
383 for (const auto& [stripID, fired] : firedStrips) {
384 // Skip strips that have already been used in a cluster
385 if (!fired) continue;
386
387 // Check the next 3 hits if they exist and have a hit in them
388 std::bitset<3> hitMap;
389 int currChipID = stripID / MaxChannelinStripRow;
390 int maxStripIDForCurrChip = (currChipID + 1) * MaxChannelinStripRow;
391
392 for (int i = 0; i < 3; i++) {
393 // Do not cluster strips that are outside the range of this chip
394 if ((stripID + 1 + i) >= maxStripIDForCurrChip) continue;
395 if (firedStrips.find(stripID + 1 + i) != firedStrips.end()) {
396 if (firedStrips.at(stripID + 1 + i)) {
397 hitMap[2 - i] = 1;
398 firedStrips[stripID + 1 + i] = false;
399 } else {
400 hitMap[2 - i] = 0;
401 }
402 }
403 }
404
405 // Encode the hit map into an integer
406 stripEncodingForITK[stripID] = static_cast<int>(hitMap.to_ulong());
407 stripEncodingForITKToRDO[stripID] = firedStripsToRDO[stripID];
408 }
409
410 stripNumber = 0;
411 firstClusterFilled = false;
412
413 // Process each fired strip and encode it
414 for (const auto& [stripID, encoding] : stripEncodingForITK) {
415 const SCT_RDORawData* sctRawData = stripEncodingForITKToRDO[stripID];
416 const Identifier rdoId = sctRawData->identify();
417 const InDetDD::SiDetectorElement* sielement = m_SCT_mgr->getDetectorElement(rdoId);
418
419 // if hash list has elements, check if the current Si in the list otherwise, continue
420 if(hashList.size() > 0)
421 {
422 if(std::find(hashList.begin(), hashList.end(), sielement->identifyHash()) == hashList.end()) continue;
423 }
424
425 // Fill the module header if not already filled
426 if (!filledHeader) {
427 if (!fillModuleHeader(sielement, encodedData)) return StatusCode::FAILURE;
428 filledHeader = true;
429 }
430
431 // Compute chip ID and ITk strip ID
432 int chipID = stripID / MaxChannelinStripRow;
433 int ITkStripID = stripID % MaxChannelinStripRow;
434
435 // Adjust for row offset based on the eta module index
436 int offset = m_sctId->eta_module(rdoId) % 2;
437 if (m_sctId->barrel_ec(rdoId) == 0) {
438 offset = (std::abs(m_sctId->eta_module(rdoId)) - 1) % 2;
439 }
440 ITkStripID += offset * MaxChannelinStripRow;
441 stripNumber++;
442 // Determine if this is the last cluster in the module
443 bool lastBit = (stripNumber == stripEncodingForITK.size());
444
445 // Create the encoded strip word
447 lastBit, // last bit indicating module boundary
448 chipID, // chip ID
449 ITkStripID, // cluster number
450 stripEncodingForITK.at(stripID), // cluster map
451 0x0F0F // spare bits
452 );
453
455
456 // **Pack two clusters into a single 64-bit word**
457 if (!firstClusterFilled) {
458 packedWord = (static_cast<uint64_t>(encodedCluster) << 32); // Store first cluster in upper 32 bits
459 firstClusterFilled = true;
460 } else {
461 packedWord |= static_cast<uint64_t>(encodedCluster); // Store second cluster in lower 32 bits
462 encodedData.push_back(packedWord); // Push the full packed word
463 firstClusterFilled = false; // Reset flag
464 packedWord = 0; // Clear for the next pair
465 }
466
467 // If this is the last cluster in the module and a single cluster is left, push it
468 if (lastBit && firstClusterFilled) {
469 encodedData.push_back(packedWord);
470 }
471
472 }
473 // Reset the header flag for the next module
474 filledHeader = false;
475 } // end for each RDO in the strip collection
476
477 return StatusCode::SUCCESS;
478}
const InDetDD::SiDetectorManager * m_SCT_mgr
virtual Identifier identify() const override final
STRIP_EF_RDO fill_STRIP_EF_RDO(const uint64_t &last, const uint64_t &chipid, const uint64_t &strip_num, const uint64_t &cluster_map, const uint64_t &spare)
uint64_t get_dataformat_STRIP_EF_RDO(const STRIP_EF_RDO &in)
setEventNumber uint32_t

◆ fillFooter()

StatusCode FPGADataFormatTool::fillFooter ( std::vector< uint64_t > & encodedData) const
private

Definition at line 498 of file FPGADataFormatTool.cxx.

499{
500 // Fill the event header
502 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EVT_FTR_w1(footer_w1));
503
504 // Fill the event header
505 auto footer_w2 = FPGADataFormatUtilities::fill_EVT_FTR_w2 (0);
506 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EVT_FTR_w2(footer_w2));
507
508 // Fill the event header
509 auto footer_w3 = FPGADataFormatUtilities::fill_EVT_FTR_w3 (encodedData.size(), 44939973);
510 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EVT_FTR_w3(footer_w3));
511
512 return StatusCode::SUCCESS;
513}
uint64_t get_dataformat_EVT_FTR_w3(const EVT_FTR_w3 &in)
EVT_FTR_w2 fill_EVT_FTR_w2(const uint64_t &error_flags)
uint64_t get_dataformat_EVT_FTR_w1(const EVT_FTR_w1 &in)
EVT_FTR_w1 fill_EVT_FTR_w1(const uint64_t &flag, const uint64_t &spare, const uint64_t &hdr_crc)
uint64_t get_dataformat_EVT_FTR_w2(const EVT_FTR_w2 &in)
EVT_FTR_w3 fill_EVT_FTR_w3(const uint64_t &word_count, const uint64_t &crc)

◆ fillHeader()

StatusCode FPGADataFormatTool::fillHeader ( std::vector< uint64_t > & encodedData) const
private

Definition at line 481 of file FPGADataFormatTool.cxx.

482{
483 // Fill the event header
485 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EVT_HDR_w1(header_w1));
486
487 // Fill the event header
488 auto header_w2 = FPGADataFormatUtilities::fill_EVT_HDR_w2 (242000, 0);
489 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EVT_HDR_w2(header_w2));
490
491 // Fill the event header
492 auto header_w3 = FPGADataFormatUtilities::fill_EVT_HDR_w3 (0, 0);
493 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EVT_HDR_w3(header_w3));
494
495 return StatusCode::SUCCESS;
496}
EVT_HDR_w2 fill_EVT_HDR_w2(const uint64_t &runnumber, const uint64_t &time)
EVT_HDR_w1 fill_EVT_HDR_w1(const uint64_t &flag, const uint64_t &l0id, const uint64_t &bcid, const uint64_t &spare)
uint64_t get_dataformat_EVT_HDR_w3(const EVT_HDR_w3 &in)
uint64_t get_dataformat_EVT_HDR_w2(const EVT_HDR_w2 &in)
EVT_HDR_w3 fill_EVT_HDR_w3(const uint64_t &status, const uint64_t &crc)
uint64_t get_dataformat_EVT_HDR_w1(const EVT_HDR_w1 &in)

◆ fillHit()

void FPGADataFormatTool::fillHit ( const FPGATrackSimHit * hit,
bool isLast,
bool isLastofSlice,
std::vector< uint64_t > & encodedData ) const
private

Definition at line 526 of file FPGADataFormatTool.cxx.

527{
528 int cluster1D=0;
529 int cluster2D=0;
530 if(hit->getOriginalHit().getCluster1ID() >=0)
531 {
532 cluster1D=hit->getOriginalHit().getCluster1ID();
533 }
534
535 if(hit->getOriginalHit().getCluster2ID() >=0)
536 {
537 cluster2D=hit->getOriginalHit().getCluster2ID();
538 }
539
540 ATH_MSG_DEBUG("\tphiregion: " << hit->getLayer());
541 ATH_MSG_DEBUG("\tR: " << hit->getR());
542 ATH_MSG_DEBUG("\tphi: " << hit->getGPhi());
543 ATH_MSG_DEBUG("\tZ: " << hit->getZ());
544 ATH_MSG_DEBUG("\tcluster1D: " << cluster1D);
545 ATH_MSG_DEBUG("\tcluster2D: " << cluster2D);
546
547 auto ghit_w1 = FPGADataFormatUtilities::fill_GHITZ_w1(isLast, hit->getLayer(), hit->getR(), hit->getGPhi(), hit->getZ(), isLastofSlice, 0);
548 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_GHITZ_w1(ghit_w1));
549 // overwrite the information for now
550 cluster1D = hit->getIdentifierHash();
551 auto ghit_w2 = FPGADataFormatUtilities::fill_GHITZ_w2 (cluster1D, cluster2D, hit->getEtaModule(), 0);
552 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_GHITZ_w2(ghit_w2));
553}
unsigned getIdentifierHash() const
float getGPhi() const
int getEtaModule(bool old=false) const
float getZ() const
int getCluster1ID() const
float getR() const
int getCluster2ID() const
const FPGATrackSimHit getOriginalHit() const
uint64_t get_dataformat_GHITZ_w1(const GHITZ_w1 &in)
GHITZ_w1 fill_GHITZ_w1(const uint64_t &last, const uint64_t &lyr, const double &rad, const double &phi, const double &z, const uint64_t &lastofslice, const uint64_t &spare)
GHITZ_w2 fill_GHITZ_w2(const uint64_t &cluster1, const uint64_t &cluster2, const uint64_t &row, const uint64_t &spare)
uint64_t get_dataformat_GHITZ_w2(const GHITZ_w2 &in)

◆ fillModuleHeader()

StatusCode FPGADataFormatTool::fillModuleHeader ( const InDetDD::SiDetectorElement * sielement,
std::vector< uint64_t > & encodedData ) const
private

Definition at line 515 of file FPGADataFormatTool.cxx.

516{
518 sielement->identifyHash().value(), 0);
519 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_M_HDR_w1(mod_w1));
520
521 return StatusCode::SUCCESS;
522}
value_type get_compact() const
Get the compact id.
value_type value() const
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
virtual Identifier identify() const override final
identifier of this detector element (inline)

◆ initialize()

StatusCode FPGADataFormatTool::initialize ( )
overridevirtual

Definition at line 9 of file FPGADataFormatTool.cxx.

9 {
10 ATH_MSG_INFO("Initializing IEFTrackingFPGADataFormatTool tool");
11
12 ATH_CHECK(detStore()->retrieve(m_PIX_mgr, "ITkPixel"));
13 ATH_CHECK(detStore()->retrieve(m_pixelId, "PixelID"));
14 ATH_CHECK(detStore()->retrieve(m_SCT_mgr, "ITkStrip"));
15 ATH_CHECK(detStore()->retrieve(m_sctId, "SCT_ID"));
16
17 return StatusCode::SUCCESS;
18}
#define ATH_MSG_INFO(x)

Member Data Documentation

◆ m_PIX_mgr

const InDetDD::SiDetectorManager* FPGADataFormatTool::m_PIX_mgr = nullptr
private

Definition at line 71 of file FPGADataFormatTool.h.

◆ m_pixelId

const PixelID* FPGADataFormatTool::m_pixelId = nullptr
private

Definition at line 68 of file FPGADataFormatTool.h.

◆ m_SCT_mgr

const InDetDD::SiDetectorManager* FPGADataFormatTool::m_SCT_mgr = nullptr
private

Definition at line 72 of file FPGADataFormatTool.h.

◆ m_sctId

const SCT_ID* FPGADataFormatTool::m_sctId = nullptr
private

Definition at line 69 of file FPGADataFormatTool.h.


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