1 void AliITSAnalizeSPDHits(TString hfn="galice.root",Int_t mod=-1,
3 // Macro to analize hits in the SPD to chatch posible problems
5 // Dynamically link some shared libs
6 if (gClassTable->GetID("AliRun") < 0) {
7 gROOT->LoadMacro("loadlibs.C");
11 delete AliRunLoader::Instance();
16 gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSstandard.C");
18 AliCDBManager* man = AliCDBManager::Instance();
19 if (!man->IsDefaultStorageSet()) {
20 printf("Setting a local default storage and run number 0\n");
21 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
24 printf("Using deafult storage \n");
27 TString geof(gSystem->DirName(hfn));
28 geof += "/geometry.root";
29 TGeoManager::Import(geof.Data());
31 cout<<"geometry not found\n";
36 AliRunLoader *rl = AccessFile(hfn); // Set up to read in Data
37 Int_t retval = rl->LoadHeader();
39 cerr<<"AliITSPrintHits.C : LoadHeader returned error"<<endl;
43 AliITSLoader* ITSloader = (AliITSLoader*) rl->GetLoader("ITSLoader");
46 cerr<<"AliITSPrintHits.C : ITS loader not found"<<endl;
50 ITSloader->LoadHits("read");
51 AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
53 cout << "Error: no ITS found. Aborting"<<endl;
56 //cout << ITS << endl;
57 AliITSInitGeometry *initgeom = new AliITSInitGeometry(ITS->GetMajorVersion(),ITS->GetMinorVersion());
58 //cout << initgeom << endl;
59 AliITSgeom *geom = initgeom->CreateAliITSgeom();
61 cout << "Error: not AliITSgeom object found."<<endl;
64 ITSloader->SetITSgeom(geom);
67 Int_t evNumber2 = AliRunLoader::GetNumberOfEvents();
73 Int_t mod2 = geom->GetIndexMax();
82 for(i=0;i<161;i++) zbin[i] = 425.0E-4;
83 zbin[32] = zbin[64] = zbin[96] = zbin[128] = 625.0E-4;
85 for(i=1;i<161;i++) zbin[i] += zbin[i-1];
86 TH1I *phiDistribution1 = new TH1I("phiDistribution1",
87 "Phi Distribution for the inner most layer of the SPD",
89 TH2I *detCoverage1 = new TH2I("detCoverage1",
90 "The SPD layer 1 cell coverage summed over the first ladder per sector",
91 160,(Double_t *)zbin,256,-0.64,+0.64);
92 TH2I *detCoverage1a = new TH2I("detCoverage1a",
93 "The SPD layer 1 cell coverage sum over the second ladder per sector",
94 160,(Double_t *)zbin,256,-0.64,+0.64);
95 TH2I *detThicknessZ1 = new TH2I("detThicknessZ1",
96 "Hit local y distribution as a function of z",
97 160,(Double_t*)zbin,200,-100.E-4,+100.E-4);
98 TH2I *detThicknessX1 = new TH2I("detThicknessX1",
99 "Hit local y distribution as a function of x",
100 256,-0.64,+0.64,200,-100.E-4,+100.E-4);
101 TH1I *phiDistribution2 = new TH1I("phiDistribution2",
102 "Phi Distribution for the outer most layer of the SPD",
104 TH2I *detCoverage2 = new TH2I("detCoverage2",
105 "The SPD layer 2 cell coverage summed over all but the forth ladder per sector",
106 160,(Double_t *)zbin,256,-0.64,+0.64);
107 TH2I *detCoverage2a = new TH2I("detCoverage2a",
108 "The SPD layer 2 cell coverage summed over all forth ladder per sector",
109 160,(Double_t *)zbin,256,-0.64,+0.64);
110 TH2I *detThicknessZ2 = new TH2I("detThicknessZ2",
111 "Hit local y distribution as a function of z",
112 160,(Double_t*)zbin,200,-100.E-4,+100.E-4);
113 TH2I *detThicknessX2 = new TH2I("detThicknessX2",
114 "Hit local y distribution as a function of x",
115 256,-0.64,+0.64,200,-100.E-4,+100.E-4);
116 TH2I *xySpace = new TH2I("xySpace",
117 "ALICE global coorinate location of hits in X,y",
118 100,-8.0,+8.0,100,-8.0,+8.0);
119 TH2I *zrSpace = new TH2I("zrSpace",
120 "ALICE global coorinate location of hits in z,r",
121 100,-15.0,+15.0,100,0.0,+8.0);
122 Double_t xg,yg,zg,xl,yl,zl,phi;
123 Int_t nmodules,size=-1;
124 Int_t event,m,i,i2,hit,trk,lay,lad,det;
125 for(event = evNumber1; event < evNumber2; event++){
126 //cout<<"Processing event "<<event<<endl;
128 ITS->InitModules(size,nmodules);
129 ITS->FillModules(event,0,-1," "," ");
130 for(m=mod1;m<mod2;m++)if(geom->GetModuleType(m)==(AliITSDetector)(0)){
131 i2 = (ITS->GetModule(m))->GetNhits();
132 //cout << "Event=" << event << " module=" << m <<
133 // " Number of Hits=" << i2 <<endl;
135 trk = (ITS->GetModule(m))->GetHitTrackIndex(i);
136 hit = (ITS->GetModule(m))->GetHitHitIndex(i);
137 hp = (ITS->GetModule(m))->GetHit(i);
138 hp->GetPositionG(xg,yg,zg);
139 hp->GetPositionL(xl,yl,zl);
140 geom->GetModuleId(m,lay,lad,det);
141 phi = TMath::ATan2(yg,xg)*TMath::RadToDeg();
142 if(phi<0.0) phi+=360.0;
145 phiDistribution1->Fill(phi,1.0);
146 if(lad%2==1) detCoverage1->Fill(zl,xl,1.0);
147 if(lad%2==0) detCoverage1a->Fill(zl,xl,1.0);
148 detThicknessZ1->Fill(zl,yl,1.0);
149 detThicknessX1->Fill(xl,yl,1.0);
152 phiDistribution2->Fill(phi,1.0);
153 if(lad%4!=0) detCoverage2->Fill(zl,xl,1.0);
154 if(lad%4==0) detCoverage2a->Fill(zl,xl,1.0);
155 detThicknessZ2->Fill(zl,yl,1.0);
156 detThicknessX2->Fill(xl,yl,1.0);
165 cout << "Creating pad"<<endl;
167 TCanvas *c0 = new TCanvas("c0","SPD Hits Tests",262,50,700,534);
172 phiDistribution2->Draw();
174 phiDistribution1->Draw();
175 TPad *pad2 = c0->cd(2);
178 TPad *pad21 = new TPad("pad21","CoverageZ",0.34,0.875,0.65,1.0);
181 pad21->Range(0,0,1,1);
183 detCoverage2->Draw();
186 TPad *pad22 = new TPad("pad22","CoverageZa",0.34,0.75,0.65,0.875);
189 pad22->Range(0,0,1,1);
191 detCoverage2a->Draw();
194 TPad *pad23 = new TPad("pad23","ThicknessZ",0.34,0.625,0.65,0.75);
197 pad23->Range(0,0,1,1);
199 detThicknessZ2->Draw();
202 TPad *pad24 = new TPad("pad24","ThicknessX",0.34,0.50,0.65,0.625);
205 pad24->Range(0,0,1,1);
207 detThicknessX2->Draw();
211 TPad *pad5 = c0->cd(5);
214 TPad *pad51 = new TPad("pad51","CoverageZ",0.34,0.375,0.65,0.50);
217 pad51->Range(0,0,1,1);
219 detCoverage1->Draw();
222 TPad *pad52 = new TPad("pad52","CoverageZa",0.34,0.25,0.65,0.375);
225 pad52->Range(0,0,1,1);
227 detCoverage1a->Draw();
230 TPad *pad53 = new TPad("pad53","ThicknessZ",0.34,0.125,0.65,0.25);
233 pad53->Range(0,0,1,1);
235 detThicknessZ1->Draw();
238 TPad *pad54 = new TPad("pad54","ThicknessX",0.34,0.00,0.65,0.125);
241 pad54->Range(0,0,1,1);
243 detThicknessX1->Draw();
246 TList *tvTreeList = new TList;
247 TTree *tvTree = (TTree *) gROOT->FindObject("TreeH");
248 tvTreeList->Add(tvTree);
250 tvTree->Draw("ITS.fY:ITS.fX","ITS.fModule<240","", 100000, 0);
252 tvTree->Draw("ITS.fX*ITS.fX+ITS.fY*ITS.fY:ITS.fZ","ITS.fModule<240","",