ATLAS Offline Software
Loading...
Searching...
No Matches
ShiftingDerivCalcTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRK_SHIFTINGDERIVCALCTOOL_H
6#define TRK_SHIFTINGDERIVCALCTOOL_H
7
9#include "GaudiKernel/ToolHandle.h"
10
13
18
19
20#include <vector>
21#include <map>
22
34
35class TGraph;
36
37namespace Trk {
38
39 class TrackStateOnSurface;
40 class Track;
41 class AlignModule;
42 class AlignTSOS;
43 class AlignTrack;
44 class AlignPar;
45
46 class ShiftingDerivCalcTool : virtual public IDerivCalcTool, public AthAlgTool {
47
48 public:
49 ShiftingDerivCalcTool(const std::string& type, const std::string& name,
50 const IInterface* parent);
51 virtual ~ShiftingDerivCalcTool();
52
53 StatusCode initialize();
54 StatusCode finalize();
55
57 bool setDerivatives(AlignTrack* track);
58
60
62 bool setResidualCovMatrix(AlignTrack* alignTrack) const;
63
64 protected:
65
66 // protected typedefs
67 typedef std::vector<Amg::VectorX> HitDerivative;
68 typedef std::map<const TrackStateOnSurface*,HitDerivative*> DerivativeMap;
69 typedef DerivativeMap::value_type DerivativePair;
70
71 // protected methods
73 int ipar, AlignPar* alignPar,
74 Amg::VectorX& derivativeErr, bool& resetIPar,
75 double& actualSecondDerivative);
76
77 void setChi2VAlignParam(const AlignTrack* alignTrack,
78 const AlignModule* module,
79 int nshifts=0);
81
82 double shiftSize(const AlignPar* alignPar) const;
83 bool setUnshiftedResiduals(AlignTrack* alignTrack);
84
85 private:
86 // private methods
87 const Trk::Track* bestPerigeeTrack(const Track* track) const;
88 bool scanShifts(const AlignTrack* alignTrack,
89 const std::vector<AlignModule*>& alignModules);
90
91 bool getAllDerivatives(AlignTrack* alignTrack, const AlignModule* alignModule,
92 std::vector<Amg::VectorX>& deriv_vec,
93 std::vector<Amg::VectorX>& derivErr_vec,
94 std::vector<double>& actualsecderiv_vec,
95 bool& resetIPar);
96
97 // private variables
98 ToolHandle<IGlobalTrackFitter> m_trackFitterTool
99 {this, "TrackFitterTool", "Trk::GlobalChi2Fitter/MCTBFitter"};
100 ToolHandle<IGlobalTrackFitter> m_SLTrackFitterTool
101 {this, "SLTrackFitterTool", "Trk::GlobalChi2Fitter/MCTBSLFitter"};
102 ToolHandle<IGlobalTrackFitter> m_fitter;
103
104 ToolHandle<IAlignResidualCalculator> m_residualCalculator
105 {this, "ResidualCalculator", "Trk::AlignResidualCalculator/ResidualCalculator"};
106 ToolHandle<IAlignModuleTool> m_alignModuleTool
107 {this, "AlignModuleTool", "Trk::AlignModuleTool/AlignModuleTool"};
108
109 Gaudi::Property<double> m_traSize{this, "TranslationSize", .1};
110 Gaudi::Property<double> m_rotSize{this, "RotationSize", .1};
111
112 Gaudi::Property<bool> m_runOutlierRemoval
113 {this, "RunOutlierRemoval", false};
115
116 Gaudi::Property<int> m_particleNumber{this, "ParticleNumber", 2};
117
119
120 Gaudi::Property<bool> m_doFits{this, "doResidualFits", true};
121 Gaudi::Property<int> m_nFits{this, "NumberOfShifts", 5};
122 Gaudi::Property<bool> m_doChi2VAlignParamMeasType
123 {this, "doChi2VChamberShiftsMeasType", false};
124 Gaudi::Property<bool> m_doResidualPlots{this, "doResidualPlots", false};
126
129
130 // stores double** for each module that track passes through
131 std::vector<double**> m_chi2VAlignParamVec;
132 std::vector<double**> m_chi2VAlignParamXVec;
133
134 double** m_tmpChi2VAlignParam = nullptr;
135 double** m_tmpChi2VAlignParamX = nullptr;
136 double*** m_tmpChi2VAlignParamMeasType = nullptr;
137
138 // stores double*** for each module that track passes through
139 // (one double** for each TrackState::MeasurementType)
140 std::vector<double***> m_chi2VAlignParamVecMeasType;
141
143 std::unique_ptr<double[]> m_unshiftedTrackChi2MeasType;
144
146 Gaudi::Property<double> m_trackAlignParamCut{this, "TrackAlignParamCut", 1e6};
147
149 Gaudi::Property<bool> m_setMinIterations{this, "SetMinIterations", false};
150
152 Gaudi::Property<int> m_maxIter{this, "MaxIterations", 50};
153
155 Gaudi::Property<int> m_minIter{this, "MinIterations", 10};
156
158 Gaudi::Property<bool> m_removeScatteringBeforeRefit
159 {this, "RemoveScatteringBeforeRefit", false};
160
172
173 bool m_secPass{};
174
175 }; // end class
176
177
178} // end namespace
179
180#endif // TRK_SHIFTINGDERIVCALCTOOL_H
AlignModule is a grouping of TrkDetElementBase objects, grouped according to the type of alignment,...
AlignPar contains all the information related to an alignment parameter of a particular align module ...
AlignTSOS is a TSOS with extra variables useful for alignment.
AlignTrack is a generalization of a Trk::Track, used as the basic object to contain track information...
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Property< bool > m_removeScatteringBeforeRefit
DerivativeMap::value_type DerivativePair
Gaudi::Property< int > m_minIter
flag to remove scattering before refitting track
const Trk::Track * bestPerigeeTrack(const Track *track) const
std::vector< double ** > m_chi2VAlignParamVec
track chi2[idof][ichambershift]
Gaudi::Property< int > m_particleNumber
ToolHandle< IGlobalTrackFitter > m_trackFitterTool
ToolHandle< IGlobalTrackFitter > m_fitter
int m_ntracksProcessed
number tracks processed
bool setUnshiftedResiduals(AlignTrack *alignTrack)
int m_ntracksPassSetUnshiftedRes
number tracks pass setting unshifted residuals
double shiftSize(const AlignPar *alignPar) const
void showStatistics()
write statistics to log file
Gaudi::Property< int > m_maxIter
set minimum number of iterations for first track fits
bool getAllDerivatives(AlignTrack *alignTrack, const AlignModule *alignModule, std::vector< Amg::VectorX > &deriv_vec, std::vector< Amg::VectorX > &derivErr_vec, std::vector< double > &actualsecderiv_vec, bool &resetIPar)
ShiftingDerivCalcTool(const std::string &type, const std::string &name, const IInterface *parent)
int m_ntracksPassInitScan
number tracks pass initial scan
std::unique_ptr< double[]> m_unshiftedTrackChi2MeasType
cut on value of track alignment parameter, determined from fit of chi2 vs.
Gaudi::Property< bool > m_doFits
int m_ntracksPassGetDeriv
number tracks pass getting derivatives
ToolHandle< IAlignResidualCalculator > m_residualCalculator
int m_ntracksPassGetDerivSecPass
number tracks pass 2nd pass of getting derivatives
Amg::VectorX getDerivatives(AlignTrack *alignTrack, int ipar, AlignPar *alignPar, Amg::VectorX &derivativeErr, bool &resetIPar, double &actualSecondDerivative)
int m_ntracksPassGetDerivLastPass
number tracks pass 2nd pass of getting derivatives
bool setDerivatives(AlignTrack *track)
sets derivatives of residuals w.r.t.
int m_ntracksPassDerivatives
number tracks pass setting derivatives
ToolHandle< IAlignModuleTool > m_alignModuleTool
ParticleHypothesis m_particleHypothesis
std::vector< Amg::VectorX > HitDerivative
Gaudi::Property< double > m_rotSize
bool scanShifts(const AlignTrack *alignTrack, const std::vector< AlignModule * > &alignModules)
Gaudi::Property< bool > m_setMinIterations
reject track if exceed maximum number of iterations
Gaudi::Property< bool > m_doChi2VAlignParamMeasType
Gaudi::Property< bool > m_doResidualPlots
bool setResidualCovMatrix(AlignTrack *alignTrack) const
sets residual covariance matrix
Gaudi::Property< double > m_trackAlignParamCut
fit track with AlignModules shifted up and down in each extreme, find the number of iterations fitter...
ToolHandle< IGlobalTrackFitter > m_SLTrackFitterTool
std::map< const TrackStateOnSurface *, HitDerivative * > DerivativeMap
std::vector< double *** > m_chi2VAlignParamVecMeasType
track chi2[idof][imeastype][ichambershift]
void setChi2VAlignParam(const AlignTrack *alignTrack, const AlignModule *module, int nshifts=0)
Gaudi::Property< double > m_traSize
Gaudi::Property< bool > m_runOutlierRemoval
std::vector< double ** > m_chi2VAlignParamXVec
chamber shift[idof][ichambershift]
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.
Ensure that the ATLAS eigen extensions are properly loaded.
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.