]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/ITSsddtest.C
New versions which work both with v5 and vPPR geometries
[u/mrichter/AliRoot.git] / ITS / ITSsddtest.C
1 {
2
3 gROOT->Reset();
4
5 // Dynamically link some shared libs
6
7   if (gClassTable->GetID("AliRun") < 0) {
8     gROOT->LoadMacro("loadlibs.C");
9     loadlibs();
10   } else {
11       delete gAlice;
12       gAlice=0;
13   }
14
15 TFile f("SDD_histos_test.root");
16
17 Int_t nbins = 18;
18 Float_t dmax = 36.;
19
20 a = local->ProjectionX();
21 t = local->ProjectionY();
22 local->Draw();
23
24 TF1 *faa = new TF1("faa","gaus",-100.,100.);
25 a->Fit("faa","R","Q",-100.,100.);
26 TF1 *fat = new TF1("fat","gaus",-50,50);
27 t->Fit("fat","R","Q",-50,50);
28
29 //c1->Size(21.,15.);
30 c1->SetFillColor(0);
31 c1->Clear();
32 c1->Divide(1,3);
33 c1->cd(1);
34 local->Draw();
35 c1->cd(2);
36 a->Draw();
37 c1->cd(3);
38 t->Draw();
39
40 c1->SaveAs("ITS_res_1.ps");
41
42 TH1F *anode_resolution = new TH1F("anoder","Anode resolution vs Drift Path",nbins,0.,dmax);
43 TH1D *anodes[nbins];
44 Float_t res_anodes[nbins];
45 Float_t errres_anodes[nbins];
46 Float_t dmin = 60.;
47
48 for(Int_t i=0;i<nbins;i++){
49   if(i>6) dmin = 70.;
50   if(i>11) dmin = 90.;
51   TString *aa = new TString("aa_");
52   Char_t ai[2];
53   sprintf(ai,"%d",i+1);
54   aa->Append(ai);
55   anodes[i] = at->ProjectionY(aa->Data(),i,i+1);
56   TF1 *fa = new TF1("fa","gaus",-1.*dmin,dmin);
57   anodes[i]->Fit("fa","R","Q",-1.*dmin,dmin);
58   res_anodes[i] = fa->GetParameter(2);
59   Float_t RMS = anodes[i]->GetRMS();
60   //if(res_anodes[i] > RMS) 
61   res_anodes[i] = RMS;
62   errres_anodes[i] = fa->GetParError(2);
63   anode_resolution->Fill(i*dmax/nbins+dmax/(2*nbins),res_anodes[i]);
64   anode_resolution->SetBinError(i+1,(Stat_t) errres_anodes[i]);
65   anode_resolution->SetMarkerColor(2);
66   anode_resolution->SetLineColor(2);
67 }
68 c1->Clear();
69 f->cd();
70
71 TH1F *time_resolution = new TH1F("timer","Time resolution vs Drift Path",nbins,0.,dmax);
72 TH1D *times[nbins];
73 Float_t res_times[nbins];
74 Float_t errres_times[nbins];
75 for(Int_t i=0;i<nbins;i++){
76   TString *ta = new TString("tt_");
77   Char_t ti[2];
78   sprintf(ti,"%d",i+1);
79   ta->Append(ti);
80   times[i] = tt->ProjectionY(ta->Data(),i,i+1);
81   TF1 *ft = new TF1("ft","gaus",-50,50);
82   times[i]->Fit("ft","R","Q",-50,50);
83   res_times[i] = ft->GetParameter(2);
84   Float_t RMS = times[i]->GetRMS();
85   //if(res_times[i] > RMS) 
86   res_times[i] = RMS;
87   errres_times[i] = ft->GetParError(2);
88   time_resolution->Fill(i*dmax/nbins+dmax/(2*nbins),res_times[i]);
89   time_resolution->SetBinError(i+1,(Stat_t) errres_times[i]);
90   time_resolution->SetMarkerColor(6);
91   time_resolution->SetLineColor(6);
92 }
93 c1->Clear();
94
95 Float_t x1 = 4000.;
96 Float_t x2 = x1;
97 Float_t y1 = 94;
98 Float_t y2 = 84;
99
100 TMarker *m1 = new TMarker(x1,y1,21);
101 TMarker *m2 = new TMarker(x2,y2,22);
102 Text_t *text1 = "Anode";
103 Text_t *text2 = "Time";
104 TText *t1 = new TText(x1 + 250,y1-2,text1);
105 TText *t2 = new TText(x2 + 250,y2-2,text2);
106 //text1->SetLineColor(2);
107 //text2->SetLineColor(4);
108
109 anode_resolution->SetMarkerStyle(21);
110 anode_resolution->SetMaximum(100.);
111 anode_resolution->SetMinimum(0.);
112 anode_resolution->Draw("Ep");
113 //m1->SetColor(2);
114 //m2->SetColor(4);
115 m1->Draw();
116 m2->Draw();
117 //t1->Draw();
118 //t2->Draw();
119 time_resolution->SetMarkerStyle(23);
120 time_resolution->Draw("Ep,same");
121 c1->SaveAs("ITS_res.ps");
122
123 c1->Clear();
124 /*
125 c1->Divide(1,2);
126 c1->cd(1);
127 dtrh->Draw();
128 dtrp->SetLineColor(2);
129 dtrp->Draw("SAME");
130
131 c1->cd(2);
132 dtrhall->Draw();
133 dtrpall->SetLineColor(1);
134 //dtrpall->SetLineStyle(2);
135 dtrpall->SetLineColor(2);
136 dtrpall->Draw("SAME");
137
138 c1->SaveAs("ITS_dtr_1.ps");
139 */
140 //c1->Size(21.,14.);
141
142 c1->Clear();
143 at->Draw();
144 c1->SaveAs("ITS_at.ps");
145
146 c1->Clear();
147 tt->Draw();
148 c1->SaveAs("ITS_tt.ps");
149
150 /*
151 c1->cd(2);
152 dtrh->Draw();
153 dtrp->SetLineColor(1);
154 //dtrp->SetLineStyle(2);
155 dtrp->SetLineColor(2);
156 dtrp->Draw("SAME");
157
158 c1->SaveAs("ITS_dtr_2.ps");
159
160 effh->SetMinimum(0.9);
161 effh->Draw();
162 effp->SetLineColor(2);
163 effp->Draw("SAME");
164 c1->SaveAs("ITS_eff_1.ps");
165 */
166
167 hit_vs_time->Draw();
168 rec_vs_time->SetLineColor(2);
169 rec_vs_time->Draw("SAME");
170 c1->SaveAs("ITS_eff_2.ps");
171
172 nanodes->ProfileX();
173 nanodes_pfx->Draw();
174 nsampls->ProfileX();
175 nsampls_pfx->Draw();
176 nanodes_pfx->SetLineColor(2);
177 nanodes_pfx->Draw("SAME");
178 c1->SaveAs("ITS_clsize.ps");
179
180 /*
181 occupancy3->Draw();
182 occupancy4->Draw("SAME");
183 c1->SaveAs("ITS_occ.ps");
184
185 xy3->ProjectionX();
186 xz3->ProjectionX();
187 xy3->ProjectionY();
188
189 xy3_py->Draw();
190 xy3_px->Draw("SAME");
191 xz3_px->Draw("SAME");
192
193 c1->SaveAs("ITS_xyz_3.ps");
194
195 xy4->ProjectionX();
196 xz4->ProjectionX();
197 xy4->ProjectionY();
198
199 xy4_py->Draw();
200 xy4_px->Draw("SAME");
201 xz4_px->Draw("SAME");
202
203 c1->SaveAs("ITS_xyz_4.ps");
204 */
205 amplit->Draw();
206 c1->SaveAs("ITS_ampl_1.ps");
207
208 amplit->ProfileX();
209 amplit_pfx->Draw();
210 c1->SaveAs("ITS_ampl_2.ps");
211
212 TF1 *fhc = new TF1("fhc","gaus",-5,5);
213 hitpnt->Fit("fhc","R","Q",-5,5);
214 hitpnt->Draw();
215 c1->SaveAs("ITS_hitpnt.ps");
216
217 f.cd();
218 anoder->SetMinimum(0.);
219 anoder->Draw();
220 anoder->SetXTitle("Drift Path (mm)");
221 anoder->SetYTitle("Resolution (um)");
222
223 TMarker *mk2 = new TMarker(16.,62.,21);
224 mk2->SetMarkerColor(2);
225 mk2->Draw();
226 TMarker *mk3 = new TMarker(16.,54.,23);
227 mk3->SetMarkerColor(6);
228 mk3->Draw();
229 Text_t *text = "294 um pitch detector";
230 TText *t3 = new TText(2,90,text);
231 Text_t *text0 = "Spatial Resolution";
232 TText *t0 = new TText(2,82,text0);
233 Text_t *text2 = "Simulation (Anode)";
234 TText *t2 = new TText(18,60,text2);
235 Text_t *text4 = "Simulation (Time)";
236 TText *t4 = new TText(18,52,text4);
237
238 t4->Draw();
239 t3->Draw();
240 t0->Draw();
241 t2->Draw();
242
243 timer->Draw("SAME");
244 c1->SaveAs("ITS_res_check_294.ps");
245
246 f.cd();
247 nanodes_pfx->SetXTitle("Drift Time (ns)");
248 nanodes_pfx->SetYTitle("Anodes/Cluster");
249 nanodes_pfx->SetMaximum(3.);
250 nanodes_pfx->SetMarkerStyle(21);
251 nanodes_pfx->SetLineColor(2);
252 nanodes_pfx->SetMarkerColor(2);
253 nanodes_pfx->Draw();
254
255 TMarker *mk2 = new TMarker(4000.,0.3,21);
256 mk2->SetMarkerColor(2);
257 mk2->Draw();
258 Text_t *text = "294 um pitch detector";
259 TText *t3 = new TText(200,2.7,text);
260 Text_t *text0 = "Average Number of Anodes/Cluster";
261 TText *t0 = new TText(200,2.4,text0);
262 Text_t *text2 = "Simulation";
263 TText *t2 = new TText(4200,0.2,text2);
264 t3->Draw();
265 t0->Draw();
266 t2->Draw();
267 c1->SaveAs("ITS_and_check_294.ps");
268
269 f.cd();
270 nsampls_pfx->SetXTitle("Drift Time (ns)");
271 nsampls_pfx->SetYTitle("Time bins/Anode/Cluster");
272 nsampls_pfx->SetMaximum(10.);
273 nsampls_pfx->SetMarkerStyle(21);
274 nsampls_pfx->SetLineColor(2);
275 nsampls_pfx->SetMarkerColor(2);
276 nsampls_pfx->Draw();
277 TMarker *mk2 = new TMarker(4000.,1.,21);
278 mk2->SetMarkerColor(2);
279 mk2->Draw();
280 Text_t *text = "294 um pitch detector";
281 TText *t3 = new TText(200,9.,text);
282 Text_t *text0 = "Average Number of Time bins/Anode/Cluster";
283 TText *t0 = new TText(200,8.,text0);
284 Text_t *text2 = "Simulation";
285 TText *t2 = new TText(4200,0.8,text2);
286 t3->Draw();
287 t0->Draw();
288 t2->Draw();
289 c1->SaveAs("ITS_tim_check_294.ps");
290
291 f.cd();
292 amplit->ProfileX();
293 amplit_pfx->SetLineColor(2);
294 amplit_pfx->SetMaximum(500.);
295 amplit_pfx->SetMarkerStyle(21);
296 amplit_pfx->SetMarkerColor(2);
297 amplit_pfx->Draw();
298 TMarker *mk2 = new TMarker(500.,50,21);
299 mk2->SetMarkerColor(2);
300 mk2->Draw();
301 Text_t *text = "294 um pitch detector";
302 TText *t3 = new TText(1000,450.,text);
303 Text_t *text0 = "Peak Amplitude";
304 TText *t0 = new TText(1000,400.,text0);
305 Text_t *text2 = "Simulation";
306 TText *t2 = new TText(700,40.,text2);
307 t3->Draw();
308 t0->Draw();
309 t2->Draw();
310 c1->SaveAs("ITS_amp_check_294.ps");
311
312 f.cd();
313 chp->ProfileX();
314 chp_pfx->SetLineColor(2);
315 chp_pfx->SetMaximum(2000.);
316 chp_pfx->SetMarkerStyle(21);
317 chp_pfx->SetMarkerColor(2);
318 chp_pfx->Draw();
319 TMarker *mk2 = new TMarker(500.,200.,21);
320 mk2->SetMarkerColor(2);
321 mk2->Draw();
322 Text_t *text = "294 um pitch detector";
323 TText *t3 = new TText(300,1800.,text);
324 Text_t *text0 = "Total Charge";
325 TText *t0 = new TText(300,1600.,text0);
326 Text_t *text2 = "Simulation";
327 TText *t2 = new TText(700,150.,text2);
328 t3->Draw();
329 t0->Draw();
330 t2->Draw();
331 c1->SaveAs("ITS_cha_check_294.ps");
332
333 TH1F *eff = f.Get("rec_vs_time");
334 TH1F *efh = f.Get("hit_vs_time");
335 eff->Divide(efh);
336
337 TH1F *effn = new TH1F("effn","Efficiency vs. drift path (mm)",18,0.,36.);
338 effn->SetMinimum(0.9);
339
340 for(Int_t i=1;i<=36;i++) {
341   Float_t cont = eff->GetBinContent(i);
342   i++;
343   cont += eff->GetBinContent(i);
344   cont /= 2.;
345   effn->SetBinContent(i/2,cont);
346 }
347
348 effn->SetXTitle("Drift Path (mm)");
349 effn->SetYTitle("Reconstruction Efficiency");
350 effn->SetMaximum(1.2);
351 effn->SetMinimum(0.6);
352 effn->SetMarkerStyle(21);
353 effn->SetLineColor(2);
354 effn->SetMarkerColor(2);
355 effn->Draw("p");
356 TMarker *mk2 = new TMarker(20.,0.7,21);
357 mk2->SetMarkerColor(2);
358 mk2->Draw();
359 Text_t *text = "294 um pitch detector";
360 TText *t3 = new TText(2.,1.13,text);
361 Text_t *text2 = "Simulation";
362 TText *t2 = new TText(22,0.685,text2);
363 t3->Draw();
364 t0->Draw();
365 t2->Draw();
366 c1->SaveAs("ITS_eff_check_294.ps");
367
368 f.cd();
369 TH1F *pa = (TH1F *) amplit_pfx;
370 TH1F *pc = (TH1F *) chp_pfx;
371
372 TH1F *sd = pa;
373 sd->Divide(pc);
374
375 sd->SetMaximum(0.4);
376 TH1F *nsd = new TH1F("nsd","nsd",28,0.,7000.);
377 for(Int_t i=1;i<=28;i++) {
378   Float_t sc = sd->GetBinContent(i);
379   nsd->SetBinContent(i,sc);
380 }
381 nsd->SetMarkerStyle(21);
382 nsd->SetMarkerColor(2);
383 nsd->SetLineColor(2);
384 nsd->SetMaximum(0.4);
385 nsd->Draw("p");
386 TMarker *mk2 = new TMarker(300.,0.05,21);
387 mk2->SetMarkerColor(2);
388 mk2->Draw();
389 Text_t *text0 = "294 um pitch detector";
390 TText *t0 = new TText(300.,0.35,text0);
391 Text_t *text = "Peak Amplitude / Total Charge";
392 TText *t3 = new TText(300.,0.3,text);
393 Text_t *text2 = "Simulation";
394 TText *t2 = new TText(500,0.04,text2);
395 t3->Draw();
396 t0->Draw();
397 t2->Draw();
398
399 c1->SaveAs("ITS_coa_check_294.ps");
400
401 }