Update z position of ADA (Z=1699.7)
[u/mrichter/AliRoot.git] / ITS / ShowITSRecPoints.C
CommitLineData
29d63bb9 1#if !defined(__CINT__) || defined(__MAKECINT__)
2#include <TCanvas.h>
3#include <TClassTable.h>
4#include <TGraph.h>
5#include <TGraph2D.h>
6#include <TGeoManager.h>
7#include <TH1.h>
5801bd60 8#include <TH2.h>
9#include <TLatex.h>
10#include <TStyle.h>
29d63bb9 11#include <TInterpreter.h>
29d63bb9 12#include "AliGeomManager.h"
13#include "AliHeader.h"
14#include "AliITS.h"
0b717bcb 15#include "AliITSRecPointContainer.h"
7285ac7a 16#include "AliITSgeomTGeo.h"
29d63bb9 17#include "AliITSRecPoint.h"
18#include "AliRun.h"
19#endif
20
7285ac7a 21Int_t ShowITSRecPoints(Int_t nevfordisp=0){
29d63bb9 22 ///////////////////////////////////////////////////////////////////////
23 // Macro to check clusters in the 6 ITS layers //
24 // Provides: //
25 // 6 canvases with 9 plots each (1 canvas for each layer) //
26 // 3 canvases with cluster XY coordinates for the first 3 events //
27 ///////////////////////////////////////////////////////////////////////
28
29 if (gClassTable->GetID("AliRun") < 0) {
30 gInterpreter->ExecuteMacro("loadlibs.C");
31 }
29d63bb9 32
0b717bcb 33 // retrieves geometry
29d63bb9 34 if(!gGeoManager){
35 AliGeomManager::LoadGeometry("geometry.root");
36 }
37
38 AliRunLoader* rl = AliRunLoader::Open("galice.root");
39 if (rl == 0x0){
40 cerr<<"Can not open session RL=NULL"<< endl;
41 return -1;
42 }
29d63bb9 43
44 AliITSLoader* ITSloader = (AliITSLoader*) rl->GetLoader("ITSLoader");
45 if(!ITSloader){
46 cerr<<"ITS loader not found"<<endl;
47 return -1;
48 }
49 ITSloader->LoadRecPoints("read");
50
0b717bcb 51 AliITSRecPointContainer* rpcont=AliITSRecPointContainer::Instance();
52
29d63bb9 53 Float_t cluglo[3]={0.,0.,0.};
29d63bb9 54
7285ac7a 55 Int_t totmod=AliITSgeomTGeo::GetNModules();
56 Int_t modmin=AliITSgeomTGeo::GetModuleIndex(1,1,1);
57 Int_t modmax=AliITSgeomTGeo::GetNModules()-1;
58
29d63bb9 59 Float_t xlim[6]={4.5,7.5,16.,26.,40.,45.};
60 Float_t zlim[6]={15.,15.,22.,30.,45.,55.};
61
97e78ca8 62 TH1F* hlayer=new TH1F("hlayer","",6,-0.5,5.5);
29d63bb9 63 TH1F** hmod=new TH1F*[6];
64 TH1F** hxl=new TH1F*[6];
65 TH1F** hzl=new TH1F*[6];
66 TH1F** hxg=new TH1F*[6];
67 TH1F** hyg=new TH1F*[6];
68 TH1F** hzg=new TH1F*[6];
69 TH1F** hr=new TH1F*[6];
70 TH1F** hphi=new TH1F*[6];
5801bd60 71 TH2F** hzphi=new TH2F*[6];
29d63bb9 72 TH1F** hq=new TH1F*[6];
5801bd60 73 TH1F** hdrtime=new TH1F*[6];
74
29d63bb9 75 Char_t name[10];
76 for(Int_t iLay=0;iLay<6;iLay++){
77 sprintf(name,"hmod%d",iLay+1);
78 hmod[iLay]=new TH1F(name,"",totmod,modmin-0.5,modmax+0.5);
79 hmod[iLay]->GetXaxis()->SetTitle("Module");
80 hmod[iLay]->GetXaxis()->CenterTitle();
81 sprintf(name,"hxloc%d",iLay+1);
82 hxl[iLay]=new TH1F(name,"",100,-4.,4.);
83 hxl[iLay]->GetXaxis()->SetTitle("Xloc (cm)");
84 hxl[iLay]->GetXaxis()->CenterTitle();
85 sprintf(name,"hzloc%d",iLay+1);
86 hzl[iLay]=new TH1F(name,"",100,-4.,4.);
87 hzl[iLay]->GetXaxis()->SetTitle("Zloc (cm)");
88 hzl[iLay]->GetXaxis()->CenterTitle();
89 sprintf(name,"hxgl%d",iLay+1);
90 hxg[iLay]=new TH1F(name,"",100,-xlim[iLay],xlim[iLay]);
91 hxg[iLay]->GetXaxis()->SetTitle("Xglob (cm)");
92 hxg[iLay]->GetXaxis()->CenterTitle();
93 sprintf(name,"hygl%d",iLay+1);
94 hyg[iLay]=new TH1F(name,"",100,-xlim[iLay],xlim[iLay]);
95 hyg[iLay]->GetXaxis()->SetTitle("Yglob (cm)");
96 hyg[iLay]->GetXaxis()->CenterTitle();
97 sprintf(name,"hzgl%d",iLay+1);
98 hzg[iLay]=new TH1F(name,"",100,-zlim[iLay],zlim[iLay]);
99 hzg[iLay]->GetXaxis()->SetTitle("Zglob (cm)");
100 hzg[iLay]->GetXaxis()->CenterTitle();
101 sprintf(name,"hr%d",iLay+1);
102 hr[iLay]=new TH1F(name,"",100,0.,50.);
103 hr[iLay]->GetXaxis()->SetTitle("r (cm)");
104 hr[iLay]->GetXaxis()->CenterTitle();
105 sprintf(name,"hphi%d",iLay+1);
106 hphi[iLay]=new TH1F(name,"",100,-TMath::Pi(),TMath::Pi());
107 hphi[iLay]->GetXaxis()->SetTitle("#varphi (rad)");
108 hphi[iLay]->GetXaxis()->CenterTitle();
109 sprintf(name,"hq%d",iLay+1);
110 hq[iLay]=new TH1F(name,"",100,0.,300.);
111 hq[iLay]->GetXaxis()->SetTitle("Charge (keV)");
112 hq[iLay]->GetXaxis()->CenterTitle();
5801bd60 113 sprintf(name,"hdtim%d",iLay+1);
114 hdrtime[iLay]=new TH1F(name,"",100,0.,7000.);
115 hdrtime[iLay]->GetXaxis()->SetTitle("Drift Time (ns)");
116 hdrtime[iLay]->GetXaxis()->CenterTitle();
117 sprintf(name,"hzphi%d",iLay+1);
118 hzphi[iLay]=new TH2F(name,Form("Layer %d",iLay+1),50,-TMath::Pi(),TMath::Pi(),50,-zlim[iLay],zlim[iLay]);
119 hzphi[iLay]->GetXaxis()->SetTitle("#varphi (rad)");
120 hzphi[iLay]->GetYaxis()->SetTitle("Zglob (cm)");
121 hzphi[iLay]->SetStats(0);
29d63bb9 122 }
123
7285ac7a 124 TGraph *gptsXY=new TGraph(0);
125 TGraph *gptsRZ=new TGraph(0);
126
29d63bb9 127 Int_t totev=rl->GetNumberOfEvents();
128 printf("Total Number of events = %d\n",totev);
129
130 for(Int_t iev=0;iev<totev;iev++){
131 rl->GetEvent(iev);
132 TTree *TR = ITSloader->TreeR();
0b717bcb 133 rpcont->FetchClusters(0,TR);
134 TClonesArray *ITSrec = NULL;
4e247ed3 135 if(iev%100==0) printf("Event #%d\n",iev);
29d63bb9 136
137
138 Int_t ipt=0;
7285ac7a 139 for (Int_t mod=modmin; mod<=modmax; mod++){
0b717bcb 140 ITSrec = rpcont->UncheckedGetClusters(mod);
7285ac7a 141 Int_t nrecp = ITSrec->GetEntries();
142 if(nrecp>0){
143 for(Int_t irec=0;irec<nrecp;irec++) {
144 AliITSRecPoint *recp = (AliITSRecPoint*)ITSrec->At(irec);
145 Int_t lay=recp->GetLayer();
146 hlayer->Fill(lay);
147 recp->GetGlobalXYZ(cluglo);
148 Float_t rad=TMath::Sqrt(cluglo[0]*cluglo[0]+cluglo[1]*cluglo[1]);
149 Float_t phi=TMath::ATan2(cluglo[1],cluglo[0]);
150 if(iev==nevfordisp){
151 gptsXY->SetPoint(ipt,cluglo[0],cluglo[1]);
152 if(cluglo[1]>0) gptsRZ->SetPoint(ipt,cluglo[2],rad);
153 else gptsRZ->SetPoint(ipt,cluglo[2],-rad);
154 ipt++;
29d63bb9 155 }
7285ac7a 156 hmod[lay]->Fill(mod);
157 hzl[lay]->Fill(recp->GetDetLocalZ());
158 hxl[lay]->Fill(recp->GetDetLocalX());
159 hzg[lay]->Fill(cluglo[2]);
160 hyg[lay]->Fill(cluglo[1]);
161 hxg[lay]->Fill(cluglo[0]);
162 hr[lay]->Fill(rad);
163 hphi[lay]->Fill(phi);
164 hq[lay]->Fill(recp->GetQ());
5801bd60 165 hdrtime[lay]->Fill(recp->GetDriftTime());
166 hzphi[lay]->Fill(phi,cluglo[2]);
29d63bb9 167 }
168 }
169 }
170 }
7285ac7a 171
29d63bb9 172 TCanvas **c=new TCanvas*[6];
173 Char_t ctit[30];
174 for(Int_t iLay=0;iLay<6;iLay++){
175 sprintf(name,"can%d",iLay+1);
176 sprintf(ctit,"Layer %d",iLay+1);
177 c[iLay]=new TCanvas(name,ctit,1200,900);
178 c[iLay]->Divide(3,3,0.001,0.001);
179 c[iLay]->cd(1);
180 hmod[iLay]->Draw();
181 c[iLay]->cd(2);
182 hxl[iLay]->Draw();
183 c[iLay]->cd(3);
184 hzl[iLay]->Draw();
185 c[iLay]->cd(4);
186 hxg[iLay]->Draw();
187 c[iLay]->cd(5);
188 hyg[iLay]->Draw();
189 c[iLay]->cd(6);
190 hzg[iLay]->Draw();
191 c[iLay]->cd(7);
192 hr[iLay]->Draw();
193 c[iLay]->cd(8);
194 hphi[iLay]->Draw();
195 c[iLay]->cd(9);
196 hq[iLay]->Draw();
197 }
198
5801bd60 199 TCanvas* cdrtim=new TCanvas("cdrtim","SDD drift time",1000,600);
200 cdrtim->Divide(2,1);
201 cdrtim->cd(1);
202 hdrtime[2]->Draw();
203 cdrtim->cd(2);
204 hdrtime[3]->Draw();
205
206 gStyle->SetPalette(1);
207 TLatex* tstat=new TLatex();
208 tstat->SetNDC();
209 TCanvas* cspd=new TCanvas("cspd","SPD",1000,600);
210 cspd->Divide(2,1);
211 cspd->cd(1);
212 hzphi[0]->Draw("colz");
213 tstat->DrawLatex(0.6,0.92,Form("# Clusters = %d",int(hzphi[0]->GetEntries())));
214 cspd->cd(2);
215 hzphi[1]->Draw("colz");
216 tstat->DrawLatex(0.6,0.92,Form("# Clusters = %d",int(hzphi[1]->GetEntries())));
217
218 TCanvas* csdd=new TCanvas("csdd","SDD",1000,600);
219 csdd->Divide(2,1);
220 csdd->cd(1);
221 hzphi[2]->Draw("colz");
222 tstat->DrawLatex(0.6,0.92,Form("# Clusters = %d",int(hzphi[2]->GetEntries())));
223 csdd->cd(2);
224 hzphi[3]->Draw("colz");
225 tstat->DrawLatex(0.6,0.92,Form("# Clusters = %d",int(hzphi[3]->GetEntries())));
226
227 TCanvas* cssd=new TCanvas("cssd","SSD",1000,600);
228 cssd->Divide(2,1);
229 cssd->cd(1);
230 hzphi[4]->Draw("colz");
231 tstat->DrawLatex(0.6,0.92,Form("# Clusters = %d",int(hzphi[4]->GetEntries())));
232 cssd->cd(2);
233 hzphi[5]->Draw("colz");
234 tstat->DrawLatex(0.6,0.92,Form("# Clusters = %d",int(hzphi[5]->GetEntries())));
235
29d63bb9 236 TCanvas *cev0;
7285ac7a 237 sprintf(ctit,"Event %d XY",nevfordisp);
238 cev0=new TCanvas("cev0",ctit,600,600);
239 if(gptsXY->GetN()>0){
240 gptsXY->SetMarkerStyle(7);
241 gptsXY->SetTitle(0);
242 gptsXY->Draw("AP");
243 gptsXY->GetXaxis()->SetTitle("Xglob");
244 gptsXY->GetYaxis()->SetTitle("Yglob");
245 }
29d63bb9 246
247 TCanvas *cev1;
7285ac7a 248 sprintf(ctit,"Event %d Zr",nevfordisp);
249 cev1=new TCanvas("cev1",ctit,600,600);
250 if(gptsRZ->GetN()>0){
251 gptsRZ->SetMarkerStyle(7);
252 gptsRZ->SetTitle(0);
253 gptsRZ->Draw("AP");
254 gptsRZ->GetXaxis()->SetTitle("Zglob");
255 gptsRZ->GetYaxis()->SetTitle("Radius");
256 }
29d63bb9 257
258 return 0;
259}
260
261