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