3 /////////////////////////////////////////////////////////////////////////
5 // Example macro for the analysis of the TRD digits and the use
6 // of the AliTRDmatrix class.
8 /////////////////////////////////////////////////////////////////////////
10 // Dynamically link some shared libs
11 if (gClassTable->GetID("AliRun") < 0) {
12 gROOT->LoadMacro("loadlibs.C");
17 Char_t *alifile = "galice_d_v1.root";
24 AliTRDgeometry *TRDgeometry;
29 // Connect the AliRoot file containing Geometry, Kine, Hits, and Digits
30 TFile *gafl = (TFile*) gROOT->GetListOfFiles()->FindObject(alifile);
32 cout << "Open the ALIROOT-file " << alifile << endl;
33 gafl = new TFile(alifile);
36 cout << alifile << " is already open" << endl;
39 // Get AliRun object from file or create it if not on file
40 gAlice = (AliRun*) gafl->Get("gAlice");
42 cout << "AliRun object found on file" << endl;
44 gAlice = new AliRun("gAlice","Alice test program");
46 // Import the Trees for the event nEvent in the file
47 Int_t nparticles = gAlice->GetEvent(nEvent);
48 if (nparticles <= 0) break;
50 // Get the pointer to the detector object
51 TRD = (AliTRDv1*) gAlice->GetDetector("TRD");
53 // Get the pointer to the geometry object
55 TRDgeometry = TRD->GetGeometry();
58 cout << "Cannot find the geometry" << endl;
62 // Create the digits manager
63 AliTRDdigitsManager *DigitsManager = new AliTRDdigitsManager();
65 // Read the digits from the file
66 DigitsManager->ReadDigits();
68 // Define the detector matrix for one chamber
69 const Int_t iSec = 17;
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);
80 // Get the detector number
81 Int_t iDet = TRDgeometry->GetDetector(iPla,iCha,iSec);
82 cout << " iDet = " << iDet << endl;
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++) {
89 Digit = DigitsManager->GetDigit(row,col,time,iDet);
90 track = DigitsManager->GetTrack(0,row,col,time,iDet);
92 TRDmatrix->SetSignal(row,col,time,Digit->GetAmp());
94 cout << "-------------------------------------" << endl;
95 cout << " track = " << track << endl;
96 cout << " iRow = " << row
98 << " iTime = " << time << endl;
99 cout << " adc = " << Digit->GetAmp() << endl;
109 // Display the detector matrix
111 //TRDmatrix->DrawRow(18);
112 //TRDmatrix->DrawCol(58);
113 //TRDmatrix->DrawTime(20);
114 TRDmatrix->ProjRow();
115 TRDmatrix->ProjCol();
116 TRDmatrix->ProjTime();