4 /////////////////////////////////////////////////////////////////////////
6 // Example macro for the analysis of the TRD digits and the use
7 // of the AliTRDmatrix class.
9 /////////////////////////////////////////////////////////////////////////
11 // Dynamically link some shared libs
12 if (gClassTable->GetID("AliRun") < 0) {
13 gROOT->LoadMacro("loadlibs.C");
18 Char_t *alifile = "galice.root";
30 // Connect the AliRoot file containing Geometry, Kine, Hits, and digits
31 TFile *gafl = (TFile*) gROOT->GetListOfFiles()->FindObject(alifile);
33 cout << "Open the ALIROOT-file " << alifile << endl;
34 gafl = new TFile(alifile);
37 cout << alifile << " is already open" << endl;
40 // Get AliRun object from file or create it if not on file
41 gAlice = (AliRun*) gafl->Get("gAlice");
43 cout << "AliRun object found on file" << endl;
45 gAlice = new AliRun("gAlice","Alice test program");
47 // Import the Trees for the event nEvent in the file
48 Int_t nparticles = gAlice->GetEvent(nEvent);
49 if (nparticles <= 0) break;
51 // Get the pointer to the detector object
52 trd = (AliTRDv1*) gAlice->GetDetector("TRD");
54 // Get the pointer to the geometry object
56 geo = trd->GetGeometry();
59 cout << "Cannot find the geometry" << endl;
63 // Create the digits manager
64 AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager();
65 digitsManager->SetDebug(1);
67 // Read the digits from the file
68 digitsManager->Open(alifile);
69 digitsManager->ReadDigits();
71 // Get the detector number
73 cout << " iDet = " << iDet << endl;
75 // Define the detector matrix for one chamber
76 const Int_t iSec = geo->GetSector(iDet);
77 const Int_t iCha = geo->GetChamber(iDet);
78 const Int_t iPla = geo->GetPlane(iDet);
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);
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++) {
92 digit = digitsManager->GetDigit(row,col,time,iDet);
93 track = digitsManager->GetTrack(0,row,col,time,iDet);
95 matrix->SetSignal(row,col,time,digit->GetAmp());
103 // Display the detector matrix
105 //matrix->DrawRow(18);
106 //matrix->DrawCol(58);
107 //matrix->DrawTime(20);