ATLAS Offline Software
AmbiguityProcessorBase.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef AmbiguityProcessorBase_h
6 #define AmbiguityProcessorBase_h
7 
8 #include "AmbiCounter.h"
10 //
15 //
17 #include "GaudiKernel/ToolHandle.h"
18 #include "TrackPtr.h"
21 //
22 #include <map> //multimap
23 #include <memory> //unique_ptr
24 #include <mutex> //mutex
25 #include <vector>
26 
27 
28 namespace Trk {
29 // fwd declare
30 class Track;
31 class PRDtoTrackMap;
32 
33 // base class for SimpleAmbiguityProcessorTool and
34 // DenseEnvironmentsAmbiguityProcessorTool
36  virtual public ITrackAmbiguityProcessorTool {
37  public:
38  enum class CounterIndex {
42  kNscoreOk,
47  kNaccepted,
48  kNsubTrack,
51  kNbremFits,
52  kNfits,
54  kNgoodFits,
56  kNCounter
57  };
59  using TrackScoreMap = std::multimap<TrackScore, TrackPtr>;
60 
61  // default methods
62  AmbiguityProcessorBase(const std::string&, const std::string&,
63  const IInterface*);
64  virtual ~AmbiguityProcessorBase() = default;
65 
66  protected:
67  // methods
68  // should try a Brem refit? based on track properties
69  bool shouldTryBremRecovery(const Trk::Track& track) const;
70 
71  // should try a Brem refit? based on track properties and previously obtained
72  // track parameters
74  const TrackParameters* pPar) const;
75 
76  // do a brem refit; implemented in the derived classes
77  virtual std::unique_ptr<Trk::Track> doBremRefit(
78  const Trk::Track& track) const = 0;
79 
81  Track* refitTrack(const Trk::Track* track, Trk::PRDtoTrackMap& prdToTrackMap,
82  Counter& stat, int trackId, int subtrackId) const;
83 
84  // refit PRD
86  Trk::PRDtoTrackMap& prdToTrackMap,
87  Counter& stat) const = 0;
88 
89  // refit ROTs
90  virtual Trk::Track* refitRots(const Trk::Track* track, Counter& stat) const;
91 
92  // generic normal fit
93  virtual std::unique_ptr<Trk::Track> fit(
94  const Track& track, bool flag, Trk::ParticleHypothesis hypo) const = 0;
95 
96  void addTrack(Trk::Track* in_track, const bool fitted,
97  TrackScoreMap& trackScoreTrackMap,
98  std::vector<std::unique_ptr<const Trk::Track> >& trackDustbin,
99  Counter& stat, int parentTrackId) const;
100 
101  const TrackParameters* getTrackParameters(const Trk::Track* track) const;
102 
109 
110  // special pointer type for the ClusterSplitProbabilityContainerPtr to allow
111  // to use a single "pointer" for ClusterSplitProbabilityContainer which need
112  // to be deleted and those owned by storegate
116 
125  createAndRecordClusterSplitProbContainer(const EventContext& ctx) const;
126 
127  // variables accessible to derived classes
128  std::vector<float> m_etaBounds;
130  mutable Counter m_stat ATLAS_THREAD_SAFE;
136  ToolHandle<ITrackScoringTool> m_scoringTool{this, "ScoringTool", "",
137  "track scoring tool"};
140  PublicToolHandle<Trk::ITrkObserverTool> m_observerTool{
141  this, "ObserverTool", "", "track observer within ambiguity solver"};
142  ToolHandle<Trk::IExtendedTrackSummaryTool> m_trackSummaryTool{
143  this, "TrackSummaryTool", "InDetTrackSummaryToolNoHoleSearch"};
144 
145  private:
146  // the handles should not be used directly instead the methods
147  // initializeClusterSplitProbContainer and
148  // createAndRecordClusterSplitProbContainer should be used.
150  m_clusterSplitProbContainerIn{this, "InputClusterSplitProbabilityName",
151  "", ""};
153  m_clusterSplitProbContainerOut{this, "OutputClusterSplitProbabilityName",
154  "", ""};
155 
156  protected:
158  bool m_tryBremFit{};
160  float m_pTminBrem{1000.};
162  // for track refit
164  bool m_refitPrds{};
166  bool m_forceRefit{true};
167 
170  int m_matEffects{3}; // pion
172 };
173 } // namespace Trk
174 #endif
175 
ITrkObserverTool.h
Trk::AmbiguityProcessorBase::CounterIndex::kNfailedFits
@ kNfailedFits
Trk::AmbiguityProcessorBase::m_clusterSplitProbContainerIn
SG::ReadHandleKey< Trk::ClusterSplitProbabilityContainer > m_clusterSplitProbContainerIn
Definition: AmbiguityProcessorBase.h:150
Trk::AmbiguityProcessorBase::m_pTminBrem
float m_pTminBrem
Definition: AmbiguityProcessorBase.h:160
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
Trk::AmbiguityProcessorBase::m_etaBounds
std::vector< float > m_etaBounds
eta intervals for internal monitoring
Definition: AmbiguityProcessorBase.h:128
Trk::AmbiguityProcessorBase::CounterIndex::kNbremFits
@ kNbremFits
AmbiCounter.h
Trk::PRDtoTrackMap
Definition: PRDtoTrackMap.h:17
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
Trk::AmbiguityProcessorBase::refitTrack
Track * refitTrack(const Trk::Track *track, Trk::PRDtoTrackMap &prdToTrackMap, Counter &stat, int trackId, int subtrackId) const
refit track
Definition: AmbiguityProcessorBase.cxx:116
Trk::AmbiguityProcessorBase::CounterIndex::kNscoreZeroBremRefitFailed
@ kNscoreZeroBremRefitFailed
Trk::AmbiguityProcessorBase::UniqueClusterSplitProbabilityContainerPtr
std::unique_ptr< Trk::ClusterSplitProbabilityContainer, void(*)(Trk::ClusterSplitProbabilityContainer *)> UniqueClusterSplitProbabilityContainerPtr
Definition: AmbiguityProcessorBase.h:115
Trk::AmbiguityProcessorBase::CounterIndex::kNcandScoreZero
@ kNcandScoreZero
Trk::AmbiguityProcessorBase::refitRots
virtual Trk::Track * refitRots(const Trk::Track *track, Counter &stat) const
Definition: AmbiguityProcessorBase.cxx:289
Trk::AmbiguityProcessorBase::CounterIndex::kNCounter
@ kNCounter
Trk::AmbiguityProcessorBase::createAndRecordClusterSplitProbContainer
AmbiguityProcessorBase::UniqueClusterSplitProbabilityContainerPtr createAndRecordClusterSplitProbContainer(const EventContext &ctx) const
Create a new cluster splitting probability container and (optionally) record it in storegate The new ...
Definition: AmbiguityProcessorBase.cxx:71
Trk::undefined
@ undefined
Definition: ParticleHypothesis.h:38
Trk::AmbiguityProcessorBase::m_refitPrds
bool m_refitPrds
Definition: AmbiguityProcessorBase.h:164
ITrackScoringTool.h
SG::ReadHandleKey< Trk::ClusterSplitProbabilityContainer >
Trk::AmbiguityProcessorBase::m_observerTool
PublicToolHandle< Trk::ITrkObserverTool > m_observerTool
Observer tool This tool is used to observe the tracks and their 'score'.
Definition: AmbiguityProcessorBase.h:140
Trk::AmbiguityProcessorBase::~AmbiguityProcessorBase
virtual ~AmbiguityProcessorBase()=default
Trk::AmbiguityProcessorBase::AmbiguityProcessorBase
AmbiguityProcessorBase(const std::string &, const std::string &, const IInterface *)
Definition: AmbiguityProcessorBase.cxx:12
ITrackAmbiguityProcessorTool.h
Trk::AmbiguityProcessorBase::m_statMutex
std::mutex m_statMutex
Definition: AmbiguityProcessorBase.h:129
Trk::AmbiguityProcessorBase::CounterIndex::kNfits
@ kNfits
Trk::AmbiguityProcessorBase::CounterIndex::kNcandidates
@ kNcandidates
Trk::AmbiguityProcessorBase::initializeClusterSplitProbContainer
StatusCode initializeClusterSplitProbContainer()
Initialize read and write handles for ClusterSplitProbabilityContainers.
Definition: AmbiguityProcessorBase.cxx:28
Trk::ParticleHypothesis
ParticleHypothesis
Definition: ParticleHypothesis.h:25
Trk::AmbiguityProcessorBase
Definition: AmbiguityProcessorBase.h:36
SG::WriteHandleKey< Trk::ClusterSplitProbabilityContainer >
Trk::AmbiguityProcessorBase::CounterIndex::kNscoreZero
@ kNscoreZero
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Trk::AmbiguityProcessorBase::shouldTryBremRecovery
bool shouldTryBremRecovery(const Trk::Track &track) const
Definition: AmbiguityProcessorBase.cxx:19
Trk::AmbiguityProcessorBase::CounterIndex::kNscoreZeroBremRefitScoreZero
@ kNscoreZeroBremRefitScoreZero
master.flag
bool flag
Definition: master.py:29
Trk::AmbiguityProcessorBase::CounterIndex::kNcandDouble
@ kNcandDouble
AthAlgTool.h
Trk::AmbiguityProcessorBase::fit
virtual std::unique_ptr< Trk::Track > fit(const Track &track, bool flag, Trk::ParticleHypothesis hypo) const =0
Trk::AmbiguityProcessorBase::CounterIndex::kNsubTrack
@ kNsubTrack
Trk::ParametersBase
Definition: ParametersBase.h:55
Trk::AmbiguityProcessorBase::CounterIndex::kNaccepted
@ kNaccepted
Trk::AmbiguityProcessorBase::CounterIndex
CounterIndex
Definition: AmbiguityProcessorBase.h:38
Trk::AmbiguityProcessorBase::getTrackParameters
const TrackParameters * getTrackParameters(const Trk::Track *track) const
Definition: AmbiguityProcessorBase.cxx:274
beamspotman.stat
stat
Definition: beamspotman.py:266
Trk::AmbiguityProcessorBase::m_tryBremFit
bool m_tryBremFit
brem recovery mode with brem fit ?
Definition: AmbiguityProcessorBase.h:158
Trk::AmbiguityProcessorBase::CounterIndex::kNrecoveryBremFits
@ kNrecoveryBremFits
Trk::AmbiguityProcessorBase::m_scoringTool
ToolHandle< ITrackScoringTool > m_scoringTool
Scoring tool This tool is used to 'score' the tracks, i.e.
Definition: AmbiguityProcessorBase.h:136
Trk::AmbiguityProcessorBase::addTrack
void addTrack(Trk::Track *in_track, const bool fitted, TrackScoreMap &trackScoreTrackMap, std::vector< std::unique_ptr< const Trk::Track > > &trackDustbin, Counter &stat, int parentTrackId) const
Definition: AmbiguityProcessorBase.cxx:152
Trk::AmbiguityProcessorBase::m_clusterSplitProbContainerOut
SG::WriteHandleKey< Trk::ClusterSplitProbabilityContainer > m_clusterSplitProbContainerOut
Definition: AmbiguityProcessorBase.h:153
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::AmbiguityProcessorBase::m_trackSummaryTool
ToolHandle< Trk::IExtendedTrackSummaryTool > m_trackSummaryTool
Definition: AmbiguityProcessorBase.h:142
Trk::ClusterSplitProbabilityContainer
Container to associate Cluster with cluster splitting probabilities.
Definition: ClusterSplitProbabilityContainer.h:17
TrackScore.h
Trk::AmbiguityProcessorBase::m_suppressHoleSearch
bool m_suppressHoleSearch
Definition: AmbiguityProcessorBase.h:161
Trk::AmbiguityProcessorBase::m_matEffects
int m_matEffects
read in as an integer and convert to particle hypothesis
Definition: AmbiguityProcessorBase.h:170
Trk::AmbiguityProcessorBase::m_forceRefit
bool m_forceRefit
by default tracks at input get refitted
Definition: AmbiguityProcessorBase.h:166
Trk::AmbiguityProcessorBase::m_particleHypothesis
Trk::ParticleHypothesis m_particleHypothesis
Definition: AmbiguityProcessorBase.h:171
Trk::ITrackAmbiguityProcessorTool
Interface for resolving hit assoication ambiguities in a given track collection.
Definition: ITrackAmbiguityProcessorTool.h:30
Trk::AmbiguityProcessorBase::ATLAS_THREAD_SAFE
Counter m_stat ATLAS_THREAD_SAFE
Definition: AmbiguityProcessorBase.h:130
Trk::AmbiguityProcessorBase::CounterIndex::kNnoSubTrack
@ kNnoSubTrack
IExtendedTrackSummaryTool.h
Trk::AmbiguityProcessorBase::CounterIndex::kNacceptedBrem
@ kNacceptedBrem
Trk::AmbiguityProcessorBase::m_suppressTrackFit
bool m_suppressTrackFit
Definition: AmbiguityProcessorBase.h:163
TrackPtr.h
ClusterSplitProbabilityContainer.h
Track
Definition: TriggerChamberClusterOnTrackCreator.h:21
AmbiguityProcessorUtility.h
Trk::AmbiguityProcessorBase::doBremRefit
virtual std::unique_ptr< Trk::Track > doBremRefit(const Trk::Track &track) const =0
Trk::AmbiguityProcessorBase::refitPrds
virtual Trk::Track * refitPrds(const Trk::Track *track, Trk::PRDtoTrackMap &prdToTrackMap, Counter &stat) const =0
Trk::AmbiguityProcessorBase::CounterIndex::kNgoodFits
@ kNgoodFits
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
Trk::AmbiguityProcessorBase::m_caloSeededBrem
bool m_caloSeededBrem
Definition: AmbiguityProcessorBase.h:159
AthAlgTool
Definition: AthAlgTool.h:26
Trk::AmbiguityProcessorBase::CounterIndex::kNscoreZeroBremRefit
@ kNscoreZeroBremRefit
AmbiCounter
Definition: AmbiCounter.h:16
Trk::AmbiguityProcessorBase::CounterIndex::kNscoreOk
@ kNscoreOk
Trk::AmbiguityProcessorBase::TrackScoreMap
std::multimap< TrackScore, TrackPtr > TrackScoreMap
Definition: AmbiguityProcessorBase.h:59