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