]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/slowDigitsAna.C
Access function to local momenta renamed.
[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.root"; 
18
19   // Event number
20   Int_t   nEvent  = 0;
21
22   // Define the objects
23   AliTRDv1       *TRD;
24   AliTRDgeometry *TRDgeometry;
25   AliTRDdigit    *Digit;
26
27   Int_t           track;
28
29   // Connect the AliRoot file containing Geometry, Kine, Hits, and Digits
30   TFile *gafl = (TFile*) gROOT->GetListOfFiles()->FindObject(alifile);
31   if (!gafl) {
32     cout << "Open the ALIROOT-file " << alifile << endl;
33     gafl = new TFile(alifile);
34   }
35   else {
36     cout << alifile << " is already open" << endl;
37   }
38
39   // Get AliRun object from file or create it if not on file
40   gAlice = (AliRun*) gafl->Get("gAlice");
41   if (gAlice)  
42     cout << "AliRun object found on file" << endl;
43   else
44     gAlice = new AliRun("gAlice","Alice test program");
45
46   // Import the Trees for the event nEvent in the file
47   Int_t nparticles = gAlice->GetEvent(nEvent);
48   if (nparticles <= 0) break;
49   
50   // Get the pointer to the detector object
51   TRD = (AliTRDv1*) gAlice->GetDetector("TRD");
52
53   // Get the pointer to the geometry object
54   if (TRD) {
55     TRDgeometry = TRD->GetGeometry();
56   }
57   else {
58     cout << "Cannot find the geometry" << endl;
59     break;
60   }
61
62   // Create the digits manager
63   AliTRDdigitsManager *DigitsManager = new AliTRDdigitsManager();
64
65   // Read the digits from the file
66   DigitsManager->ReadDigits();
67
68   // Define the detector matrix for one chamber
69   const Int_t iSec = 11;
70   const Int_t iCha = 2;
71   const Int_t iPla = 0;
72   Int_t  rowMax = TRDgeometry->GetRowMax(iPla,iCha,iSec);
73   Int_t  colMax = TRDgeometry->GetColMax(iPla);
74   Int_t timeMax = TRDgeometry->GetTimeMax();
75   cout << "Geometry: rowMax = "  <<  rowMax
76                 << " colMax = "  <<  colMax
77                 << " timeMax = " << timeMax << endl;
78   AliTRDmatrix *TRDmatrix = new AliTRDmatrix(rowMax,colMax,timeMax,iSec,iCha,iPla);
79
80   // Get the detector number
81   Int_t iDet = TRDgeometry->GetDetector(iPla,iCha,iSec); 
82   cout << " iDet = " << iDet << endl;
83
84   // Loop through the detector pixel
85   for (Int_t time = 0; time < timeMax; time++) {
86     for (Int_t  col = 0;  col <  colMax;  col++) {
87       for (Int_t  row = 0;  row <  rowMax;  row++) {
88
89         Digit = DigitsManager->GetDigit(row,col,time,iDet);
90         track = DigitsManager->GetTrack(0,row,col,time,iDet);
91         
92         TRDmatrix->SetSignal(row,col,time,Digit->GetAmp());
93
94         delete Digit;
95
96       }
97     }
98   }
99
100   // Display the detector matrix
101   TRDmatrix->Draw();
102   //TRDmatrix->DrawRow(18);
103   //TRDmatrix->DrawCol(58);
104   //TRDmatrix->DrawTime(20);
105   TRDmatrix->ProjRow();
106   TRDmatrix->ProjCol();
107   TRDmatrix->ProjTime();
108
109 }