]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/MUONDigitsTestnew.C
AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHi...
[u/mrichter/AliRoot.git] / MUON / MUONDigitsTestnew.C
CommitLineData
a897a37a 1#include "iostream.h"
2
fe4da5cc 3void MUONdigitsTestnew (Int_t evNumber1=0,Int_t evNumber2=0)
4{
5/////////////////////////////////////////////////////////////////////////
6// This macro is a small example of a ROOT macro
7// illustrating how to read the output of GALICE
8// and do some analysis.
9//
10/////////////////////////////////////////////////////////////////////////
11
12// Dynamically link some shared libs
13
14 if (gClassTable->GetID("AliRun") < 0) {
a897a37a 15 gROOT->LoadMacro("loadlibs.C");
16 loadlibs();
fe4da5cc 17 }
18
19// Connect the Root Galice file containing Geometry, Kine and Hits
20
21 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
22 if (!file) file = new TFile("galice.root");
23
24// Get AliRun object from file or create it if not on file
25
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//
33// Loop over events
34//
35 Int_t Nh=0;
36 Int_t Nh1=0;
37 for (int nev=0; nev<= evNumber2; nev++) {
38 Int_t nparticles = gAlice->GetEvent(nev);
39 cout << "nev " << nev <<endl;
40 cout << "nparticles " << nparticles <<endl;
41 if (nev < evNumber1) continue;
42 if (nparticles <= 0) return;
43
44 TTree *TH = gAlice->TreeH();
45 Int_t ntracks = TH->GetEntries();
46 cout<<"ntracks "<<ntracks<<endl;
47
48 Int_t nbytes = 0;
49
50 AliMUONdigit *MUONdigit;
51
52// Get pointers to Alice detectors and Digits containers
53 AliMUON *MUON = gAlice->GetDetector("MUON");
54 TClonesArray *Particles = gAlice->Particles();
55 TTree *TD = gAlice->TreeD();
56 Int_t nent=TD->GetEntries();
57 printf("Found %d entries in the tree (must be one per cathode per event!)\n",nent);
58 if (MUON) {
59 for (Int_t ich=0;ich<10;ich++) {
60 TClonesArray *MUONdigits = MUON->DigitsAddress(ich);
61 // printf ("MUONdigits %f \n",MUONdigits);
62
63 for (Int_t dig=1; dig<nent; dig++) {
64 gAlice->ResetDigits();
65 nbytes += TD->GetEvent(dig);
66 Int_t ndigits = MUONdigits->GetEntries();
67 printf("Found %d digits for cathode %d in chamber %d \n",ndigits,dig,ich+1);
68 for (Int_t digit=0;digit<ndigits;digit++) {
69 MUONdigit = (AliMUONdigit*)MUONdigits->UncheckedAt(digit);
70 // printf("%d %d %d %d %d\n",MUONdigit->fPadX,MUONdigit->fPadY,MUONdigit->fSignal,MUONdigit->fTracks[0],MUONdigit->fTcharges[0]);
71 }
72 }
73 }
74 } // end if MUON
75
76 } // event loop
77
78 cout<<"END test for digits "<<endl;
79
80 file->Close();
81}
82
83
84