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
565 const std::size_t nId = id.size();
568 DataMap[
"numDoF"] = std::move(numDoF);
569 DataMap[
"trackAuthor"] = std::move(trackAuthor);
570 DataMap[
"barcode"] = std::move(barcode);
571
573 DataMap[
"nBLayerHits"] = std::move(nBLayerHits);
574 DataMap[
"nPixHits"] = std::move(nPixHits);
575 DataMap[
"nSCTHits"] = std::move(nSCTHits);
576 DataMap[
"nTRTHits"] = std::move(nTRTHits);
577 DataMap[
"numPolyline"] = std::move(numPolyline);
578
579
580
585 DataMap[
"phi0"] = std::move(phi0);
586 DataMap[
"cotTheta"] = std::move(cotTheta);
587 DataMap[
"covMatrix multiple=\"15\""] = std::move(covMatrix);
588 }
589
590
591 if ( !polylineX.empty()){
592 std::string numPolyPerTrack =
DataType(polylineX.size()/((
double)
id.size())).toString();
593 DataMap[
"polylineX multiple=\"" + numPolyPerTrack +
"\""] = std::move(polylineX);
594 DataMap[
"polylineY multiple=\"" + numPolyPerTrack +
"\""] = std::move(polylineY);
595 DataMap[
"polylineZ multiple=\"" + numPolyPerTrack +
"\""] = std::move(polylineZ);
596 }
597
599 std::string numHitsPerTrack =
DataType(
hits.size()/((
double)
id.size())).toString();
600 DataMap[
"hits multiple=\"" + numHitsPerTrack +
"\""] = std::move(hits);
601 DataMap[
"isOutlier multiple=\""+numHitsPerTrack+
"\""] = std::move(isOutlier);
602 DataMap[
"driftSign multiple=\""+numHitsPerTrack+
"\""] = std::move(driftSign);
603
605
606 DataMap[
"numTsos"] = std::move(numHits);
607 DataMap[
"tsosResLoc1 multiple=\""+numHitsPerTrack+
"\""] = std::move(tsosResLoc1);
608 DataMap[
"tsosResLoc2 multiple=\""+numHitsPerTrack+
"\""] = std::move(tsosResLoc2);
609 DataMap[
"tsosPullLoc1 multiple=\""+numHitsPerTrack+
"\""] = std::move(tsosPullLoc1);
610 DataMap[
"tsosPullLoc2 multiple=\""+numHitsPerTrack+
"\""] = std::move(tsosPullLoc2);
611 DataMap[
"tsosDetType multiple=\""+numHitsPerTrack+
"\""] = std::move(tsosDetType);
612 }
613 }
614
616
618 }
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
static const uint32_t nHits
size_t size() const
Number of registered mappings.
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