3 void ITSdigitsTest (Int_t evNumber1=0,Int_t evNumber2=0)
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.
10 /////////////////////////////////////////////////////////////////////////
12 // Dynamically link some shared libs
14 if (gClassTable->GetID("AliRun") < 0) {
15 gROOT->LoadMacro("loadlibs.C");
19 // Connect the Root Galice file containing Geometry, Kine and Hits
21 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
22 if (!file) file = new TFile("galice.root");
25 // Get AliRun object from file or create it if not on file
28 gAlice = (AliRun*)file->Get("gAlice");
29 if (gAlice) printf("AliRun object found on file\n");
30 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
38 for (int nev=0; nev<= evNumber2; nev++) {
39 Int_t nparticles = gAlice->GetEvent(nev);
40 cout << "nev " << nev <<endl;
41 cout << "nparticles " << nparticles <<endl;
42 if (nev < evNumber1) continue;
43 if (nparticles <= 0) return;
45 TTree *TH = gAlice->TreeH();
46 Int_t ntracks = TH->GetEntries();
47 cout<<"ntracks "<<ntracks<<endl;
51 AliITSdigitSSD *ITSdigit;
53 // Get pointers to Alice detectors and Digits containers
54 AliITS *ITS = (AliITS*)gAlice->GetModule("ITS");
55 TClonesArray *Particles = gAlice->Particles();
56 TTree *TD = gAlice->TreeD();
58 Int_t nent=TD->GetEntries();
59 printf("Found %d entries in the tree (must be one per module per event!)\n",nent);
61 TObjArray *fBranches=TD->GetListOfBranches();
63 for (Int_t ich=0;ich<3;ich++) {
64 TBranch *branch = (TBranch*)fBranches->UncheckedAt(ich);
65 printf ("branch %p \n",branch);
66 printf ("branch %p entries %d \n",branch,branch->GetEntries());
67 TClonesArray *ITSdigits = ITS->DigitsAddress(ich);
68 printf ("ITSdigits %p \n",ITSdigits);
70 if (ich != 2) continue;
71 for (Int_t mod=1; mod<nent; mod++) {
72 //Int_t nmodules=2269;
73 //for (Int_t mod=nent-nmodules; mod<nent; mod++) {
75 nbytes += TD->GetEvent(mod+1);
76 //nbytes += branch->GetEvent(mod); this works as well
77 Int_t ndigits = ITSdigits->GetEntries();
78 if (ndigits) printf("Found %d digits for module %d in det type %d \n",ndigits,mod,ich+1);
80 if (!ndigits) continue;
82 for (Int_t digit=0;digit<ndigits;digit++) {
83 ITSdigit = (AliITSdigitSPD*)ITSdigits->UncheckedAt(digit);
84 printf("%d %d %d %d \n",ITSdigit->fCoord1,ITSdigit->fCoord2,ITSdigit->fTracks[0],ITSdigit->fTracks[1]);
87 for (Int_t digit=0;digit<ndigits;digit++) {
88 ITSdigit = (AliITSdigitSDD*)ITSdigits->UncheckedAt(digit);
89 printf("%d %d %d %d %f %f\n",ITSdigit->fCoord1,ITSdigit->fCoord2,ITSdigit->fSignal,ITSdigit->fTracks[0],ITSdigit->fTcharges[0],ITSdigit->fPhysics);
91 for (Int_t digit=0;digit<ndigits;digit++) {
92 ITSdigit = (AliITSdigitSSD*)ITSdigits->UncheckedAt(digit);
93 printf("%d %d %d %d %d %d \n",ITSdigit->fCoord1,ITSdigit->fCoord2,ITSdigit->fSignal,ITSdigit->fTracks[0],ITSdigit->fTracks[1],ITSdigit->fTracks[2]);
102 cout<<"END test for digits "<<endl;