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