1 #if !defined(__CINT__) || defined(__MAKECINT__)
6 #include <TGraphErrors.h>
14 #include "AliITSgeomTGeo.h"
15 #include "AliESDEvent.h"
18 enum {kAll, kTPCITS, kITSsa, kITSpureSA};
20 void CheckSDDInESD(TString filename="AliESDs.root", Int_t optTracks=kAll){
23 TFile* esdFile = TFile::Open(filename.Data());
24 if (!esdFile || !esdFile->IsOpen()) {
25 printf("Error in opening ESD file");
29 AliESDEvent * esd = new AliESDEvent;
30 TTree* tree = (TTree*) esdFile->Get("esdTree");
32 printf("Error: no ESD tree found");
35 esd->ReadFromTree(tree);
36 TH1F* hpt=new TH1F("hpt","",100,0.,10.);
37 TH1F* hphi=new TH1F("hphi","",100,-1,1);
38 TH1F* hlam=new TH1F("hlam","",100,-2.,2.);
39 TH1F* halpha=new TH1F("halpha","",100,-7,7);
40 TH1F* hitscl=new TH1F("hitscl","",7,-0.5,6.5);
41 TH1F* htpccl=new TH1F("htpccl","",200,-0.5,199.5);
42 TH1F* hitsmap=new TH1F("hitsmap","",64,-0.5,63.5);
43 TH1F* hclulay=new TH1F("hclulay","",7,-1.5,5.5);
45 TH1F* hvx=new TH1F("hvx","",100,-1.,1.);
46 TH1F* hvy=new TH1F("hvy","",100,-1.,1.);
47 TH1F* hvz=new TH1F("hvz","",100,-20.,20.);
48 TH1F* hdedx3=new TH1F("hdedx3","",100,0.,300.);
49 TH1F* hdedx4=new TH1F("hdedx4","",100,0.,300.);
50 TH1F* hdedx5=new TH1F("hdedx5","",100,0.,300.);
51 TH1F* hdedx6=new TH1F("hdedx6","",100,0.,300.);
52 TH1F* hStatus=new TH1F("hStatus","",11,-1.5,9.5);
55 // -- Local coordinates
60 TH1F* hAllPMod = new TH1F("hAllPmod","Crossing Tracks vs. Module",260,239.5,499.5);
61 TH1F* hGoodPMod = new TH1F("hGoodPmod","PointsAssocToTrack per Module",260,239.5,499.5);
62 TH1F* hBadRegMod = new TH1F("hBadRegmod","Tracks in BadRegion per Module",260,239.5,499.5);
63 TH1F* hMissPMod = new TH1F("hMissPmod","Missing Points per Module",260,239.5,499.5);
64 TH1F* hSkippedMod = new TH1F("hSkippedmod","Tracks in Skipped Module",260,239.5,499.5);
65 TH1F* hOutAccMod = new TH1F("hOutAccmod","Tracks outside zAcc per Module",260,239.5,499.5);
66 TH1F* hNoRefitMod = new TH1F("hNoRefitmod","Points rejected in refit per Module",260,239.5,499.5);
68 TH1F* hAllPXloc = new TH1F("hAllPxloc","Crossing Tracks vs. Xloc",75, -3.75, 3.75);
69 TH1F* hGoodPXloc = new TH1F("hGoodPxloc","PointsAssocToTrack vs. Xloc",75, -3.75, 3.75);
70 TH1F* hBadRegXloc = new TH1F("hBadRegxloc","Tracks in BadRegion vs. Xloc",75, -3.75, 3.75);
71 TH1F* hMissPXloc = new TH1F("hMissPxloc","Missing Points vs. Xloc",75, -3.75, 3.75);
72 TH1F* hAllPZloc = new TH1F("hAllPzloc","Crossing Tracks vs. Zloc",77, -3.85, 3.85);
73 TH1F* hGoodPZloc = new TH1F("hGoodPzloc","PointsAssocToTrack vs. Zloc",77, -3.85, 3.85);
74 TH1F* hBadRegZloc = new TH1F("hBadRegzloc","Tracks in BadRegion vs. Zloc",77, -3.85, 3.85);
75 TH1F* hMissPZloc = new TH1F("hMissPzloc","Missing Points vs. Zloc",77, -3.85, 3.85);
76 TH2F* hdEdxVsMod=new TH2F("hdEdxVsMod","dE/dx vs. mod",260,239.5,499.5,100,0.,500.);
78 gStyle->SetPalette(1);
81 for (Int_t iEvent = 0; iEvent < tree->GetEntries(); iEvent++) {
82 tree->GetEvent(iEvent);
84 printf("Error: no ESD object found for event %d", iEvent);
87 cout<<"-------- Event "<<iEvent<<endl;
88 printf(" Tracks # = %d\n",esd->GetNumberOfTracks());
89 const AliESDVertex *spdv=esd->GetVertex();
90 printf(" SPD Primary Vertex in %f %f %f with %d contributors\n",spdv->GetX(),spdv->GetY(),spdv->GetZ(),spdv->GetNContributors());
91 const AliESDVertex *trkv=esd->GetPrimaryVertex();
92 printf(" Track Primary Vertex with %d contributors\n",trkv->GetNContributors());
93 if(spdv->IsFromVertexer3D()){
94 hvx->Fill(spdv->GetX());
95 hvy->Fill(spdv->GetY());
96 hvz->Fill(spdv->GetZ());
99 for (Int_t iTrack = 0; iTrack < esd->GetNumberOfTracks(); iTrack++) {
100 AliESDtrack* track = esd->GetTrack(iTrack);
101 Int_t nITSclus=track->GetNcls(0);
102 UChar_t clumap=track->GetITSClusterMap();
103 Int_t nPointsForPid=0;
104 for(Int_t i=2; i<6; i++){
105 if(clumap&(1<<i)) ++nPointsForPid;
107 // track->PropagateTo(4.,5.);
108 htpccl->Fill(track->GetNcls(1));
109 Int_t status=track->GetStatus();
112 if(status & AliESDtrack::kTPCin){
116 if(status & AliESDtrack::kTPCout){
119 if(status & AliESDtrack::kTPCrefit){
123 if(status & AliESDtrack::kITSin){
127 if(status & AliESDtrack::kITSout){
130 if(status & AliESDtrack::kITSrefit){
136 if(status & AliESDtrack::kITSpureSA){
140 if(status & AliESDtrack::kITSrefit){
141 if((optTracks==kTPCITS) && !(status & AliESDtrack::kTPCin)) continue;
142 if((optTracks==kITSsa) && (status & AliESDtrack::kTPCin)) continue;
143 if((optTracks==kITSsa) && (status & AliESDtrack::kITSpureSA)) continue;
144 if((optTracks==kITSpureSA) && (status & AliESDtrack::kITSpureSA)) continue;
146 track->GetITSdEdxSamples(itss);
147 // printf("Track %d (label %d) in ITS with %d clusters clumap %d pointspid= %d\n",iTrack,track->GetLabel(),nITSclus,clumap,nPointsForPid);
148 //printf(" dedx=%f %f %f %f\n",itss[0],itss[1],itss[2],itss[3]);
149 hitscl->Fill(nITSclus);
150 hdedx3->Fill(itss[0]);
151 hdedx4->Fill(itss[1]);
152 hdedx5->Fill(itss[2]);
153 hdedx6->Fill(itss[3]);
154 hitsmap->Fill(clumap);
156 for(Int_t iLay=0;iLay<6;iLay++){
157 if(clumap&1<<iLay) hclulay->Fill(iLay);
159 hpt->Fill(track->Pt());
160 hphi->Fill(TMath::ASin(track->GetSnp()));
161 hlam->Fill(TMath::ATan(track->GetTgl()));
162 halpha->Fill(track->GetAlpha());
165 for(Int_t iLay=2; iLay<=3; iLay++){
166 Bool_t ok=track->GetITSModuleIndexInfo(iLay,iMod,status,xloc,zloc);
169 hAllPMod->Fill(iMod);
170 hAllPXloc->Fill(xloc);
171 hAllPZloc->Fill(zloc);
173 hGoodPMod->Fill(iMod);
174 hGoodPXloc->Fill(xloc);
175 hGoodPZloc->Fill(zloc);
176 if(track->Pt()>1.) hdEdxVsMod->Fill(iMod,itss[iLay-2]);
179 hBadRegMod->Fill(iMod);
180 hBadRegXloc->Fill(xloc);
181 hBadRegZloc->Fill(zloc);
183 else if(status==3) hSkippedMod->Fill(iMod);
184 else if(status==4) hOutAccMod->Fill(iMod);
186 hMissPMod->Fill(iMod);
187 hMissPXloc->Fill(xloc);
188 hMissPZloc->Fill(zloc);
190 else if(status==6) hNoRefitMod->Fill(iMod);
196 Float_t norm=hclulay->GetBinContent(1);
198 hclulay->Scale(1./norm);
199 gStyle->SetLineWidth(2);
201 TCanvas* c1=new TCanvas("c1","Track quantities",900,900);
205 htpccl->GetXaxis()->SetTitle("Clusters in TPC ");
208 hitscl->GetXaxis()->SetTitle("Clusters in ITS ");
211 hclulay->GetXaxis()->SetRange(2,7);
212 hclulay->GetXaxis()->SetTitle("# ITS Layer");
213 hclulay->GetYaxis()->SetTitle("Fraction of tracks with point in Layer x");
216 TCanvas* c2=new TCanvas("c2","dedx per Layer",900,900);
220 hdedx3->GetXaxis()->SetTitle("dE/dx Lay3");
223 hdedx4->GetXaxis()->SetTitle("dE/dx Lay4");
226 hdedx5->GetXaxis()->SetTitle("dE/dx Lay5");
229 hdedx6->GetXaxis()->SetTitle("dE/dx Lay6");
231 hdEdxVsMod->SetStats(0);
232 TCanvas* cdedx=new TCanvas("cdedx","dedx SDD",1400,600);
234 hdEdxVsMod->Draw("col");
235 hdEdxVsMod->GetXaxis()->SetTitle("SDD Module Id");
236 hdEdxVsMod->GetYaxis()->SetTitle("dE/dx (keV/300 #mum)");
237 hdEdxVsMod->GetYaxis()->SetTitleOffset(1.25);
241 TCanvas* cv=new TCanvas("cv","Vertex",600,900);
245 hvx->GetXaxis()->SetTitle("Xv (cm)");
248 hvy->GetXaxis()->SetTitle("Yv (cm)");
251 hvz->GetXaxis()->SetTitle("Xv (cm)");
253 hGoodPMod->SetStats(0);
254 hGoodPMod->SetTitle("");
255 TCanvas* ceff0=new TCanvas("ceff0","ModuleIndexInfo",1000,600);
256 hGoodPMod->Draw("e");
257 hGoodPMod->GetXaxis()->SetTitle("SDD Module Id");
258 hGoodPMod->GetYaxis()->SetTitle("Number of tracks");
259 hMissPMod->SetLineColor(2);
260 hMissPMod->SetMarkerColor(2);
261 hMissPMod->SetMarkerStyle(22);
262 hMissPMod->SetMarkerSize(0.5);
263 hMissPMod->Draw("psame");
264 hBadRegMod->SetLineColor(kGreen+1);
265 hBadRegMod->SetMarkerColor(kGreen+1);
266 hBadRegMod->SetMarkerStyle(20);
267 hBadRegMod->SetMarkerSize(0.5);
268 hBadRegMod->Draw("esame");
269 hSkippedMod->SetLineColor(kYellow);
270 hSkippedMod->Draw("esame");
271 hOutAccMod->SetLineColor(4);
272 hOutAccMod->Draw("esame");
273 hNoRefitMod->SetLineColor(6);
274 hNoRefitMod->Draw("esame");
275 TLatex* t1=new TLatex(0.7,0.85,"Good Point");
279 TLatex* t2=new TLatex(0.7,0.8,"Missing Point");
283 TLatex* t3=new TLatex(0.7,0.75,"Bad Region");
285 t3->SetTextColor(kGreen+1);
289 TH1F* heff=new TH1F("heff","",260,239.5,499.5);
290 for(Int_t imod=0; imod<260;imod++){
291 Float_t numer=hGoodPMod->GetBinContent(imod+1)+hBadRegMod->GetBinContent(imod+1)+hOutAccMod->GetBinContent(imod+1)+hNoRefitMod->GetBinContent(imod+1);
292 Float_t denom=hAllPMod->GetBinContent(imod+1);
297 erreff=TMath::Sqrt(eff*(1-eff)/denom);
299 heff->SetBinContent(imod+1,eff);
300 heff->SetBinError(imod+1,erreff);
303 printf("---- Modules with efficiency < 90%% ----\n");
305 TCanvas* ceff1=new TCanvas("ceff1","Efficiency",1000,600);
307 heff->GetXaxis()->SetTitle("SDD Module Id");
308 heff->GetYaxis()->SetTitle("Fraction of tracks with point in good region");
309 for(Int_t ibin=1; ibin<=heff->GetNbinsX(); ibin++){
310 Float_t e=heff->GetBinContent(ibin);
312 Int_t iMod=(Int_t)heff->GetBinCenter(ibin);
314 AliITSgeomTGeo::GetModuleId(iMod,lay,lad,det);
315 printf("Module %d - Layer %d Ladder %2d Det %d - Eff. %.3f\n",iMod,lay,lad,det,heff->GetBinContent(ibin));
322 hGoodPXloc->SetTitle("");
323 hGoodPZloc->SetTitle("");
324 hGoodPXloc->SetStats(0);
325 hGoodPZloc->SetStats(0);
326 hGoodPXloc->SetMinimum(0);
327 hGoodPZloc->SetMinimum(0);
328 TCanvas* ceff2=new TCanvas("ceff2","LocalCoord",1000,600);
331 hGoodPXloc->Draw("e");
332 hGoodPXloc->GetXaxis()->SetTitle("Xlocal (cm)");
333 hGoodPXloc->GetYaxis()->SetTitle("Number of tracks");
334 hMissPXloc->SetLineColor(2);
335 hMissPXloc->SetMarkerColor(2);
336 hMissPXloc->SetMarkerStyle(22);
337 hMissPXloc->SetMarkerSize(0.5);
338 hMissPXloc->Draw("psame");
339 hBadRegXloc->SetLineColor(kGreen+1);
340 hBadRegXloc->SetMarkerColor(kGreen+1);
341 hBadRegXloc->SetMarkerStyle(20);
342 hBadRegXloc->SetMarkerSize(0.5);
343 hBadRegXloc->Draw("psame");
348 hGoodPZloc->Draw("e");
349 hGoodPZloc->GetXaxis()->SetTitle("Zlocal (cm)");
350 hGoodPZloc->GetYaxis()->SetTitle("Number of tracks");
351 hMissPZloc->SetLineColor(2);
352 hMissPZloc->SetMarkerColor(2);
353 hMissPZloc->SetMarkerStyle(22);
354 hMissPZloc->SetMarkerSize(0.5);
355 hMissPZloc->Draw("psame");
356 hBadRegZloc->SetLineColor(kGreen+1);
357 hBadRegZloc->SetMarkerColor(kGreen+1);
358 hBadRegZloc->SetMarkerStyle(20);
359 hBadRegZloc->SetMarkerSize(0.5);
360 hBadRegZloc->Draw("psame");