ATLAS Offline Software
Loading...
Searching...
No Matches
MatrixTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRKALIGNGENTOOLS_MATRIXTOOL_H
6#define TRKALIGNGENTOOLS_MATRIXTOOL_H
7
21
22#include "GaudiKernel/ToolHandle.h"
24
26
27#include <TMatrixDSym.h>
28#include "CLHEP/Matrix/SymMatrix.h"
29
30#include <string>
31
32class TString;
33
45
46namespace Trk {
47
48 class AlSymMatBase;
49 class AlSymMat;
50 class AlMat;
51 class AlVec;
52
53 class IAlignModuleTool;
54
55 class MatrixTool : public AthAlgTool, virtual public IMatrixTool {
56 public:
57
68
70 MatrixTool(const std::string& type, const std::string& name,
71 const IInterface* parent);
72
74 virtual ~MatrixTool();
75
77 StatusCode initialize();
78
80 StatusCode finalize();
81
83 StatusCode allocateMatrix(int nDoF=0);
84
86 void prepareBinaryFiles(int solveOption);
87
90
92 void addFirstDerivatives(std::list<int,double>& derivatives);
93
94 void addFirstDerivative(int irow, double firstderiv);
95
98
100 void addSecondDerivatives(std::list<std::pair<int,int>,double >& derivatives);
101
102 void addSecondDerivative(int irow, int icol, double secondderiv);
103
104
106 bool accumulateFromFiles();
107
110
112 int solve();
113
114
116 void storeInTFile(const TString& filename);
117
120
121 void printModuleSolution(std::ostream & os, const AlignModule * module, const CLHEP::HepSymMatrix * cov) const;
122 void printGlobalSolution(std::ostream & os, const CLHEP::HepSymMatrix * cov);
123 void printGlobalSolution(std::ostream & os, const TMatrixDSym * cov);
124
125 private:
126
127 // private methods
128 int solveROOT();
129 int solveCLHEP();
130 int solveLapack();
131 int solveSparseEigen();
132 int solveLocal();
133
134 StatusCode spuriousRemoval();
135 static int fillVecMods();
136 void postSolvingLapack(AlVec * dChi2, AlSymMat * d2Chi2, AlVec &w, AlMat &z, int size);
137
138 void writeHitmap();
139 void readHitmaps();
140
141 // private variables
142 ToolHandle<IAlignModuleTool> m_alignModuleTool;
143
146
149
152
155
160 float m_pullcut;
163
164 bool m_calDet;
171
175
178
180
181 double m_scale;
183
185
187
188 bool m_calculateFullCovariance; //?< calculate full covariance matrix for Lapack
189
190 std::string m_pathbin;
191 std::string m_pathtxt;
192 std::string m_prefixName;
193
194 std::string m_tfileName;
195
196
197 std::string m_scalaMatName;
198 std::string m_scalaVecName;
199
200
201
202 std::vector<std::string> m_inputMatrixFiles;
203 std::vector<std::string> m_inputVectorFiles;
204
205 std::vector<std::string> m_inputHitmapFiles;
206
207 std::vector<std::string> m_inputTFiles;
208
209 std::vector<int> m_activeIndices;
211
213
217
224
231
232
233 }; // end of class
234
235
236
237} // End of namespace
238
239
240
241#endif // TRKALIGNGENTOOLS_MATRIXTOOL_H
242
243
244
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
contains the implementation of the methods of class AlMat, for handling general NxM matrices
Definition AlMat.h:27
contains the base implementation for handling symmertic matrices
contains the implementation for handling symmetric matrices in triangular representation
Definition AlSymMat.h:26
IMatrixTool()
constructor
MatrixTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
int m_maxReadErrors
maximum number of reading TFile errors
Definition MatrixTool.h:212
std::string m_prefixName
prefix string to filenames
Definition MatrixTool.h:192
void prepareBinaryFiles(int solveOption)
reads/writes matrix entries from/to binary files as necessary
std::vector< std::string > m_inputHitmapFiles
input binary files containing the hitmaps
Definition MatrixTool.h:205
std::string m_pathtxt
path ascii files (in/out)
Definition MatrixTool.h:191
int m_minNumTrks
cut on the minimum number of tracks per module
Definition MatrixTool.h:159
double m_scale
scale for big matrix and vector normalization
Definition MatrixTool.h:181
StatusCode spuriousRemoval()
bool m_readHitmaps
accumulate hitymap from files
Definition MatrixTool.h:174
bool m_wSqMatrix
write a triangular matrix by default (true: square format) ?
Definition MatrixTool.h:165
StatusCode allocateMatrix(int nDoF=0)
allocates memory for big matrix and big vector
std::vector< int > m_activeIndices
vector of indices which pass the min-hits cut
Definition MatrixTool.h:209
std::vector< std::string > m_inputTFiles
input binary files containing matrix terms
Definition MatrixTool.h:207
void addSecondDerivative(int irow, int icol, double secondderiv)
bool m_AlignPixelbutNotIBL
Definition MatrixTool.h:215
std::string m_pathbin
path binary files (in/out)
Definition MatrixTool.h:190
bool accumulateFromFiles()
accumulates derivates from files.
AlVec * m_bigvector
vector to contain first derivative terms to be used for alignment
Definition MatrixTool.h:148
bool m_diagonalize
run diagonalization instead of inversion
Definition MatrixTool.h:153
static int fillVecMods()
int m_aNDoF
number of active DoF (size of m_activeIndices)
Definition MatrixTool.h:210
double m_softEigenmodeCut
add constant to diagonal to effectively cut on weak eigenmodes
Definition MatrixTool.h:184
int m_minNumHits
cut on the minimum number of hits per module
Definition MatrixTool.h:158
bool m_calculateFullCovariance
Definition MatrixTool.h:188
int solve()
solves for alignment parameters
float m_Align_db_step
corr in the diagonal basis step for the third pass in the auto weak mode removal method
Definition MatrixTool.h:162
ToolHandle< IAlignModuleTool > m_alignModuleTool
Definition MatrixTool.h:142
virtual ~MatrixTool()
Virtual destructor.
bool m_writeHitmapTxt
write hitmap into text file
Definition MatrixTool.h:173
std::vector< std::string > m_inputMatrixFiles
input binary files containing matrix terms
Definition MatrixTool.h:202
float m_eigenvalueStep
eigenvalue step for the second pass in the automatic weak mode removal method
Definition MatrixTool.h:161
bool m_writeMatTxt
also write big matrix and vector into txt files ?
Definition MatrixTool.h:167
void addSecondDerivatives(AlSymMatBase *matrix)
adds second derivatives to matrix
bool m_DeactivateSCT_ECA_LastDisk
Definition MatrixTool.h:216
bool m_readTFiles
write out files to a root file
Definition MatrixTool.h:177
bool accumulateFromTFiles()
Store Files in a tfile.
int m_modcut
cut on the weak modes which number is <par_modcut
Definition MatrixTool.h:157
bool m_writeHitmap
write hitmap into file
Definition MatrixTool.h:172
void storeInTFile(const TString &filename)
Store Files in a tfile.
void addFirstDerivatives(AlVec *vector)
adds first derivative to vector
std::string m_tfileName
prefix string to filenames
Definition MatrixTool.h:194
void printModuleSolution(std::ostream &os, const AlignModule *module, const CLHEP::HepSymMatrix *cov) const
namespace { class RestoreIOSFlags { public: RestoreIOSFlags (std::ostream &os) : m_os(&os),...
bool m_writeTFile
write out files to a root file
Definition MatrixTool.h:176
bool m_writeMat
write big matrix and vector into files ?
Definition MatrixTool.h:166
std::vector< std::string > m_inputVectorFiles
input binary files containing vector terms
Definition MatrixTool.h:203
bool m_writeEigenMat
write eigenvalues and eigenvectors into files ?
Definition MatrixTool.h:168
bool m_runLocal
Run solving using Local method.
Definition MatrixTool.h:179
void postSolvingLapack(AlVec *dChi2, AlSymMat *d2Chi2, AlVec &w, AlMat &z, int size)
std::string m_scalaVecName
Scalapack vector name.
Definition MatrixTool.h:198
bool m_writeModuleNames
write module name instead of Identifier to vector file
Definition MatrixTool.h:170
std::string m_scalaMatName
Scalapack matrix name.
Definition MatrixTool.h:197
bool m_writeEigenMatTxt
also write eigenvalues and eigenvectors into txt files ?
Definition MatrixTool.h:169
AlSymMatBase * m_bigmatrix
matrix to contain second derivative terms to be used for alignment
Definition MatrixTool.h:145
double m_eigenvaluethreshold
cut on the minimum eigenvalue
Definition MatrixTool.h:154
bool m_calDet
Compute bigmatrix's determinant ?
Definition MatrixTool.h:164
@ SOLVE_FAST
Fast (Eigen method) solving after data accumulation.
Definition MatrixTool.h:61
@ SOLVE_ROOT
computation using ROOT
Definition MatrixTool.h:65
@ SOLVE
solving after data accumulation (LAPACK)
Definition MatrixTool.h:60
@ DIRECT_SOLVE_FAST
direct Fast (Eigen method) solving, already available matrix & vector
Definition MatrixTool.h:63
@ DIRECT_SOLVE
direct solving (LAPACK), already available matrix & vector
Definition MatrixTool.h:62
@ DIRECT_SOLVE_CLUSTER
computation of alignment parameters from SCALAPAK already solved matrix
Definition MatrixTool.h:64
@ NONE
not solve in any case (to be used when ipc)
Definition MatrixTool.h:59
@ SOLVE_CLHEP
computation using CLHEP
Definition MatrixTool.h:66
void addFirstDerivative(int irow, double firstderiv)
bool m_removeSpurious
run spurious removal
Definition MatrixTool.h:186
StatusCode finalize()
initialize
int m_solveOption
solving option
Definition MatrixTool.h:156
bool accumulateFromBinaries()
accumulates derivates from binary files
bool m_AlignIBLbutNotPixel
Definition MatrixTool.h:214
StatusCode initialize()
initialize
void printGlobalSolution(std::ostream &os, const CLHEP::HepSymMatrix *cov)
float m_pullcut
pull cut for the automatic weak mode removal method
Definition MatrixTool.h:160
bool m_useSparse
flag to use AlSpaMat for the big matrix (default is AlSymMat)
Definition MatrixTool.h:151
bool m_scaleMatrix
scale matrix by number of hits before solving
Definition MatrixTool.h:182
Ensure that the ATLAS eigen extensions are properly loaded.
@ z
global position (cartesian)
Definition ParamDefs.h:57