388 {
389
391
392
393 if ( trackCollection->
empty()){
394 ATH_MSG_DEBUG(
"Empty track collection " << collectionName );
395 } else {
396 ATH_MSG_DEBUG(
"Retrieving data for track collection " << collectionName);
397 }
398
399
402 DataVect numDoF; numDoF.reserve(trackCollection->
size());
403 DataVect trackAuthor; trackAuthor.reserve(trackCollection->
size());
405 DataVect numHits; numHits.reserve(trackCollection->
size());
406 DataVect numPolyline; numPolyline.reserve(trackCollection->
size());
407 DataVect nBLayerHits; nBLayerHits.reserve(trackCollection->
size());
408 DataVect nPixHits; nPixHits.reserve(trackCollection->
size());
411
412
413
425
426
432
434
435
437 for (track=trackCollection->
begin(); track!=trackCollection->
end(); ++track) {
441 id.emplace_back(
id.
size());
442 chi2.emplace_back((*track)->fitQuality()->chiSquared());
443 numDoF.emplace_back((*track)->fitQuality()->numberDoF());
444 trackAuthor.emplace_back((*track)->info().trackFitter());
445
449
451 std::string matchingKey = "";
453 if (
key->key().find(collectionName) != std::string::npos) {
454 matchingKey=
key->key();
455 break;
456 }
457 }
458 if(!matchingKey.empty()){
459 SG::ReadHandle<TrackTruthCollection>truthCollection(matchingKey);
460 if (truthCollection.isValid()) {
461 ATH_MSG_DEBUG(
"Found TrackTruthCollection for \"" << collectionName <<
"\": " << matchingKey);
463 } else {
464 ATH_MSG_WARNING(
"TrackTruthCollection \"" << matchingKey <<
"\" is not valid");
465
467 }
468 } else {
469 ATH_MSG_DEBUG(
"No matching TrackTruthCollection key found containing \"" << collectionName <<
"\"");
471 }
472 }
473 else{
476 }
477
482
486 std::unique_ptr<Trk::TrackSummary>
summary =
nullptr;
488
489 if(not summary){
491 nBLayerHits.emplace_back(0);
492 nPixHits.emplace_back(0);
495 }else{
500 }
501
505
507
511
512 polylineX.reserve(polylineX.size()+TSoSVec.size());
513 polylineY.reserve(polylineY.size()+TSoSVec.size());
514 polylineZ.reserve(polylineZ.size()+TSoSVec.size());
515
516
518
522
523 isOutlier.reserve(isOutlier.size()+TSoSVec.size());
524 hits.reserve(
hits.size()+TSoSVec.size());
525 driftSign.reserve(driftSign.size()+TSoSVec.size());
526 tsosResLoc1.reserve(tsosResLoc1.size()+TSoSVec.size());
527 tsosResLoc2.reserve(tsosResLoc2.size()+TSoSVec.size());
528 tsosPullLoc1.reserve(tsosPullLoc1.size()+TSoSVec.size());
529 tsosPullLoc2.reserve(tsosPullLoc2.size()+TSoSVec.size());
530 tsosDetType.reserve(tsosDetType.size()+TSoSVec.size());
531
532
533 std::vector< const Trk::TrackStateOnSurface* >::const_iterator TSoSItr = TSoSVec.begin();
534
537 for (; TSoSItr != TSoSVec.end(); ++TSoSItr){
538
540
542
543 if (!rot){
544 ATH_MSG_VERBOSE(
"Could not obtain RIO for TSoS of type " << (*TSoSItr)->dumpType() );
545 continue ;
546 }
547
549
550
553 }
554 }
555 }
556
557
558 numHits.emplace_back(
nHits);
559
560 }
561
562
564
568 DataMap[
"trackAuthor"] = trackAuthor;
571 DataMap[
"nBLayerHits"] = nBLayerHits;
572 DataMap[
"nPixHits"] = nPixHits;
575 DataMap[
"numPolyline"] = numPolyline;
576
577
578
586 }
587
588
589 if ( !polylineX.empty()){
590 std::string numPolyPerTrack =
DataType(polylineX.size()/((
double)
id.size())).toString();
591 DataMap[
"polylineX multiple=\"" + numPolyPerTrack +
"\""] = polylineX;
592 DataMap[
"polylineY multiple=\"" + numPolyPerTrack +
"\""] = polylineY;
593 DataMap[
"polylineZ multiple=\"" + numPolyPerTrack +
"\""] = polylineZ;
594 }
595
597 std::string numHitsPerTrack =
DataType(
hits.size()/((
double)
id.size())).toString();
598 DataMap[
"hits multiple=\"" + numHitsPerTrack +
"\""] =
hits;
599 DataMap[
"isOutlier multiple=\""+numHitsPerTrack+
"\""] = isOutlier;
600 DataMap[
"driftSign multiple=\""+numHitsPerTrack+
"\""] = driftSign;
601
603
605 DataMap[
"tsosResLoc1 multiple=\""+numHitsPerTrack+
"\""] = tsosResLoc1;
606 DataMap[
"tsosResLoc2 multiple=\""+numHitsPerTrack+
"\""] = tsosResLoc2;
607 DataMap[
"tsosPullLoc1 multiple=\""+numHitsPerTrack+
"\""] = tsosPullLoc1;
608 DataMap[
"tsosPullLoc2 multiple=\""+numHitsPerTrack+
"\""] = tsosPullLoc2;
609 DataMap[
"tsosDetType multiple=\""+numHitsPerTrack+
"\""] = tsosDetType;
610 }
611 }
612
614
616 }
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
static const uint32_t nHits
DataModel_detail::const_iterator< DataVector > const_iterator
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
bool empty() const noexcept
Returns true if the collection is empty.
ToolHandle< Trk::ITrackSummaryTool > m_trackSumTool
ToolHandle< Trk::IResidualPullCalculator > m_residualPullCalculator
SG::ReadHandleKeyArray< TrackTruthCollection > m_TrackTruthCollections
const AtlasDetectorID * m_idHelper
Used to find out the corresponding sub-det from ROT->identify().
Gaudi::Property< bool > m_doHitsDetails
Gaudi::Property< bool > m_doWriteResiduals
Gaudi::Property< bool > m_doHitsSorting
Gaudi::Property< bool > m_isMC
virtual std::string dataTypeName() const
Return the name of the data type that is generated by this retriever.
double chi2(TH1 *h0, TH1 *h1)
float nSCTHits(const U &p)
float nTRTHits(const U &p)
const Trk::RIO_OnTrack * getBaseInfoFromHit(const Trk::TrackStateOnSurface *tsos, const AtlasDetectorID *idHelper, DataVect &isOutlier, DataVect &hits, DataVect &driftSign, DataVect &tsosDetType)
Retrieve all the basic hit information from the Trk::TrackStateOnSurface.
void getPolylineFromHits(const std::vector< const Trk::TrackStateOnSurface * > &TSoSVec, DataVect &polylineX, DataVect &polylineY, DataVect &polylineZ, DataVect &numPolyline)
Get polyline hits if available.
void getTruthFromTrack(const Trk::Track *track, const TrackCollection *trackCollection, SG::ReadHandle< TrackTruthCollection > &truthCollection, DataVect &barcode)
Get the barcode of the associated truth track.
std::vector< const Trk::TrackStateOnSurface * > getTrackStateOnSurfaces(const Trk::Track *track, const Trk::Perigee *perigee, bool doHitsSorting)
Get a list of track-State on Surfaces for measurement and outlier hits, sorted using the perigee comp...
void getResidualPullFromHit(const Trk::TrackStateOnSurface *tsos, const Trk::RIO_OnTrack *rot, const ToolHandle< Trk::IResidualPullCalculator > &residualPullCalculator, DataVect &tsosResLoc1, DataVect &tsosResLoc2, DataVect &tsosPullLoc1, DataVect &tsosPullLoc2)
Get the residual pull information from the Trk::TrackStateOnSurface hit.
const Trk::Perigee * getPerigeeParameters(const Trk::Track *track, DataVect &pt, DataVect &d0, DataVect &z0, DataVect &phi0, DataVect &cotTheta, DataVect &covMatrix)
Obtain the perigee parameters for a given track, if available, and fill them in the corresponding dat...
std::map< std::string, DataVect > DataMap
std::vector< DataType > DataVect
Defines a map with a key and a vector of DataType objects e.g.
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
@ numberOfSCTHits
number of SCT holes
@ numberOfPixelHits
number of pixel layers on track with absence of hits
@ numberOfTRTHits
number of TRT outliers
@ numberOfInnermostPixelLayerHits
these are the hits in the 1st pixel layer