]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/slowDigitsAna.C
Replaced Fill3() by Fill()
[u/mrichter/AliRoot.git] / TRD / slowDigitsAna.C
1 void slowDigitsAna() {
2
3 /////////////////////////////////////////////////////////////////////////
4 //
5 // Example macro for the analysis of the TRD digits and the use
6 // of the AliTRDmatrix class.
7 //
8 /////////////////////////////////////////////////////////////////////////
9
10   // Dynamically link some shared libs
11   if (gClassTable->GetID("AliRun") < 0) {
12     gROOT->LoadMacro("loadlibs.C");
13     loadlibs();
14   }
15
16   // Input file name
17   Char_t *alifile = "galice_d_v1.root"; 
18
19   // Event number
20   Int_t   nEvent  = 0;
21
22   // Define the objects
23   AliTRDv1       *TRD;
24   AliTRDgeometry *TRDgeometry;
25
26   // Connect the AliRoot file containing Geometry, Kine, Hits, and Digits
27   TFile *gafl = (TFile*) gROOT->GetListOfFiles()->FindObject(alifile);
28   if (!gafl) {
29     cout << "Open the ALIROOT-file " << alifile << endl;
30     gafl = new TFile(alifile);
31   }
32   else {
33     cout << alifile << " is already open" << endl;
34   }
35
36   // Get AliRun object from file or create it if not on file
37   gAlice = (AliRun*) gafl->Get("gAlice");
38   if (gAlice)  
39     cout << "AliRun object found on file" << endl;
40   else
41     gAlice = new AliRun("gAlice","Alice test program");
42
43   // Import the Trees for the event nEvent in the file
44   Int_t nparticles = gAlice->GetEvent(nEvent);
45   if (nparticles <= 0) break;
46   
47   // Get the pointer to the detector classes
48   TRD = (AliTRDv1*) gAlice->GetDetector("TRD");
49   // Get the pointer to the digits container and the geometry
50   if (TRD) {
51     TRDgeometry = TRD->GetGeometry();
52   }
53   else {
54     cout << "Cannot find the geometry" << endl;
55     break;
56   }
57
58   // Define the segment array for the digits
59   AliTRDsegmentArray *DigitsArray = new AliTRDsegmentArray(540);
60
61   // Load the digits from the tree
62   DigitsArray->LoadArray("TRDdigits");
63
64   // Define the detector matrix for one chamber
65   const Int_t iSec = 13;
66   const Int_t iCha = 3;
67   const Int_t iPla = 3;
68   Int_t  rowMax = TRDgeometry->GetRowMax(iPla,iCha,iSec);
69   Int_t  colMax = TRDgeometry->GetColMax(iPla);
70   Int_t timeMax = TRDgeometry->GetTimeMax();
71   cout << "Geometry: rowMax = "  <<  rowMax
72                 << " colMax = "  <<  colMax
73                 << " timeMax = " << timeMax << endl;
74   AliTRDmatrix *TRDmatrix = new AliTRDmatrix(rowMax,colMax,timeMax,iSec,iCha,iPla);
75
76   // Get the digits for this detector
77   Int_t iDet = TRDgeometry->GetDetector(iPla,iCha,iSec); 
78   AliTRDdataArray *Digits = (AliTRDdataArray *) DigitsArray->At(iDet);
79   Digits->Dump();
80   // Expand the digits array
81   //Digits->Expand();
82
83   //Float_t signal = Digits->GetData(0,0,29);
84
85   // Loop through the detector pixel
86   for (Int_t time = 0; time < timeMax; time++) {
87     for (Int_t  col = 0;  col <  colMax;  col++) {
88       for (Int_t  row = 0;  row <  rowMax;  row++) {
89
90         Float_t signal = Digits->GetData(row,col,time);
91         if (signal != 0) {
92         }
93         TRDmatrix->SetSignal(row,col,time,signal);
94
95       }
96     }
97   }
98
99   // Display the detector matrix
100   TRDmatrix->Draw();
101   TRDmatrix->DrawRow(18);
102   TRDmatrix->DrawCol(58);
103   TRDmatrix->DrawTime(20);
104
105 }