New macros DrawITSAlignObj.C and MakeITSRealisticMisAlignment.C with associated class...
[u/mrichter/AliRoot.git] / ITS / DrawITSAlignObj.C
CommitLineData
3b61c716 1#if !defined(__CINT__) || defined(__MAKECINT__)
2#include <TCanvas.h>
3#include <TClonesArray.h>
4#include <TFile.h>
5#include <TGeoManager.h>
6#include <TH1F.h>
7#include <TString.h>
8#include <Riostream.h>
9#include "AliAlignObj.h"
10#endif
11void DrawITSAlignObj(const char* filename="ITSrealisticMisalignment.root",
12 Bool_t local=kTRUE) {
13 //
14 // Draw distribution of alignment constants
15 // (original version: A.Jacholkowski; modified by: A.Dainese)
16 //
17
18/* $Id$ */
19
20 TGeoManager::Import("geometry.root");
21
22 TFile* f = TFile::Open(filename);
23 if(!f) {cerr<<"cannot open input file\n"; return;}
24
25 TCanvas *cSPDsector = new TCanvas("cSPDsector","SPD sectors alignobjs",0,0,800,600);
26 cSPDsector->Divide(3,2);
27 TH1F* hxSPDsector = new TH1F("hxSPDsector","x in SPD sectors",100,-0.1,0.1);
28 hxSPDsector->SetXTitle("[cm]");
29 TH1F* hySPDsector = new TH1F("hySPDsector","y in SPD sectors",100,-0.1,0.1);
30 hySPDsector->SetXTitle("[cm]");
31 TH1F* hzSPDsector = new TH1F("hzSPDsector","z in SPD sectors",100,-0.1,0.1);
32 hzSPDsector->SetXTitle("[cm]");
33 TH1F* hrxSPDsector = new TH1F("hrxSPDsector","rx in SPD sectors",100,-0.5,0.5);
34 hrxSPDsector->SetXTitle("[deg]");
35 TH1F* hrySPDsector = new TH1F("hrySPDsector","ry in SPD sectors",100,-0.5,0.5);
36 hrySPDsector->SetXTitle("[deg]");
37 TH1F* hrzSPDsector = new TH1F("hrzSPDsector","rz in SPD sectors",100,-0.5,0.5);
38 hrzSPDsector->SetXTitle("[deg]");
39
40 TCanvas *cSPDhalfstave = new TCanvas("cSPDhalfstave","SPD halfstaves alignobjs",0,0,800,600);
41 cSPDhalfstave->Divide(3,2);
42 TH1F* hxSPDhalfstave = new TH1F("hxSPDhalfstave","x in SPD halfstaves",100,-0.01,0.01);
43 hxSPDhalfstave->SetXTitle("[cm]");
44 TH1F* hySPDhalfstave = new TH1F("hySPDhalfstave","y in SPD halfstaves",100,-0.01,0.01);
45 hySPDhalfstave->SetXTitle("[cm]");
46 TH1F* hzSPDhalfstave = new TH1F("hzSPDhalfstave","z in SPD halfstaves",100,-0.01,0.01);
47 hzSPDhalfstave->SetXTitle("[cm]");
48 TH1F* hrxSPDhalfstave = new TH1F("hrxSPDhalfstave","rx in SPD halfstaves",100,-0.1,0.1);
49 hrxSPDhalfstave->SetXTitle("[deg]");
50 TH1F* hrySPDhalfstave = new TH1F("hrySPDhalfstave","ry in SPD halfstaves",100,-0.1,0.1);
51 hrySPDhalfstave->SetXTitle("[deg]");
52 TH1F* hrzSPDhalfstave = new TH1F("hrzSPDhalfstave","rz in SPD halfstaves",100,-0.5,0.5);
53 hrzSPDhalfstave->SetXTitle("[deg]");
54
55 TCanvas *cSPDladder = new TCanvas("cSPDladder","SPD ladders alignobjs",0,0,800,600);
56 cSPDladder->Divide(3,2);
57 TH1F* hxSPDladder = new TH1F("hxSPDladder","x in SPD ladders",100,-0.01,0.01);
58 hxSPDladder->SetXTitle("[cm]");
59 TH1F* hySPDladder = new TH1F("hySPDladder","y in SPD ladders",100,-0.01,0.01);
60 hySPDladder->SetXTitle("[cm]");
61 TH1F* hzSPDladder = new TH1F("hzSPDladder","z in SPD ladders",100,-0.01,0.01);
62 hzSPDladder->SetXTitle("[cm]");
63 TH1F* hrxSPDladder = new TH1F("hrxSPDladder","rx in SPD ladders",100,-0.01,0.01);
64 hrxSPDladder->SetXTitle("[deg]");
65 TH1F* hrySPDladder = new TH1F("hrySPDladder","ry in SPD ladders",100,-0.01,0.01);
66 hrySPDladder->SetXTitle("[deg]");
67 TH1F* hrzSPDladder = new TH1F("hrzSPDladder","rz in SPD ladders",100,-0.01,0.01);
68 hrzSPDladder->SetXTitle("[deg]");
69
70 TCanvas *cSDDladder = new TCanvas("cSDDladder","SDD ladders alignobjs",0,0,800,600);
71 cSDDladder->Divide(3,2);
72 TH1F* hxSDDladder = new TH1F("hxSDDladder","x in SDD ladders",100,-0.01,0.01);
73 hxSDDladder->SetXTitle("[cm]");
74 TH1F* hySDDladder = new TH1F("hySDDladder","y in SDD ladders",100,-0.01,0.01);
75 hySDDladder->SetXTitle("[cm]");
76 TH1F* hzSDDladder = new TH1F("hzSDDladder","z in SDD ladders",100,-0.01,0.01);
77 hzSDDladder->SetXTitle("[cm]");
78 TH1F* hrxSDDladder = new TH1F("hrxSDDladder","rx in SDD ladders",100,-0.01,0.01);
79 hrxSDDladder->SetXTitle("[deg]");
80 TH1F* hrySDDladder = new TH1F("hrySDDladder","ry in SDD ladders",100,-0.01,0.01);
81 hrySDDladder->SetXTitle("[deg]");
82 TH1F* hrzSDDladder = new TH1F("hrzSDDladder","rz in SDD ladders",100,-0.01,0.01);
83 hrzSDDladder->SetXTitle("[deg]");
84
85 TCanvas *cSDDsensor = new TCanvas("cSDDsensor","SDD sensors alignobjs",0,0,800,600);
86 cSDDsensor->Divide(3,2);
87 TH1F* hxSDDsensor = new TH1F("hxSDDsensor","x in SDD sensors",100,-0.01,0.01);
88 hxSDDsensor->SetXTitle("[cm]");
89 TH1F* hySDDsensor = new TH1F("hySDDsensor","y in SDD sensors",100,-0.01,0.01);
90 hySDDsensor->SetXTitle("[cm]");
91 TH1F* hzSDDsensor = new TH1F("hzSDDsensor","z in SDD sensors",100,-0.01,0.01);
92 hzSDDsensor->SetXTitle("[cm]");
93 TH1F* hrxSDDsensor = new TH1F("hrxSDDsensor","rx in SDD sensors",100,-0.01,0.01);
94 hrxSDDsensor->SetXTitle("[deg]");
95 TH1F* hrySDDsensor = new TH1F("hrySDDsensor","ry in SDD sensors",100,-0.01,0.01);
96 hrySDDsensor->SetXTitle("[deg]");
97 TH1F* hrzSDDsensor = new TH1F("hrzSDDsensor","rz in SDD sensors",100,-0.01,0.01);
98 hrzSDDsensor->SetXTitle("[deg]");
99
100
101 TCanvas *cSSDladder = new TCanvas("cSSDladder","SSD ladders alignobjs",0,0,800,600);
102 cSSDladder->Divide(3,2);
103 TH1F* hxSSDladder = new TH1F("hxSSDladder","x in SSD ladders",100,-0.01,0.01);
104 hxSSDladder->SetXTitle("[cm]");
105 TH1F* hySSDladder = new TH1F("hySSDladder","y in SSD ladders",100,-0.01,0.01);
106 hySSDladder->SetXTitle("[cm]");
107 TH1F* hzSSDladder = new TH1F("hzSSDladder","z in SSD ladders",100,-0.01,0.01);
108 hzSSDladder->SetXTitle("[cm]");
109 TH1F* hrxSSDladder = new TH1F("hrxSSDladder","rx in SSD ladders",100,-0.01,0.01);
110 hrxSSDladder->SetXTitle("[deg]");
111 TH1F* hrySSDladder = new TH1F("hrySSDladder","ry in SSD ladders",100,-0.01,0.01);
112 hrySSDladder->SetXTitle("[deg]");
113 TH1F* hrzSSDladder = new TH1F("hrzSSDladder","rz in SSD ladders",100,-0.01,0.01);
114 hrzSSDladder->SetXTitle("[deg]");
115
116 TCanvas *cSSDsensor = new TCanvas("cSSDsensor","SSD sensors alignobjs",0,0,800,600);
117 cSSDsensor->Divide(3,2);
118 TH1F* hxSSDsensor = new TH1F("hxSSDsensor","x in SSD sensors",100,-0.01,0.01);
119 hxSSDsensor->SetXTitle("[cm]");
120 TH1F* hySSDsensor = new TH1F("hySSDsensor","y in SSD sensors",100,-0.01,0.01);
121 hySSDsensor->SetXTitle("[cm]");
122 TH1F* hzSSDsensor = new TH1F("hzSSDsensor","z in SSD sensors",100,-0.01,0.01);
123 hzSSDsensor->SetXTitle("[cm]");
124 TH1F* hrxSSDsensor = new TH1F("hrxSSDsensor","rx in SSD sensors",100,-0.01,0.01);
125 hrxSSDsensor->SetXTitle("[deg]");
126 TH1F* hrySSDsensor = new TH1F("hrySSDsensor","ry in SSD sensors",100,-0.01,0.01);
127 hrySSDsensor->SetXTitle("[deg]");
128 TH1F* hrzSSDsensor = new TH1F("hrzSSDsensor","rz in SSD sensors",100,-0.01,0.01);
129 hrzSSDsensor->SetXTitle("[deg]");
130
131
132
133 TClonesArray* ar = (TClonesArray*)f->Get("ITSAlignObjs");
134 Int_t entries = ar->GetEntriesFast();
135 cout<<"number of alignment objects: "<<entries<<endl;
136
137 AliAlignObj* a;
138 Option_t *opt = NULL;
139 Double_t tr[3];
140 Double_t rot[3];
141
142 for(Int_t i=0; i<entries; i++){
143 a=(AliAlignObj*)ar->UncheckedAt(i);
144 if(local) {
145 a->GetLocalPars(tr,rot);
146 } else {
147 a->GetPars(tr,rot);
148 }
149 TString symName = a->GetSymName();
150 printf(" %s\n",symName.Data());
151 if(!symName.Contains("SPD") && !symName.Contains("SDD") && !symName.Contains("SSD")) {
152 a->Print(opt);
153 }
154 if(symName.Contains("SPD") && symName.Contains("Sector") && !symName.Contains("HalfStave")) {
155 hxSPDsector->Fill(tr[0]);
156 hySPDsector->Fill(tr[1]);
157 hzSPDsector->Fill(tr[2]);
158 hrxSPDsector->Fill(rot[0]);
159 hrySPDsector->Fill(rot[1]);
160 hrzSPDsector->Fill(rot[2]); printf("%f\n",rot[2]);
161 }
162 if(symName.Contains("SPD") && symName.Contains("Sector") && symName.Contains("HalfStave") && !symName.Contains("Ladder")) {
163 hxSPDhalfstave->Fill(tr[0]);
164 hySPDhalfstave->Fill(tr[1]);
165 hzSPDhalfstave->Fill(tr[2]);
166 hrxSPDhalfstave->Fill(rot[0]);
167 hrySPDhalfstave->Fill(rot[1]);
168 hrzSPDhalfstave->Fill(rot[2]);
169 }
170 if(symName.Contains("SPD") && symName.Contains("Sector") && symName.Contains("HalfStave") && symName.Contains("Ladder")) {
171 hxSPDladder->Fill(tr[0]);
172 hySPDladder->Fill(tr[1]);
173 hzSPDladder->Fill(tr[2]);
174 hrxSPDladder->Fill(rot[0]);
175 hrySPDladder->Fill(rot[1]);
176 hrzSPDladder->Fill(rot[2]);
177 }
178 if(symName.Contains("SDD") && symName.Contains("Ladder") && !symName.Contains("Sensor")) {
179 hxSDDladder->Fill(tr[0]);
180 hySDDladder->Fill(tr[1]);
181 hzSDDladder->Fill(tr[2]);
182 hrxSDDladder->Fill(rot[0]);
183 hrySDDladder->Fill(rot[1]);
184 hrzSDDladder->Fill(rot[2]);
185 }
186 if(symName.Contains("SDD") && symName.Contains("Ladder") && symName.Contains("Sensor")) {
187 hxSDDsensor->Fill(tr[0]);
188 hySDDsensor->Fill(tr[1]);
189 hzSDDsensor->Fill(tr[2]);
190 hrxSDDsensor->Fill(rot[0]);
191 hrySDDsensor->Fill(rot[1]);
192 hrzSDDsensor->Fill(rot[2]);
193 }
194 if(symName.Contains("SSD") && symName.Contains("Ladder") && !symName.Contains("Sensor")) {
195 hxSSDladder->Fill(tr[0]);
196 hySSDladder->Fill(tr[1]);
197 hzSSDladder->Fill(tr[2]);
198 hrxSSDladder->Fill(rot[0]);
199 hrySSDladder->Fill(rot[1]);
200 hrzSSDladder->Fill(rot[2]);
201 }
202 if(symName.Contains("SSD") && symName.Contains("Ladder") && symName.Contains("Sensor")) {
203 hxSSDsensor->Fill(tr[0]);
204 hySSDsensor->Fill(tr[1]);
205 hzSSDsensor->Fill(tr[2]);
206 hrxSSDsensor->Fill(rot[0]);
207 hrySSDsensor->Fill(rot[1]);
208 hrzSSDsensor->Fill(rot[2]);
209 }
210
211
212 }
213
214
215 cSPDsector->cd(1);
216 hxSPDsector->Draw();
217 cSPDsector->cd(2);
218 hySPDsector->Draw();
219 cSPDsector->cd(3);
220 hzSPDsector->Draw();
221 cSPDsector->cd(4);
222 hrxSPDsector->Draw();
223 cSPDsector->cd(5);
224 hrySPDsector->Draw();
225 cSPDsector->cd(6);
226 hrzSPDsector->Draw();
227
228 cSPDhalfstave->cd(1);
229 hxSPDhalfstave->Draw();
230 cSPDhalfstave->cd(2);
231 hySPDhalfstave->Draw();
232 cSPDhalfstave->cd(3);
233 hzSPDhalfstave->Draw();
234 cSPDhalfstave->cd(4);
235 hrxSPDhalfstave->Draw();
236 cSPDhalfstave->cd(5);
237 hrySPDhalfstave->Draw();
238 cSPDhalfstave->cd(6);
239 hrzSPDhalfstave->Draw();
240
241 cSPDladder->cd(1);
242 hxSPDladder->Draw();
243 cSPDladder->cd(2);
244 hySPDladder->Draw();
245 cSPDladder->cd(3);
246 hzSPDladder->Draw();
247 cSPDladder->cd(4);
248 hrxSPDladder->Draw();
249 cSPDladder->cd(5);
250 hrySPDladder->Draw();
251 cSPDladder->cd(6);
252 hrzSPDladder->Draw();
253
254
255 cSDDladder->cd(1);
256 hxSDDladder->Draw();
257 cSDDladder->cd(2);
258 hySDDladder->Draw();
259 cSDDladder->cd(3);
260 hzSDDladder->Draw();
261 cSDDladder->cd(4);
262 hrxSDDladder->Draw();
263 cSDDladder->cd(5);
264 hrySDDladder->Draw();
265 cSDDladder->cd(6);
266 hrzSDDladder->Draw();
267
268 cSDDsensor->cd(1);
269 hxSDDsensor->Draw();
270 cSDDsensor->cd(2);
271 hySDDsensor->Draw();
272 cSDDsensor->cd(3);
273 hzSDDsensor->Draw();
274 cSDDsensor->cd(4);
275 hrxSDDsensor->Draw();
276 cSDDsensor->cd(5);
277 hrySDDsensor->Draw();
278 cSDDsensor->cd(6);
279 hrzSDDsensor->Draw();
280
281 cSSDladder->cd(1);
282 hxSSDladder->Draw();
283 cSSDladder->cd(2);
284 hySSDladder->Draw();
285 cSSDladder->cd(3);
286 hzSSDladder->Draw();
287 cSSDladder->cd(4);
288 hrxSSDladder->Draw();
289 cSSDladder->cd(5);
290 hrySSDladder->Draw();
291 cSSDladder->cd(6);
292 hrzSSDladder->Draw();
293
294 cSSDsensor->cd(1);
295 hxSSDsensor->Draw();
296 cSSDsensor->cd(2);
297 hySSDsensor->Draw();
298 cSSDsensor->cd(3);
299 hzSSDsensor->Draw();
300 cSSDsensor->cd(4);
301 hrxSSDsensor->Draw();
302 cSSDsensor->cd(5);
303 hrySSDsensor->Draw();
304 cSSDsensor->cd(6);
305 hrzSSDsensor->Draw();
306
307 return;
308}