ATLAS Offline Software
Loading...
Searching...
No Matches
FPGATrackSimSGToRawHitsTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5
12
22
26
28
29#include "AtlasHepMC/GenEvent.h"
33
35
36#include "GaudiKernel/IPartPropSvc.h"
38
39#include <bitset>
40
41namespace {
42 // A few constants for truth cuts
43 const float FPGATrackSim_PT_TRUTHMIN = 400.;
44 const float FPGATrackSim_Z_TRUTHMIN = 2300.;
45}
46
47FPGATrackSimSGToRawHitsTool::FPGATrackSimSGToRawHitsTool(const std::string& algname, const std::string& name, const IInterface* ifc) :
48 base_class(algname, name, ifc)
49{}
50
52
53 ATH_MSG_DEBUG("FPGATrackSimSGToRawHitsTool::initialize()");
54
55 if(!m_truthToTrack.empty() ) ATH_CHECK(m_truthToTrack.retrieve());
56 if(!m_extrapolator.empty()) ATH_CHECK(m_extrapolator.retrieve());
57 ATH_CHECK(m_beamSpotKey.initialize());
58
59 ATH_CHECK(detStore()->retrieve(m_PIX_mgr, "ITkPixel"));
60 ATH_CHECK(detStore()->retrieve(m_pixelId, "PixelID"));
61 ATH_CHECK(detStore()->retrieve(m_SCT_mgr, "ITkStrip"));
62 ATH_CHECK(detStore()->retrieve(m_sctId, "SCT_ID"));
63
64 ATH_CHECK(m_eventInfoKey.initialize());
67
69
73 ATH_CHECK(m_pixelRDOKey.initialize());
74 ATH_CHECK(m_stripRDOKey.initialize());
75
76 ATH_MSG_DEBUG("Initialization complete");
77 return StatusCode::SUCCESS;
78}
79
80
82 return StatusCode::SUCCESS;
83}
84
85
88StatusCode FPGATrackSimSGToRawHitsTool::readData(FPGATrackSimEventInputHeader* eventHeader, const EventContext& eventContext) const
89{
90
91 auto eventInfo = SG::makeHandle(m_eventInfoKey, eventContext);
92 //Filled to variable / start event
93 FPGATrackSimEventInfo event_info;
94 event_info.setRunNumber(eventInfo->runNumber());
95 event_info.setEventNumber(eventInfo->eventNumber());
96 event_info.setLB(eventInfo->lumiBlock());
97 event_info.setBCID(eventInfo->bcid());
98 event_info.setaverageInteractionsPerCrossing(eventInfo->averageInteractionsPerCrossing());
99 event_info.setactualInteractionsPerCrossing(eventInfo->actualInteractionsPerCrossing());
100 event_info.setextendedLevel1ID(eventInfo->extendedLevel1ID());
101 event_info.setlevel1TriggerType(eventInfo->level1TriggerType());
102 eventHeader->newEvent(event_info);
103
104 HitIndexMap hitIndexMap; // keep running index event-unique to each hit
105 HitIndexMap pixelClusterIndexMap;
106 // get pixel and sct cluster containers
107 // dump raw silicon data
108 ATH_MSG_DEBUG("Dump raw silicon data");
109 ATH_CHECK(readRawSilicon(eventHeader, hitIndexMap, eventContext));
112 std::vector <FPGATrackSimCluster> clusters;
113 ATH_CHECK(readOfflineClusters(clusters, eventContext));
114 for (const auto& cluster : clusters) optional.addOfflineCluster(cluster);
115 ATH_MSG_DEBUG("Saved " << optional.nOfflineClusters() << " offline clusters");
116 ATH_CHECK(dumpPixelClusters(pixelClusterIndexMap, eventContext));
117 }
118 if (m_readTruthTracks) {
119 std::vector <FPGATrackSimTruthTrack> truth;
120 ATH_CHECK(readTruthTracks(truth, eventContext));
121 for (const FPGATrackSimTruthTrack& trk : truth) optional.addTruthTrack(trk);
122 ATH_MSG_DEBUG("Saved " << optional.nTruthTracks() << " truth tracks");
123 }
124 std::vector <FPGATrackSimOfflineTrack> offline;
126 ATH_CHECK(readOfflineTracks(offline, eventContext));
127 for (const FPGATrackSimOfflineTrack& trk : offline) optional.addOfflineTrack(trk);
128 ATH_MSG_DEBUG("Saved " << optional.nOfflineTracks() << " offline tracks");
129 }
130 eventHeader->setOptional(optional);
131 ATH_MSG_DEBUG(*eventHeader);
132 ATH_MSG_DEBUG("End of execute()");
133 return StatusCode::SUCCESS;
134}
135
136
137StatusCode FPGATrackSimSGToRawHitsTool::readOfflineTracks(std::vector<FPGATrackSimOfflineTrack>& offline, const EventContext& eventContext) const
138{
139 auto offlineTracksHandle = SG::makeHandle(m_offlineTracksKey, eventContext);
140 ATH_MSG_DEBUG("read Offline tracks, size= " << offlineTracksHandle->size());
141
142 int iTrk = -1;
143 for (const xAOD::TrackParticle* trackParticle : *offlineTracksHandle) {
144 iTrk++;
145 FPGATrackSimOfflineTrack tmpOfflineTrack;
146 tmpOfflineTrack.setQOverPt(trackParticle->pt() > 0 ? trackParticle->charge() / trackParticle->pt() : 0);
147 tmpOfflineTrack.setEta(trackParticle->eta());
148 tmpOfflineTrack.setPhi(trackParticle->phi());
149 tmpOfflineTrack.setD0(trackParticle->d0());
150 tmpOfflineTrack.setZ0(trackParticle->z0());
151
152 const Trk::TrackStates* trackStates = trackParticle->track()->trackStateOnSurfaces();
153 if (trackStates == nullptr) {
154 ATH_MSG_ERROR("missing trackStatesOnSurface");
155 return StatusCode::FAILURE;
156 }
157 for (const Trk::TrackStateOnSurface* tsos : *trackStates) {
158 if (tsos == nullptr) continue;
160 const Trk::MeasurementBase* measurement = tsos->measurementOnTrack();
161 if (tsos->trackParameters() != nullptr &&
162 tsos->trackParameters()->associatedSurface().associatedDetectorElement() != nullptr &&
163 tsos->trackParameters()->associatedSurface().associatedDetectorElement()->identify() != 0
164 ) {
165 const Trk::RIO_OnTrack* hit = dynamic_cast <const Trk::RIO_OnTrack*>(measurement);
166 const Identifier& hitId = hit->identify();
167 FPGATrackSimOfflineHit tmpOfflineHit;
168 if (m_pixelId->is_pixel(hitId)) {
169 tmpOfflineHit.setIsPixel(true);
170 tmpOfflineHit.setIsBarrel(m_pixelId->is_barrel(hitId));
171
172 const InDetDD::SiDetectorElement* sielement = m_PIX_mgr->getDetectorElement(hitId);
173 tmpOfflineHit.setClusterID(sielement->identifyHash());
174 tmpOfflineHit.setTrackNumber(iTrk);
175 tmpOfflineHit.setLayer(m_pixelId->layer_disk(hitId));
176 tmpOfflineHit.setLocX((float)measurement->localParameters()[Trk::locX]);
177 tmpOfflineHit.setLocY((float)measurement->localParameters()[Trk::locY]);
178 }
179 else if (m_sctId->is_sct(hitId)) {
180 tmpOfflineHit.setIsPixel(false);
181 tmpOfflineHit.setIsBarrel(m_sctId->is_barrel(hitId));
182 const InDetDD::SiDetectorElement* sielement = m_SCT_mgr->getDetectorElement(hitId);
183 tmpOfflineHit.setClusterID(sielement->identifyHash());
184 tmpOfflineHit.setTrackNumber(iTrk);
185 tmpOfflineHit.setLayer(m_sctId->layer_disk(hitId));
186 tmpOfflineHit.setLocX(((float)measurement->localParameters()[Trk::locX]));
187 tmpOfflineHit.setLocY(-99999.9);
188 }
189 tmpOfflineTrack.addHit(tmpOfflineHit);
190 }
191 }
192 }
193 offline.push_back(tmpOfflineTrack);
194 }//end of loop over tracks
195
196
197 return StatusCode::SUCCESS;
198}
199
200
201
202// dump silicon channels with geant matching information.
203StatusCode
205 FPGATrackSimEventInputHeader* eventHeader,
206 HitIndexMap& hitIndexMap,
207 const EventContext& eventContext) const
208{
209 ATH_MSG_DEBUG("read silicon hits");
210 unsigned int hitIndex = 0u;
211
212 ATH_CHECK(readPixelSimulation(eventHeader, hitIndexMap, hitIndex, eventContext));
213 ATH_CHECK(readStripSimulation(eventHeader, hitIndexMap, hitIndex, eventContext));
214
215 return StatusCode::SUCCESS;
216}
217
218
219StatusCode
221 FPGATrackSimEventInputHeader* eventHeader,
222 HitIndexMap& hitIndexMap,
223 unsigned int& hitIndex,
224 const EventContext& eventContext) const {
225
226 auto pixelSDOHandle = SG::makeHandle(m_pixelSDOKey, eventContext);
227 auto pixelRDOHandle = SG::makeHandle(m_pixelRDOKey, eventContext);
228
229 ATH_MSG_DEBUG("Found Pixel SDO Map");
230
231 for (const InDetRawDataCollection<PixelRDORawData>* pixel_rdoCollection : *pixelRDOHandle) {
232 if (pixel_rdoCollection == nullptr) { continue; }
233 // loop on all RDOs
234 for (const PixelRDORawData* pixelRawData : *pixel_rdoCollection) {
235 Identifier rdoId = pixelRawData->identify();
236 // get the det element from the det element collection
237 const InDetDD::SiDetectorElement* sielement = m_PIX_mgr->getDetectorElement(rdoId); assert(sielement);
238
239 Amg::Vector2D localPos = sielement->rawLocalPositionOfCell(rdoId);
240 Amg::Vector3D globalPos = sielement->globalPosition(localPos);
241 InDetDD::SiCellId cellID = sielement->cellIdFromIdentifier(rdoId);
242
243 // update map between pixel identifier and event-unique hit index.
244 // ganged pixels (nCells==2) get two entries.
245 hitIndexMap[rdoId] = hitIndex;
246 const int nCells = sielement->numberOfConnectedCells(cellID);
247 if (nCells == 2) {
248 const InDetDD::SiCellId tmpCell = sielement->connectedCell(cellID, 1);
249 const Identifier tmpId = sielement->identifierFromCellId(tmpCell);
250 hitIndexMap[tmpId] = hitIndex; // add second entry for ganged pixel ID
251 }
252 // if there is simulation truth available, try to retrieve the "most likely" barcode for this pixel.
254 const HepMcParticleLink* bestTruthLink{};
255 if (!m_pixelSDOKey.empty()) {
256 InDetSimDataCollection::const_iterator iter(pixelSDOHandle->find(rdoId));
257 if (nCells > 1 && iter == pixelSDOHandle->end()) {
258 InDetDD::SiReadoutCellId SiRC(m_pixelId->phi_index(rdoId), m_pixelId->eta_index(rdoId));
259 for (int ii = 0; ii < nCells && iter == pixelSDOHandle->end(); ++ii) {
260 iter = pixelSDOHandle->find(sielement->identifierFromCellId(sielement->design().connectedCell(SiRC, ii)));
261 }
262 } // end search for correct ganged pixel
263 // if SDO found for this pixel, associate the particle. otherwise leave unassociated.
264 if (iter != pixelSDOHandle->end()) { bestTruthLink = getTruthInformation(iter, parentMask); }
265 } // end if pixel truth available
266 HepMC::ConstGenParticlePtr bestParent = (bestTruthLink) ? bestTruthLink->cptr() : nullptr;
267 ++hitIndex;
268
269 // push back the hit information to DataInput for HitList
270 FPGATrackSimHit tmpSGhit;
273 tmpSGhit.setIdentifierHash(sielement->identifyHash());
274 tmpSGhit.setIdentifier(sielement->identify().get_identifier32().get_compact());
275 tmpSGhit.setRdoIdentifier(rdoId.get_compact()); // full 64 bit hit identifier
276
277 int barrel_ec = m_pixelId->barrel_ec(rdoId);
278 if (barrel_ec == 0)
280 else if (barrel_ec == 2)
282 else if (barrel_ec == -2)
284
285 tmpSGhit.setLayerDisk(m_pixelId->layer_disk(rdoId));
286 tmpSGhit.setPhiModule(m_pixelId->phi_module(rdoId));
287 tmpSGhit.setEtaModule(m_pixelId->eta_module(rdoId));
288 tmpSGhit.setPhiIndex(m_pixelId->phi_index(rdoId));
289 tmpSGhit.setEtaIndex(m_pixelId->eta_index(rdoId));
290 tmpSGhit.setPhiCoord(localPos[0]);
291 tmpSGhit.setEtaCoord(localPos[1]);
292 tmpSGhit.setEtaWidth(0);
293 tmpSGhit.setPhiWidth(0);
294 tmpSGhit.setX(globalPos[Amg::x]);
295 tmpSGhit.setY(globalPos[Amg::y]);
296 tmpSGhit.setZ(globalPos[Amg::z]);
297 tmpSGhit.setToT(pixelRawData->getToT());
298 tmpSGhit.setisValidForITkHit(true); // Pixel clusters are close enough right now that they all can be considered valid for ITK
299 if (bestParent) {
300 tmpSGhit.setEventIndex(bestTruthLink->eventIndex());
301 tmpSGhit.setBarcode(bestTruthLink->barcode()); // FIXME barcode-based
302 tmpSGhit.setUniqueID(bestTruthLink->id()); // May need fixing when uid will be used.
303 }
304 else {
305 tmpSGhit.setEventIndex(std::numeric_limits<long>::max());
306 tmpSGhit.setBarcode(std::numeric_limits<HepMcParticleLink::barcode_type>::max());
307 tmpSGhit.setUniqueID(std::numeric_limits<HepMcParticleLink::barcode_type>::max());
308 }
309
310 tmpSGhit.setBarcodePt(static_cast<unsigned long>(std::ceil(bestParent ? bestParent->momentum().perp() : 0.)));
311 tmpSGhit.setParentageMask(parentMask.to_ulong());
312
313 if (m_doMultiTruth) {
314 // Add truth
316 FPGATrackSimMultiTruth::Barcode uniqueID(tmpSGhit.getEventIndex(), tmpSGhit.getBarcode()); // FIXME barcode-based
317 mt.maximize(uniqueID, tmpSGhit.getBarcodePt()); // FIXME barcode-based
318 tmpSGhit.setTruth(mt);
319 }
320
321 eventHeader->addHit(tmpSGhit);
322 } // end for each RDO in the collection
323 } // for each pixel RDO collection
324
325 return StatusCode::SUCCESS;
326}
327
328StatusCode
330 FPGATrackSimEventInputHeader* eventHeader,
331 HitIndexMap& hitIndexMap,
332 unsigned int& hitIndex,
333 const EventContext& eventContext) const {
334
335 constexpr int MaxChannelinStripRow = 128;
336
337 auto stripSDOHandle = SG::makeHandle(m_stripSDOKey, eventContext);
338 ATH_MSG_DEBUG("Found SCT SDO Map");
339 auto stripRDOHandle = SG::makeHandle(m_stripRDOKey, eventContext);
340 for (const InDetRawDataCollection<SCT_RDORawData>* SCT_Collection : *stripRDOHandle) {
341 if (SCT_Collection == nullptr) { continue; }
342
343 std::map<int, bool> firedStrips;
344 std::map<int, const SCT_RDORawData*> firedStripsToRDO;
345 // Preprocess the SCT collection hits to get information for encoding strip in ITK format
346 // All strips fired read into a map to an overview of full module that should be used to encode
347 // the data into the ITk formatl
348 for (const SCT_RDORawData* sctRawData : *SCT_Collection)
349 {
350 const Identifier rdoId = sctRawData->identify();
351 const int baseLineStrip{m_sctId->strip(rdoId)};
352 for(int i = 0; i < sctRawData->getGroupSize(); i++) {
353 firedStrips[baseLineStrip+ i] = true;
354 firedStripsToRDO[baseLineStrip + i] = sctRawData;
355 }
356 }
357
358 // Loop over the fired hits and encode them in the ITk strips hit map
359 // It find unique hits in the list that can be encoded and don't overlap
360 std::map<int, int> stripEncodingForITK;
361 std::map<int, const SCT_RDORawData* > stripEncodingForITKToRDO;
362 for(const auto& [stripID, fired]: firedStrips)
363 {
364 // Don't use the strip that has been set false.
365 // This will be the case where neighbouring strip will "used up in the cluster"
366 // And then we don't want to re use them
367 if(!fired) continue;
368
369 // Check the next 3 hits if they are there and have a hit in them
370 std::bitset<3> hitMap;
371
372
373 // Get the current chip id of the strip
374 int currChipID = stripID / MaxChannelinStripRow;
375 // Compute the maximum stripID this chip can have
376 int maxStripIDForCurrChip = (currChipID + 1) * MaxChannelinStripRow;
377
378 for(int i = 0; i < 3; i++)
379 {
380 // We don't want to "cluster" strips that are outside the range of this chip
381 if((stripID + 1 + i) >= maxStripIDForCurrChip) continue;
382
383 if(firedStrips.find(stripID + 1 + i) != firedStrips.end())
384 {
385 if(firedStrips.at(stripID + 1 + i))
386 {
387 hitMap[2 - i] = 1;
388 firedStrips[stripID + 1 + i] = false;
389 }
390 else
391 {
392 hitMap[2 - i] = 0;
393 }
394 }
395 }
396
397 // Encode the hit map into a int
398 stripEncodingForITK[stripID] = (int)(hitMap.to_ulong());
399 stripEncodingForITKToRDO[stripID] = firedStripsToRDO[stripID];
400 }
401
402 // Actual creation of the FPGAHit objects
403 for(const auto& [stripID, fired]: firedStrips)
404 {
405 const SCT_RDORawData* sctRawData = firedStripsToRDO[stripID];
406 const Identifier rdoId = sctRawData->identify();
407 // get the det element from the det element collection
408 const InDetDD::SiDetectorElement* sielement = m_SCT_mgr->getDetectorElement(rdoId);
409 const InDetDD::SiDetectorDesign& design = dynamic_cast<const InDetDD::SiDetectorDesign&>(sielement->design());
410
411 InDetDD::SiCellId frontId(stripID);
412 Amg::Vector2D localPos = design.localPositionOfCell(frontId);
413 std::pair<Amg::Vector3D, Amg::Vector3D> endsOfStrip = sielement->endsOfStrip(localPos);
414
415 hitIndexMap[rdoId] = hitIndex;
416 ++hitIndex;
417 // if there is simulation truth available, try to retrieve the
418 // "most likely" barcode for this strip.
420 const HepMcParticleLink* bestTruthLink{};
421 if (!m_stripSDOKey.empty()) {
422 InDetSimDataCollection::const_iterator iter(stripSDOHandle->find(rdoId));
423 // if SDO found for this strip, associate the particle
424 if (iter != stripSDOHandle->end()) { bestTruthLink = getTruthInformation(iter, parentMask); }
425 } // end if sct truth available
426 HepMC::ConstGenParticlePtr bestParent = (bestTruthLink) ? bestTruthLink->cptr() : nullptr;
427 // push back the hit information to DataInput for HitList , copy from RawInput.cxx
428
429 FPGATrackSimHit tmpSGhit;
432 tmpSGhit.setIdentifierHash(sielement->identifyHash());
433 tmpSGhit.setIdentifier(sielement->identify().get_identifier32().get_compact());
434 tmpSGhit.setRdoIdentifier(rdoId.get_compact()); // full 64 bit hit identifier
435
436 int barrel_ec = m_sctId->barrel_ec(rdoId);
437 if (barrel_ec == 0)
439 else if (barrel_ec == 2)
441 else if (barrel_ec == -2)
443
444 tmpSGhit.setLayerDisk(m_sctId->layer_disk(rdoId));
445 tmpSGhit.setPhiModule(m_sctId->phi_module(rdoId));
446 tmpSGhit.setEtaModule(m_sctId->eta_module(rdoId));
447 tmpSGhit.setPhiIndex(stripID);
448 tmpSGhit.setEtaIndex(m_sctId->row(rdoId));
449 tmpSGhit.setPhiCoord(localPos[0]);
450 tmpSGhit.setEtaCoord(localPos[1]);
451 tmpSGhit.setSide(m_sctId->side(rdoId));
452 tmpSGhit.setEtaWidth(0);
453 tmpSGhit.setPhiWidth(1);
454 if (bestParent) {
455 tmpSGhit.setEventIndex(bestTruthLink->eventIndex());
456 tmpSGhit.setBarcode(bestTruthLink->barcode()); // FIXME barcode-based
457 tmpSGhit.setUniqueID(bestTruthLink->id());
458 }
459 else {
460 tmpSGhit.setEventIndex(std::numeric_limits<long>::max());
461 tmpSGhit.setBarcode(std::numeric_limits<HepMcParticleLink::barcode_type>::max());
462 tmpSGhit.setUniqueID(std::numeric_limits<HepMcParticleLink::barcode_type>::max());
463 }
464
465 // If the strip has been identified by the previous for loop as a valid hit that can be encoded into ITk Strip format
466 if(stripEncodingForITK.find(stripID) != stripEncodingForITK.end())
467 {
468 // Each ITK ABC chip reads 128 channels in one row, so we just need to divide the current strip with 128 to get the chip index
469 // for the Strip ID, it is the remainder left after dividing by 128
470 int chipID = stripID / MaxChannelinStripRow;
471 int ITkStripID = stripID % MaxChannelinStripRow;
472
473 // for each ABC chip readout, each reads 256 channels actually. 0-127 corresponds to lower row and then 128-255 corresponds to the
474 // upper. This can be simulated in the code by using the eta module index. Even index are not offset, while odd index, the
475 // strip id is offset by 128
476 // One point to not is that for barrel, the eta module index start at 1, and not zero. Hence a shift of 1 is needed
477 int offset = m_sctId->eta_module(rdoId) % 2;
478 if(m_sctId->barrel_ec(rdoId) == 0) offset = (std::abs(m_sctId->eta_module(rdoId)) - 1) % 2;
479
480 ITkStripID += offset * MaxChannelinStripRow;
481
482 tmpSGhit.setisValidForITkHit(true);
483 tmpSGhit.setStripRowIDForITk(ITkStripID);
484 tmpSGhit.setStripChipIDForITk(chipID);
485 tmpSGhit.setStripHitMapForITk(stripEncodingForITK.at(stripID));
486 }
487
488 tmpSGhit.setBarcodePt(static_cast<unsigned long>(std::ceil(bestParent ? bestParent->momentum().perp() : 0.)));
489 tmpSGhit.setParentageMask(parentMask.to_ulong());
490 tmpSGhit.setX(0.5 * (endsOfStrip.first.x() + endsOfStrip.second.x()));
491 tmpSGhit.setY(0.5 * (endsOfStrip.first.y() + endsOfStrip.second.y()));
492 tmpSGhit.setZ(0.5 * (endsOfStrip.first.z() + endsOfStrip.second.z()));
493
494 if (m_doMultiTruth) {
495 // Add truth
497 FPGATrackSimMultiTruth::Barcode uniqueID(tmpSGhit.getEventIndex(), tmpSGhit.getBarcode()); // FIXME barcode-based
498 mt.maximize(uniqueID, tmpSGhit.getBarcodePt()); // FIMXE barcode-based
499 tmpSGhit.setTruth(mt);
500 }
501
502 eventHeader->addHit(tmpSGhit);
503 } // end for each RDO in the strip collection
504 } // end for each strip RDO collection
505 // dump all RDO's and SDO's for a given event, for debugging purposes
506
507 return StatusCode::SUCCESS;
508}
509
510
511StatusCode
512FPGATrackSimSGToRawHitsTool::dumpPixelClusters(HitIndexMap& pixelClusterIndexMap, const EventContext& eventContext) const {
513 unsigned int pixelClusterIndex = 0;
514 auto pixelSDOHandle = SG::makeHandle(m_pixelSDOKey, eventContext);
515 auto pixelClusterContainerHandle = SG::makeHandle(m_pixelClusterContainerKey, eventContext);
516 // Dump pixel clusters. They're in m_pixelContainer
517 for (const InDet::SiClusterCollection* pixelClusterCollection : *pixelClusterContainerHandle) {
518 if (pixelClusterCollection == nullptr) {
519 ATH_MSG_DEBUG("pixelClusterCollection not available!");
520 continue;
521 }
522
523 for (const InDet::SiCluster* cluster : *pixelClusterCollection) {
524 Identifier theId = cluster->identify();
525 // if there is simulation truth available, try to retrieve the "most likely" barcode for this pixel cluster.
526 FPGATrackSimInputUtils::ParentBitmask parentMask; // FIXME set, but not used
527 if (!m_pixelSDOKey.empty()) {
528 for (const Identifier& rdoId : cluster->rdoList()) {
529 const InDetDD::SiDetectorElement* sielement = m_PIX_mgr->getDetectorElement(rdoId);
530 assert(sielement);
531 InDetDD::SiCellId cellID = sielement->cellIdFromIdentifier(rdoId);
532
533 const int nCells = sielement->numberOfConnectedCells(cellID);
534 InDetSimDataCollection::const_iterator iter(pixelSDOHandle->find(rdoId));
535 // this might be the ganged pixel copy.
536 if (nCells > 1 && iter == pixelSDOHandle->end()) {
537 InDetDD::SiReadoutCellId SiRC(m_pixelId->phi_index(rdoId), m_pixelId->eta_index(rdoId));
538 for (int ii = 0; ii < nCells && iter == pixelSDOHandle->end(); ++ii) {
539 iter = pixelSDOHandle->find(sielement->identifierFromCellId(sielement->design().connectedCell(SiRC, ii)));
540 }
541 } // end search for correct ganged pixel
542 // if SDO found for this pixel, associate the particle. otherwise leave unassociated.
543 if (iter != pixelSDOHandle->end()) { (void) getTruthInformation(iter, parentMask); } // FIXME not used??
544 } // if we have pixel sdo's available
545 }
546 pixelClusterIndexMap[theId] = pixelClusterIndex;
547 pixelClusterIndex++;
548 } // End loop over pixel clusters
549 } // End loop over pixel cluster collection
550
551 return StatusCode::SUCCESS;
552}
553
554StatusCode
555FPGATrackSimSGToRawHitsTool::readOfflineClusters(std::vector <FPGATrackSimCluster>& clusters, const EventContext& eventContext) const
556
557{
558
559 //Lets do the Pixel clusters first
560 //Loopover the pixel clusters and convert them into a FPGATrackSimCluster for storage
561 // Dump pixel clusters. They're in m_pixelContainer
562 auto pixelSDOHandle = SG::makeHandle(m_pixelSDOKey, eventContext);
563 auto pixelClusterContainerHandler = SG::makeHandle(m_pixelClusterContainerKey, eventContext);
564 for (const InDet::SiClusterCollection* pixelClusterCollection : *pixelClusterContainerHandler) {
565 if (pixelClusterCollection == nullptr) {
566 ATH_MSG_DEBUG("pixelClusterCollection not available!");
567 continue;
568 }
569 const int size = pixelClusterCollection->size();
570 ATH_MSG_DEBUG("PixelClusterCollection found with " << size << " clusters");
571 for (const InDet::SiCluster* cluster : *pixelClusterCollection) {
572
573 // if there is simulation truth available, try to retrieve the "most likely" barcode for this pixel cluster.
575 const HepMcParticleLink* bestTruthLink{};
576 if (!m_pixelSDOKey.empty()) {
577 for (const Identifier& rdoId : cluster->rdoList()) {
578 const InDetDD::SiDetectorElement* sielement = m_PIX_mgr->getDetectorElement(rdoId);
579 assert(sielement);
580 InDetDD::SiCellId cellID = sielement->cellIdFromIdentifier(rdoId);
581 const int nCells = sielement->numberOfConnectedCells(cellID);
582 InDetSimDataCollection::const_iterator iter(pixelSDOHandle->find(rdoId));
583 // this might be the ganged pixel copy.
584 if (nCells > 1 && iter == pixelSDOHandle->end()) {
585 InDetDD::SiReadoutCellId SiRC(m_pixelId->phi_index(rdoId), m_pixelId->eta_index(rdoId));
586 for (int ii = 0; ii < nCells && iter == pixelSDOHandle->end(); ++ii) {
587 iter = pixelSDOHandle->find(sielement->identifierFromCellId(sielement->design().connectedCell(SiRC, ii)));
588 }
589 } // end search for correct ganged pixel
590 // if SDO found for this pixel, associate the particle. otherwise leave unassociated.
591 if (iter != pixelSDOHandle->end()) { bestTruthLink = getTruthInformation(iter, parentMask); }
592 } // if we have pixel sdo's available
593 }
594 HepMC::ConstGenParticlePtr bestParent = (bestTruthLink) ? bestTruthLink->cptr() : nullptr;
595
596 Identifier theID = cluster->identify();
597 //cluster object to be written out
598 FPGATrackSimCluster clusterOut;
599 //Rawhit object to represent the cluster
600 FPGATrackSimHit clusterEquiv;
601 //Lets get the information of this pixel cluster
602 const InDetDD::SiDetectorElement* sielement = m_PIX_mgr->getDetectorElement(theID);
603 assert(sielement);
604 const InDetDD::SiLocalPosition localPos = sielement->rawLocalPositionOfCell(theID);
605 const Amg::Vector3D globalPos(sielement->globalPosition(localPos));
606 clusterEquiv.setHitType(HitType::clustered);
607 clusterEquiv.setX(globalPos.x());
608 clusterEquiv.setY(globalPos.y());
609 clusterEquiv.setZ(globalPos.z());
610 clusterEquiv.setDetType(SiliconTech::pixel);
611 clusterEquiv.setIdentifierHash(sielement->identifyHash());
612 clusterEquiv.setIdentifier(sielement->identify().get_identifier32().get_compact());
613
614 int barrel_ec = m_pixelId->barrel_ec(theID);
615 if (barrel_ec == 0)
617 else if (barrel_ec == 2)
619 else if (barrel_ec == -2)
621
622 clusterEquiv.setLayerDisk(m_pixelId->layer_disk(theID));
623 clusterEquiv.setPhiModule(m_pixelId->phi_module(theID));
624 clusterEquiv.setEtaModule(m_pixelId->eta_module(theID));
625 clusterEquiv.setPhiIndex(m_pixelId->phi_index(theID));
626 clusterEquiv.setEtaIndex(m_pixelId->eta_index(theID));
627 clusterEquiv.setPhiCoord(localPos.xPhi());
628 clusterEquiv.setEtaCoord(localPos.xEta());
629
630 clusterEquiv.setPhiWidth(cluster->width().colRow()[1]);
631 clusterEquiv.setEtaWidth(cluster->width().colRow()[0]);
632 //Save the truth here as the MultiTruth object is only transient
633 if (bestParent) {
634 clusterEquiv.setEventIndex(bestTruthLink->eventIndex());
635 clusterEquiv.setBarcode(bestTruthLink->barcode()); // FIXME barcode-based
636 clusterEquiv.setUniqueID(bestTruthLink->id());
637 }
638 else {
639 clusterEquiv.setEventIndex(std::numeric_limits<long>::max());
640 clusterEquiv.setBarcode(std::numeric_limits<HepMcParticleLink::barcode_type>::max());
641 clusterEquiv.setUniqueID(std::numeric_limits<HepMcParticleLink::barcode_type>::max());
642 }
643
644 clusterEquiv.setBarcodePt(static_cast<unsigned long>(std::ceil(bestParent ? bestParent->momentum().perp() : 0.)));
645 clusterEquiv.setParentageMask(parentMask.to_ulong());
646 clusterOut.setClusterEquiv(clusterEquiv);
647 clusters.push_back(clusterOut);
648 }
649 }
650
651 //Now lets do the strip clusters
652 //Loopover the pixel clusters and convert them into a FPGATrackSimCluster for storage
653 // Dump pixel clusters. They're in m_pixelContainer
654 auto stripSDOHandle = SG::makeHandle(m_stripSDOKey, eventContext);
655 ATH_MSG_DEBUG("Found SCT SDO Map");
656 auto stripRDOHandle = SG::makeHandle(m_stripRDOKey, eventContext);
657
658 for (const InDetRawDataCollection<SCT_RDORawData>* SCT_Collection : *stripRDOHandle) {
659 if (SCT_Collection == nullptr) { continue; }
660 for (const SCT_RDORawData* sctRawData : *SCT_Collection) {
661 const Identifier rdoId = sctRawData->identify();
662 // get the det element from the det element collection
663 const InDetDD::SiDetectorElement* sielement = m_SCT_mgr->getDetectorElement(rdoId);
664 const InDetDD::SiDetectorDesign& design = dynamic_cast<const InDetDD::SiDetectorDesign&>(sielement->design());
665 const InDetDD::SiLocalPosition localPos = design.localPositionOfCell(m_sctId->strip(rdoId));
666 const Amg::Vector3D gPos = sielement->globalPosition(localPos);
667 // if there is simulation truth available, try to retrieve the
668 // "most likely" barcode for this strip.
670 const HepMcParticleLink* bestTruthLink{};
671 if (!m_stripSDOKey.empty()) {
672 InDetSimDataCollection::const_iterator iter(stripSDOHandle->find(rdoId));
673 // if SDO found for this pixel, associate the particle
674 if (iter != stripSDOHandle->end()) { bestTruthLink = getTruthInformation(iter, parentMask); }
675 } // end if sct truth available
676 HepMC::ConstGenParticlePtr bestParent = (bestTruthLink) ? bestTruthLink->cptr() : nullptr;
677
678 // push back the hit information to DataInput for HitList , copy from RawInput.cxx
679 FPGATrackSimCluster clusterOut;
680 FPGATrackSimHit clusterEquiv;
681 clusterEquiv.setHitType(HitType::clustered);
682 clusterEquiv.setX(gPos.x());
683 clusterEquiv.setY(gPos.y());
684 clusterEquiv.setZ(gPos.z());
685 clusterEquiv.setDetType(SiliconTech::strip);
686 clusterEquiv.setIdentifierHash(sielement->identifyHash());
687 clusterEquiv.setIdentifier(sielement->identify().get_identifier32().get_compact());
688
689 int barrel_ec = m_sctId->barrel_ec(rdoId);
690 if (barrel_ec == 0)
692 else if (barrel_ec == 2)
694 else if (barrel_ec == -2)
696
697 clusterEquiv.setLayerDisk(m_sctId->layer_disk(rdoId));
698 clusterEquiv.setPhiModule(m_sctId->phi_module(rdoId));
699 clusterEquiv.setEtaModule(m_sctId->eta_module(rdoId));
700 clusterEquiv.setPhiIndex(m_sctId->strip(rdoId));
701 clusterEquiv.setEtaIndex(m_sctId->row(rdoId));
702 clusterEquiv.setPhiCoord(localPos.xPhi());
703 clusterEquiv.setEtaCoord(localPos.xEta());
704 clusterEquiv.setSide(m_sctId->side(rdoId));
705 //I think this is the strip "cluster" width
706 clusterEquiv.setPhiWidth(sctRawData->getGroupSize());
707 //Save the truth here as the MultiTruth object is only transient
708 if (bestParent) {
709 clusterEquiv.setEventIndex(bestTruthLink->eventIndex());
710 clusterEquiv.setBarcode(bestTruthLink->barcode()); // FIXME barcode-based
711 clusterEquiv.setUniqueID(bestTruthLink->id());
712 }
713 else {
714 clusterEquiv.setEventIndex(std::numeric_limits<long>::max());
715 clusterEquiv.setBarcode(std::numeric_limits<HepMcParticleLink::barcode_type>::max());
716 clusterEquiv.setUniqueID(std::numeric_limits<HepMcParticleLink::barcode_type>::max());
717 }
718
719 clusterEquiv.setBarcodePt(static_cast<unsigned long>(std::ceil(bestParent ? bestParent->momentum().perp() : 0.)));
720 clusterEquiv.setParentageMask(parentMask.to_ulong());
721 clusterOut.setClusterEquiv(clusterEquiv);
722 clusters.push_back(clusterOut);
723 } // end for each RDO in the strip collection
724 } // end for each strip RDO collection
725 // dump all RDO's and SDO's for a given event, for debugging purposes
726
727 return StatusCode::SUCCESS;
728}
729
730StatusCode
731FPGATrackSimSGToRawHitsTool::readTruthTracks(std::vector <FPGATrackSimTruthTrack>& truth, const EventContext& eventContext) const
732{
733 auto simTracksHandle = SG::makeHandle(m_mcCollectionKey, eventContext);
734 ATH_MSG_DEBUG("Dump truth tracks, size " << simTracksHandle->size());
735
736 // dump each truth track
737 for (unsigned int ievt = 0; ievt < simTracksHandle->size(); ++ievt) {
738 const HepMC::GenEvent* genEvent = simTracksHandle->at(ievt);
739 // retrieve the primary interaction vertex here. for now, use the dummy origin.
740 HepGeom::Point3D<double> primaryVtx(0., 0., 0.);
741 // the event should have signal process vertex unless it was generated as single particles.
742 // if it exists, use it for the primary vertex.
744 if (spv) {
745 primaryVtx.set(spv->position().x(),
746 spv->position().y(),
747 spv->position().z());
748 ATH_MSG_DEBUG("using signal process vertex for eventIndex " << ievt << ":"
749 << primaryVtx.x() << "\t" << primaryVtx.y() << "\t" << primaryVtx.z());
750 }
751 for (const auto& particle: *genEvent) {
752 const int pdgcode = particle->pdg_id();
753 // reject generated particles without a production vertex.
754 if (particle->production_vertex() == nullptr) {
755 continue;
756 }
757 float charge = MC::charge(pdgcode);
758 if (std::abs(charge) < 0.5) {
759 continue;
760 }
761 if (!MC::isStable(particle)) {
762 continue;
763 }
764 // truth-to-track tool
765 const Amg::Vector3D momentum(particle->momentum().px(), particle->momentum().py(), particle->momentum().pz());
766 const Amg::Vector3D position(particle->production_vertex()->position().x(), particle->production_vertex()->position().y(), particle->production_vertex()->position().z());
767 const Trk::CurvilinearParameters cParameters(position, momentum, charge);
769 if (m_UseNominalOrigin) {
770 Amg::Vector3D origin(0, 0, 0);
771 persf = Trk::PerigeeSurface(origin);
772 }
773 else {
774 SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle{ m_beamSpotKey, eventContext };
775 Trk::PerigeeSurface persf(beamSpotHandle->beamPos());
776 }
777 const std::unique_ptr<Trk::TrackParameters> tP = m_extrapolator->extrapolate(eventContext, cParameters, persf, Trk::anyDirection, false);
778 const double track_truth_d0 = tP ? tP->parameters()[Trk::d0] : 999.;
779 const double track_truth_phi = tP ? tP->parameters()[Trk::phi] : 999.;
780 const double track_truth_p = (tP && fabs(tP->parameters()[Trk::qOverP]) > 1.e-8) ?
781 tP->charge() / tP->parameters()[Trk::qOverP] : 10E7;
782 const double track_truth_x0 = tP ? tP->position().x() : 999.;
783 const double track_truth_y0 = tP ? tP->position().y() : 999.;
784 const double track_truth_z0 = tP ? tP->parameters()[Trk::z0] : 999.;
785 const double track_truth_q = tP ? tP->charge() : 0.;
786 const double track_truth_sinphi = tP ? std::sin(tP->parameters()[Trk::phi]) : -1.;
787 const double track_truth_cosphi = tP ? std::cos(tP->parameters()[Trk::phi]) : -1.;
788 const double track_truth_sintheta = tP ? std::sin(tP->parameters()[Trk::theta]) : -1.;
789 const double track_truth_costheta = tP ? std::cos(tP->parameters()[Trk::theta]) : -1.;
790 double truth_d0corr = track_truth_d0 - (primaryVtx.y() * cos(track_truth_phi) - primaryVtx.x() * sin(track_truth_phi));
791 double truth_zvertex = 0.;
792 const HepGeom::Point3D<double> startVertex(particle->production_vertex()->position().x(), particle->production_vertex()->position().y(), particle->production_vertex()->position().z());
793 // categorize particle (prompt, secondary, etc.) based on InDetPerformanceRTT/detector paper criteria.
794 bool isPrimary = true;
795 if (std::abs(truth_d0corr) > 2.) { isPrimary = false; }
796 const int bc = HepMC::barcode(particle); // FIXME update barcode-based syntax
797 const int uid = HepMC::uniqueID(particle);
798 if (HepMC::is_simulation_particle(particle) || bc == 0) { isPrimary = false; } // FIXME update barcode-based syntax
799 if (isPrimary && particle->production_vertex()) {
800 const HepGeom::Point3D<double> startVertex(particle->production_vertex()->position().x(), particle->production_vertex()->position().y(), particle->production_vertex()->position().z());
801 if (std::abs(startVertex.z() - truth_zvertex) > 100.) { isPrimary = false; }
802 if (particle->end_vertex()) {
803 HepGeom::Point3D<double> endVertex(particle->end_vertex()->position().x(), particle->end_vertex()->position().y(), particle->end_vertex()->position().z());
804 if (endVertex.perp() < FPGATrackSim_PT_TRUTHMIN && std::abs(endVertex.z()) < FPGATrackSim_Z_TRUTHMIN) { isPrimary = false; }
805 }
806 }
807 else {
808 isPrimary = false;
809 }
810
812
813 FPGATrackSimTruthTrack tmpSGTrack;
814 tmpSGTrack.setVtxX(track_truth_x0);
815 tmpSGTrack.setVtxY(track_truth_y0);
816 tmpSGTrack.setVtxZ(track_truth_z0);
817 tmpSGTrack.setD0(track_truth_d0);
818 tmpSGTrack.setZ0(track_truth_z0);
819 tmpSGTrack.setQ(track_truth_q);
820 tmpSGTrack.setPX(track_truth_p * (track_truth_cosphi * track_truth_sintheta));
821 tmpSGTrack.setPY(track_truth_p * (track_truth_sinphi * track_truth_sintheta));
822 tmpSGTrack.setPZ(track_truth_p * track_truth_costheta);
823 tmpSGTrack.setPDGCode(pdgcode);
824 tmpSGTrack.setStatus(particle->status());
825 tmpSGTrack.setPrimary(!HepMC::is_simulation_particle(particle));
826 tmpSGTrack.setBarcode(truthLink2.barcode());
827 tmpSGTrack.setUniqueID(truthLink2.id());
828 tmpSGTrack.setEventIndex(truthLink2.eventIndex());
829
830 truth.push_back(tmpSGTrack);
831 } // end for each GenParticle in this GenEvent
832 } // end for each GenEvent
833
834
835 return StatusCode::SUCCESS;
836}
837
838
839const HepMcParticleLink* FPGATrackSimSGToRawHitsTool::getTruthInformation(InDetSimDataCollection::const_iterator& iter,
840 FPGATrackSimInputUtils::ParentBitmask& parentMask) const {
841 const HepMcParticleLink* bestTruthLink{};
842 const InDetSimData& sdo(iter->second);
843 const std::vector<InDetSimData::Deposit>& deposits(sdo.getdeposits());
844 float bestPt{-999.f};
845 for (const InDetSimData::Deposit& dep : deposits) {
846
847 const HepMcParticleLink& particleLink = dep.first;
848 // RDO's without SDO's are delta rays or detector noise.
849 if (!particleLink.isValid()) { continue; }
850 const float genEta = particleLink->momentum().pseudoRapidity();
851 const float genPt = particleLink->momentum().perp(); // MeV
852 // reject unstable particles
853 if (!MC::isStable(particleLink.cptr())) { continue; }
854 // reject secondaries and low pT (<400 MeV) pileup
855 if (HepMC::is_simulation_particle(particleLink.cptr()) || particleLink.barcode() == 0 /*HepMC::no_truth_link(particleLink)*/) { continue; } // FIXME
856 // reject far forward particles
857 if (std::fabs(genEta) > m_maxEta) { continue; }
858 // "bestTruthLink" links to the highest pt particle
859 if (bestPt < genPt) {
860 bestPt = genPt;
861 bestTruthLink = &particleLink;
862 }
863 parentMask |= FPGATrackSimInputUtils::construct_truth_bitmap(std::shared_ptr<const HepMC3::GenParticle>(particleLink.cptr()));
864 // check SDO
865 } // end for each contributing particle
866 return bestTruthLink;
867}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
double charge(const T &p)
Definition AtlasPID.h:997
: FPGATrackSim-specific class to represent an hit in the detector.
ATLAS-specific HepMC functions.
size_t size() const
Number of registered mappings.
void setClusterEquiv(const FPGATrackSimHit &input)
void setaverageInteractionsPerCrossing(const int &val)
void setBCID(const int &val)
void setLB(const int &val)
void setRunNumber(const unsigned long &val)
void setlevel1TriggerType(const unsigned int &val)
void setactualInteractionsPerCrossing(const int &val)
void setEventNumber(const unsigned long &val)
void setextendedLevel1ID(const unsigned int &val)
void addHit(FPGATrackSimHit const &s)
void newEvent(FPGATrackSimEventInfo const &event)
void setOptional(FPGATrackSimOptionalEventInfo const &optional)
void setPhiModule(unsigned v)
void setIdentifierHash(unsigned v)
void setEtaIndex(unsigned v)
void setEventIndex(long v)
void setPhiIndex(unsigned v)
void setStripChipIDForITk(int v)
long getEventIndex() const
void setHitType(HitType type)
float getBarcodePt() const
void setPhiCoord(float v)
void setIdentifier(unsigned int v)
void setZ(float v)
void setBarcode(const HepMcParticleLink::barcode_type &v)
void setX(float v)
void setisValidForITkHit(bool v)
void setRdoIdentifier(Identifier::value_type v)
void setParentageMask(unsigned long v)
void setBarcodePt(float v)
HepMcParticleLink::barcode_type getBarcode() const
void setToT(unsigned v)
void setY(float v)
void setLayerDisk(unsigned v)
void setEtaModule(int v)
void setStripHitMapForITk(int v)
void setStripRowIDForITk(int v)
void setSide(unsigned v)
void setEtaCoord(float v)
void setTruth(const FPGATrackSimMultiTruth &v)
void setEtaWidth(unsigned v)
void setPhiWidth(unsigned v)
void setUniqueID(const HepMcParticleLink::barcode_type &v)
void setDetectorZone(DetectorZone detZone)
void setDetType(SiliconTech detType)
void maximize(const FPGATrackSimMultiTruth::Barcode &code, const FPGATrackSimMultiTruth::Weight &weight)
std::pair< unsigned long, unsigned long > Barcode
void addHit(const FPGATrackSimOfflineHit &s)
void addOfflineCluster(const FPGATrackSimCluster &c) const
void addOfflineTrack(const FPGATrackSimOfflineTrack &t) const
void addTruthTrack(const FPGATrackSimTruthTrack &t) const
SG::ReadHandleKey< InDet::SiClusterContainer > m_pixelClusterContainerKey
Gaudi::Property< bool > m_readOfflineTracks
ToolHandle< Trk::ITruthToTrack > m_truthToTrack
tool to create track parameters from a gen particle
const InDetDD::SiDetectorManager * m_SCT_mgr
SG::ReadHandleKey< InDetSimDataCollection > m_stripSDOKey
StatusCode readOfflineClusters(std::vector< FPGATrackSimCluster > &Clusters, const EventContext &eventContext) const
StatusCode readRawSilicon(FPGATrackSimEventInputHeader *header, HitIndexMap &hitIndexMap, const EventContext &eventContext) const
SG::ReadHandleKey< SCT_RDO_Container > m_stripRDOKey
const HepMcParticleLink * getTruthInformation(InDetSimDataCollection::const_iterator &iter, FPGATrackSimInputUtils::ParentBitmask &parentMask) const
StatusCode readOfflineTracks(std::vector< FPGATrackSimOfflineTrack > &Track, const EventContext &eventContext) const
Gaudi::Property< bool > m_readOfflineClusters
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
const InDetDD::SiDetectorManager * m_PIX_mgr
StatusCode readPixelSimulation(FPGATrackSimEventInputHeader *header, HitIndexMap &hitIndexMap, unsigned int &hitIndex, const EventContext &eventContext) const
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_offlineTracksKey
ToolHandle< Trk::IExtrapolator > m_extrapolator
ToolHandle for Extrapolator.
virtual StatusCode readData(FPGATrackSimEventInputHeader *header, const EventContext &eventContext) const override
This function get from the SG the inner detector raw hits and prepares them for FPGATrackSim simulati...
std::map< Identifier, int > HitIndexMap
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
StatusCode readStripSimulation(FPGATrackSimEventInputHeader *header, HitIndexMap &hitIndexMap, unsigned int &hitIndex, const EventContext &eventContext) const
SG::ReadHandleKey< InDet::SiClusterContainer > m_sctClusterContainerKey
Gaudi::Property< bool > m_readTruthTracks
virtual StatusCode finalize() override
SG::ReadHandleKey< PixelRDO_Container > m_pixelRDOKey
FPGATrackSimSGToRawHitsTool(const std::string &, const std::string &, const IInterface *)
Gaudi::Property< bool > m_UseNominalOrigin
StatusCode readTruthTracks(std::vector< FPGATrackSimTruthTrack > &truth, const EventContext &eventContext) const
SG::ReadHandleKey< McEventCollection > m_mcCollectionKey
StatusCode dumpPixelClusters(HitIndexMap &pixelClusterIndexMap, const EventContext &eventContext) const
SG::ReadHandleKey< InDetSimDataCollection > m_pixelSDOKey
virtual StatusCode initialize() override
void setUniqueID(const HepMcParticleLink::barcode_type &v)
void setBarcode(const HepMcParticleLink::barcode_type &v)
value_type get_compact() const
Get the compact id.
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.
virtual SiCellId connectedCell(const SiReadoutCellId &readoutId, int number) const =0
readout id -> id of connected diodes.
virtual SiLocalPosition localPositionOfCell(const SiCellId &cellId) const =0
readout or diode id -> position.
Identifier for the strip or pixel cell.
Definition SiCellId.h:29
Base class for the detector design classes for Pixel and SCT.
Class to hold geometrical description of a silicon detector element.
virtual SiCellId cellIdFromIdentifier(const Identifier &identifier) const override final
SiCellId from Identifier.
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
std::pair< Amg::Vector3D, Amg::Vector3D > endsOfStrip(const Amg::Vector2D &position) const
Special method for SCT to retrieve the two ends of a "strip" Returned coordinates are in global frame...
virtual Identifier identifierFromCellId(const SiCellId &cellId) const override final
Identifier <-> SiCellId (ie strip number or pixel eta_index,phi_index) Identifier from SiCellId (ie s...
Class to represent a position in the natural frame of a silicon sensor, for Pixel and SCT For Pixel: ...
double xPhi() const
position along phi direction:
double xEta() const
position along eta direction:
Identifier for the strip or pixel readout cell.
SiCellId connectedCell(const SiCellId cellId, int number) const
Get the cell ids sharing the readout for this cell.
virtual IdentifierHash identifyHash() const override final
identifier hash (inline)
int numberOfConnectedCells(const SiCellId cellId) const
Test if readout cell has more than one diode associated with it.
HepGeom::Point3D< double > globalPosition(const HepGeom::Point3D< double > &localPos) const
transform a reconstruction local position into a global position (inline):
virtual Identifier identify() const override final
identifier of this detector element (inline)
Amg::Vector2D rawLocalPositionOfCell(const SiCellId &cellId) const
Returns position (center) of cell.
virtual Identifier identify() const override final
std::pair< HepMcParticleLink, float > Deposit
const std::vector< Deposit > & getdeposits() const
This class is the pure abstract base class for all fittable tracking measurements.
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
Class describing the Line to which the Perigee refers to.
Class to handle RIO On Tracks ROT) for InDet and Muons, it inherits from the common MeasurementBase.
Definition RIO_OnTrack.h:70
Identifier identify() const
return the identifier -extends MeasurementBase
represents the track state (measurement, material, fit parameters and quality) at a surface.
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
const ParentBitmask construct_truth_bitmap(HepMC::ConstGenParticlePtr p)
std::bitset< NBITS > ParentBitmask
int barcode(const T *p)
Definition Barcode.h:15
int uniqueID(const T &p)
ConstGenVertexPtr signal_process_vertex(const GenEvent *e)
Definition GenEvent.h:597
HepMC3::ConstGenParticlePtr ConstGenParticlePtr
Definition GenParticle.h:20
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...
HepMC3::ConstGenVertexPtr ConstGenVertexPtr
Definition GenVertex.h:24
HepMC3::GenEvent GenEvent
Definition GenEvent.h:39
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
double charge(const T &p)
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
@ anyDirection
DataVector< const Trk::TrackStateOnSurface > TrackStates
CurvilinearParametersT< TrackParametersDim, Charged, PlaneSurface > CurvilinearParameters
@ locY
local cartesian
Definition ParamDefs.h:38
@ locX
Definition ParamDefs.h:37
@ theta
Definition ParamDefs.h:66
@ qOverP
perigee
Definition ParamDefs.h:67
@ phi
Definition ParamDefs.h:75
@ d0
Definition ParamDefs.h:63
@ z0
Definition ParamDefs.h:64
TrackParticle_v1 TrackParticle
Reference the current persistent version: