ATLAS Offline Software
AmbiguityProcessorUtility.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
9 #include "TrkTrack/TrackInfo.h"
10 #include "TrkTrack/Track.h"
11 
12 
15  categoriseTrack(const Trk::Track & track, const Trk::TrackScore & score, const bool dropDuplicates, const AssociationTool & associate, AssociationMap & map, DuplicationCheckSet & set){
16  if (score == 0) return TrackFilterCategory::ScoreIsZero;
17  if (dropDuplicates){
18  if(const auto & [p, uniqueTrack] = set.insert(associate->getPrdsOnTrack( map, track)); not uniqueTrack) return TrackFilterCategory::TrackIsDuplicate;
19  }
21  }
22  //
23  float
25  float result{0.0};
26  if (const auto *const quality=track.fitQuality(); quality and quality->numberDoF()>0 ){
27  result = quality->chiSquared()/quality->numberDoF();
28  }
29  return result;
30  }
31  //
32  std::unique_ptr<Trk::Track>
34  double reXi2 = 0.;
35  int nDF = 0;
36  const Trk::TrackStates* tsos = track.trackStateOnSurfaces();
37  auto vecTsos = std::make_unique<Trk::TrackStates>();
38  // loop over TSOS, copy TSOS and push into vector
40  Trk::TrackStates::const_iterator iTsosEnd = tsos->end();
41  for ( ; iTsos != iTsosEnd ; ++iTsos) {
42  const Trk::TrackStateOnSurface* newTsos = new Trk::TrackStateOnSurface(**iTsos);
43  vecTsos->push_back(newTsos);
44  if((*iTsos)->type(Trk::TrackStateOnSurface::Measurement)){ //Get the chi2 and number of hits
45  if ((*iTsos)->fitQualityOnSurface()) {
46  reXi2 += (*iTsos)->fitQualityOnSurface().chiSquared();
47  nDF += (*iTsos)->fitQualityOnSurface().numberDoF();
48  }
49  }
50  }
51  auto fq = std::make_unique<Trk::FitQuality>(reXi2,nDF-5);
53  info.addPatternRecoAndProperties(track.info());
54  Trk::TrackInfo newInfo;
56  info.addPatternReco(newInfo);
57  return std::make_unique<Trk::Track>(info, std::move(vecTsos), std::move(fq));
58  }
59  //
60  int getUid() {
61  static std::atomic<std::uint32_t> uid { 0 };
62  return ++uid;
63  }
64 
65 }
grepfile.info
info
Definition: grepfile.py:38
Trk::TrackInfo
Contains information about the 'fitter' of this track.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/TrackInfo.h:32
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
get_generator_info.result
result
Definition: get_generator_info.py:21
AmbiguityProcessor::TrackAccepted
@ TrackAccepted
Definition: AmbiguityProcessorUtility.h:24
AmbiguityProcessor::categoriseTrack
TrackFilterCategory categoriseTrack(const Trk::Track &track, const Trk::TrackScore &score, const bool dropDuplicates, const AssociationTool &associate, AssociationMap &map, DuplicationCheckSet &set)
Definition: AmbiguityProcessorUtility.cxx:15
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
Trk::PRDtoTrackMap
Definition: PRDtoTrackMap.h:17
AmbiguityProcessor::TrackIsDuplicate
@ TrackIsDuplicate
Definition: AmbiguityProcessorUtility.h:24
Trk::TrackInfo::SimpleAmbiguityProcessorTool
@ SimpleAmbiguityProcessorTool
Added because of compilation problems.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/TrackInfo.h:156
AmbiguityProcessor::calculateFitQuality
float calculateFitQuality(const Trk::Track &track)
Definition: AmbiguityProcessorUtility.cxx:24
Track.h
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AmbiguityProcessor::TrackFilterCategory
TrackFilterCategory
Definition: AmbiguityProcessorUtility.h:24
Trk::TrackScore
float TrackScore
Definition: TrackScore.h:10
AmbiguityProcessor::createNewFitQualityTrack
std::unique_ptr< Trk::Track > createNewFitQualityTrack(const Trk::Track &track)
Definition: AmbiguityProcessorUtility.cxx:33
AmbiguityProcessor::ScoreIsZero
@ ScoreIsZero
Definition: AmbiguityProcessorUtility.h:24
AmbiguityProcessor
Definition: AmbiguityProcessorUtility.cxx:13
DataVector< const Trk::TrackStateOnSurface >
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
Trk::TrackStateOnSurface
represents the track state (measurement, material, fit parameters and quality) at a surface.
Definition: TrackStateOnSurface.h:71
TrackInfo.h
AmbiguityProcessor::DuplicationCheckSet
std::set< std::vector< const Trk::PrepRawData * > > DuplicationCheckSet
Definition: AmbiguityProcessorUtility.h:27
xAOD::score
@ score
Definition: TrackingPrimitives.h:513
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
DataVector.h
An STL vector of pointers that by default owns its pointed-to elements.
AmbiguityProcessor::getUid
int getUid()
Definition: AmbiguityProcessorUtility.cxx:60
AmbiguityProcessorUtility.h
AmbiguityProcessor::AssociationTool
ToolHandle< Trk::IPRDtoTrackMapTool > AssociationTool
Definition: AmbiguityProcessorUtility.h:25
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
Trk::TrackInfo::setPatternRecognitionInfo
void setPatternRecognitionInfo(const TrackPatternRecoInfo &patternReco)
Method setting the pattern recognition algorithm.
FitQuality.h
Trk::TrackStateOnSurface::Measurement
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
Definition: TrackStateOnSurface.h:101
TrackStateOnSurface.h
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.