]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/UPGRADE/readRecPoint.C
Removed obsolete scripts
[u/mrichter/AliRoot.git] / ITS / UPGRADE / readRecPoint.C
1 void readRecPoint(){
2   gSystem->Load("libITSUpgradeBase");
3   gSystem->Load("libITSUpgradeSim");
4   gSystem->Load("libITSUpgradeRec");
5   gROOT->SetStyle("Plain");
6   gStyle->SetOptStat(1111111);
7   Int_t nbins=100;
8   Int_t xmin=0;
9   Int_t xmax=50000;//00*1e-09;
10
11
12   AliITSsegmentationUpgrade *seg = new AliITSsegmentationUpgrade();
13   if(!seg){
14     printf("no segmentation info available... Exiting");
15     return;
16   }
17   Int_t nLayers = seg->GetNLayers();
18
19   TH1D **hNel, **hNsect;
20   hNel = new TH1D[nLayers]; 
21   hNsect = new TH1D[nLayers]; 
22  // [nLayers];
23   for(Int_t i=0; i< nLayers; i++ ) {
24   hNel[i] = new TH1D(Form("hNel%i",i),Form("cluster charge distribution [ Layer %i] ",i),nbins,xmin,xmax);
25   hNel[i]->SetXTitle("N electrons");
26   hNsect[i] = new TH1D(Form("hNsect%i",i),Form("cluster entries per sector [ Layer %i] ",i),seg->GetNSectors(),-0.5,seg->GetNSectors()-0.5);
27   hNsect[i]->SetXTitle("Sector Number");
28   hNsect[i]->SetYTitle("# clusters");
29   hNsect[i]->SetMinimum(0);
30   }
31
32   TH1D * type = new TH1D("hCluType"," cluster type" , 50,0,15 );
33
34   TH2F *xyGlob = new TH2F("xyGlob"," X - Y Global coordinates ",100,-50,50,100,-50,50);
35   xyGlob->SetXTitle("cm"); 
36   xyGlob->SetMarkerStyle(7); 
37   TH1F *zGlob  = new TH1F("zGlob", " Z Global coordinates ",200, -50,50 );
38   zGlob->SetXTitle("cm"); 
39
40   gAlice=NULL;
41   AliRunLoader* runLoader = AliRunLoader::Open("galice.root");
42   runLoader->LoadgAlice();
43
44   gAlice = runLoader->GetAliRun();
45
46   runLoader->LoadHeader();
47   runLoader->LoadKinematics();
48   runLoader->LoadRecPoints();
49
50   AliITSLoader *dl = (AliITSLoader*)runLoader->GetDetectorLoader("ITS");
51
52   TTree *clusTree = 0x0;
53
54   TClonesArray statITSCluster("AliITSRecPointU");
55
56   for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
57     runLoader->GetEvent(iEvent);
58     clusTree=dl->TreeR();
59     TClonesArray *ITSCluster = &statITSCluster;
60     TBranch* itsClusterBranch=clusTree->GetBranch("ITSRecPoints");
61     if (!itsClusterBranch) {
62       printf("can't get the branch with the ITS clusters ! \n");
63       return;
64     }
65     itsClusterBranch->SetAddress(&ITSCluster);
66     clusTree->GetEntry(0);   
67     Double_t charge=0.;
68     Int_t nCluster = ITSCluster->GetEntriesFast();
69     for(Int_t i=0; i<nCluster; i++){
70       AliITSRecPointU *recp = (AliITSRecPointU*)ITSCluster->UncheckedAt(i);
71       //  cout<<"layer "<<recp->GetLayer()<<endl;
72       Double_t xyz[3]={-1,-1,-1};
73       seg->DetToGlobal(recp->GetLayer(), recp->GetModule(), recp->GetDetLocalX(), recp->GetDetLocalZ(), xyz[0],xyz[1],xyz[2]) ;
74       xyGlob->Fill(xyz[0],xyz[1]);
75       zGlob->Fill(xyz[2]);
76       charge=recp->GetQ();
77       type->Fill(recp->GetType());
78       hNel[recp->GetLayer()]->Fill(charge);
79       hNsect[recp->GetLayer()]->Fill(recp->GetModule());
80     }
81   }
82   
83   Int_t size = 400;
84
85   TCanvas *xyCanv =  new TCanvas("xvCanvClus","RecPoint X-Y Positions",10,10,size,size);
86   xyCanv->cd();
87   xyGlob->Draw();
88
89   TCanvas *zCanv =  new TCanvas("zCanvClus","RecPoint Z Positions",size+20,10,size,size);
90   zCanv->cd();
91   zGlob->Draw();
92   TCanvas *typeCanv = new TCanvas("ClusType","Cluster type distribution",10,size+40,2*size+10,size);
93   type->Draw();
94
95
96   TCanvas *c = new TCanvas("c","Cluster charge distribution",900,0, 1000,550);
97    c->Divide(3,(nLayers/3)+1);
98   for(Int_t ip =1; ip<=nLayers; ip++){
99     c->cd(ip);
100     hNel[ip-1]->Draw();
101   }
102  
103   TCanvas *cS = new TCanvas("cS","clusters in sectors",900,640,1000,550);
104    cS->Divide(3,(nLayers/3)+1);
105   for(Int_t ip =1; ip<=nLayers; ip++){
106     cS->cd(ip);
107     hNsect[ip-1]->Draw();
108   } 
109 }
110