]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGPP/ITS/PlotSDDPerformance.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGPP / ITS / PlotSDDPerformance.C
CommitLineData
70b1033a 1#if !defined(__CINT__) || defined(__MAKECINT__)
2#include <TH1F.h>
3#include <TH2F.h>
4#include <TF1.h>
5#include <TPad.h>
6#include <TGraphErrors.h>
7#include <TROOT.h>
8#include <TFile.h>
9#include <TTree.h>
10#include <TGrid.h>
98d289f0 11#include <TGridResult.h>
70b1033a 12#include <TMath.h>
13#include <TCanvas.h>
14#include <TStyle.h>
15#include <TLatex.h>
16#include "AliITSgeomTGeo.h"
17#endif
18
19Double_t LangausFun(Double_t *x, Double_t *par) {
20
21 //Fit parameters:
22 //par[0]=Width (scale) parameter of Landau density
23 //par[1]=Most Probable (MP, location) parameter of Landau density
24 //par[2]=Total area (integral -inf to inf, normalization constant)
25 //par[3]=Width (sigma) of convoluted Gaussian function
26 //
27 //In the Landau distribution (represented by the CERNLIB approximation),
28 //the maximum is located at x=-0.22278298 with the location parameter=0.
29 //This shift is corrected within this function, so that the actual
30 //maximum is identical to the MP parameter.
31
32 // Numeric constants
33 Double_t invsq2pi = 0.3989422804014; // (2 pi)^(-1/2)
34 Double_t mpshift = -0.22278298; // Landau maximum location
35
36 // Control constants
37 Double_t np = 100.0; // number of convolution steps
38 Double_t sc = 5.0; // convolution extends to +-sc Gaussian sigmas
39
40 // Variables
41 Double_t xx;
42 Double_t mpc;
43 Double_t fland;
44 Double_t sum = 0.0;
45 Double_t xlow,xupp;
46 Double_t step;
47 Double_t i;
48
49
50 // MP shift correction
51 mpc = par[1] - mpshift * par[0];
52
53 // Range of convolution integral
54 xlow = x[0] - sc * par[3];
55 xupp = x[0] + sc * par[3];
56
57 step = (xupp-xlow) / np;
58
59 // Convolution integral of Landau and Gaussian by sum
60 for(i=1.0; i<=np/2; i++) {
61 xx = xlow + (i-.5) * step;
62 fland = TMath::Landau(xx,mpc,par[0]) / par[0];
63 sum += fland * TMath::Gaus(x[0],xx,par[3]);
64
65 xx = xupp - (i-.5) * step;
66 fland = TMath::Landau(xx,mpc,par[0]) / par[0];
67 sum += fland * TMath::Gaus(x[0],xx,par[3]);
68 }
69
70 return (par[2] * step * sum * invsq2pi / par[3]);
71}
72
73
98d289f0 74void PlotSDDPerformance(TString option="local",
75 TString fileName="QAresults.root",
76 Int_t nRun=0,
77 Int_t year=2010,
78 TString period="LHC10e"){
79
70b1033a 80 gStyle->SetOptStat(0);
81 // gStyle->SetOptTitle(0);
70b1033a 82 TFile *f;
98d289f0 83 TString path;
84 Char_t psfilename[100];
85 Char_t openpsfilename[100];
86 Char_t closepsfilename[100];
87 sprintf(psfilename,"QAtrainRun%d.ps",nRun);
88 sprintf(openpsfilename,"QAtrainRun%d.ps[",nRun);
89 sprintf(closepsfilename,"QAtrainRun%d.ps]",nRun);
90
70b1033a 91 if(option.Contains("local")){
70b1033a 92 f=new TFile(fileName.Data());
93 }else{
70b1033a 94 TGrid::Connect("alien:");
98d289f0 95 path=Form("/alice/data/%d/%s/%09d/ESDs/",year,period.Data(),nRun);
96 if(!gGrid||!gGrid->IsConnected()) {
97 printf("gGrid not found! exit macro\n");
98 return;
99 }
100 TGridResult *gr = gGrid->Query(path,fileName);
101 Int_t nFiles = gr->GetEntries();
102 if (nFiles < 1){
103 printf("QA file for run %d not found\n",nRun);
104 return;
105 }
106 printf("================>%d files found\n", nFiles);
107 Int_t theFile=0;
108 Int_t maxVer=0;
109 if (nFiles > 1){
110 for (Int_t iFil = 0; iFil <nFiles ; iFil++) {
111 fileName=Form("%s",gr->GetKey(iFil,"turl"));
112 TString cutFilename=fileName.ReplaceAll("/QAresults.root","");
113 Int_t last=cutFilename.Sizeof()-3;
114 cutFilename.Remove(0,last);
115 Int_t qaver=atoi(cutFilename.Data());
116 if(qaver>maxVer){
117 maxVer=qaver;
118 theFile=iFil;
119 }
120 }
121 }
122 fileName=Form("%s",gr->GetKey(theFile,"turl"));
70b1033a 123 f=TFile::Open(fileName.Data());
124 }
98d289f0 125
70b1033a 126 TDirectoryFile* df=(TDirectoryFile*)f->Get("SDD_Performance");
127 if(!df){
128 printf("SDD_Performance MISSING -> Exit\n");
129 return;
130 }
131 TList* l=(TList*)df->Get("coutputRP");
132 if(!df){
133 printf("coutputRP TList MISSING -> Exit\n");
134 return;
135 }
136
98d289f0 137 TH1F* hcllay=(TH1F*)l->FindObject("hCluInLay");
70b1033a 138 TH1F* hapmod=(TH1F*)l->FindObject("hAllPmod");
139 TH1F* hgpmod=(TH1F*)l->FindObject("hGoodPmod");
140 TH1F* hmpmod=(TH1F*)l->FindObject("hMissPmod");
141 TH1F* hbrmod=(TH1F*)l->FindObject("hBadRegmod");
142 TH1F* hskmod=(TH1F*)l->FindObject("hSkippedmod");
143 TH1F* hoamod=(TH1F*)l->FindObject("hOutAccmod");
144 TH1F* hnrmod=(TH1F*)l->FindObject("hNoRefitmod");
145
98d289f0 146 // TH1F* hapxl=(TH1F*)l->FindObject("hAllPxloc");
147 TH1F* hgpxl=(TH1F*)l->FindObject("hGoodPxloc");
148 TH1F* hmpxl=(TH1F*)l->FindObject("hMissPxloc");
149 TH1F* hbrxl=(TH1F*)l->FindObject("hBadRegxloc");
150 // TH1F* hapzl=(TH1F*)l->FindObject("hAllPzloc");
151 TH1F* hgpzl=(TH1F*)l->FindObject("hGoodPzloc");
152 TH1F* hmpzl=(TH1F*)l->FindObject("hMissPzloc");
153 TH1F* hbrzl=(TH1F*)l->FindObject("hBadRegzloc");
154
70b1033a 155 TH2F* hdedx3=(TH2F*)l->FindObject("hdEdxL3VsP");
156 TH2F* hdedx4=(TH2F*)l->FindObject("hdEdxL4VsP");
157 TH2F* hdedxmod=(TH2F*)l->FindObject("hdEdxVsMod");
158
159
160 TH1F* hmodR=(TH1F*)l->FindObject("hRPMod");
161 TH1F* hmodT=(TH1F*)l->FindObject("hTPMod");
162 TH1F* hgamod=(TH1F*)l->FindObject("hGAMod");
163
164 TH2F* h2dmodR3=new TH2F("h2dmodR3","Rec Points, Layer 3",6,0.5,6.5,14,0.5,14.5);
165 TH2F* h2dmodR4=new TH2F("h2dmodR4","Rec Points, Layer 4",8,0.5,8.5,22,0.5,22.5);
166 TH2F* h2dmodT3=new TH2F("h2dmodT3","Track Points, Layer 3",6,0.5,6.5,14,0.5,14.5);
167 TH2F* h2dmodT4=new TH2F("h2dmodT4","Track Points, Layer 4",8,0.5,8.5,22,0.5,22.5);
168 TH2F* h2dmodR3N=new TH2F("h2dmodR3N","Rec Points/GoodAnode/Event, Layer 3",6,0.5,6.5,14,0.5,14.5);
169 TH2F* h2dmodR4N=new TH2F("h2dmodR4N","Rec Points/GoodAnode/Event, Layer 4",8,0.5,8.5,22,0.5,22.5);
170 TH2F* h2dmodT3N=new TH2F("h2dmodT3N","Track Points/GoodAnode/Event, Layer 3",6,0.5,6.5,14,0.5,14.5);
171 TH2F* h2dmodT4N=new TH2F("h2dmodT4N","Track Points/GoodAnode/Event, Layer 4",8,0.5,8.5,22,0.5,22.5);
172 TH1F* hmodRN=new TH1F("hmodRN","Normalized Rec Points per Module",260,239.5,499.5);
173 TH1F* hmodTN=new TH1F("hmodTN","Normalized Track Points per Module",260,239.5,499.5);
174
175 TH1F* hev=(TH1F*)l->FindObject("hNEvents");
176 Int_t nTotEvents=hev->GetBinContent(2);
177 Int_t nTrigEvents=hev->GetBinContent(3);
178 Int_t nEvents=nTotEvents;
179 printf("---- Statistics ----\n");
180 printf("Number of Events = %d\n",nTotEvents);
181 if(nTrigEvents>0){
182 printf("Number of Triggered Events = %d\n",nTrigEvents);
183 nEvents=nTrigEvents;
184 }else{
185 printf("No request on the trigger done whenrunning the task\n");
186 }
187 Int_t bestMod=0;
188 for(Int_t iMod=0; iMod<260;iMod++){
189 Int_t gda=(Int_t)hgamod->GetBinContent(iMod+1);
190 if(gda>bestMod) bestMod=gda;
191 }
192 Int_t nChunks=1;
193 if(bestMod>512){
194 nChunks=(Int_t)(bestMod/512.+0.5);
195 }
196 printf("Chunks merged = %d\n",nChunks);
197 hgamod->Scale(1./nChunks);
198 TCanvas* cgan=new TCanvas("cgan","Good Anodes");
98d289f0 199 cgan->Print(openpsfilename);
70b1033a 200 cgan->SetTickx();
201 cgan->SetTicky();
202 hgamod->SetMarkerStyle(20);
203 hgamod->SetMarkerSize(0.6);
98d289f0 204 hgamod->SetMinimum(-10.);
70b1033a 205 hgamod->Draw("P");
206 hgamod->GetXaxis()->SetTitle("SDD Module Id");
207 hgamod->GetYaxis()->SetTitle("Number of good anodes");
208 cgan->Update();
98d289f0 209 cgan->Print(psfilename);
70b1033a 210
211 printf("---- Modules with > 2%% of bad anodes ----\n");
212 for(Int_t iMod=0; iMod<260; iMod++){
213 Int_t idMod=iMod+240;
214 Float_t rps=hmodR->GetBinContent(iMod+1);
215 Float_t tps=hmodT->GetBinContent(iMod+1);
216 Float_t ga=hgamod->GetBinContent(iMod+1);
217 if(ga<500){
218 printf("Module %d - Good Anodes = %d\n",idMod,(Int_t)ga);
219 }
220 Float_t rpsN=0.;
221 Float_t tpsN=0.;
222 Float_t erpsN=0.;
223 Float_t etpsN=0.;
224 if(ga>0){
225 rpsN=rps/ga/(Float_t)nEvents;
226 tpsN=tps/ga/(Float_t)nEvents;
227 erpsN=TMath::Sqrt(rps)/ga/(Float_t)nEvents;
228 etpsN=TMath::Sqrt(tps)/ga/(Float_t)nEvents;
229 }
230 hmodRN->SetBinContent(iMod+1,rpsN);
231 hmodTN->SetBinContent(iMod+1,tpsN);
232 hmodRN->SetBinError(iMod+1,erpsN);
233 hmodTN->SetBinError(iMod+1,etpsN);
234 Int_t iLay,iLad,iDet;
235 AliITSgeomTGeo::GetModuleId(idMod,iLay,iLad,iDet);
236 if(iLay==3){
237 h2dmodR3->SetBinContent(iDet,iLad,rps);
238 h2dmodT3->SetBinContent(iDet,iLad,tps);
239 h2dmodR3N->SetBinContent(iDet,iLad,rpsN);
240 h2dmodT3N->SetBinContent(iDet,iLad,tpsN);
241 }
242 else if(iLay==4){
243 h2dmodR4->SetBinContent(iDet,iLad,rps);
244 h2dmodT4->SetBinContent(iDet,iLad,tps);
245 h2dmodR4N->SetBinContent(iDet,iLad,rpsN);
246 h2dmodT4N->SetBinContent(iDet,iLad,tpsN);
247 }
248 }
249
250 gStyle->SetPalette(1);
251
252 if(hmodR->GetEntries()>0){
253 TCanvas* cmodR=new TCanvas("cmodR","RecPoint Occup",1200,1200);
254 cmodR->Divide(2,3);
255 cmodR->cd(1);
256 gPad->SetLeftMargin(0.14);
257 hmodR->Draw();
258 hmodR->GetXaxis()->SetTitle("SDD Module Id");
259 hmodR->GetYaxis()->SetTitle("RecPoints");
260 hmodR->GetYaxis()->SetTitleOffset(1.55);
261 cmodR->cd(2);
262 gPad->SetLeftMargin(0.14);
263 hmodRN->Draw("E");
264 hmodRN->GetXaxis()->SetTitle("SDD Module Id");
265 hmodRN->GetYaxis()->SetTitle("RecPoints/GoodAnode/Event");
266 hmodRN->GetYaxis()->SetTitleOffset(1.55);
267 cmodR->cd(3);
268 gPad->SetLeftMargin(0.14);
269 h2dmodR3->Draw("colz");
270 h2dmodR3->GetXaxis()->SetTitle("Detector");
271 h2dmodR3->GetYaxis()->SetTitle("Ladder");
272 cmodR->cd(4);
273 gPad->SetLeftMargin(0.14);
274 h2dmodR3N->Draw("colz");
275 h2dmodR3N->GetXaxis()->SetTitle("Detector");
276 h2dmodR3N->GetYaxis()->SetTitle("Ladder");
277 cmodR->cd(5);
278 gPad->SetLeftMargin(0.14);
279 h2dmodR4->Draw("colz");
280 h2dmodR4->GetXaxis()->SetTitle("Detector");
281 h2dmodR4->GetYaxis()->SetTitle("Ladder");
282 cmodR->cd(6);
283 gPad->SetLeftMargin(0.14);
284 gPad->SetLeftMargin(0.14);
285 h2dmodR4N->Draw("colz");
286 h2dmodR4N->GetXaxis()->SetTitle("Detector");
287 h2dmodR4N->GetYaxis()->SetTitle("Ladder");
288 cmodR->Update();
98d289f0 289 cmodR->Print(psfilename);
70b1033a 290 }
291
292 TCanvas* cmodT=new TCanvas("cmodT","TrackPoint Occup",1200,1200);
293 cmodT->Divide(2,3);
294 cmodT->cd(1);
295 hmodT->Draw();
296 hmodT->GetXaxis()->SetTitle("SDD Module Id");
297 hmodT->GetYaxis()->SetTitle("TrackPoints");
298 hmodT->GetYaxis()->SetTitleOffset(1.4);
299 cmodT->cd(2);
300 gPad->SetLeftMargin(0.14);
301 hmodTN->Draw("E");
302 hmodTN->GetXaxis()->SetTitle("SDD Module Id");
303 hmodTN->GetYaxis()->SetTitle("TrackPoints");
304 hmodTN->GetYaxis()->SetTitleOffset(1.4);
305 cmodT->cd(3);
306 gPad->SetLeftMargin(0.14);
307 h2dmodT3->Draw("colz");
308 h2dmodT3->GetXaxis()->SetTitle("Detector");
309 h2dmodT3->GetYaxis()->SetTitle("Ladder");
310 cmodT->cd(4);
311 gPad->SetLeftMargin(0.14);
312 h2dmodT3N->Draw("colz");
313 h2dmodT3N->GetXaxis()->SetTitle("Detector");
314 h2dmodT3N->GetYaxis()->SetTitle("Ladder");
315 cmodT->cd(5);
316 gPad->SetLeftMargin(0.14);
317 h2dmodT4->Draw("colz");
318 h2dmodT4->GetXaxis()->SetTitle("Detector");
319 h2dmodT4->GetYaxis()->SetTitle("Ladder");
320 cmodT->cd(6);
321 gPad->SetLeftMargin(0.14);
322 h2dmodT4N->Draw("colz");
323 h2dmodT4N->GetXaxis()->SetTitle("Detector");
324 h2dmodT4N->GetYaxis()->SetTitle("Ladder");
325 cmodT->Update();
98d289f0 326 cmodT->Print(psfilename);
70b1033a 327
328 TH1F* htplad3=(TH1F*)l->FindObject("hTPLad3");
329 TH1F* htplad4=(TH1F*)l->FindObject("hTPLad4");
330 TH1F* hgalad3=(TH1F*)l->FindObject("hGALad3");
331 TH1F* hgalad4=(TH1F*)l->FindObject("hGALad4");
332 TH1F* hnormOcc3=new TH1F("hnormOcc3","",14,-0.5,13.5);
333 TH1F* hnormOcc4=new TH1F("hnormOcc4","",22,-0.5,21.5);
334 for(Int_t ilad=0;ilad<14;ilad++){
335 Float_t occ=0.;
336 Float_t eocc=0.;
337 Int_t gd3=hgalad3->GetBinContent(ilad+1);
338 if(gd3>0){
339 occ=(Float_t)htplad3->GetBinContent(ilad+1)/(Float_t)gd3/(Float_t)nEvents;
340 eocc=TMath::Sqrt((Float_t)htplad3->GetBinContent(ilad+1))/(Float_t)gd3/(Float_t)nEvents;
341 }
342 hnormOcc3->SetBinContent(ilad+1,occ);
343 hnormOcc3->SetBinError(ilad+1,eocc);
344 }
345 for(Int_t ilad=0;ilad<22;ilad++){
346 Float_t occ=0.;
347 Float_t eocc=0.;
348 Int_t gd4=hgalad4->GetBinContent(ilad+1);
349 if(gd4>0){
350 occ=(Float_t)htplad4->GetBinContent(ilad+1)/(Float_t)gd4/(Float_t)nEvents;
351 eocc=TMath::Sqrt((Float_t)htplad4->GetBinContent(ilad+1))/(Float_t)gd4/(Float_t)nEvents;
352 }
353 hnormOcc4->SetBinContent(ilad+1,occ);
354 hnormOcc4->SetBinError(ilad+1,eocc);
355 }
356
357
358 TCanvas* cn0=new TCanvas("cn0","Normalized Ladder Occupancy",1400,600);
359 cn0->Divide(2,1);
360 cn0->cd(1);
361 gPad->SetLeftMargin(0.14);
362 hnormOcc3->Draw();
363 hnormOcc3->GetXaxis()->SetTitle("Ladder number (layer 3)");
364 hnormOcc3->GetYaxis()->SetTitle("TrackPoints/GoodAnodes/Events");
365 hnormOcc3->GetYaxis()->SetTitleOffset(1.35);
366 cn0->cd(2);
367 gPad->SetLeftMargin(0.14);
368 hnormOcc4->Draw();
369 hnormOcc4->GetXaxis()->SetTitle("Ladder number (layer 4)");
370 hnormOcc4->GetYaxis()->SetTitle("TrackPoints/GoodAnode/Events");
371 hnormOcc4->GetYaxis()->SetTitleOffset(1.35);
372 cn0->Update();
98d289f0 373 cn0->Print(psfilename);
374
375 if(hcllay){
376 Double_t norm=hcllay->GetBinContent(1);
377 hcllay->Scale(1./norm);
378 hcllay->SetTitle("");
379 hcllay->GetXaxis()->SetRange(2,7);
380 hcllay->SetMinimum(0.);
381 hcllay->SetMaximum(1.1);
382 hcllay->SetMarkerStyle(23);
383 TCanvas* ceffL=new TCanvas("ceffL","PointPerLayer",1000,600);
384 ceffL->SetGridy();
385 hcllay->Draw();
386 hcllay->GetXaxis()->SetTitle("Layer");
387 hcllay->GetYaxis()->SetTitle("Fraction of tracks with point in layer");
388 ceffL->Update();
389 ceffL->Print(psfilename);
390 }
70b1033a 391
392 hgpmod->SetTitle("");
393 TCanvas* ceff0=new TCanvas("ceff0","ModuleIndexInfo",1000,600);
394 hgpmod->Draw();
395 hgpmod->GetXaxis()->SetTitle("SDD Module Id");
396 hgpmod->GetYaxis()->SetTitle("Number of tracks");
397 hmpmod->SetLineColor(2);
398 hmpmod->SetMarkerColor(2);
399 hmpmod->SetMarkerStyle(22);
400 hmpmod->SetMarkerSize(0.5);
401 hmpmod->Draw("psame");
402 hbrmod->SetLineColor(kGreen+1);
403 hbrmod->SetMarkerColor(kGreen+1);
404 hbrmod->SetMarkerStyle(20);
405 hbrmod->SetMarkerSize(0.5);
406 hbrmod->Draw("same");
407 hskmod->SetLineColor(kYellow);
408 hskmod->Draw("same");
409 hoamod->SetLineColor(4);
410 hoamod->Draw("same");
411 hnrmod->SetLineColor(6);
412 hnrmod->Draw("same");
413 TLatex* t1=new TLatex(0.7,0.85,"Good Point");
414 t1->SetNDC();
415 t1->SetTextColor(1);
416 t1->Draw();
417 TLatex* t2=new TLatex(0.7,0.8,"Missing Point");
418 t2->SetNDC();
419 t2->SetTextColor(2);
420 t2->Draw();
421 TLatex* t3=new TLatex(0.7,0.75,"Bad Region");
422 t3->SetNDC();
423 t3->SetTextColor(kGreen+1);
424 t3->Draw();
425 ceff0->Update();
98d289f0 426 ceff0->Print(psfilename);
70b1033a 427
428 TH1F* heff=new TH1F("heff","",260,239.5,499.5);
429 for(Int_t imod=0; imod<260;imod++){
430 Float_t numer=hgpmod->GetBinContent(imod+1)+hbrmod->GetBinContent(imod+1)+hoamod->GetBinContent(imod+1)+hnrmod->GetBinContent(imod+1);
431 Float_t denom=hapmod->GetBinContent(imod+1);
432 Float_t eff=0.;
433 Float_t erreff=0.;
434 if(denom>0){
435 eff=numer/denom;
436 erreff=TMath::Sqrt(eff*(1-eff)/denom);
437 }
438 heff->SetBinContent(imod+1,eff);
439 heff->SetBinError(imod+1,erreff);
440 }
441
442 printf("---- Modules with efficiency < 90%% ----\n");
443 TCanvas* ceff1=new TCanvas("ceff1","Efficiency",1000,600);
444 heff->Draw();
445 heff->GetXaxis()->SetTitle("SDD Module Id");
446 heff->GetYaxis()->SetTitle("Fraction of tracks with point in good region");
447 for(Int_t ibin=1; ibin<=heff->GetNbinsX(); ibin++){
448 Float_t e=heff->GetBinContent(ibin);
449 if(e<0.9){
450 Int_t iMod=(Int_t)heff->GetBinCenter(ibin);
451 Int_t lay,lad,det;
452 AliITSgeomTGeo::GetModuleId(iMod,lay,lad,det);
453 printf("Module %d - Layer %d Ladder %2d Det %d - Eff. %.3f\n",iMod,lay,lad,det,heff->GetBinContent(ibin));
454 }
455 }
98d289f0 456 ceff1->Update();
457 ceff1->Print(psfilename);
458
459 if(hgpxl){
460 hgpxl->SetTitle("");
461 hgpzl->SetTitle("");
462 TCanvas* ceff2=new TCanvas("ceff2","LocalCoord",1000,600);
463 ceff2->Divide(2,1);
464 ceff2->cd(1);
465 hgpxl->Draw();
466 hgpxl->GetXaxis()->SetTitle("Xlocal (cm)");
467 hgpxl->GetYaxis()->SetTitle("Number of tracks");
468 hmpxl->SetLineColor(2);
469 hmpxl->SetMarkerColor(2);
470 hmpxl->SetMarkerStyle(22);
471 hmpxl->SetMarkerSize(0.5);
472 hmpxl->Draw("psame");
473 hbrxl->SetLineColor(kGreen+1);
474 hbrxl->SetMarkerColor(kGreen+1);
475 hbrxl->SetMarkerStyle(20);
476 hbrxl->SetMarkerSize(0.5);
477 hbrxl->Draw("same");
478 t1->Draw();
479 t2->Draw();
480 t3->Draw();
481 ceff2->cd(2);
482 hgpzl->Draw();
483 hgpzl->GetXaxis()->SetTitle("Zlocal (cm)");
484 hgpzl->GetYaxis()->SetTitle("Number of tracks");
485 hmpzl->SetLineColor(2);
486 hmpzl->SetMarkerColor(2);
487 hmpzl->SetMarkerStyle(22);
488 hmpzl->SetMarkerSize(0.5);
489 hmpzl->Draw("psame");
490 hbrzl->SetLineColor(kGreen+1);
491 hbrzl->SetMarkerColor(kGreen+1);
492 hbrzl->SetMarkerStyle(20);
493 hbrzl->SetMarkerSize(0.5);
494 hbrzl->Draw("same");
495 t1->Draw();
496 t2->Draw();
497 t3->Draw();
498 ceff2->Update();
499 ceff2->Print(psfilename);
500 }
70b1033a 501
502 TH1F* htimR=(TH1F*)l->FindObject("hDrTimRP");
503 TH1F* htimT=(TH1F*)l->FindObject("hDrTimTPAll");
504 TH1F* htimTe=(TH1F*)l->FindObject("hDrTimTPExtra");
505 TH1F* htimTne=(TH1F*)l->FindObject("hDrTimTPNoExtra");
506 TCanvas* ctim=new TCanvas("ctim","DriftTime",1400,600);
507 ctim->Divide(2,1);
508 ctim->cd(1);
509 htimR->Draw();
510 htimR->GetYaxis()->SetTitleOffset(1.2);
511 htimR->GetXaxis()->SetTitle("Drift Time (ns)");
512 htimR->GetYaxis()->SetTitle("RecPoints");
513 ctim->cd(2);
514 htimT->Draw();
515 htimTe->SetLineColor(2);
516 htimTe->Draw("same");
517 htimTne->SetLineColor(4);
518 htimTne->Draw("same");
519 htimT->GetXaxis()->SetTitle("Drift Time (ns)");
520 htimT->GetYaxis()->SetTitle("TrackPoints");
521 htimT->GetYaxis()->SetTitleOffset(1.2);
522 TLatex* ta=new TLatex(0.5,0.85,"All Clusters");
523 ta->SetNDC();
524 ta->SetTextColor(1);
525 ta->Draw();
526 TLatex* te=new TLatex(0.5,0.8,"Extra Clusters");
527 te->SetNDC();
528 te->SetTextColor(2);
529 te->Draw();
530 TLatex* tn=new TLatex(0.5,0.75,"Non-Extra Clusters");
531 tn->SetNDC();
532 tn->SetTextColor(4);
533 tn->Draw();
534 ctim->Update();
98d289f0 535 ctim->Print(psfilename);
70b1033a 536
537 TCanvas* cdedx=new TCanvas("cdedx","dedx",1400,600);
538 cdedx->Divide(3,1);
539 cdedx->cd(1);
540 gPad->SetLogz();
541 hdedx3->Draw("col");
542 hdedx3->GetXaxis()->SetTitle("P (GeV/c)");
543 hdedx3->GetYaxis()->SetTitle("dE/dx (keV/300 #mum) Layer 3");
544 hdedx3->GetYaxis()->SetTitleOffset(1.25);
545 cdedx->cd(2);
546 gPad->SetLogz();
547 hdedx4->Draw("col");
548 hdedx4->GetXaxis()->SetTitle("P (GeV/c)");
549 hdedx4->GetYaxis()->SetTitle("dE/dx (keV/300 #mum) Layer 4");
550 hdedx4->GetYaxis()->SetTitleOffset(1.25);
551 cdedx->cd(3);
552 gPad->SetLogz();
553 hdedxmod->Draw("col");
554 hdedxmod->GetXaxis()->SetTitle("SDD Module Id");
555 hdedxmod->GetYaxis()->SetTitle("dE/dx (keV/300 #mum)");
556 hdedxmod->GetYaxis()->SetTitleOffset(1.25);
557 cdedx->Update();
98d289f0 558 cdedx->Print(psfilename);
70b1033a 559
560 printf("---- dE/dx vs.DriftTime ----\n");
561 TCanvas* csig=new TCanvas("csig","dedx vs. DriftTime",1000,700);
562 csig->Divide(4,2);
563 TH1F* hSigTim[8];
564 TGraphErrors* gmpv=new TGraphErrors(0);
565 TGraphErrors* gsigg=new TGraphErrors(0);
566 TGraphErrors* gsigl=new TGraphErrors(0);
567 gmpv->SetTitle("");
568 gsigg->SetTitle("");
569 gsigl->SetTitle("");
570 Int_t iPoint=0;
571 TF1 *lfun = new TF1("LangausFun",LangausFun,50.,300.,4);
572 for(Int_t it=0; it<8; it++){
573 hSigTim[it]=(TH1F*)l->FindObject(Form("hSigTimeInt%d",it));
574 csig->cd(it+1);
575 hSigTim[it]->Draw();
576 if(hSigTim[it]->GetEntries()>200){
577 lfun->SetLineWidth(2);
578 lfun->SetParameter(0,5.);
579 lfun->SetParameter(1,80.);
580 lfun->SetParameter(2,hSigTim[it]->GetEntries()/10.);
581 lfun->SetParameter(3,10.);
582 lfun->SetParLimits(3,0.,20);
583
584 hSigTim[it]->Fit("LangausFun","QLR");
585 hSigTim[it]->GetXaxis()->SetTitle(Form("dE/dx, time interval %d",it+1));
586 hSigTim[it]->GetYaxis()->SetTitle("Events");
587 Float_t mpv=lfun->GetParameter(1);
588 Float_t empv=lfun->GetParError(1);
589 Float_t sig=lfun->GetParameter(3);
590 Float_t esig=lfun->GetParError(3);
591 Float_t sigl=lfun->GetParameter(0);
592 Float_t esigl=lfun->GetParError(0);
593 gmpv->SetPoint(iPoint,(Float_t)it,mpv);
594 gmpv->SetPointError(iPoint,0.,empv);
595 gsigg->SetPoint(iPoint,(Float_t)it,sig);
596 gsigg->SetPointError(iPoint,0.,esig);
597 gsigl->SetPoint(iPoint,(Float_t)it,sigl);
598 gsigl->SetPointError(iPoint,0.,esigl);
599 ++iPoint;
600 gPad->Update();
601 printf("Bin %d - MPV=%.3f \t SigmaLandau=%.3f \t SigmaGaus=%.3f\n",it,mpv,sigl,sig);
602 }
603 }
98d289f0 604 csig->Print(psfilename);
70b1033a 605
606 TCanvas* cpars=new TCanvas("cpars","Params",800,900);
607 cpars->Divide(1,3,0.01,0.);
608 cpars->cd(1);
609 gPad->SetLeftMargin(0.14);
610 gPad->SetFrameLineWidth(2);
611 gPad->SetTickx();
612 gPad->SetTicky();
613 gmpv->SetMarkerStyle(20);
614 // gmpv->SetMinimum(0);
615 // gmpv->SetMaximum(120);
616 gmpv->GetXaxis()->SetLimits(-0.2,6.8);
617 gmpv->Draw("AP");
618 // gmpv->GetXaxis()->SetTitle("Drift Time interval number");
619 gmpv->GetYaxis()->SetTitle("Landau MPV (keV)");
620 gmpv->GetXaxis()->SetTitleSize(0.05);
621 gmpv->GetYaxis()->SetTitleSize(0.05);
622 gmpv->GetYaxis()->SetTitleOffset(1.2);
623 cpars->cd(2);
624 gPad->SetLeftMargin(0.14);
625 gPad->SetFrameLineWidth(2);
626 gPad->SetTickx();
627 gPad->SetTicky();
628 gsigl->SetMarkerStyle(20);
629 gsigl->GetXaxis()->SetLimits(-0.2,6.8);
630 gsigl->Draw("AP");
631 // gsigl->GetXaxis()->SetTitle("Drift Time interval number");
632 gsigl->GetYaxis()->SetTitle("#sigma_{Landau} (keV)");
633 gsigl->GetXaxis()->SetTitleSize(0.05);
634 gsigl->GetYaxis()->SetTitleSize(0.05);
635 gsigl->GetYaxis()->SetTitleOffset(1.2);
636 cpars->cd(3);
637 gPad->SetLeftMargin(0.14);
638 gPad->SetFrameLineWidth(2);
639 gPad->SetTickx();
640 gPad->SetTicky();
641 gsigg->SetMarkerStyle(20);
642 gsigg->GetXaxis()->SetLimits(-0.2,6.8);
643 gsigg->Draw("AP");
644 gsigg->GetXaxis()->SetTitle("Drift Time interval number");
645 gsigg->GetYaxis()->SetTitle("#sigma_{Gauss} (keV)");
646 gsigg->GetXaxis()->SetTitleSize(0.05);
647 gsigg->GetYaxis()->SetTitleSize(0.05);
648 gsigg->GetYaxis()->SetTitleOffset(1.2);
98d289f0 649 cpars->Update();
650 cpars->Print(psfilename);
651 cpars->Print(closepsfilename);
70b1033a 652
653}