ATLAS Offline Software
ShiftingDerivCalcTool.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 TRK_SHIFTINGDERIVCALCTOOL_H
6 #define TRK_SHIFTINGDERIVCALCTOOL_H
7 
9 #include "GaudiKernel/ToolHandle.h"
10 
13 
15 
16 
17 #include <vector>
18 #include <map>
19 
32 class TGraph;
33 
34 namespace Trk {
35 
36  class TrackStateOnSurface;
37  class Track;
38  class IGlobalTrackFitter;
39  //class ITrackFitter;
41  class AlignModule;
42  class AlignTSOS;
43  class AlignTrack;
44  class AlignPar;
45  class IAlignModuleTool;
46 
47  class ShiftingDerivCalcTool : virtual public IDerivCalcTool, public AthAlgTool {
48 
49  public:
50  ShiftingDerivCalcTool(const std::string& type, const std::string& name,
51  const IInterface* parent);
52  virtual ~ShiftingDerivCalcTool();
53 
56 
59 
60  void showStatistics() {}
61 
63  bool setResidualCovMatrix(AlignTrack* alignTrack) const;
64 
65  protected:
66 
67  // protected typedefs
68  typedef std::vector<Amg::VectorX> HitDerivative;
69  typedef std::map<const TrackStateOnSurface*,HitDerivative*> DerivativeMap;
70  typedef DerivativeMap::value_type DerivativePair;
71 
72  // protected methods
74  int ipar, AlignPar* alignPar,
75  Amg::VectorX& derivativeErr, bool& resetIPar,
76  double& actualSecondDerivative);
77 
78  void setChi2VAlignParam(const AlignTrack* alignTrack,
79  const AlignModule* module,
80  int nshifts=0);
81  void deleteChi2VAlignParam();
82 
83  double shiftSize(const AlignPar* alignPar) const;
84  bool setUnshiftedResiduals(AlignTrack* alignTrack);
85 
86  private:
87  // private methods
88  const Trk::Track* bestPerigeeTrack(const Track* track) const;
89  bool scanShifts(const AlignTrack* alignTrack,
90  const std::vector<AlignModule*>& alignModules);
91 
92  bool getAllDerivatives(AlignTrack* alignTrack, const AlignModule* alignModule,
93  std::vector<Amg::VectorX>& deriv_vec,
94  std::vector<Amg::VectorX>& derivErr_vec,
95  std::vector<double>& actualsecderiv_vec,
96  bool& resetIPar);
97 
98  // private variables
99  ToolHandle<IGlobalTrackFitter> m_trackFitterTool;
100  ToolHandle<IGlobalTrackFitter> m_SLTrackFitterTool;
101  ToolHandle<IGlobalTrackFitter> m_fitter;
102  //ToolHandle<ITrackFitter> m_trackFitterTool;
103  //ToolHandle<ITrackFitter> m_SLTrackFitterTool;
104  //ToolHandle<ITrackFitter> m_fitter;
105 
106  ToolHandle<IAlignResidualCalculator> m_residualCalculator;
107  ToolHandle<IAlignModuleTool> m_alignModuleTool;
108 
109  double m_traSize;
110  double m_rotSize;
111 
114 
116 
118 
119  bool m_doFits;
120  int m_nFits;
125 
128 
129  // stores double** for each module that track passes through
130  std::vector<double**> m_chi2VAlignParamVec;
131  std::vector<double**> m_chi2VAlignParamXVec;
132 
136 
137  // stores double*** for each module that track passes through
138  // (one double** for each TrackState::MeasurementType)
139  std::vector<double***> m_chi2VAlignParamVecMeasType;
140 
143 
145 
147 
148  int m_maxIter;
149 
150  int m_minIter;
151 
153 
165 
166  bool m_secPass;
167 
168  }; // end class
169 
170 
171 } // end namespace
172 
173 #endif // TRK_SHIFTINGDERIVCALCTOOL_H
Trk::ShiftingDerivCalcTool::m_alignModuleTool
ToolHandle< IAlignModuleTool > m_alignModuleTool
Definition: ShiftingDerivCalcTool.h:107
Trk::ShiftingDerivCalcTool::m_chi2VAlignParamVec
std::vector< double ** > m_chi2VAlignParamVec
track chi2[idof][ichambershift]
Definition: ShiftingDerivCalcTool.h:130
Trk::ShiftingDerivCalcTool::m_ntracksPassGetDeriv
int m_ntracksPassGetDeriv
number tracks pass getting derivatives
Definition: ShiftingDerivCalcTool.h:158
Trk::ShiftingDerivCalcTool::setResidualCovMatrix
bool setResidualCovMatrix(AlignTrack *alignTrack) const
sets residual covariance matrix
Definition: ShiftingDerivCalcTool.cxx:880
IAlignResidualCalculator
Interface for tool used to calculate residuals.
Amg::VectorX
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.
Definition: EventPrimitives.h:30
Trk::ShiftingDerivCalcTool::m_nIterations
int m_nIterations
Definition: ShiftingDerivCalcTool.h:124
Trk::ShiftingDerivCalcTool::m_chi2VAlignParamXVec
std::vector< double ** > m_chi2VAlignParamXVec
chamber shift[idof][ichambershift]
Definition: ShiftingDerivCalcTool.h:131
Trk::ShiftingDerivCalcTool::m_ntracksPassGetDerivSecPass
int m_ntracksPassGetDerivSecPass
number tracks pass 2nd pass of getting derivatives
Definition: ShiftingDerivCalcTool.h:159
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
Trk::ShiftingDerivCalcTool::bestPerigeeTrack
const Trk::Track * bestPerigeeTrack(const Track *track) const
Trk::ShiftingDerivCalcTool::DerivativePair
DerivativeMap::value_type DerivativePair
Definition: ShiftingDerivCalcTool.h:70
Trk::ShiftingDerivCalcTool::scanShifts
bool scanShifts(const AlignTrack *alignTrack, const std::vector< AlignModule * > &alignModules)
Definition: ShiftingDerivCalcTool.cxx:164
Trk::ShiftingDerivCalcTool::m_traSize
double m_traSize
Definition: ShiftingDerivCalcTool.h:109
Trk::ShiftingDerivCalcTool::m_tmpChi2VAlignParamX
double ** m_tmpChi2VAlignParamX
Definition: ShiftingDerivCalcTool.h:134
Trk::AlignModule
Definition: AlignModule.h:45
Trk::ShiftingDerivCalcTool::m_ntracksProcessed
int m_ntracksProcessed
number tracks processed
Definition: ShiftingDerivCalcTool.h:154
Trk::ShiftingDerivCalcTool::m_ntracksFailMaxIter
int m_ntracksFailMaxIter
Definition: ShiftingDerivCalcTool.h:161
Trk::ShiftingDerivCalcTool::m_ntracksFailAlignParamCut
int m_ntracksFailAlignParamCut
Definition: ShiftingDerivCalcTool.h:163
Trk::ShiftingDerivCalcTool::m_unshiftedResiduals
Amg::VectorX * m_unshiftedResiduals
Definition: ShiftingDerivCalcTool.h:126
ParamDefs.h
Trk::ShiftingDerivCalcTool::m_particleHypothesis
ParticleHypothesis m_particleHypothesis
Definition: ShiftingDerivCalcTool.h:113
Trk::ShiftingDerivCalcTool::initialize
StatusCode initialize()
Definition: ShiftingDerivCalcTool.cxx:117
Trk::ShiftingDerivCalcTool::m_ntracksPassSetUnshiftedRes
int m_ntracksPassSetUnshiftedRes
number tracks pass setting unshifted residuals
Definition: ShiftingDerivCalcTool.h:156
Trk::ShiftingDerivCalcTool::m_ntracksFailFinalAttempt
int m_ntracksFailFinalAttempt
Definition: ShiftingDerivCalcTool.h:164
Trk::ShiftingDerivCalcTool::m_chi2VAlignParamVecMeasType
std::vector< double *** > m_chi2VAlignParamVecMeasType
track chi2[idof][imeastype][ichambershift]
Definition: ShiftingDerivCalcTool.h:139
Trk::ShiftingDerivCalcTool::setChi2VAlignParam
void setChi2VAlignParam(const AlignTrack *alignTrack, const AlignModule *module, int nshifts=0)
Trk::ParticleHypothesis
ParticleHypothesis
Definition: ParticleHypothesis.h:25
AlignModule
AlignModule is a grouping of TrkDetElementBase objects, grouped according to the type of alignment,...
python.PyAthena.module
module
Definition: PyAthena.py:131
Trk::ShiftingDerivCalcTool::DerivativeMap
std::map< const TrackStateOnSurface *, HitDerivative * > DerivativeMap
Definition: ShiftingDerivCalcTool.h:69
Trk::ShiftingDerivCalcTool::m_nChamberShifts
int m_nChamberShifts
Definition: ShiftingDerivCalcTool.h:122
AlignTSOS
AlignTSOS is a TSOS with extra variables useful for alignment. It is created using an implementation ...
Trk::ShiftingDerivCalcTool::m_ntracksPassGetDerivLastPass
int m_ntracksPassGetDerivLastPass
number tracks pass 2nd pass of getting derivatives
Definition: ShiftingDerivCalcTool.h:160
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Trk::ShiftingDerivCalcTool::ShiftingDerivCalcTool
ShiftingDerivCalcTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: ShiftingDerivCalcTool.cxx:39
AthAlgTool.h
Trk::AlignPar
Definition: AlignPar.h:25
test_pyathena.parent
parent
Definition: test_pyathena.py:15
Trk::ShiftingDerivCalcTool::m_trackAlignParamCut
double m_trackAlignParamCut
cut on value of track alignment parameter, determined from fit of chi2 vs.
Definition: ShiftingDerivCalcTool.h:144
Trk::ShiftingDerivCalcTool::HitDerivative
std::vector< Amg::VectorX > HitDerivative
Definition: ShiftingDerivCalcTool.h:68
Trk::ShiftingDerivCalcTool::~ShiftingDerivCalcTool
virtual ~ShiftingDerivCalcTool()
Definition: ShiftingDerivCalcTool.cxx:110
Trk::ShiftingDerivCalcTool::m_derivative_map
DerivativeMap m_derivative_map
Definition: ShiftingDerivCalcTool.h:117
Trk::ShiftingDerivCalcTool::getAllDerivatives
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)
Definition: ShiftingDerivCalcTool.cxx:936
Trk::ShiftingDerivCalcTool::m_secPass
bool m_secPass
Definition: ShiftingDerivCalcTool.h:166
Trk::ShiftingDerivCalcTool::getDerivatives
Amg::VectorX getDerivatives(AlignTrack *alignTrack, int ipar, AlignPar *alignPar, Amg::VectorX &derivativeErr, bool &resetIPar, double &actualSecondDerivative)
Definition: ShiftingDerivCalcTool.cxx:496
ParticleHypothesis.h
Trk::ShiftingDerivCalcTool::m_tmpChi2VAlignParam
double ** m_tmpChi2VAlignParam
Definition: ShiftingDerivCalcTool.h:133
Trk::ShiftingDerivCalcTool::m_ntracksPassDerivatives
int m_ntracksPassDerivatives
number tracks pass setting derivatives
Definition: ShiftingDerivCalcTool.h:157
Trk::ShiftingDerivCalcTool
Definition: ShiftingDerivCalcTool.h:47
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::ShiftingDerivCalcTool::setDerivatives
bool setDerivatives(AlignTrack *track)
sets derivatives of residuals w.r.t.
Definition: ShiftingDerivCalcTool.cxx:328
Trk::ShiftingDerivCalcTool::m_doFits
bool m_doFits
Definition: ShiftingDerivCalcTool.h:119
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
AlignPar
AlignPar contains all the information related to an alignment parameter of a particular align module ...
Trk::ShiftingDerivCalcTool::m_minIter
int m_minIter
set minimum number of iterations for first track fits
Definition: ShiftingDerivCalcTool.h:150
Trk::AlignTrack
Definition: AlignTrack.h:41
Trk::ShiftingDerivCalcTool::shiftSize
double shiftSize(const AlignPar *alignPar) const
Definition: ShiftingDerivCalcTool.cxx:866
Trk::IDerivCalcTool
Definition: IDerivCalcTool.h:36
Trk::ShiftingDerivCalcTool::deleteChi2VAlignParam
void deleteChi2VAlignParam()
Definition: ShiftingDerivCalcTool.cxx:920
Trk::ShiftingDerivCalcTool::m_nFits
int m_nFits
Definition: ShiftingDerivCalcTool.h:120
Trk::ShiftingDerivCalcTool::m_ntracksPassInitScan
int m_ntracksPassInitScan
number tracks pass initial scan
Definition: ShiftingDerivCalcTool.h:155
Trk::ShiftingDerivCalcTool::m_rotSize
double m_rotSize
Definition: ShiftingDerivCalcTool.h:110
Trk::ShiftingDerivCalcTool::m_particleNumber
int m_particleNumber
Definition: ShiftingDerivCalcTool.h:115
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
Trk::ShiftingDerivCalcTool::m_unshiftedTrackChi2MeasType
double * m_unshiftedTrackChi2MeasType
Definition: ShiftingDerivCalcTool.h:142
Trk::ShiftingDerivCalcTool::m_residualCalculator
ToolHandle< IAlignResidualCalculator > m_residualCalculator
Definition: ShiftingDerivCalcTool.h:106
Trk::ShiftingDerivCalcTool::setUnshiftedResiduals
bool setUnshiftedResiduals(AlignTrack *alignTrack)
Definition: ShiftingDerivCalcTool.cxx:246
Trk::ShiftingDerivCalcTool::m_setMinIterations
bool m_setMinIterations
fit track with AlignModules shifted up and down in each extreme, find the number of iterations fitter...
Definition: ShiftingDerivCalcTool.h:146
Trk::ShiftingDerivCalcTool::m_trackFitterTool
ToolHandle< IGlobalTrackFitter > m_trackFitterTool
Definition: ShiftingDerivCalcTool.h:99
Trk::ShiftingDerivCalcTool::m_fitter
ToolHandle< IGlobalTrackFitter > m_fitter
Definition: ShiftingDerivCalcTool.h:101
Track
Definition: TriggerChamberClusterOnTrackCreator.h:21
Trk::ShiftingDerivCalcTool::m_unshiftedResErrors
Amg::VectorX * m_unshiftedResErrors
Definition: ShiftingDerivCalcTool.h:127
Trk::ShiftingDerivCalcTool::finalize
StatusCode finalize()
Definition: ShiftingDerivCalcTool.cxx:146
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
Trk::ShiftingDerivCalcTool::m_doChi2VAlignParamMeasType
bool m_doChi2VAlignParamMeasType
Definition: ShiftingDerivCalcTool.h:121
AthAlgTool
Definition: AthAlgTool.h:26
IDerivCalcTool.h
Trk::ShiftingDerivCalcTool::m_ntracksFailTrackRefit
int m_ntracksFailTrackRefit
Definition: ShiftingDerivCalcTool.h:162
Trk::ShiftingDerivCalcTool::m_SLTrackFitterTool
ToolHandle< IGlobalTrackFitter > m_SLTrackFitterTool
Definition: ShiftingDerivCalcTool.h:100
Trk::ShiftingDerivCalcTool::m_runOutlierRemoval
bool m_runOutlierRemoval
Definition: ShiftingDerivCalcTool.h:112
Trk::ShiftingDerivCalcTool::m_unshiftedTrackChi2
double m_unshiftedTrackChi2
Definition: ShiftingDerivCalcTool.h:141
Trk::ShiftingDerivCalcTool::m_doResidualPlots
bool m_doResidualPlots
Definition: ShiftingDerivCalcTool.h:123
Trk::ShiftingDerivCalcTool::m_removeScatteringBeforeRefit
bool m_removeScatteringBeforeRefit
flag to remove scattering before refitting track
Definition: ShiftingDerivCalcTool.h:152
Trk::ShiftingDerivCalcTool::showStatistics
void showStatistics()
write statistics to log file
Definition: ShiftingDerivCalcTool.h:60
Trk::ShiftingDerivCalcTool::m_tmpChi2VAlignParamMeasType
double *** m_tmpChi2VAlignParamMeasType
Definition: ShiftingDerivCalcTool.h:135
AlignTrack
AlignTrack is a generalization of a Trk::Track, used as the basic object to contain track information...
Trk::ShiftingDerivCalcTool::m_maxIter
int m_maxIter
reject track if exceed maximum number of iterations
Definition: ShiftingDerivCalcTool.h:148