]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/debug.C
Add ResetDecayTable() and SsetDecayTable() methods.
[u/mrichter/AliRoot.git] / ITS / debug.C
1 void debug(){
2  //
3  //  macro fro trigger analysis (F. Meddi suggestion)
4  //
5  Int_t evNumber=0;
6  char *filename="galice.root";
7  char *fileout="analyse.root";
8
9  // Dynamically link some shared libs
10  if (gClassTable->GetID("AliRun") < 0) {
11     gROOT->LoadMacro("loadlibs.C");
12     loadlibs();
13  } 
14    
15  // Connect the Root Galice file containing Geometry, Kine and Hits
16  TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename);
17  if (!file) file = new TFile(filename);
18
19  // Get AliRun object from file or create it if not on file
20  if (!gAlice) {
21     gAlice = (AliRun*)file->Get("gAlice");
22     if (gAlice) printf("AliRun object found on file\n");
23     if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
24  }
25
26  //loop over events
27  for (int nev=0; nev<= evNumber; nev++) {
28    Int_t nparticles = gAlice->GetEvent(nev);
29    cout << "nev         " <<nev<<endl;
30    cout << "nparticles  " <<nparticles<<endl;
31    if (nparticles <= 0) return;
32
33    TTree *TH        = gAlice->TreeH();
34    Int_t ntracks    = TH->GetEntries();
35    cout << "ntracks  " <<ntracks<<endl;
36
37    // Get pointers to Alice detectors and Digit containers
38    AliITS *ITS  = (AliITS *)gAlice->GetModule("ITS");
39    TClonesArray *Particles = gAlice->Particles();
40    if(!ITS) return;
41
42    // fill modules with sorted by module hits
43    Int_t nmodules;
44    ITS->InitModules(-1,nmodules);
45    ITS->FillModules(nev,-1,nmodules," "," ");
46
47    // get pointer to modules array
48    TObjArray *mods = ITS->GetModules();
49    AliITShit *itsHit;
50
51
52    //get the Tree for clusters
53    ITS->GetTreeC(nev);
54    TTree *TC=ITS->TreeC();
55    //TC->Print();
56    Int_t nent=TC->GetEntries();
57    printf("Found %d entries in the tree of clusters)\n",nent);
58    TClonesArray *ITSclusters = ITS->ClustersAddress(0);
59    printf("ITSclusters %p\n",ITSclusters);
60
61    //get the Tree for digits
62    TTree *TD = gAlice->TreeD();
63    //TD->Print();
64    Int_t nentd=TD->GetEntries();
65    printf("Found %d entries in the tree of digits)\n",nentd);
66    TObjArray *fBranches=TD->GetListOfBranches();
67    TBranch *branch = (TBranch*)fBranches->UncheckedAt(0);
68    printf ("branch %p entries %d \n",branch,branch->GetEntries());
69    TClonesArray *ITSdigits  = ITS->DigitsAddress(0);
70    printf ("ITSdigits %p \n",ITSdigits);
71
72    //get the Tree for rec points
73    TTree *TR = gAlice->TreeR();
74    //TR->Print();
75    Int_t nentr=TR->GetEntries();
76    printf("Found %d entries in the tree of rec points)\n",nentr);
77    TClonesArray *ITSrec  = ITS->RecPoints();
78    printf ("ITSrec %p \n",ITSrec);
79    AliITSRecPoint  *recp;
80
81   AliITSgeom *g = ((AliITS *)ITS)->GetITSgeom();
82   Int_t lay, lad, det;
83   printf("Starts loop on SPD detectors\n");
84
85
86   //loop over the pixel detectors index=0-79     (1-20)*4 layer 1  
87   //                              index=80-239   (1-40)*4 layer 2
88 //  for (Int_t index=g->GetStartSPD();index<=g->GetLastSPD();index++) 
89     for (Int_t index=0;index<2;index++)  //debug
90 //    Int_t index=5;
91   {
92   
93     g->GetModuleId(index,lay,lad,det); 
94     printf("detector %d (lay=%d lad=%d det=%d)\n",index+1,lay,lad,det);
95
96     AliITSmodule *itsModule = (AliITSmodule*) mods->At(index);
97     Int_t numofhits = itsModule->GetNhits();
98     printf("number of hits %d\n",numofhits);
99     if(!numofhits) continue;
100
101     //---------- starts test on digits
102     ITS->ResetDigits();
103     TD->GetEvent(index+1);
104     Int_t ndigits = ITSdigits->GetEntriesFast();
105     if (ndigits) printf("Found %d digits for module %d \n",ndigits,index+1);
106     if (!ndigits) printf("no digits found \n");
107
108
109     //loop on digits
110     for (Int_t digit=0;digit<ndigits;digit++) {
111         ITSdigit   = (AliITSdigitSPD*)ITSdigits->UncheckedAt(digit);
112         printf("%d %d %d %d \n",ITSdigit->fCoord1,ITSdigit->fCoord2,ITSdigit->fSignal,ITSdigit->fTracks[0]);
113      }
114      cout<<"END  test for digits "<<endl;
115
116
117     //---------- starts test on clusters
118     ITS->ResetClusters();
119     TC->GetEvent(index);
120     Int_t nclust = ITSclusters->GetEntries();
121     printf("number of clusters %d\n",nclust);
122
123
124     //loop on clusters
125     for (Int_t clu=0;clu<nclust;clu++)
126     {
127       itsclu = (AliITSRawClusterSPD*) ITSclusters->UncheckedAt(clu);
128       printf("cluster %d nZ=%f nX=%f Z=%f X=%f\n",clu+1,itsclu->NclZ(),
129                       itsclu->NclX(),itsclu->Z(),itsclu->X());
130     }
131      cout<<"END  test for clusters "<<endl;
132
133
134     //---------- starts test on rec points
135     ITS->ResetRecPoints();
136     TR->GetEvent(index+1);
137     Int_t nrecpoints = ITSrec->GetEntries();
138     printf("Found %d recpoints for module %d \n",nrecpoints,index+1);
139
140     //loop on rec points
141     for (Int_t irec=0;irec<nrecpoints;irec++) {
142          recp   = (AliITSRecPoint*)ITSrec->UncheckedAt(irec);
143         printf("%d %f %f %f %f  %d %d %d\n",irec+1,recp->GetX(),recp->GetZ(),
144             recp->fSigmaX2,recp->fSigmaZ2,
145             recp->fTracks[0],recp->fTracks[1],recp->fTracks[2]);
146     }
147
148     printf("Detector No. %d (%d total hits) (%d digits) (%d clusters)\n",
149                                          index+1,numofhits,ndigits,nclust);
150
151  
152   } //end loop on the SPD detectors
153
154 } // end loop over events
155
156 }