]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/RICHchamberView.C
Avoid warning.
[u/mrichter/AliRoot.git] / RICH / RICHchamberView.C
1 void RICHchamberView (Int_t evNumber=0, Int_t ChamberView = 3) 
2 {
3
4 /////////////////////////////////////////////////////////////////////////
5
6     gClassTable->GetID("AliRun");
7
8
9 // Dynamically link some shared libs
10  
11     if (gClassTable->GetID("AliRun") < 0) {
12       gROOT->LoadMacro("loadlibs.C");
13       loadlibs();
14     }else {
15       delete gAlice;
16       gAlice = 0;
17    }
18
19     gAlice=0;
20     
21 // Connect the Root Galice file containing Geometry, Kine and Hits
22     
23     TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
24     if (!file) file = new TFile("galice.root","UPDATE");
25     
26 // Get AliRun object from file or create it if not on file
27     
28     if (!gAlice) {
29       gAlice = (AliRun*)file->Get("gAlice");
30       if (gAlice) printf("AliRun object found on file %d \n",gAlice);
31       if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
32     }
33     else {
34       delete gAlice;
35       gAlice = (AliRun*)file->Get("gAlice");
36       if (gAlice) printf("AliRun object found on file\n");
37       if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
38     }
39
40    TH2F *ChView = new TH2F("ChView","RICH DISPLAY",160,0,160,144,0,144);
41
42    gStyle->SetPalette(1);
43
44    TCanvas *view = new TCanvas("Display","ALICE RICH Display",0,0,1200,750);
45
46    ChView->SetStats(0);
47
48    ChView->SetMaximum(100);
49
50    Int_t Nevents = gAlice->GetEventsPerRun();
51
52    printf(" Events in Run: %d\n",Nevents);
53
54    Int_t ich = ChamberView - 1;
55
56    AliRICH *RICH  = (AliRICH*)gAlice->GetDetector("RICH");
57    
58    AliRICHSegmentationV0*  segmentation;
59    AliRICHChamber*       chamber;
60    
61    chamber = &(RICH->Chamber(ich));
62    segmentation=(AliRICHSegmentationV0*) chamber->GetSegmentationModel(ich);
63    
64    Int_t NpadX = segmentation->Npx();                 // number of pads on X
65    Int_t NpadY = segmentation->Npy();                 // number of pads on Y
66    
67    printf(" NpadX: %d NpadY: %d \n",NpadX,NpadY);
68    
69    //   Start loop over events 
70
71    for (int nev=evNumber; nev<= Nevents; nev++) {
72
73        Int_t nparticles = gAlice->GetEvent(nev);
74
75        if (nparticles == -1) break;
76
77        printf("Particles:%d\n",nparticles);
78
79        gAlice->ResetDigits();
80
81        gAlice->TreeD()->GetEvent(0);
82
83        printf("gAlice D: %x\n",gAlice);
84
85        TClonesArray *Digits = RICH->DigitsAddress(ich);    //  Raw clusters branch
86
87        Int_t ndigits = Digits->GetEntriesFast();
88
89        printf("Digits:%d %d\n",Digits,ndigits);
90
91        for (Int_t hit=0;hit<ndigits;hit++) {
92
93          AliRICHDigit *dHit = (AliRICHDigit*) Digits->UncheckedAt(hit);
94
95          //      printf(" dHit %d\n",dHit);
96
97          Int_t qtot = dHit->Signal();                       // charge
98          Int_t ipx  = dHit->PadX() + NpadX/2;               // pad number on X
99          Int_t ipy  = dHit->PadY() + NpadY/2;               // pad number on Y
100
101          ChView -> Fill((Float_t)ipx,(Float_t)ipy,(Float_t)qtot); 
102
103          //      printf(" X: %d Y: %d Q: %d\n",ipx,ipy,qtot);
104
105        }
106
107        
108               
109        gAlice->TreeR()->GetEvent(0);
110        Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
111        printf("ich: %d nent: %d\n",ich,nent);
112        gAlice->TreeR()->GetEvent(nent-1);
113
114        TClonesArray *RecRings = RICH->RecHitsAddress1D(ich);
115
116        printf(" Ring Pointer: %x\n",RecRings);
117
118        Int_t nRecRings = RecRings->GetEntriesFast();
119  
120        printf(" nRings: %d\n",nRecRings);
121        
122
123        for (Int_t ring=0;ring<nRecRings;ring++) {
124
125          AliRICHRecHit1D *recHit1D = (AliRICHRecHit1D*) RecRings->UncheckedAt(ring);
126
127          printf(" Pointer to PatRec: %d \n",recHit1D);
128
129          Float_t r_omega = recHit1D->fOmega;                  // Cerenkov angle
130          Float_t *cer_pho = recHit1D->fCerPerPhoton;        // Cerenkov angle per photon
131          Int_t *padsx = recHit1D->fPadsUsedX;           // Pads Used fo reconstruction (x)
132          Int_t *padsy = recHit1D->fPadsUsedY;           // Pads Used fo reconstruction (y)
133          Int_t goodPhotons = recHit1D->fGoodPhotons;    // Number of pads used for reconstruct
134
135          printf(" Theta Cerenkov %d : %f NgoodPhotons: %d\n",ring,r_omega,goodPhotons);
136        }
137
138        
139        ChView->Draw("colz");
140        
141        view->Modified();
142        view->Update();
143        
144        gSystem->Sleep(1000);
145        
146        cout << endl;
147        
148        ChView->Reset();
149        
150    }
151    
152    printf("\nEnd of macro\n");
153    printf("**********************************\n");
154    
155 }
156
157