Fix in cluster coordinates calculation
[u/mrichter/AliRoot.git] / ITS / UPGRADE / readClusters.C
CommitLineData
b69620f8 1void readClusters(){
2
3 gSystem->Load("libITSUpgradeBase");
4 gSystem->Load("libITSUpgradeRec");
5 gROOT->SetStyle("Plain");
6
7 gAlice=NULL;
8 AliRunLoader* runLoader = AliRunLoader::Open("galice.root");
9 runLoader->LoadgAlice();
10
11 gAlice = runLoader->GetAliRun();
12
13 runLoader->LoadHeader();
14 runLoader->LoadKinematics();
15 runLoader->LoadRecPoints();
16
17 AliLoader *dl = runLoader->GetDetectorLoader("ITS");
18
19 AliGeomManager::LoadGeometry("geometry.root");
20 AliITSUGeomTGeo* gm = new AliITSUGeomTGeo(kTRUE);
21 Int_t nLayers = gm->GetNLayers();
5e375bb4 22 AliITSUClusterPix::SetGeom(gm);
b69620f8 23
24 TH2F *xyGlob = new TH2F("xyGlob"," X - Y Global coordinates ",500,-50,50,500,-50,50);
25 xyGlob->SetXTitle("cm");
26 xyGlob->SetMarkerStyle(7);
27 TH1F *zGlob = new TH1F("zGlob", " Z Global coordinates ",200, -50,50 );
28 zGlob->SetXTitle("cm");
29
30
31 TTree * cluTree = 0x0;
32 TObjArray layerClus;
33
34 printf("N Events : %i \n",(Int_t)runLoader->GetNumberOfEvents());
35
36 for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
37 printf("\n Event %i \n",iEvent);
38 runLoader->GetEvent(iEvent);
39 // AliStack *stack = runLoader->Stack();
40 cluTree=dl->TreeR();
41 int nlr=0;
42 while(1) {
43 TBranch* br = cluTree->GetBranch(Form("ITSRecPoints%d",nlr));
44 if (!br) break;
45 TClonesArray* clr = 0;
46 br->SetAddress(&clr);
47 layerClus.AddLast(clr);
48 nlr++;
49 }
50
51 printf(" tree entries: %d\n",cluTree->GetEntries());
52 cluTree->GetEntry(0);
53 //
54 for (int ilr=0;ilr<nlr;ilr++) {
55 TClonesArray* clr = (TClonesArray*)layerClus.At(ilr);
56 int nClu = clr->GetEntries();
57 printf("Layer %d : %d clusters\n",ilr,nClu);
58 //
59 for (int icl=0;icl<nClu;icl++) {
0e84ce67 60 AliITSUClusterPix *cl = (AliITSUClusterPix*)clr->At(icl);
61 cl->Print();
b69620f8 62 Double_t loc[3]={cl->GetX(),cl->GetY(),cl->GetZ()};
63 Double_t glob[3];
64 gm->LocalToGlobal(cl->GetVolumeId(),loc,glob);
0e84ce67 65 // printf("%d: mod %d: loc(%.4lf,%.4lf,%.4lf); glob(%.4lf,%.4lf,%.4lf); \n",icl,cl->GetVolumeId(),
66 // loc[0],loc[1],loc[2],glob[0],glob[1],glob[2]);
b69620f8 67 xyGlob->Fill(glob[0],glob[1]);
68 zGlob->Fill(glob[2]);
69
70 }
71 }
72 layerClus.Clear();
73 }//event loop
74
75 Int_t size = 400;
76
77 TCanvas *xyCanv = new TCanvas("xvCanvClus","RecPoint X-Y Positions",10,10,size,size);
78 xyCanv->cd();
79 xyGlob->Draw("P");
80
81 TCanvas *zCanv = new TCanvas("zCanvClus","RecPoint Z Positions",size+20,10,size,size);
82 zCanv->cd();
83 zGlob->Draw();
84
85}