ATLAS Offline Software
Loading...
Searching...
No Matches
TrackRetriever.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include "GaudiKernel/IToolSvc.h"
7#include "GaudiKernel/TypeNameString.h"
8
9#include "TrkTrack/Track.h"
10#include "TrkTrack/TrackInfo.h"
13
14
21#include "AthLinks/ElementLink.h"
23
26
28
29// for residuals
32
33// for detector id
35
36#include "GaudiKernel/SystemOfUnits.h"
37
38namespace JiveXML {
41
49 DataVect& pt, DataVect& d0, DataVect& z0, DataVect& phi0,
50 DataVect& cotTheta, DataVect& covMatrix){
51
57 const Trk::Perigee *perigee = track->perigeeParameters();
58
59 //return immediately if there is no perigee information
60 if (!perigee) return nullptr;
61
62 //write out p_T
63 if ((perigee->parameters())[Trk::qOverP]==0) pt.emplace_back(9999.);
64 else pt.push_back( (perigee->charge() > 0) ? DataType(perigee->pT()/Gaudi::Units::GeV) : DataType((-perigee->pT())/Gaudi::Units::GeV));
65
66 d0.emplace_back((perigee->parameters())[Trk::d0]/Gaudi::Units::cm);
67 z0.emplace_back(perigee->parameters()[Trk::z0]/Gaudi::Units::cm);
68 phi0.emplace_back(perigee->parameters()[Trk::phi0]);
69
70 if (perigee->parameters()[Trk::theta] == 0.) cotTheta.emplace_back(9999.);
71 else cotTheta.emplace_back(1./tan(perigee->parameters()[Trk::theta]));
72
73 // CLHEP->Eigen migration. jpt Dec'13
74 // https://twiki.cern.ch/twiki/bin/viewauth/Atlas/MigrationCLHEPtoEigen
75 // https://twiki.cern.ch/twiki/bin/viewauth/Atlas/MigrationToUpdatedEDM#Changes_to_TrkParameters
76
78 AmgSymMatrix(5) covVert;
79
80 const AmgSymMatrix(5)* covariance = perigee->covariance(); //perigee cannot be null here
81 if (perigee && covariance) {
82 // do trafo to old format
83 double measuredTheta = perigee->parameters()[Trk::theta];
84 double measuredQoverp = perigee->parameters()[Trk::qOverP];
85 const Trk::JacobianThetaPToCotThetaPt theJac( measuredTheta, measuredQoverp );
86 covVert = covariance->similarity(theJac);
87 }else{
88 for ( int ii=0; ii<20; ii++){ // placeholder. Do this nicer.
89 covVert(ii) = 0.;
90 }
91 }
92 //Scale covariance matrix values to get good resolution with fixed
93 //precision in JiveXML data
94
95 const long scale = 10000;
96 const double thisScale(scale/100.);
97 // Migration: Now only has diagonal elements from covariance matrix ?
98 covMatrix.emplace_back(covVert(0)*thisScale); // 5 elements
99 covMatrix.emplace_back(covVert(1)*thisScale);
100 covMatrix.emplace_back(covVert(2)*thisScale);
101 covMatrix.emplace_back(covVert(3)*thisScale);
102 covMatrix.emplace_back(covVert(4)*thisScale);
103
104 // Used to be 15 elements before migration, so need to put 10 placeholders
105 for ( int i=0; i<10; i++){
106 covMatrix.emplace_back( 0. );
107 }
108
109 //All for perigee, return object for use by other functions
110 return perigee;
111 }
112
118 std::vector<const Trk::TrackStateOnSurface*> getTrackStateOnSurfaces( const Trk::Track* track, const Trk::Perigee* perigee, bool doHitsSorting){
119 // vector for the return object
120 std::vector<const Trk::TrackStateOnSurface*> TSoSVec;
121
122 // loop over TrackStateOnSurfaces to extract interesting ones
123 Trk::TrackStates::const_iterator tsos = track->trackStateOnSurfaces()->begin();
124 for (; tsos!=track->trackStateOnSurfaces()->end(); ++tsos) {
125 // include measurements AND outliers:
126 if ((*tsos)->type(Trk::TrackStateOnSurface::Measurement) || (*tsos)->type(Trk::TrackStateOnSurface::Outlier) ) {
127 // add to temp vector
128 TSoSVec.push_back(*tsos);
129 } // end if TSoS is measurement or outlier
130 } // end loop over TSoS
131
132 // sort the selected TSoS, if not already sorted using a comparison functor
133
134 if (perigee) {
135 //Get hold of the comparison functor
138 if (compFunc){
139 if (doHitsSorting) {
140 //Sort track state on surface if needed
141 if (TSoSVec.size() > 2 && !is_sorted(TSoSVec.begin(), TSoSVec.end(), *compFunc))
142 std::sort(TSoSVec.begin(), TSoSVec.end(), *compFunc);
143 }
144 }
145 delete compFunc;
146 } // end if compFunc
147
148 //Now return that vector
149 return TSoSVec;
150 }
151
155 void getPolylineFromHits( const std::vector<const Trk::TrackStateOnSurface*>& TSoSVec,
156 DataVect& polylineX, DataVect& polylineY, DataVect& polylineZ, DataVect& numPolyline){
157 int numPoly = 0 ;
158 if (TSoSVec.size() > 1) {
159 //Loop over track state on surfaces
160 std::vector<const Trk::TrackStateOnSurface*>::const_iterator tsosIter;
161 const double onetenth(0.1);
162 for (tsosIter=TSoSVec.begin(); tsosIter!=TSoSVec.end(); ++tsosIter) {
163 // get global track position
164 if (!(*tsosIter)->trackParameters()) continue ;
165 const Amg::Vector3D& pos = (*tsosIter)->trackParameters()->position();
166 polylineX.emplace_back(pos.x()*onetenth);
167 polylineY.emplace_back(pos.y()*onetenth);
168 polylineZ.emplace_back(pos.z()*onetenth);
169 ++numPoly;
170 }
171 }
172 //Store counter as well
173 numPolyline.emplace_back(numPoly);
174 }
175
176
182 DataVect& isOutlier, DataVect& hits, DataVect& driftSign, DataVect& tsosDetType){
183
184 //Get corresponding measurement
185 const Trk::MeasurementBase *measurement = tsos->measurementOnTrack();
186
187 //If measurement is invalid, return imediately
188 if (!measurement) return nullptr;
189
190 // get RIO_OnTrack
191 const Trk::RIO_OnTrack* rot = dynamic_cast<const Trk::RIO_OnTrack*>(measurement);
192
193 // check for competing RIO_OnTracks
194 if (!rot) {
195 // try to get identifier by CompetingROT:
196 const Trk::CompetingRIOsOnTrack* comprot = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(measurement);
197 //Get the input object with highest probability
198 if (comprot) rot = &(comprot->rioOnTrack(comprot->indexOfMaxAssignProb()));
199 }
200
201 //If there is still no RIO_onTrack, return Null
202 if (!rot) return nullptr;
203
204 // Now start writing out values:
205 // Check if this is an outlier hit
206 isOutlier.emplace_back(tsos->type(Trk::TrackStateOnSurface::Outlier));
207
208 //Now try to get the identifier, create an empty invalid one if no rot
209 Identifier hitId (rot->identify());
210 //Check if it is valid, othwerise store 0
211 hits.push_back( hitId.is_valid()?DataType( hitId.get_compact() ):DataType(0) );
212
213 // get sign of drift radius for TRT measurements
214 int theDriftSign = 0;
215 if (idHelper->is_trt(hitId)) {
216 // get local parameters
217 theDriftSign = measurement->localParameters()[Trk::driftRadius] > 0. ? 1 : -1;
218 }
219 driftSign.emplace_back(theDriftSign);
220
221 //Now get the detector type of the hit
222 if ( !hitId.is_valid() ){
223 tsosDetType.emplace_back("unident");
224 } else if (idHelper->is_pixel(hitId) ) {
225 tsosDetType.emplace_back("PIX"); // is PIX in Atlantis
226 } else if (idHelper->is_sct(hitId)) {
227 tsosDetType.emplace_back("SIL"); // is SIL in Atlantis
228 } else if (idHelper->is_trt(hitId)) {
229 tsosDetType.emplace_back("TRT");
230 } else if (idHelper->is_mdt(hitId)) {
231 tsosDetType.emplace_back("MDT");
232 } else if (idHelper->is_csc(hitId)) {
233 tsosDetType.emplace_back("CSC");
234 } else if (idHelper->is_rpc(hitId)) {
235 tsosDetType.emplace_back("RPC");
236 } else if (idHelper->is_tgc(hitId)) {
237 tsosDetType.emplace_back("TGC");
238 } else {
239 tsosDetType.emplace_back("unident");
240 }
241
242 //Return the reco input object
243 return rot;
244 }
245
246
251 const ToolHandle<Trk::IResidualPullCalculator> & residualPullCalculator,
252 DataVect& tsosResLoc1, DataVect& tsosResLoc2, DataVect& tsosPullLoc1, DataVect& tsosPullLoc2 ){
253
254 //Define default return values for invalid states
255 double ResLoc1 = -99.;
256 double ResLoc2 = -99.;
257 double PullLoc1 = -99.;
258 double PullLoc2 = -99.;
259
260 // get TrackParameters on the surface to calculate residual
261 const Trk::TrackParameters* tsosParameters = tsos->trackParameters();
262
263 //Check we got the parameters
264 if (tsosParameters){
265
270
271 //Get the residualPull object
272 std::optional<Trk::ResidualPull> residualPull = residualPullCalculator->residualPull(rot, tsosParameters,Trk::ResidualPull::Biased);
273
274 if (residualPull) {
275 //Get the first residual
276 ResLoc1 = residualPull->residual()[Trk::loc1];
277 //Get the second residual for more than 1 dimension
278 if (residualPull->dimension() >= 2) ResLoc2 = residualPull->residual()[Trk::loc2];
279
280 if ((residualPull->isPullValid()) ) {
281 //Get the first residual
282 PullLoc1 = residualPull->pull()[Trk::loc1];
283 //Get the second residual for more than 1 dimension
284 if (residualPull->dimension() >= 2) PullLoc2 = residualPull->pull()[Trk::loc2];
285 }
286 } // end if residualPull
287 } // end if tsosParameters
288
289 //Finally store the values
290 tsosResLoc1.emplace_back(ResLoc1 );
291 tsosResLoc2.emplace_back(ResLoc2 );
292 tsosPullLoc1.emplace_back(PullLoc1 );
293 tsosPullLoc2.emplace_back(PullLoc2 );
294 }
295
299 void getTruthFromTrack( const Trk::Track* track, const TrackCollection* trackCollection,
300 SG::ReadHandle<TrackTruthCollection>& truthCollection, DataVect& barcode){
301
302 if (!truthCollection.isValid()) {
303 //Fill with zero if none found
304 barcode.emplace_back(0);
305 return;
306 }
307
308 //Get the element link to this track collection
310 tracklink.setElement(track);
311 tracklink.setStorableObject(*trackCollection);
312
313 //try to find it in the truth collection
314 std::map<Trk::TrackTruthKey,TrackTruth>::const_iterator tempTrackTruthItr = truthCollection->find(tracklink);
315
316 //Fill with zero if none found
317 if (tempTrackTruthItr == truthCollection->end()){
318 //Fill with zero if none found
319 barcode.emplace_back(0);
320 return;
321 }
322
323 //if found, Store the barcode
324 barcode.emplace_back((*tempTrackTruthItr).second.particleLink().barcode());
325 }
326
327 } //namespace TrackRetrieverHelpers
328
335 TrackRetriever::TrackRetriever(const std::string& type,const std::string& name,const IInterface* parent):
336 AthAlgTool(type,name,parent){}
337
344 //Set up ATLAS ID helper to be able to identify the RIO's det-subsystem.
345 ATH_CHECK(detStore()->retrieve(m_idHelper, "AtlasID"));
346
347 // try to retrieve residual-pull calculation only if requested
350 }
351
352 ATH_CHECK(m_trackSumTool.retrieve());
353 ATH_CHECK(m_keys.initialize());
355 return StatusCode::SUCCESS;
356 }
357
358
359
366 StatusCode TrackRetriever::retrieve(ToolHandle<IFormatTool> &FormatTool) {
367
368 ATH_MSG_DEBUG("In retrieve()");
369
370 // Loop through the keys and retrieve the corresponding data
371 for (const auto& key : m_keys) {
373 if (cont.isValid()) {
374 DataMap data = getData(&(*cont),key.key());
375 if (FormatTool->AddToEvent(dataTypeName(), key.key(), &data).isFailure()) {
376 ATH_MSG_WARNING("Failed to add collection " << key.key());
377 } else {
378 ATH_MSG_DEBUG(" (" << key.key() << ") retrieved");
379 }
380 } else {
381 ATH_MSG_WARNING("Collection " << key.key() << " not found in SG");
382 }
383 }
384
385 return StatusCode::SUCCESS;
386 }
387
388 const DataMap TrackRetriever::getData(const TrackCollection* trackCollection, const std::string &collectionName) {
389
390 ATH_MSG_DEBUG("in getData()");
391
392 //Some sanity checks
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 // Make a list of track-wise entries and reserve enough space
400 DataVect id; id.reserve(trackCollection->size());
401 DataVect chi2; chi2.reserve(trackCollection->size());
402 DataVect numDoF; numDoF.reserve(trackCollection->size());
403 DataVect trackAuthor; trackAuthor.reserve(trackCollection->size());
404 DataVect barcode; barcode.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());
409 DataVect nSCTHits; nSCTHits.reserve(trackCollection->size());
410 DataVect nTRTHits; nTRTHits.reserve(trackCollection->size());
411
412 // vectors with measurement- or TrackStateOnSurface-wise entries
413 // reserve space later on
414 DataVect polylineX;
415 DataVect polylineY;
416 DataVect polylineZ;
417 DataVect tsosResLoc1;
418 DataVect tsosResLoc2;
419 DataVect tsosPullLoc1;
420 DataVect tsosPullLoc2;
421 DataVect tsosDetType;
422 DataVect isOutlier;
423 DataVect driftSign;
424 DataVect hits;
425
426 //Store wether this collection has perigee parameters
427 DataVect pt; pt.reserve(trackCollection->size());
428 DataVect d0; d0.reserve(trackCollection->size());
429 DataVect z0; z0.reserve(trackCollection->size());
430 DataVect phi0; phi0.reserve(trackCollection->size());
431 DataVect cotTheta; cotTheta.reserve(trackCollection->size());
432 //Covariance matrix has 15 entries per track
433 DataVect covMatrix; covMatrix.reserve(trackCollection->size() * 15 );
434
435 // Now loop over all tracks in the collection
437 for (track=trackCollection->begin(); track!=trackCollection->end(); ++track) {
441 id.emplace_back(id.size()); //<! simple counter starting from 0
442 chi2.emplace_back((*track)->fitQuality()->chiSquared());
443 numDoF.emplace_back((*track)->fitQuality()->numberDoF());
444 trackAuthor.emplace_back((*track)->info().trackFitter());
445
449
450 if(m_isMC){
451 std::string matchingKey = "";
452 for (const auto& key : m_TrackTruthCollections.keys()) {
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);
462 TrackRetrieverHelpers::getTruthFromTrack(*track,trackCollection,truthCollection,barcode);
463 } else {
464 ATH_MSG_WARNING("TrackTruthCollection \"" << matchingKey << "\" is not valid");
465 //Fill with zero if none found
466 barcode.emplace_back(0);
467 }
468 } else {
469 ATH_MSG_DEBUG("No matching TrackTruthCollection key found containing \"" << collectionName << "\"");
470 barcode.emplace_back(0);
471 }
472 }
473 else{
474 ATH_MSG_DEBUG("Not MC so no truth tracks, fill with 0s");
475 barcode.emplace_back(0);
476 }
477
481 const Trk::Perigee* perigee = TrackRetrieverHelpers::getPerigeeParameters(*track, pt, d0, z0, phi0, cotTheta, covMatrix);
482
486 std::unique_ptr<Trk::TrackSummary> summary = nullptr;
487 summary = m_trackSumTool->summary(Gaudi::Hive::currentContext(), **track);
488
489 if(not summary){
490 ATH_MSG_DEBUG( "Track summary is NULL " );
491 nBLayerHits.emplace_back(0);
492 nPixHits.emplace_back(0);
493 nSCTHits.emplace_back(0);
494 nTRTHits.emplace_back(0);
495 }else{
496 nBLayerHits.emplace_back(summary->get(Trk::numberOfInnermostPixelLayerHits));
497 nPixHits.emplace_back(summary->get(Trk::numberOfPixelHits));
498 nSCTHits.emplace_back(summary->get(Trk::numberOfSCTHits));
499 nTRTHits.emplace_back(summary->get(Trk::numberOfTRTHits));
500 }
501
505 // Vector of interesting TrackStateOnSurfaces
506 std::vector<const Trk::TrackStateOnSurface*> TSoSVec = TrackRetrieverHelpers::getTrackStateOnSurfaces(*track,perigee,m_doHitsSorting);
507
511 // Reserving some space for polyline hits
512 polylineX.reserve(polylineX.size()+TSoSVec.size());
513 polylineY.reserve(polylineY.size()+TSoSVec.size());
514 polylineZ.reserve(polylineZ.size()+TSoSVec.size());
515
516 //And fill them
517 TrackRetrieverHelpers::getPolylineFromHits(TSoSVec,polylineX,polylineY,polylineZ,numPolyline);
518
522 //Reserve some space for resPull and other hit info
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 //Now loop over tracks and fill them
533 std::vector< const Trk::TrackStateOnSurface* >::const_iterator TSoSItr = TSoSVec.begin();
534 //Count number of hits stored in this loop
535 long nHits = 0;
536 if (m_doHitsDetails){ // disable only for HeavyIons !
537 for (; TSoSItr != TSoSVec.end(); ++TSoSItr){
538 // This produces the full long debug dump for TSoS:
539 ATH_MSG_VERBOSE( (**TSoSItr) );
540 //Get the basic hit information
541 const Trk::RIO_OnTrack* rot = TrackRetrieverHelpers::getBaseInfoFromHit(*TSoSItr, m_idHelper, isOutlier, hits, driftSign, tsosDetType );
542 //tell if this didn't work out
543 if (!rot){
544 ATH_MSG_VERBOSE( "Could not obtain RIO for TSoS of type " << (*TSoSItr)->dumpType() );
545 continue ;
546 }
547 //count this as a hit
548 ++nHits;
549
550 //if we shell retrieve residuals, also get those
552 TrackRetrieverHelpers::getResidualPullFromHit( *TSoSItr, rot, m_residualPullCalculator, tsosResLoc1, tsosResLoc2, tsosPullLoc1, tsosPullLoc2);
553 }
554 }
555 } // end hits details
556
557 //Store number of retrieved hits for which we have retrieved information
558 numHits.emplace_back(nHits);
559
560 } // end loop over tracks in collection
561
562 //Now fill everything in a datamap
564 // Start with mandatory entries
565 DataMap["id"] = id;
566 DataMap["chi2"] = chi2;
567 DataMap["numDoF"] = numDoF;
568 DataMap["trackAuthor"] = trackAuthor;
569 DataMap["barcode"] = barcode;
570 DataMap["numHits"] = numHits;
571 DataMap["nBLayerHits"] = nBLayerHits;
572 DataMap["nPixHits"] = nPixHits;
573 DataMap["nSCTHits"] = nSCTHits;
574 DataMap["nTRTHits"] = nTRTHits;
575 DataMap["numPolyline"] = numPolyline;
576
577 // if perigee parameters are not available, leave the corresponding subtags empty.
578 // This way atlantis knows that such tracks can only be displayed as polylines.
579 if (!pt.empty()){
580 DataMap["pt"] = pt;
581 DataMap["d0"] = d0;
582 DataMap["z0"] = z0;
583 DataMap["phi0"] = phi0;
584 DataMap["cotTheta"] = cotTheta;
585 DataMap["covMatrix multiple=\"15\""] = covMatrix;
586 }
587
588 // vectors with measurement- or TrackStateOnSurface-wise entries
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
596 if ( !hits.empty()){
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 // hits counter in principle not needed anymore:
604 DataMap["numTsos"] = numHits;
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
613 ATH_MSG_DEBUG(dataTypeName() << " collection " << collectionName << " retrieved with " << id.size() << " entries");
614
615 return DataMap;
616 }
617
618
619} //namespace JiveXML
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
OFFLINE_FRAGMENTS_NAMESPACE::PointerType DataType
An STL vector of pointers that by default owns its pointed-to elements.
#define AmgSymMatrix(dim)
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
bool(*)(const xAOD::Jet *, const xAOD::Jet *) compFunc
Definition JetSorter.cxx:12
static const uint32_t nHits
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
const ServiceHandle< StoreGateSvc > & detStore() const
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
bool is_mdt(Identifier id) const
bool is_rpc(Identifier id) const
bool is_sct(Identifier id) const
bool is_tgc(Identifier id) const
bool is_pixel(Identifier id) const
bool is_csc(Identifier id) const
bool is_trt(Identifier id) const
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
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.
bool is_valid() const
Check if id is in a valid state.
value_type get_compact() const
Get the compact id.
Templated class to convert any object that is streamable in a ostringstream in a string.
Definition DataType.h:21
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
For each track collection retrieve all data.
ToolHandle< Trk::ITrackSummaryTool > m_trackSumTool
ToolHandle< Trk::IResidualPullCalculator > m_residualPullCalculator
SG::ReadHandleKeyArray< TrackCollection > m_keys
TrackRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
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
StatusCode initialize()
Default AthAlgTool methods.
Gaudi::Property< bool > m_doWriteResiduals
const DataMap getData(const TrackCollection *trackCollection, const std::string &collectionName)
Puts the variables into a DataMap.
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.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Base class for all CompetingRIOsOnTack implementations, extends the common MeasurementBase.
unsigned int indexOfMaxAssignProb() const
Index of the ROT with the highest assignment probability.
virtual const RIO_OnTrack & rioOnTrack(unsigned int) const =0
returns the RIO_OnTrack (also known as ROT) objects depending on the integer.
This is the 5x5 jacobian for the transformation of track parameters and errors having the new standar...
This class is the pure abstract base class for all fittable tracking measurements.
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
const Amg::Vector3D & momentum() const
Access method for the momentum.
const Amg::Vector3D & position() const
Access method for the position.
double charge() const
Returns the charge.
double pT() const
Access method for transverse momentum.
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
@ Biased
RP with track state including the hit.
Class providing comparison function, or relational definition, for sorting MeasurementBase objects.
represents the track state (measurement, material, fit parameters and quality) at a surface.
const MeasurementBase * measurementOnTrack() const
returns MeasurementBase const overload
const TrackParameters * trackParameters() const
return ptr to trackparameters const overload
bool type(const TrackStateOnSurfaceType type) const
Use this method to find out if the TSoS is of a certain type: i.e.
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
double chi2(TH1 *h0, TH1 *h1)
Eigen::Matrix< double, 3, 1 > Vector3D
Namespace for all helper functions.
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...
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.
std::map< std::string, DataVect > DataMap
Definition DataType.h:59
std::vector< DataType > DataVect
Defines a map with a key and a vector of DataType objects e.g.
Definition DataType.h:58
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
@ driftRadius
trt, straws
Definition ParamDefs.h:53
@ phi0
Definition ParamDefs.h:65
@ theta
Definition ParamDefs.h:66
@ qOverP
perigee
Definition ParamDefs.h:67
@ loc2
generic first and second local coordinate
Definition ParamDefs.h:35
@ loc1
Definition ParamDefs.h:34
@ d0
Definition ParamDefs.h:63
@ z0
Definition ParamDefs.h:64
ParametersBase< TrackParametersDim, Charged > TrackParameters
@ numberOfPixelHits
number of pixel layers on track with absence of hits
@ numberOfInnermostPixelLayerHits
these are the hits in the 1st pixel layer
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.