]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/anaDigits.C
New classes added
[u/mrichter/AliRoot.git] / TRD / anaDigits.C
CommitLineData
d2829bc1 1void anaDigits()
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();
65 digitsManager->SetVerbose(1);
66
67 // Read the digits from the file
68 digitsManager->Open(alifile);
69 digitsManager->ReadDigits();
70
71 // Define the detector matrix for one chamber
72 const Int_t iSec = 11;
73 const Int_t iCha = 2;
74 const Int_t iPla = 0;
75 Int_t rowMax = geo->GetRowMax(iPla,iCha,iSec);
76 Int_t colMax = geo->GetColMax(iPla);
77 Int_t timeMax = geo->GetTimeMax();
78 cout << "Geometry: rowMax = " << rowMax
79 << " colMax = " << colMax
80 << " timeMax = " << timeMax << endl;
81 AliTRDmatrix *matrix = new AliTRDmatrix(rowMax,colMax,timeMax,iSec,iCha,iPla);
82
83 // Get the detector number
84 Int_t iDet = geo->GetDetector(iPla,iCha,iSec);
85 cout << " iDet = " << iDet << endl;
86
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}