]>
Commit | Line | Data |
---|---|---|
29b902d4 | 1 | void anaDigits() |
d2829bc1 | 2 | { |
3 | ||
4 | ///////////////////////////////////////////////////////////////////////// | |
5 | // | |
6 | // Example macro for the analysis of the TRD digits and the use | |
7 | // of the AliTRDmatrix class. | |
8 | // | |
9 | ///////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | // Dynamically link some shared libs | |
12 | if (gClassTable->GetID("AliRun") < 0) { | |
13 | gROOT->LoadMacro("loadlibs.C"); | |
14 | loadlibs(); | |
15 | } | |
16 | ||
17 | // Input file name | |
18 | Char_t *alifile = "galice.root"; | |
19 | ||
20 | // Event number | |
21 | Int_t nEvent = 0; | |
22 | ||
23 | // Define the objects | |
24 | AliTRDv1 *trd; | |
25 | AliTRDgeometry *geo; | |
26 | AliTRDdigit *digit; | |
27 | ||
28 | Int_t track; | |
29 | ||
30 | // Connect the AliRoot file containing Geometry, Kine, Hits, and digits | |
31 | TFile *gafl = (TFile*) gROOT->GetListOfFiles()->FindObject(alifile); | |
32 | if (!gafl) { | |
33 | cout << "Open the ALIROOT-file " << alifile << endl; | |
34 | gafl = new TFile(alifile); | |
35 | } | |
36 | else { | |
37 | cout << alifile << " is already open" << endl; | |
38 | } | |
39 | ||
40 | // Get AliRun object from file or create it if not on file | |
41 | gAlice = (AliRun*) gafl->Get("gAlice"); | |
42 | if (gAlice) | |
43 | cout << "AliRun object found on file" << endl; | |
44 | else | |
45 | gAlice = new AliRun("gAlice","Alice test program"); | |
46 | ||
47 | // Import the Trees for the event nEvent in the file | |
48 | Int_t nparticles = gAlice->GetEvent(nEvent); | |
49 | if (nparticles <= 0) break; | |
50 | ||
51 | // Get the pointer to the detector object | |
52 | trd = (AliTRDv1*) gAlice->GetDetector("TRD"); | |
53 | ||
54 | // Get the pointer to the geometry object | |
55 | if (trd) { | |
56 | geo = trd->GetGeometry(); | |
57 | } | |
58 | else { | |
59 | cout << "Cannot find the geometry" << endl; | |
60 | break; | |
61 | } | |
62 | ||
63 | // Create the digits manager | |
64 | AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager(); | |
29b902d4 | 65 | digitsManager->SetDebug(1); |
d2829bc1 | 66 | |
67 | // Read the digits from the file | |
68 | digitsManager->Open(alifile); | |
69 | digitsManager->ReadDigits(); | |
70 | ||
29b902d4 | 71 | // Get the detector number |
72 | Int_t iDet = 423; | |
73 | cout << " iDet = " << iDet << endl; | |
74 | ||
d2829bc1 | 75 | // Define the detector matrix for one chamber |
29b902d4 | 76 | const Int_t iSec = geo->GetSector(iDet); |
77 | const Int_t iCha = geo->GetChamber(iDet); | |
78 | const Int_t iPla = geo->GetPlane(iDet); | |
d2829bc1 | 79 | Int_t rowMax = geo->GetRowMax(iPla,iCha,iSec); |
80 | Int_t colMax = geo->GetColMax(iPla); | |
81 | Int_t timeMax = geo->GetTimeMax(); | |
82 | cout << "Geometry: rowMax = " << rowMax | |
83 | << " colMax = " << colMax | |
84 | << " timeMax = " << timeMax << endl; | |
85 | AliTRDmatrix *matrix = new AliTRDmatrix(rowMax,colMax,timeMax,iSec,iCha,iPla); | |
86 | ||
d2829bc1 | 87 | // Loop through the detector pixel |
88 | for (Int_t time = 0; time < timeMax; time++) { | |
89 | for (Int_t col = 0; col < colMax; col++) { | |
90 | for (Int_t row = 0; row < rowMax; row++) { | |
91 | ||
92 | digit = digitsManager->GetDigit(row,col,time,iDet); | |
93 | track = digitsManager->GetTrack(0,row,col,time,iDet); | |
94 | ||
95 | matrix->SetSignal(row,col,time,digit->GetAmp()); | |
96 | ||
97 | delete digit; | |
98 | ||
99 | } | |
100 | } | |
101 | } | |
102 | ||
103 | // Display the detector matrix | |
104 | matrix->Draw(); | |
105 | //matrix->DrawRow(18); | |
106 | //matrix->DrawCol(58); | |
107 | //matrix->DrawTime(20); | |
108 | matrix->ProjRow(); | |
109 | matrix->ProjCol(); | |
110 | matrix->ProjTime(); | |
111 | ||
112 | } |