10 ATH_MSG_INFO(
"Initializing IEFTrackingFPGADataFormatTool tool");
17 return StatusCode::SUCCESS;
22 std::vector<uint64_t> &encodedData,
23 const std::vector<IdentifierHash>& hashList,
24 const EventContext &ctx)
const {
36 return StatusCode::SUCCESS;
41 std::vector<uint64_t> &encodedData,
42 const std::vector<IdentifierHash>& hashList,
43 const EventContext &ctx)
const {
54 return StatusCode::SUCCESS;
64 std::vector<uint64_t> &encodedData,
65 const EventContext &ctx)
const {
77 return StatusCode::SUCCESS;
86 std::vector<uint64_t> &encodedData,
95 std::map<unsigned int, std::vector<const FPGATrackSimHit*> > organizedHits;
97 for (
size_t i = 0; i < hitsinSlice->size(); i++)
106 unsigned int moduleCounter = 0;
107 for (
const auto& hits: organizedHits)
109 const auto& firstHit = hits.second[0];
113 unsigned int counter = 0;
114 for(
const auto& hit: hits.second)
116 bool isLast = (counter + 1 == hits.second.size());
117 bool isLastofSlice = isLast && (moduleCounter + 1 == organizedHits.size());
118 fillHit(hit, isLast, isLastofSlice, encodedData);
124 return StatusCode::SUCCESS;
134 std::vector<uint64_t> &encodedData,
135 const EventContext &ctx)
const {
147 return StatusCode::SUCCESS;
156 std::vector<uint64_t> &encodedData,
163 std::map<unsigned int, std::vector<const FPGATrackSimHit*> > organizedHits;
165 for (
size_t i = 0; i < allHits->size(); i++)
174 for (
const auto& hits: organizedHits)
176 const auto& firstHit = hits.second[0];
180 unsigned int counter = 0;
181 for(
const auto& hit: hits.second)
183 bool isLast = (counter + 1 == hits.second.size());
184 fillHit(hit, isLast,
false, encodedData);
188 return StatusCode::SUCCESS;
198 std::vector<uint64_t> &encodedData,
199 const EventContext &ctx)
const {
211 return StatusCode::SUCCESS;
216 std::vector<uint64_t> &encodedData,
223 for(
const auto& hit: track.getFPGATrackSimHits())
225 bitmask |= 2 << hit.getLayer();
238 auto trackBinsIndex = track.getBinIdx();
264 auto hits = track.getFPGATrackSimHits();
270 for(
unsigned int i = 0 ; i < hits.size(); i++)
272 const auto& hit = hits[i];
273 bool isLast = (i+1 == hits.size());
274 fillHit(&hit, isLast,
false, encodedData);
281 return StatusCode::SUCCESS;
288 std::vector<uint64_t> &encodedData,
289 const std::vector<IdentifierHash>& hashList,
293 constexpr int maxChannels = 1000;
294 bool filledHeader =
false;
297 if (pixel_rdoCollection ==
nullptr) {
continue; }
307 if(hashList.size() > 0)
309 if(std::find(hashList.begin(), hashList.end(), sielement->
identifyHash()) == hashList.end())
continue;
321 (pixelRawData == pixel_rdoCollection->back()) || (nChannels == maxChannels),
324 pixelRawData->getToT(),
325 pixelRawData->getLVL1A(),
332 if(nChannels == maxChannels)
break;
338 filledHeader =
false;
342return StatusCode::SUCCESS;
347 std::vector<uint64_t> &encodedData,
348 const std::vector<IdentifierHash>& hashList,
351 constexpr int MaxChannelinStripRow = 128;
352 long unsigned int stripNumber = 0;
353 bool filledHeader =
false;
355 uint64_t packedWord = 0;
356 bool firstClusterFilled =
false;
359 if (SCT_Collection ==
nullptr) {
continue; }
361 std::map<int, bool> firedStrips;
362 std::map<int, const SCT_RDORawData*> firedStripsToRDO;
368 const Identifier rdoId = sctRawData->identify();
369 const int baseLineStrip{
m_sctId->strip(rdoId)};
370 for (
int i = 0; i < sctRawData->getGroupSize(); i++) {
371 firedStrips[baseLineStrip + i] =
true;
372 firedStripsToRDO[baseLineStrip + i] = sctRawData;
377 std::map<int, int> stripEncodingForITK;
378 std::map<int, const SCT_RDORawData* > stripEncodingForITKToRDO;
379 for (
const auto& [stripID, fired] : firedStrips) {
381 if (!fired)
continue;
384 std::bitset<3> hitMap;
385 int currChipID = stripID / MaxChannelinStripRow;
386 int maxStripIDForCurrChip = (currChipID + 1) * MaxChannelinStripRow;
388 for (
int i = 0; i < 3; i++) {
390 if ((stripID + 1 + i) >= maxStripIDForCurrChip)
continue;
391 if (firedStrips.find(stripID + 1 + i) != firedStrips.end()) {
392 if (firedStrips.at(stripID + 1 + i)) {
394 firedStrips[stripID + 1 + i] =
false;
402 stripEncodingForITK[stripID] =
static_cast<int>(hitMap.to_ulong());
403 stripEncodingForITKToRDO[stripID] = firedStripsToRDO[stripID];
407 firstClusterFilled =
false;
410 for (
const auto& [stripID, encoding] : stripEncodingForITK) {
411 const SCT_RDORawData* sctRawData = stripEncodingForITKToRDO[stripID];
416 if(hashList.size() > 0)
418 if(std::find(hashList.begin(), hashList.end(), sielement->
identifyHash()) == hashList.end())
continue;
428 int chipID = stripID / MaxChannelinStripRow;
429 int ITkStripID = stripID % MaxChannelinStripRow;
432 int offset =
m_sctId->eta_module(rdoId) % 2;
433 if (
m_sctId->barrel_ec(rdoId) == 0) {
434 offset = (std::abs(
m_sctId->eta_module(rdoId)) - 1) % 2;
436 ITkStripID += offset * MaxChannelinStripRow;
439 bool lastBit = (stripNumber == stripEncodingForITK.size());
446 stripEncodingForITK.at(stripID),
453 if (!firstClusterFilled) {
454 packedWord = (
static_cast<uint64_t
>(encodedCluster) << 32);
455 firstClusterFilled =
true;
457 packedWord |=
static_cast<uint64_t
>(encodedCluster);
458 encodedData.push_back(packedWord);
459 firstClusterFilled =
false;
464 if (lastBit && firstClusterFilled) {
465 encodedData.push_back(packedWord);
470 filledHeader =
false;
473 return StatusCode::SUCCESS;
491 return StatusCode::SUCCESS;
508 return StatusCode::SUCCESS;
517 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
std::vector< FPGATrackSimHit > FPGATrackSimHitCollection
std::vector< FPGATrackSimTrack > FPGATrackSimTrackCollection
InDetRawDataContainer< InDetRawDataCollection< PixelRDORawData > > PixelRDO_Container
InDetRawDataContainer< InDetRawDataCollection< SCT_RDORawData > > SCT_RDO_Container
unsigned int getIdentifier() const
unsigned getIdentifierHash() const
int getEtaModule(bool old=false) const
int getCluster1ID() const
int getCluster2ID() const
const FPGATrackSimHit getOriginalHit() const
value_type get_compact() const
Get the compact id.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
Class to hold geometrical description of a silicon detector element.
virtual IdentifierHash identifyHash() const override final
identifier hash (inline)
virtual Identifier identify() const override final
identifier of this detector element (inline)
virtual Identifier identify() const override final
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.