]>
Commit | Line | Data |
---|---|---|
00653a86 | 1 | //_____________________________________________________________________________ |
fa148e6c | 2 | Int_t AliTRDdisplayDigits3D(Int_t event = 0, Int_t thresh = 2 |
00653a86 | 3 | , Bool_t sdigits = kFALSE) |
4 | { | |
5 | // | |
6 | // TRD digits display | |
7 | // | |
8 | // Input parameter: | |
9 | // <event> : Event number | |
10 | // <thresh> : Threshold to suppress the noise | |
11 | // <sdigits> : If kTRUE it will display summable digits, normal digits otherwise. | |
12 | // The signal event is displayed in yellow. | |
13 | // | |
14 | ||
15 | Char_t *inputFile = "galice.root"; | |
16 | ||
17 | const Int_t kNdict = 3; | |
18 | ||
19 | // Define the objects | |
20 | AliTRDv1 *trd; | |
21 | AliTRDgeometry *geo; | |
22 | ||
23 | Int_t track; | |
24 | Int_t idict; | |
25 | ||
26 | // Connect the AliRoot file containing Geometry, Kine, Hits, and digits | |
27 | TFile *gafl = (TFile*) gROOT->GetListOfFiles()->FindObject(inputFile); | |
28 | if (!gafl) { | |
29 | printf("Open the ALIROOT-file %s\n",inputFile); | |
30 | gafl = new TFile(inputFile); | |
31 | } | |
32 | else { | |
33 | printf("%s is already open",inputFile); | |
34 | } | |
35 | ||
36 | // Get AliRun object from file or create it if not on file | |
37 | gAlice = (AliRun *) gafl->Get("gAlice"); | |
38 | if (!gAlice) return 1; | |
39 | ||
40 | // Import the Trees for the event nEvent in the file | |
41 | Int_t nparticles = gAlice->GetEvent(event); | |
42 | if (nparticles <= 0) return 1; | |
43 | ||
44 | // Get the pointer to the detector object | |
45 | trd = (AliTRDv1*) gAlice->GetDetector("TRD"); | |
46 | ||
47 | // Get the pointer to the geometry object | |
48 | if (trd) { | |
49 | geo = trd->GetGeometry(); | |
50 | } | |
51 | else { | |
52 | printf("Cannot find the geometry\n"); | |
53 | return 1; | |
54 | } | |
55 | ||
56 | TCanvas *c1 = new TCanvas("digits","TRD digits display",0,0,700,730); | |
57 | TView *v = new TView(1); | |
58 | v->SetRange(-430,-560,-430,430,560,1710); | |
59 | c1->Clear(); | |
60 | c1->SetFillColor(1); | |
61 | c1->SetTheta(90.0); | |
62 | c1->SetPhi(0.0); | |
63 | ||
64 | Int_t markerColorSignal = 2; | |
65 | Int_t markerColorBgnd = 7; | |
66 | Int_t markerColorMerged = 5; | |
67 | Int_t mask = 10000000; | |
68 | ||
69 | // Create the digits manager | |
70 | AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager(); | |
71 | digitsManager->SetDebug(1); | |
72 | digitsManager->SetSDigits(sdigits); | |
73 | ||
74 | // Read the digits from the file | |
75 | digitsManager->Open(inputFile); | |
76 | digitsManager->ReadDigits(); | |
77 | ||
78 | Int_t totalsignal = 0; | |
79 | Int_t totalbgnd = 0; | |
80 | Int_t totalmerged = 0; | |
81 | ||
ecd782af | 82 | AliTRDparameter *par = new AliTRDparameter("TRDparameter","TRD parameter class"); |
83 | ||
00653a86 | 84 | // Loop through all detectors |
85 | for (Int_t idet = 0; idet < geo->Ndet(); idet++) { | |
86 | ||
87 | printf("<AliTRDdisplayDigits3D> Loading detector %d\n",idet); | |
88 | AliTRDdataArrayI *digits = digitsManager->GetDigits(idet); | |
89 | digits->Expand(); | |
90 | AliTRDdataArrayI *tracks[kNdict]; | |
91 | for (Int_t idict = 0; idict < kNdict; idict++) { | |
92 | tracks[idict] = digitsManager->GetDictionary(idet,idict); | |
93 | tracks[idict]->Expand(); | |
94 | } | |
95 | ||
96 | Int_t isec = geo->GetSector(idet); | |
97 | Int_t icha = geo->GetChamber(idet); | |
98 | Int_t ipla = geo->GetPlane(idet); | |
ecd782af | 99 | Int_t rowMax = par->GetRowMax(ipla,icha,isec); |
100 | Int_t colMax = par->GetColMax(ipla); | |
101 | Int_t timeMax = par->GetTimeMax(); | |
00653a86 | 102 | |
103 | Int_t ndigits = digits->GetOverThreshold(thresh); | |
104 | ||
105 | if (ndigits > 0) { | |
106 | ||
107 | TPolyMarker3D *pmSignal = new TPolyMarker3D(ndigits); | |
108 | TPolyMarker3D *pmBgnd = new TPolyMarker3D(ndigits); | |
109 | TPolyMarker3D *pmMerged = new TPolyMarker3D(ndigits); | |
110 | ||
111 | Int_t ibgnd = 0; | |
112 | Int_t isignal = 0; | |
113 | Int_t imerged = 0; | |
114 | ||
115 | for (Int_t time = 0; time < timeMax; time++) { | |
116 | for (Int_t col = 0; col < colMax; col++) { | |
117 | for (Int_t row = 0; row < rowMax; row++) { | |
118 | ||
119 | Int_t type = 1; | |
120 | ||
121 | Int_t amp = digits->GetDataUnchecked(row,col,time); | |
122 | for (idict = 0; idict < kNdict; idict++) { | |
123 | Int_t trk = tracks[idict]->GetDataUnchecked(row,col,time) - 1; | |
124 | if ((idict == 0) && (trk >= mask)) { | |
125 | type = 2; | |
126 | } | |
127 | if ((type == 1) && (trk >= mask)) { | |
128 | type = 3; | |
129 | } | |
130 | } | |
131 | ||
132 | if (amp > thresh) { | |
133 | ||
134 | Float_t glb[3]; | |
135 | Float_t loc[3]; | |
136 | ||
137 | loc[0] = row; | |
138 | loc[1] = col; | |
139 | loc[2] = time; | |
ecd782af | 140 | geo->Local2Global(idet,loc,glb,par); |
00653a86 | 141 | Float_t x = glb[0]; |
142 | Float_t y = glb[1]; | |
143 | Float_t z = glb[2]; | |
144 | ||
145 | if (type == 1) { | |
146 | pmSignal->SetPoint(isignal,x,y,z); | |
147 | isignal++; | |
148 | totalsignal++; | |
149 | } | |
150 | else if (type == 2) { | |
151 | pmBgnd->SetPoint(ibgnd,x,y,z); | |
152 | ibgnd++; | |
153 | totalbgnd++; | |
154 | } | |
155 | else if (type == 3) { | |
156 | pmMerged->SetPoint(imerged,x,y,z); | |
157 | imerged++; | |
158 | totalmerged++; | |
159 | } | |
160 | ||
161 | } | |
162 | ||
163 | } | |
164 | } | |
165 | } | |
166 | ||
167 | digits->Compress(1,0); | |
168 | for (idict = 0; idict < kNdict; idict++) { | |
169 | tracks[idict]->Compress(1,0); | |
170 | } | |
171 | ||
172 | pmMerged->SetMarkerSize(1); | |
173 | pmMerged->SetMarkerColor(markerColorMerged); | |
174 | pmMerged->SetMarkerStyle(1); | |
175 | pmMerged->Draw(); | |
176 | ||
177 | pmBgnd->SetMarkerSize(1); | |
178 | pmBgnd->SetMarkerColor(markerColorBgnd); | |
179 | pmBgnd->SetMarkerStyle(1); | |
180 | pmBgnd->Draw(); | |
181 | ||
182 | pmSignal->SetMarkerSize(1); | |
183 | pmSignal->SetMarkerColor(markerColorSignal); | |
184 | pmSignal->SetMarkerStyle(1); | |
185 | pmSignal->Draw(); | |
186 | ||
187 | } | |
188 | ||
189 | } | |
190 | ||
191 | TGeometry *geoAlice = (TGeometry *) gafl->Get("AliceGeom"); | |
192 | TNode *main = (TNode *) ((geoAlice->GetListOfNodes())->First()); | |
193 | TIter next(main->GetListOfNodes()); | |
194 | TNode *module = 0; | |
195 | while ((module = (TNode *) next())) { | |
196 | Char_t ch[100]; | |
197 | sprintf(ch,"%s\n",module->GetTitle()); | |
198 | if ((ch[0] == 'T') && ((ch[1] == 'R') || (ch[1] == 'P'))) { | |
199 | module->SetVisibility( 3); | |
200 | } | |
201 | else { | |
202 | module->SetVisibility(-1); | |
203 | } | |
204 | } | |
205 | ||
206 | geoAlice->Draw("same"); | |
207 | ||
208 | c1->Modified(); | |
209 | c1->Update(); | |
210 | ||
211 | gafl->Close(); | |
212 | ||
213 | printf("<AliTRDdisplayDigits3D> Number of digits:\n"); | |
214 | printf(" signal = %d, bgnd = %d, merged = %d\n" | |
215 | ,totalsignal,totalbgnd,totalmerged); | |
216 | ||
217 | return 0; | |
218 | ||
219 | } | |
220 |