1 #if !defined(__CINT__) || defined(__MAKECINT__)
3 #include <TClassTable.h>
6 #include <TGeoManager.h>
8 #include <TInterpreter.h>
9 #include "AliCDBManager.h"
10 #include "AliGeomManager.h"
11 #include "AliHeader.h"
13 #include "AliITSDetTypeRec.h"
14 #include "AliITSgeom.h"
15 #include "AliITSRecPoint.h"
19 Int_t ShowITSRecPoints(){
20 ///////////////////////////////////////////////////////////////////////
21 // Macro to check clusters in the 6 ITS layers //
23 // 6 canvases with 9 plots each (1 canvas for each layer) //
24 // 3 canvases with cluster XY coordinates for the first 3 events //
25 ///////////////////////////////////////////////////////////////////////
27 if (gClassTable->GetID("AliRun") < 0) {
28 gInterpreter->ExecuteMacro("loadlibs.C");
31 AliCDBManager* man = AliCDBManager::Instance();
32 if (!man->IsDefaultStorageSet()) {
33 printf("Setting a local default storage and run number 0\n");
34 man->SetDefaultStorage("local://$ALICE_ROOT");
38 printf("Using deafult storage \n");
43 AliGeomManager::LoadGeometry("geometry.root");
46 AliRunLoader* rl = AliRunLoader::Open("galice.root");
48 cerr<<"Can not open session RL=NULL"<< endl;
51 Int_t retval = rl->LoadHeader();
53 cerr<<"LoadHeader returned error"<<endl;
58 AliITSLoader* ITSloader = (AliITSLoader*) rl->GetLoader("ITSLoader");
60 cerr<<"ITS loader not found"<<endl;
63 ITSloader->LoadRecPoints("read");
64 AliITSgeom *geom = ITSloader->GetITSgeom();
66 Float_t cluglo[3]={0.,0.,0.};
67 AliITSDetTypeRec* detTypeRec = new AliITSDetTypeRec();
68 detTypeRec->SetITSgeom(geom);
69 detTypeRec->SetDefaults();
71 Int_t modmin=geom->GetStartDet(0);
72 Int_t modmax=geom->GetLastDet(2);
73 Int_t totmod=modmax-modmin;
74 Float_t xlim[6]={4.5,7.5,16.,26.,40.,45.};
75 Float_t zlim[6]={15.,15.,22.,30.,45.,55.};
77 TH1F* hlayer=new TH1F("hlayer","",6,-0.5,5.5);
78 TH1F** hmod=new TH1F*[6];
79 TH1F** hxl=new TH1F*[6];
80 TH1F** hzl=new TH1F*[6];
81 TH1F** hxg=new TH1F*[6];
82 TH1F** hyg=new TH1F*[6];
83 TH1F** hzg=new TH1F*[6];
84 TH1F** hr=new TH1F*[6];
85 TH1F** hphi=new TH1F*[6];
86 TH1F** hq=new TH1F*[6];
89 for(Int_t iLay=0;iLay<6;iLay++){
90 sprintf(name,"hmod%d",iLay+1);
91 hmod[iLay]=new TH1F(name,"",totmod,modmin-0.5,modmax+0.5);
92 hmod[iLay]->GetXaxis()->SetTitle("Module");
93 hmod[iLay]->GetXaxis()->CenterTitle();
94 sprintf(name,"hxloc%d",iLay+1);
95 hxl[iLay]=new TH1F(name,"",100,-4.,4.);
96 hxl[iLay]->GetXaxis()->SetTitle("Xloc (cm)");
97 hxl[iLay]->GetXaxis()->CenterTitle();
98 sprintf(name,"hzloc%d",iLay+1);
99 hzl[iLay]=new TH1F(name,"",100,-4.,4.);
100 hzl[iLay]->GetXaxis()->SetTitle("Zloc (cm)");
101 hzl[iLay]->GetXaxis()->CenterTitle();
102 sprintf(name,"hxgl%d",iLay+1);
103 hxg[iLay]=new TH1F(name,"",100,-xlim[iLay],xlim[iLay]);
104 hxg[iLay]->GetXaxis()->SetTitle("Xglob (cm)");
105 hxg[iLay]->GetXaxis()->CenterTitle();
106 sprintf(name,"hygl%d",iLay+1);
107 hyg[iLay]=new TH1F(name,"",100,-xlim[iLay],xlim[iLay]);
108 hyg[iLay]->GetXaxis()->SetTitle("Yglob (cm)");
109 hyg[iLay]->GetXaxis()->CenterTitle();
110 sprintf(name,"hzgl%d",iLay+1);
111 hzg[iLay]=new TH1F(name,"",100,-zlim[iLay],zlim[iLay]);
112 hzg[iLay]->GetXaxis()->SetTitle("Zglob (cm)");
113 hzg[iLay]->GetXaxis()->CenterTitle();
114 sprintf(name,"hr%d",iLay+1);
115 hr[iLay]=new TH1F(name,"",100,0.,50.);
116 hr[iLay]->GetXaxis()->SetTitle("r (cm)");
117 hr[iLay]->GetXaxis()->CenterTitle();
118 sprintf(name,"hphi%d",iLay+1);
119 hphi[iLay]=new TH1F(name,"",100,-TMath::Pi(),TMath::Pi());
120 hphi[iLay]->GetXaxis()->SetTitle("#varphi (rad)");
121 hphi[iLay]->GetXaxis()->CenterTitle();
122 sprintf(name,"hq%d",iLay+1);
123 hq[iLay]=new TH1F(name,"",100,0.,300.);
124 hq[iLay]->GetXaxis()->SetTitle("Charge (keV)");
125 hq[iLay]->GetXaxis()->CenterTitle();
128 TGraph **gpts=new TGraph*[3];
129 TGraph2D **gpts3d=new TGraph2D*[3];
130 for(Int_t i=0;i<3;i++){
131 gpts[i]=new TGraph(0);
132 gpts3d[i]=new TGraph2D(0);
134 Int_t totev=rl->GetNumberOfEvents();
135 printf("Total Number of events = %d\n",totev);
137 for(Int_t iev=0;iev<totev;iev++){
139 TTree *TR = ITSloader->TreeR();
140 TClonesArray *ITSrec = detTypeRec->RecPoints();
143 branch = ITSloader->TreeR()->GetBranch("ITSRecPoints");
144 if(branch)branch->SetAddress(&ITSrec);
146 Int_t nparticles = rl->GetHeader()->GetNtrack();
147 cout<<"Event #"<<iev<<" #Particles="<<nparticles<<endl;
151 for(Int_t subd=0;subd<3;subd++){
153 Int_t first = geom->GetStartDet(subd);
154 Int_t last = geom->GetLastDet(subd);
156 for (Int_t mod=first; mod<=last; mod++){
157 detTypeRec->ResetRecPoints();
158 branch->GetEvent(mod);
159 Int_t nrecp = ITSrec->GetEntries();
161 for(Int_t irec=0;irec<nrecp;irec++) {
162 AliITSRecPoint *recp = (AliITSRecPoint*)ITSrec->At(irec);
163 Int_t lay=recp->GetLayer();
165 recp->GetGlobalXYZ(cluglo);
166 Float_t rad=TMath::Sqrt(cluglo[0]*cluglo[0]+cluglo[1]*cluglo[1]);
167 Float_t phi=TMath::ATan2(cluglo[1],cluglo[0]);
169 gpts[iev]->SetPoint(ipt,cluglo[0],cluglo[1]);
170 gpts3d[iev]->SetPoint(ipt,cluglo[0],cluglo[1],cluglo[2]);
173 hmod[lay]->Fill(mod);
174 hzl[lay]->Fill(recp->GetDetLocalZ());
175 hxl[lay]->Fill(recp->GetDetLocalX());
176 hzg[lay]->Fill(cluglo[2]);
177 hyg[lay]->Fill(cluglo[1]);
178 hxg[lay]->Fill(cluglo[0]);
180 hphi[lay]->Fill(phi);
181 hq[lay]->Fill(recp->GetQ());
187 TCanvas **c=new TCanvas*[6];
189 for(Int_t iLay=0;iLay<6;iLay++){
190 sprintf(name,"can%d",iLay+1);
191 sprintf(ctit,"Layer %d",iLay+1);
192 c[iLay]=new TCanvas(name,ctit,1200,900);
193 c[iLay]->Divide(3,3,0.001,0.001);
215 cev0=new TCanvas("cev0","Event 0",600,600);
216 gpts[0]->SetMarkerStyle(7);
217 gpts[0]->SetTitle(0);
221 cev1=new TCanvas("cev1","Event 1",600,600);
222 gpts[1]->SetMarkerStyle(7);
223 gpts[1]->SetTitle(0);
227 cev2=new TCanvas("cev2","Event 2",600,600);
228 gpts[2]->SetMarkerStyle(7);
229 gpts[2]->SetTitle(0);