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_v2.root";
24 TClonesArray *TRDDigits;
25 AliTRDdigit *OneTRDDigit;
27 // Connect the AliRoot file containing Geometry, Kine, Hits, and Digits
28 TFile *gafl = (TFile*) gROOT->GetListOfFiles()->FindObject(alifile);
30 cout << "Open the ALIROOT-file " << alifile << endl;
31 gafl = new TFile(alifile);
34 cout << alifile << " is already open" << endl;
37 // Get AliRun object from file or create it if not on file
39 gAlice = (AliRun*) gafl->Get("gAlice");
41 cout << "AliRun object found on file" << endl;
43 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 hit-tree
51 TTree *DigitsTree = gAlice->TreeD();
53 // Get the pointer to the detector classes
54 TRD = (AliTRDv2*) gAlice->GetDetector("TRD");
55 // Get the pointer to the hit container
56 if (TRD) TRDDigits = TRD->Digits();
58 // Define the detector matrix for one chamber (Sector 6, Chamber 3, Plane 1)
62 Int_t rowMax = TRD->GetRowMax(iPla,iCha);
63 Int_t colMax = TRD->GetColMax(iPla);
64 Int_t timeMax = TRD->GetTimeMax();
65 cout << " rowMax = " << rowMax
66 << " colMax = " << colMax
67 << " timeMax = " << timeMax << endl;
68 AliTRDmatrix *TRDMatrix = new AliTRDmatrix(rowMax,colMax,timeMax,iSec,iCha,iPla);
70 Int_t nEntries = DigitsTree->GetEntries();
71 cout << "Number of entries in digits tree = " << nEntries << endl;
73 // Loop through all entries in the tree
75 for (Int_t iEntry = 0; iEntry < nEntries; iEntry++) {
77 cout << "iEntry = " << iEntry << endl;
80 gAlice->ResetDigits();
81 nbytes += DigitsTree->GetEvent(iEntry);
83 // Get the number of digits in the detector
84 Int_t nTRDDigits = TRDDigits->GetEntriesFast();
85 cout << " nTRDDigits = " << nTRDDigits << endl;
87 // Loop through all TRD digits
88 for (Int_t iTRDDigits = 0; iTRDDigits < nTRDDigits; iTRDDigits++) {
90 // Get the information for this digit
91 OneTRDDigit = (AliTRDdigit*) TRDDigits->UncheckedAt(iTRDDigits);
92 Int_t signal = OneTRDDigit->fSignal;
93 Int_t sector = OneTRDDigit->fSector;
94 Int_t chamber = OneTRDDigit->fChamber;
95 Int_t plane = OneTRDDigit->fPlane;
96 Int_t row = OneTRDDigit->fRow;
97 Int_t col = OneTRDDigit->fCol;
98 Int_t time = OneTRDDigit->fTime;
100 // Fill the detector matrix
102 TRDMatrix->SetSignal(row,col,time,signal);
109 // Display the detector matrix
111 TRDMatrix->DrawRow(18);
112 TRDMatrix->DrawCol(58);
113 TRDMatrix->DrawTime(20);