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