]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/UPGRADE/readHit.C
Added version tailored for pp (AliTrackletTaskMultipp) with additional
[u/mrichter/AliRoot.git] / ITS / UPGRADE / readHit.C
1
2 void readHit(){
3   gROOT->SetStyle("Plain");
4
5   gSystem->Load("libITSUpgradeBase");
6   gSystem->Load("libITSUpgradeSim");
7
8   TH2F *xyGlob = new TH2F("xyGlob"," X - Y Global coordinates ",100,-50,50,100,-50,50);
9   xyGlob->SetXTitle("cm");
10   xyGlob->SetMarkerStyle(7);
11   TH1F *zGlob  = new TH1F("zGlob", " Z Global coordinates ",200, -100,100 );
12   zGlob->SetXTitle("cm");
13
14   Int_t nbins=100;
15   Int_t xmin=0;
16   Int_t xmax=0.1;//00*1e-09;
17
18   const Int_t nLayers = 6;
19
20   TH1D *hDeLoss[nLayers];
21   for(Int_t i=0; i< nLayers; i++ ) {
22     hDeLoss[i] = new TH1D(Form("hDeLossl%i",i),Form("E loss distribution [ Layer %i] ",i),nbins,xmin,xmax);
23     hDeLoss[i]->SetXTitle("GeV");
24   }
25
26   gAlice=NULL;
27   AliRunLoader* runLoader = AliRunLoader::Open("galice.root");
28   runLoader->LoadgAlice();
29
30   gAlice = runLoader->GetAliRun();
31
32   runLoader->LoadHeader();
33   runLoader->LoadKinematics();
34   runLoader->LoadSDigits();
35   runLoader->LoadHits();
36
37   AliLoader *dl = runLoader->GetDetectorLoader("ITS");
38
39   //HIT INIT
40
41   TTree *hitTree = 0x0;
42   TClonesArray *hitList=new TClonesArray("AliITShit");
43
44   AliITSsegmentationUpgrade *segmentation = new AliITSsegmentationUpgrade();
45   for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
46  
47     runLoader->GetEvent(iEvent);
48     
49     hitTree=dl->TreeH();
50     hitTree->SetBranchAddress("ITSupgrade",&hitList);
51     for(Int_t iEnt=0;iEnt<hitTree->GetEntries();iEnt++){//entries loop degli hits
52       hitTree->GetEntry(iEnt);
53       for(Int_t iHit=0; iHit<hitList->GetEntries();iHit++){
54               
55         AliITShit *pHit = (AliITShit*)hitList->At(iHit);
56   
57         if(pHit->GetParticle()->IsPrimary()){
58           Double_t xg,yg,zg=0.;
59           pHit->GetPositionG(xg,yg,zg);
60           xyGlob->Fill(xg,yg);
61           zGlob->Fill(zg);
62           hDeLoss[pHit->GetModule()]->Fill(pHit->GetIonization());
63         } // is primary
64       }//loop hit 
65     }//entryloopHitList
66         
67   }//event loop
68
69   TCanvas *xyCanv =  new TCanvas("xyCanv","Hit X-Y positions",500,500);
70   xyCanv->cd();
71   xyGlob->Draw();
72   TCanvas *zCanv =  new TCanvas("zCanv","Hit Z positions",500,500);
73   zCanv->cd();
74   zGlob->Draw();
75
76   TCanvas *c = new TCanvas("c","E loss  distribution per layer",1000,800);
77   c->Divide(3,2);
78   for(Int_t ip =1; ip<=6; ip++){
79     c->cd(ip);
80     hDeLoss[ip-1]->Draw();
81   }
82
83 }