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;
26 // Connect the AliRoot file containing Geometry, Kine, Hits, and Digits
27 TFile *gafl = (TFile*) gROOT->GetListOfFiles()->FindObject(alifile);
29 cout << "Open the ALIROOT-file " << alifile << endl;
30 gafl = new TFile(alifile);
33 cout << alifile << " is already open" << endl;
36 // Get AliRun object from file or create it if not on file
37 gAlice = (AliRun*) gafl->Get("gAlice");
39 cout << "AliRun object found on file" << endl;
41 gAlice = new AliRun("gAlice","Alice test program");
43 // Import the Trees for the event nEvent in the file
44 Int_t nparticles = gAlice->GetEvent(nEvent);
45 if (nparticles <= 0) break;
47 // Get the pointer to the detector classes
48 TRD = (AliTRDv1*) gAlice->GetDetector("TRD");
49 // Get the pointer to the digits container and the geometry
51 TRDgeometry = TRD->GetGeometry();
54 cout << "Cannot find the geometry" << endl;
58 // Define the segment array for the digits
59 AliTRDsegmentArray *DigitsArray = new AliTRDsegmentArray(540);
61 // Load the digits from the tree
62 DigitsArray->LoadArray("TRDdigits");
64 // Define the detector matrix for one chamber
65 const Int_t iSec = 13;
68 Int_t rowMax = TRDgeometry->GetRowMax(iPla,iCha,iSec);
69 Int_t colMax = TRDgeometry->GetColMax(iPla);
70 Int_t timeMax = TRDgeometry->GetTimeMax();
71 cout << "Geometry: rowMax = " << rowMax
72 << " colMax = " << colMax
73 << " timeMax = " << timeMax << endl;
74 AliTRDmatrix *TRDmatrix = new AliTRDmatrix(rowMax,colMax,timeMax,iSec,iCha,iPla);
76 // Get the digits for this detector
77 Int_t iDet = TRDgeometry->GetDetector(iPla,iCha,iSec);
78 AliTRDdataArray *Digits = (AliTRDdataArray *) DigitsArray->At(iDet);
80 // Expand the digits array
83 //Float_t signal = Digits->GetData(0,0,29);
85 // Loop through the detector pixel
86 for (Int_t time = 0; time < timeMax; time++) {
87 for (Int_t col = 0; col < colMax; col++) {
88 for (Int_t row = 0; row < rowMax; row++) {
90 Float_t signal = Digits->GetData(row,col,time);
93 TRDmatrix->SetSignal(row,col,time,signal);
99 // Display the detector matrix
101 TRDmatrix->DrawRow(18);
102 TRDmatrix->DrawCol(58);
103 TRDmatrix->DrawTime(20);