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