]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/ITSreadClustTestSPD.C
added tcsh UI
[u/mrichter/AliRoot.git] / ITS / ITSreadClustTestSPD.C
CommitLineData
44afd9c0 1#include "iostream.h"
2
3void ITSreadClustTestSPD (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) {
15 gROOT->LoadMacro("loadlibs.C");
16 loadlibs();
17 }
18 // Anyway, this macro needs to read a gAlice file, so it
19 // clears the gAlice object if there is already one in memory...
20 else {
21 if(gAlice){
22 delete gAlice;
23 gAlice = 0;
24 }
25 }
26
27// Connect the Root Galice file containing Geometry, Kine and Hits
28
29 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
30 if (!file) file = new TFile("galice.root");
31 file->ls();
32
33// Get AliRun object from file or create it if not on file
34
35 if (!gAlice) {
36 gAlice = (AliRun*)file->Get("gAlice");
37 if (gAlice) printf("AliRun object found on file\n");
38 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
39 }
40
41//
42// Loop over events
43//
44 Int_t Nh=0;
45 Int_t Nh1=0;
46 for (int nev=0; nev<= evNumber2; nev++) {
47 Int_t nparticles = gAlice->GetEvent(nev);
48 cout << "nev " << nev <<endl;
49 cout << "nparticles " << nparticles <<endl;
50 if (nev < evNumber1) continue;
51 if (nparticles <= 0) return;
52
53 TTree *TH = gAlice->TreeH();
54 Int_t ntracks = TH->GetEntries();
55 cout<<"ntracks "<<ntracks<<endl;
56
57 Int_t nbytes = 0;
58
59 //AliITSRawClusterSDD *ITSclust;
60 AliITSRawClusterSPD *ITSclust;
61
62// Get pointers to Alice detectors and Digits containers
63 AliITS *ITS = (AliITS*)gAlice->GetModule("ITS");
64 if(!ITS) return;
65 TClonesArray *Particles = gAlice->Particles();
66
67 ITS->GetTreeC(nev);
68 TTree *TC=ITS->TreeC();
69 Int_t nent=TC->GetEntries();
70 printf("Found %d entries in the tree (must be one per module per event!)\n",nent);
71
72 for (Int_t idet=0;idet<3;idet++) {
73
74 TClonesArray *ITSclu = ITS->ClustersAddress(idet);
75
76 if (idet != 0) continue;
77 for (Int_t mod=0; mod<nent; mod++) {
78 ITS->ResetClusters();
79 TC->GetEvent(mod);
80 Int_t ncl = ITSclu->GetEntries();
81 if (ncl) printf("Found %d clusters for module %d in det type %d \n",ncl,mod,idet);
82
83 if (!ncl) continue;
84
85 for (Int_t icl=0;icl<ncl;icl++) {
86 ITSclust = (AliITSRawClusterSPD*)ITSclu->UncheckedAt(icl);
87 printf("%d %d %f %f %f\n",ITSclust->NclZ(),ITSclust->NclX(),ITSclust->Q(),ITSclust->X(),ITSclust->Z());
88 }
89 //for (Int_t icl=0;icl<ncl;icl++) {
90 //ITSclust = (AliITSRawClusterSDD*)ITSclu->UncheckedAt(icl);
91 //printf("%d %d %f %f %f\n",ITSclust->Anodes(),ITSclust->Samples(),ITSclust->Q(),ITSclust->X(),ITSclust->Z());
92 //}
93 }
94 }
95
96 } // event loop
97
98 cout<<"END test for clusters "<<endl;
99
100 file->Close();
101}
102
103
104
105
106
107
108
109
110
111