]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDanaDigits.C
Add conversion class to produce fake raw data
[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
5990c064 18 Char_t *alifile = "galice.root";
fa148e6c 19
20 // Event number
21 Int_t nEvent = 0;
22
23 // Define the objects
5990c064 24 AliTRDv1 *trd;
25 AliTRDgeometry *geo;
26 AliTRDdigit *digit;
27 AliTRDparameter *par;
fa148e6c 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
5990c064 64 // The parameter object
65 par = new AliTRDparameter("TRDparameter","TRD parameter class");
66
fa148e6c 67 // Create the digits manager
68 AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager();
69 digitsManager->SetDebug(1);
fa148e6c 70
71 // Read the digits from the file
72 digitsManager->Open(alifile);
73 digitsManager->ReadDigits();
74
75 // Get the detector number
5990c064 76 Int_t iDet = 514;
fa148e6c 77 cout << " iDet = " << iDet << endl;
78
79 // Define the detector matrix for one chamber
80 const Int_t iSec = geo->GetSector(iDet);
81 const Int_t iCha = geo->GetChamber(iDet);
82 const Int_t iPla = geo->GetPlane(iDet);
5990c064 83 Int_t rowMax = par->GetRowMax(iPla,iCha,iSec);
84 Int_t colMax = par->GetColMax(iPla);
85 Int_t timeMax = par->GetTimeMax();
fa148e6c 86 cout << "Geometry: rowMax = " << rowMax
87 << " colMax = " << colMax
88 << " timeMax = " << timeMax << endl;
89 AliTRDmatrix *matrix = new AliTRDmatrix(rowMax,colMax,timeMax,iSec,iCha,iPla);
90
91 // Loop through the detector pixel
92 for (Int_t time = 0; time < timeMax; time++) {
93 for (Int_t col = 0; col < colMax; col++) {
94 for (Int_t row = 0; row < rowMax; row++) {
95
96 digit = digitsManager->GetDigit(row,col,time,iDet);
97 track = digitsManager->GetTrack(0,row,col,time,iDet);
98
fa148e6c 99 matrix->SetSignal(row,col,time,digit->GetAmp());
100
101 delete digit;
102
103 }
104 }
105 }
106
107 // Display the detector matrix
108 matrix->Draw();
fa148e6c 109 matrix->ProjRow();
110 matrix->ProjCol();
111 matrix->ProjTime();
112
113}