FairRoot/PandaRoot
runLumiPixel2gAlignQA.C
Go to the documentation of this file.
1 /*
2  * runs align QA Taks and strores results to PDF, root
3  *
4  * Author: Roman Klasen, roklasen@uni-mainz.de or klasen@kph.uni-mainz.de
5  *
6  */
7 
9 
10 void runLumiPixel2gAlignQA(TString LMDmatrixPath="/home/arbeit/RedPro3TB/simulationData/boxtest-50u-1.5/binaryPairs-cut-160/LMDmatrices", const int verboseLevel=0)
11 {
12  // ----- Timer --------------------------------------------------------
13  //TStopwatch timer;
14  //timer.Start();
15 
16  //TODO: convert this so it actually uses the parameters from above!
17 
18  /*
19  * what does it do? read matrices found by ICP and compare with PndLmdDim matrices.
20  * That means matrices must already be there from previous steps, right? So check that.
21  */
22 
23  // ---------------------- init parameters
24 
25  bool useCorrectionMatrix = false;
26  bool inCentimeters = false;
27 
28  // ---------------------- init QA Task
29 
30  PndLmdAlignQA qaTask;
31 
32  qaTask.setCorrection(useCorrectionMatrix);
33  qaTask.setInCentimeters(inCentimeters);
34  qaTask.setLmdMatPath("/home/arbeit/RedPro3TB/simulationData/boxtest-0u-1.5/binaryPairs-cut-80/LMDmatrices");
35 
36  //TODO: Actually I don't want a dimension object here, the Manager should take care of that. See three lines down.
37  //dimension is a singleton, so you can load matrices even after a different object requested a dimension object
38  PndLmdDim *dimension = PndLmdDim::Instance();
39  //TODO: the matrices here are also important for the AlignQA class, which also needs to know if we use 10u or 50u. So this is messy design.
40  //change that!
41  dimension->Read_transformation_matrices("/geometry/MisalignTestGeometryMatrices/trafo_matrices_lmd.dat", true);
42  dimension->Read_transformation_matrices("/geometry/MisalignTestGeometryMatrices/trafo_matrices_lmd_misaligned-100u.dat", false);
43 
44  // DELETE THIS AFTERWARDS
45  //qaTask.setPdfOutPath("/home/arbeit/RedPro3TB/simulationData/PDFout");
46  //qaTask.compareMatrices(kHistPixelDistances);
47  //return;
48  // DELETE THIS AFTERWARDS
49 
50  //calculate all overlapping areas
51  if(false){
52  qaTask.compareMatrices(kCalcOverlap);
53  }
54 
55  // check if matrices exist (matrix finder was run)
56  bool matrixPresent = qaTask.checkForMatrixFiles();
57  if(matrixPresent){
58  cout << "\nINFO: all matrix files accounted for!\n";
59  }
60  else{
61  cout << "\nINFO: at least one matrix file could not be found!\n";
62  }
63 
64  /*
65  * prepare global settings
66  */
67  qaTask.setAlignOption(2); //0=aligned, other is misaligned. change together with LmdMatPath!
68  qaTask.setPairsRequired(300e3);
69 
70  //check combined matrices
71  if(false){
72  qaTask.setPdfOutPath("/home/arbeit/RedPro3TB/simulationData/boxtest-0u-1.5/AlignQA/");
73  //qaTask.compareMatrices(kPlotCombinedPXResiduals);
74  //qaTask.compareMatrices(kPlotCombinedCMResiduals);
75 
76  qaTask.compareMatrices(kCyclicCheckCM);
77  qaTask.compareMatrices(kCyclicCheckPX);
78 
79  return;
80  }
81 
82  /*
83  qaTask.setPdfOutPath("/home/arbeit/RedPro3TB/simulationData/boxtest-0u-1.5/AlignQA-80/");
84  qaTask.setLmdMatPath("/home/arbeit/RedPro3TB/simulationData/boxtest-0u-1.5/binaryPairs-cut-80/LMDmatrices"); //aligned, change together with setAlignOption!
85  //compare (matCM-matTargetCM)
86  qaTask.compareMatrices(kPlotCMMatrixResiduals);
87  //compare (matPX-matTargetPX)
88  qaTask.compareMatrices(kPlotPXMatrixResiduals);
89  //compare (matCM*matrixTarget-transFormToLMD(matPX))
90  qaTask.compareMatrices(kPlotCMvsPX);
91  //compare transformToLMD(matPX-matTargetPX) - (matCM-matTargetCM)
92  qaTask.compareMatrices(kPlotPXvsCMResiduals);
93  // compare combined matrices from 0 to 1-9
94  qaTask.compareMatrices(kPlotCombinedPXResiduals);
95 
96  qaTask.setPdfOutPath("/home/arbeit/RedPro3TB/simulationData/boxtest-0u-15/AlignQA-80/");
97  qaTask.setLmdMatPath("/home/arbeit/RedPro3TB/simulationData/boxtest-0u-15/binaryPairs-cut-80/LMDmatrices"); //aligned, change together with setAlignOption!
98  //compare (matCM-matTargetCM)
99  qaTask.compareMatrices(kPlotCMMatrixResiduals);
100  //compare (matPX-matTargetPX)
101  qaTask.compareMatrices(kPlotPXMatrixResiduals);
102  //compare (matCM*matrixTarget-transFormToLMD(matPX))
103  qaTask.compareMatrices(kPlotCMvsPX);
104  //compare transformToLMD(matPX-matTargetPX) - (matCM-matTargetCM)
105  qaTask.compareMatrices(kPlotPXvsCMResiduals);
106  // compare combined matrices from 0 to 1-9
107  qaTask.compareMatrices(kPlotCombinedPXResiduals);
108 
109 */
110 
111  dimension->Read_transformation_matrices("/geometry/MisalignTestGeometryMatrices/trafo_matrices_lmd_misaligned-10u.dat", false);
112  qaTask.setPdfOutPath("/home/arbeit/RedPro3TB/simulationData/boxtest-10u-1.5/AlignQA-80/");
113  qaTask.setLmdMatPath("/home/arbeit/RedPro3TB/simulationData/boxtest-10u-1.5/binaryPairs-cut-80/LMDmatrices"); //aligned, change together with setAlignOption!
114  //compare (matCM-matTargetCM)
115  qaTask.compareMatrices(kPlotCMMatrixResiduals);
116  //compare (matPX-matTargetPX)
117  qaTask.compareMatrices(kPlotPXMatrixResiduals);
118  //compare (matCM*matrixTarget-transFormToLMD(matPX))
119  qaTask.compareMatrices(kPlotCMvsPX);
120  //compare transformToLMD(matPX-matTargetPX) - (matCM-matTargetCM)
121  qaTask.compareMatrices(kPlotPXvsCMResiduals);
122  // compare combined matrices from 0 to 1-9
123  qaTask.compareMatrices(kPlotCombinedPXResiduals);
124 
125  qaTask.setPdfOutPath("/home/arbeit/RedPro3TB/simulationData/boxtest-10u-15/AlignQA-80/");
126  qaTask.setLmdMatPath("/home/arbeit/RedPro3TB/simulationData/boxtest-10u-15/binaryPairs-cut-80/LMDmatrices"); //aligned, change together with setAlignOption!
127  //compare (matCM-matTargetCM)
128  qaTask.compareMatrices(kPlotCMMatrixResiduals);
129  //compare (matPX-matTargetPX)
130  qaTask.compareMatrices(kPlotPXMatrixResiduals);
131  //compare (matCM*matrixTarget-transFormToLMD(matPX))
132  qaTask.compareMatrices(kPlotCMvsPX);
133  //compare transformToLMD(matPX-matTargetPX) - (matCM-matTargetCM)
134  qaTask.compareMatrices(kPlotPXvsCMResiduals);
135  // compare combined matrices from 0 to 1-9
136  qaTask.compareMatrices(kPlotCombinedPXResiduals);
137 
138 
139  dimension->Read_transformation_matrices("/geometry/MisalignTestGeometryMatrices/trafo_matrices_lmd_misaligned-50u.dat", false);
140  qaTask.setPdfOutPath("/home/arbeit/RedPro3TB/simulationData/boxtest-50u-1.5/AlignQA-640/");
141  qaTask.setLmdMatPath("/home/arbeit/RedPro3TB/simulationData/boxtest-50u-1.5/binaryPairs-cut-640/LMDmatrices"); //aligned, change together with setAlignOption!
142  //compare (matCM-matTargetCM)
143  qaTask.compareMatrices(kPlotCMMatrixResiduals);
144  //compare (matPX-matTargetPX)
145  qaTask.compareMatrices(kPlotPXMatrixResiduals);
146  //compare (matCM*matrixTarget-transFormToLMD(matPX))
147  qaTask.compareMatrices(kPlotCMvsPX);
148  //compare transformToLMD(matPX-matTargetPX) - (matCM-matTargetCM)
149  qaTask.compareMatrices(kPlotPXvsCMResiduals);
150  // compare combined matrices from 0 to 1-9
151  qaTask.compareMatrices(kPlotCombinedPXResiduals);
152 
153 
154  qaTask.setPdfOutPath("/home/arbeit/RedPro3TB/simulationData/boxtest-50u-15/AlignQA-640/");
155  qaTask.setLmdMatPath("/home/arbeit/RedPro3TB/simulationData/boxtest-50u-15/binaryPairs-cut-640/LMDmatrices"); //aligned, change together with setAlignOption!
156  //compare (matCM-matTargetCM)
157  qaTask.compareMatrices(kPlotCMMatrixResiduals);
158  //compare (matPX-matTargetPX)
159  qaTask.compareMatrices(kPlotPXMatrixResiduals);
160  //compare (matCM*matrixTarget-transFormToLMD(matPX))
161  qaTask.compareMatrices(kPlotCMvsPX);
162  //compare transformToLMD(matPX-matTargetPX) - (matCM-matTargetCM)
163  qaTask.compareMatrices(kPlotPXvsCMResiduals);
164  // compare combined matrices from 0 to 1-9
165  qaTask.compareMatrices(kPlotCombinedPXResiduals);
166 
167  dimension->Read_transformation_matrices("/geometry/MisalignTestGeometryMatrices/trafo_matrices_lmd_misaligned-100u.dat", false);
168  qaTask.setPdfOutPath("/home/arbeit/RedPro3TB/simulationData/boxtest-100u-1.5/AlignQA-dynamic/");
169  qaTask.setLmdMatPath("/home/arbeit/RedPro3TB/simulationData/boxtest-100u-1.5/binaryPairs-cut-dynamic/LMDmatrices"); //aligned, change together with setAlignOption!
170  //compare (matCM-matTargetCM)
171  qaTask.compareMatrices(kPlotCMMatrixResiduals);
172  //compare (matPX-matTargetPX)
173  qaTask.compareMatrices(kPlotPXMatrixResiduals);
174  //compare (matCM*matrixTarget-transFormToLMD(matPX))
175  qaTask.compareMatrices(kPlotCMvsPX);
176  //compare transformToLMD(matPX-matTargetPX) - (matCM-matTargetCM)
177  qaTask.compareMatrices(kPlotPXvsCMResiduals);
178  // compare combined matrices from 0 to 1-9
179  qaTask.compareMatrices(kPlotCombinedPXResiduals);
180 
181 
182  qaTask.setPdfOutPath("/home/arbeit/RedPro3TB/simulationData/boxtest-100u-15/AlignQA-dynamic/");
183  qaTask.setLmdMatPath("/home/arbeit/RedPro3TB/simulationData/boxtest-100u-15/binaryPairs-cut-dynamic/LMDmatrices"); //aligned, change together with setAlignOption!
184  //compare (matCM-matTargetCM)
185  qaTask.compareMatrices(kPlotCMMatrixResiduals);
186  //compare (matPX-matTargetPX)
187  qaTask.compareMatrices(kPlotPXMatrixResiduals);
188  //compare (matCM*matrixTarget-transFormToLMD(matPX))
189  qaTask.compareMatrices(kPlotCMvsPX);
190  //compare transformToLMD(matPX-matTargetPX) - (matCM-matTargetCM)
191  qaTask.compareMatrices(kPlotPXvsCMResiduals);
192  // compare combined matrices from 0 to 1-9
193  qaTask.compareMatrices(kPlotCombinedPXResiduals);
194 
195 
196  dimension->Read_transformation_matrices("/geometry/MisalignTestGeometryMatrices/trafo_matrices_lmd_misaligned-200u.dat", false);
197  qaTask.setPdfOutPath("/home/arbeit/RedPro3TB/simulationData/boxtest-200u-1.5/AlignQA-dynamic/");
198  qaTask.setLmdMatPath("/home/arbeit/RedPro3TB/simulationData/boxtest-200u-1.5/binaryPairs-cut-dynamic/LMDmatrices"); //aligned, change together with setAlignOption!
199  //compare (matCM-matTargetCM)
200  qaTask.compareMatrices(kPlotCMMatrixResiduals);
201  //compare (matPX-matTargetPX)
202  qaTask.compareMatrices(kPlotPXMatrixResiduals);
203  //compare (matCM*matrixTarget-transFormToLMD(matPX))
204  qaTask.compareMatrices(kPlotCMvsPX);
205  //compare transformToLMD(matPX-matTargetPX) - (matCM-matTargetCM)
206  qaTask.compareMatrices(kPlotPXvsCMResiduals);
207  // compare combined matrices from 0 to 1-9
208  qaTask.compareMatrices(kPlotCombinedPXResiduals);
209 
210  qaTask.setPdfOutPath("/home/arbeit/RedPro3TB/simulationData/boxtest-200u-15/AlignQA-dynamic/");
211  qaTask.setLmdMatPath("/home/arbeit/RedPro3TB/simulationData/boxtest-200u-15/binaryPairs-cut-dynamic/LMDmatrices"); //aligned, change together with setAlignOption!
212  //compare (matCM-matTargetCM)
213  qaTask.compareMatrices(kPlotCMMatrixResiduals);
214  //compare (matPX-matTargetPX)
215  qaTask.compareMatrices(kPlotPXMatrixResiduals);
216  //compare (matCM*matrixTarget-transFormToLMD(matPX))
217  qaTask.compareMatrices(kPlotCMvsPX);
218  //compare transformToLMD(matPX-matTargetPX) - (matCM-matTargetCM)
219  qaTask.compareMatrices(kPlotPXvsCMResiduals);
220  // compare combined matrices from 0 to 1-9
221  qaTask.compareMatrices(kPlotCombinedPXResiduals);
222 
223  // TODO: compare lmdlocal -> sensor matrices with target matrices from PndLmdDim (maybe optional, because they are already in PndLmdDim?)
224 
225 
226 
227  // TODO: generate report, pdf or root file or w/e
228 
229  cout << "Macro finished successfully.\n";
230 
231  return;
232 }
int verboseLevel
Definition: Lars/runMvdSim.C:7
void setPdfOutPath(const std::string &path)
Definition: PndLmdAlignQA.h:90
static PndLmdDim * Instance()
Definition: PndLmdDim.cxx:249
bool checkForMatrixFiles()
void setLmdMatPath(const std::string &path)
Definition: PndLmdAlignQA.h:88
void setInCentimeters(bool inCentimeters)
Definition: PndLmdAlignQA.h:87
void Read_transformation_matrices(string filename="", bool aligned=true, int version_number=geometry_version)
Definition: PndLmdDim.cxx:1515
void setPairsRequired(int number)
Definition: PndLmdAlignQA.h:92
void runLumiPixel2gAlignQA(TString LMDmatrixPath="/home/arbeit/RedPro3TB/simulationData/boxtest-50u-1.5/binaryPairs-cut-160/LMDmatrices", const int verboseLevel=0)