]>
Commit | Line | Data |
---|---|---|
d5a17faf | 1 | void slowDigitsAna() { |
5c7f4665 | 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 | |
793ff80c | 17 | Char_t *alifile = "galice.root"; |
5c7f4665 | 18 | |
19 | // Event number | |
20 | Int_t nEvent = 0; | |
21 | ||
22 | // Define the objects | |
851d3db9 | 23 | AliTRDv1 *TRD; |
24 | AliTRDgeometry *TRDgeometry; | |
6f1e466d | 25 | AliTRDdigit *Digit; |
26 | ||
27 | Int_t track; | |
5c7f4665 | 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 | |
851d3db9 | 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"); | |
5c7f4665 | 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 | ||
6f1e466d | 50 | // Get the pointer to the detector object |
5c7f4665 | 51 | TRD = (AliTRDv1*) gAlice->GetDetector("TRD"); |
6f1e466d | 52 | |
53 | // Get the pointer to the geometry object | |
851d3db9 | 54 | if (TRD) { |
55 | TRDgeometry = TRD->GetGeometry(); | |
56 | } | |
57 | else { | |
58 | cout << "Cannot find the geometry" << endl; | |
59 | break; | |
60 | } | |
5c7f4665 | 61 | |
6f1e466d | 62 | // Create the digits manager |
63 | AliTRDdigitsManager *DigitsManager = new AliTRDdigitsManager(); | |
5c7f4665 | 64 | |
6f1e466d | 65 | // Read the digits from the file |
66 | DigitsManager->ReadDigits(); | |
851d3db9 | 67 | |
68 | // Define the detector matrix for one chamber | |
793ff80c | 69 | const Int_t iSec = 11; |
6f1e466d | 70 | const Int_t iCha = 2; |
71 | const Int_t iPla = 0; | |
851d3db9 | 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 | ||
6f1e466d | 80 | // Get the detector number |
851d3db9 | 81 | Int_t iDet = TRDgeometry->GetDetector(iPla,iCha,iSec); |
6f1e466d | 82 | cout << " iDet = " << iDet << endl; |
851d3db9 | 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 | ||
6f1e466d | 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()); | |
6f1e466d | 93 | |
94 | delete Digit; | |
5c7f4665 | 95 | |
851d3db9 | 96 | } |
5c7f4665 | 97 | } |
5c7f4665 | 98 | } |
99 | ||
100 | // Display the detector matrix | |
851d3db9 | 101 | TRDmatrix->Draw(); |
6f1e466d | 102 | //TRDmatrix->DrawRow(18); |
103 | //TRDmatrix->DrawCol(58); | |
104 | //TRDmatrix->DrawTime(20); | |
105 | TRDmatrix->ProjRow(); | |
106 | TRDmatrix->ProjCol(); | |
107 | TRDmatrix->ProjTime(); | |
5c7f4665 | 108 | |
109 | } |