ATLAS Offline Software
Loading...
Searching...
No Matches
FitProcedure.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
6// class FitProcedure
7// Basic iterative least square fit procedure producing a fitted Track
8//
9// execute and constructTrack methods allow use from standard ITrackFitter
10// and iPatRec specific Algtools.
11// This class is kept transient rather than a tool as there are many state
12// variables.
13//
14// for clarity (i.e. to avoid an overly long class) the inner loop over
15// measurements is performed by MeasurementProcessor
16//
18
19#ifndef TRKIPATFITTERUTILS_FITPROCEDURE_H
20#define TRKIPATFITTERUTILS_FITPROCEDURE_H
21
22#include <vector>
23
26#include "GaudiKernel/ToolHandle.h"
31
32class MsgStream;
33
34namespace Trk {
35class FitMeasurement;
36class FitParameters;
37class IIntersector;
38class IPropagator;
39class Track;
40class TrackInfo;
42class Volume;
43
45 public:
46 // Cache to be passed by the caller
47 struct Cache {
49 : chRatio1(0.),
50 chRatio2(0.),
51 chiSq(0.),
52 chiSqCut(20.),
53 chiSqMin(0.),
54 chiSqOld(0.),
55 chiSqWorst(0.),
56 convergence(false),
57 cutStep(false),
58 cutTaken(0),
59 debug(false),
60 driftSum(0.),
61 driftSumLast(0.),
65 fitQuality(nullptr),
66 iteration(0),
67 log(nullptr),
68 nearConvergence(false),
69 nCuts(0),
70 numberDoF(0),
72 verbose(false),
74 ~Cache() = default;
75 // delete the rest as should not be needed.
76 Cache(const Cache&) = delete;
77 Cache& operator=(const Cache&) = delete;
78 Cache(Cache&&) = delete;
79 Cache& operator=(Cache&&) = delete;
80
81 double chRatio1 = 0;
82 double chRatio2 = 0;
83 double chiSq = 0;
84 double chiSqCut = 20;
85 double chiSqMin = 0;
86 double chiSqOld = 0;
87 double chiSqWorst = 0;
88 bool convergence = false;
89 bool cutStep = 0;
90 int cutTaken = false;
91 bool debug = false;
92 double driftSum = 0;
93 double driftSumLast = 0;
94 std::unique_ptr<FitMatrices> fitMatrices = nullptr;
95 double fitProbability = 0;
96 std::unique_ptr<FitProcedureQuality> fitQuality = nullptr;
97 int iteration = 0;
98 MsgStream* log = nullptr;
99 bool nearConvergence = false;
100 int nCuts = 0;
101 int numberDoF = 0;
103 bool verbose = false;
105 };
106
107 FitProcedure(bool constrainedAlignmentEffects, bool extendedDebug,
108 bool lineFit, ToolHandle<IIntersector>& rungeKuttaIntersector,
109 ToolHandle<IIntersector>& solenoidalIntersector,
110 ToolHandle<IIntersector>& straightLineIntersector,
111 const ToolHandle<IPropagator>& stepPropagator,
112 const Volume* indetVolume = 0, int maxIterations = 25,
113 int useStepPropagator = 0);
114
115 ~FitProcedure(void) = default; // destructor
116 // forbidden copy constructor
117 // forbidden assignment operator
118
119 // clean up memory (after fit completion)
120 static void clear(FitProcedure::Cache& cache);
121
122 // retrieve result
123 static Track* constructTrack(
124 FitProcedure::Cache& cache,
125 const std::vector<FitMeasurement*>& measurements,
126 FitParameters& parameters, const TrackInfo& trackInfo,
127 const DataVector<const TrackStateOnSurface>* leadingTSOS = nullptr);
128
129 // perform fit procedure
131 bool asymmetricCaloEnergy, MsgStream& log,
132 std::vector<FitMeasurement*>& measurements,
133 FitParameters*& parameters,
134 const FitQuality* perigeeQuality = 0,
135 bool for_iPatTrack = false) const;
136
137 // for IGlobalTrackFit interface
139
140 // set minimum number of iterations to perform (IGlobalTrackFit friends)
141 void setMinIterations(int minIter);
142
146
147 private:
148 // copy, assignment: no semantics, no implementation
149 FitProcedure(const FitProcedure&) = delete;
153
155 std::vector<FitMeasurement*>& measurements) const;
156
157 const ToolHandle<IIntersector>& chooseIntersector(
158 std::vector<FitMeasurement*>& measurements,
159 const FitParameters& parameters) const;
160
161 static void reportQuality(FitProcedure::Cache& cache,
162 const std::vector<FitMeasurement*>& measurements,
163 const FitParameters& parameters);
164
173 double m_minPt;
174 ToolHandle<IIntersector>& m_rungeKuttaIntersector;
175 const ToolHandle<IIntersector>& m_solenoidalIntersector;
176 ToolHandle<IIntersector>& m_straightLineIntersector;
177 const ToolHandle<IPropagator>& m_stepPropagator;
179};
180} // namespace Trk
181
182#endif // TRKIPATFITTERUTILS_FITPROCEDURE_H
An STL vector of pointers that by default owns its pointed-to elements.
Derived DataVector<T>.
Definition DataVector.h:795
const ToolHandle< IPropagator > & m_stepPropagator
static void reportQuality(FitProcedure::Cache &cache, const std::vector< FitMeasurement * > &measurements, const FitParameters &parameters)
ToolHandle< IIntersector > & m_rungeKuttaIntersector
const Trk::Volume * m_indetVolume
FitProcedure & operator=(FitProcedure &&)=delete
FitProcedure & operator=(const FitProcedure &)=delete
static void clear(FitProcedure::Cache &cache)
const ToolHandle< IIntersector > & m_solenoidalIntersector
ToolHandle< IIntersector > & m_straightLineIntersector
void setMinIterations(int minIter)
void calculateChiSq(FitProcedure::Cache &cache, std::vector< FitMeasurement * > &measurements) const
static Track * constructTrack(FitProcedure::Cache &cache, const std::vector< FitMeasurement * > &measurements, FitParameters &parameters, const TrackInfo &trackInfo, const DataVector< const TrackStateOnSurface > *leadingTSOS=nullptr)
FitProcedure(bool constrainedAlignmentEffects, bool extendedDebug, bool lineFit, ToolHandle< IIntersector > &rungeKuttaIntersector, ToolHandle< IIntersector > &solenoidalIntersector, ToolHandle< IIntersector > &straightLineIntersector, const ToolHandle< IPropagator > &stepPropagator, const Volume *indetVolume=0, int maxIterations=25, int useStepPropagator=0)
const FitProcedureQuality & execute(FitProcedure::Cache &cache, bool asymmetricCaloEnergy, MsgStream &log, std::vector< FitMeasurement * > &measurements, FitParameters *&parameters, const FitQuality *perigeeQuality=0, bool for_iPatTrack=false) const
FitProcedure(const FitProcedure &)=delete
FitProcedure(FitProcedure &&)=delete
bool constrainedAlignmentEffects() const
const ToolHandle< IIntersector > & chooseIntersector(std::vector< FitMeasurement * > &measurements, const FitParameters &parameters) const
~FitProcedure(void)=default
static Amg::MatrixX * fullCovariance()
bool m_constrainedAlignmentEffects
Class to represent and store fit qualities from track reconstruction in terms of and number of degre...
Definition FitQuality.h:97
Base class for Intersector AlgTools.
Interface class IPropagators It inherits from IAlgTool.
Definition IPropagator.h:55
Contains information about the 'fitter' of this track.
represents the track state (measurement, material, fit parameters and quality) at a surface.
Base class for all volumes inside the tracking realm, it defines the interface for inherited Volume c...
Definition Volume.h:36
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Ensure that the ATLAS eigen extensions are properly loaded.
STL namespace.
std::unique_ptr< FitProcedureQuality > fitQuality
Cache & operator=(const Cache &)=delete
std::unique_ptr< FitMatrices > fitMatrices
Cache(bool constrainedAlignmentEffects)
Cache(const Cache &)=delete
Cache(Cache &&)=delete
Cache & operator=(Cache &&)=delete