fe4da5cc |
1 | void RICH (Int_t evNumber=0) |
2 | { |
3 | ///////////////////////////////////////////////////////////////////////// |
4 | // This macro is a small example of a ROOT macro |
5 | // illustrating how to read the output of GALICE |
6 | // for RICH |
7 | // |
8 | // Root > .L RICH.C //this loads the macro in memory |
9 | // Root > RICH(); //by default process first event |
10 | // Root > RICH(2); //process third event |
11 | ///////////////////////////////////////////////////////////////////////// |
12 | |
13 | |
14 | // Dynamically link some shared libs |
15 | if (gClassTable->GetID("AliRun") < 0) { |
16 | gSystem->Load("libGeant3Dummy.so"); // a dummy version of Geant3 |
17 | gSystem->Load("PHOS/libPHOSdummy.so"); // the standard Alice classes |
18 | gSystem->Load("libgalice.so"); // the standard Alice classes |
19 | } |
20 | |
21 | // Connect the Root Galice file containing Geometry, Kine and Hits |
22 | TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root"); |
23 | if (!file) file = new TFile("galice.root"); |
24 | |
25 | // Get AliRun object from file or create it if not on file |
26 | if (!gAlice) { |
27 | gAlice = (AliRun*)file->Get("gAlice"); |
28 | if (gAlice) printf("AliRun object found on file\n"); |
29 | if (!gAlice) gAlice = new AliRun("gAlice","Alice test program"); |
30 | } |
31 | |
32 | // Import the Kine and Hits Trees for the event evNumber in the file |
33 | Int_t nparticles = gAlice->GetEvent(evNumber); |
34 | if (nparticles <= 0) return; |
35 | Float_t x,y,z,mass,e; |
36 | Int_t nbytes = 0; |
37 | Int_t j,hit,ipart; |
38 | Int_t nhits; |
39 | Int_t sector,plane; |
40 | GParticle *particle; |
41 | AliTPChit *tpcHit; |
42 | AliTRDhit *trdHit; |
43 | |
44 | // Get pointers to Alice detectors and Hits containers |
45 | AliRICH *RICH = gAlice->GetDetector("RICH"); |
46 | TClonesArray *Particles = gAlice->Particles(); |
47 | if (RICH) { |
48 | TClonesArray *RICHhits = RICH->Hits(); |
49 | TClonesArray *Mips = RICH->Mips(); |
50 | TClonesArray *Ckovs = RICH->Ckovs(); |
51 | TClonesArray *Padhits = RICH->Padhits(); |
52 | } |
53 | printf("RICHhits, Mips, Ckovs, Pad %d, %d, %d, %d\n",RICHhits,Mips,Ckovs,Padhits); |
54 | |
55 | TTree *TH = gAlice->TreeH(); |
56 | Int_t ntracks = TH->GetEntries(); |
57 | |
58 | // Start loop on tracks in the hits containers |
59 | for (Int_t track=0; track<ntracks;track++) { |
60 | gAlice->ResetHits(); |
61 | nbytes += TH->GetEvent(track); |
62 | Int_t nrich=RICHhits->GetEntriesFast(); |
63 | if(nrich) { |
64 | printf("Number of hit entries %d\n",nrich); |
65 | printf("Number of Mips entries %d\n",Mips->GetEntriesFast()); |
66 | printf("Number of Ckovs entries %d\n",Ckovs->GetEntriesFast()); |
67 | printf("Number of Padhits entries %d\n",Padhits->GetEntriesFast()); |
68 | } |
69 | } |
70 | } |