e118b27e |
1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
3 | * * |
4 | * Author: The ALICE Off-line Project. * |
5 | * Contributors are mentioned in the code where appropriate. * |
6 | * * |
7 | * Permission to use, copy, modify and distribute this software and its * |
8 | * documentation strictly for non-commercial purposes is hereby granted * |
9 | * without fee, provided that the above copyright notice appears in all * |
10 | * copies and that both the copyright notice and this permission notice * |
11 | * appear in the supporting documentation. The authors make no claims * |
12 | * about the suitability of this software for any purpose. It is * |
13 | * provided "as is" without express or implied warranty. * |
14 | **************************************************************************/ |
15 | |
16 | // $Id$ |
17 | // |
18 | // Class AliMUONTest |
19 | // ----------------- |
20 | // Class with functions for testing |
21 | // |
22 | // Author: Ivana Hrivnacova, IPN Orsay |
23 | |
24 | #include <TStopwatch.h> |
25 | #include <Riostream.h> |
24def874 |
26 | #include <TH2F.h> |
27 | #include <TPave.h> |
152d6f4e |
28 | #include <TCanvas.h> |
e118b27e |
29 | |
30 | #include "AliRun.h" |
31 | #include "AliSegmentation.h" |
32 | #include "AliLog.h" |
33 | |
34 | #include "AliMUONTest.h" |
35 | #include "AliMUON.h" |
36 | #include "AliMUONConstants.h" |
37 | #include "AliMUONGeometryModule.h" |
38 | #include "AliMUONGeometryStore.h" |
39 | #include "AliMUONGeometrySegmentation.h" |
40 | #include "AliMUONSt12QuadrantSegmentation.h" |
24def874 |
41 | #include "AliMUONSt345SlatSegmentation.h" |
58d53b65 |
42 | #include "AliMUONTriggerSegmentation.h" |
43 | #include "AliMUONTriggerConstants.h" |
e118b27e |
44 | |
45 | ClassImp(AliMUONTest) |
46 | |
47 | //__________________________________________________________________ |
24def874 |
48 | AliMUONTest::AliMUONTest(const TString& configMacro) |
152d6f4e |
49 | : TObject(), |
50 | fCanvas(0) |
e118b27e |
51 | { |
52 | // Standard Constructor |
53 | // |
54 | // Initialize AliRoot |
55 | gAlice->Init(configMacro.Data()); |
56 | } |
57 | |
58 | //__________________________________________________________________ |
59 | AliMUONTest::AliMUONTest() |
152d6f4e |
60 | : TObject(), |
61 | fCanvas(0) |
e118b27e |
62 | { |
63 | // Default Constructor |
64 | // |
65 | } |
66 | |
67 | //____________________________________________________________________ |
68 | AliMUONTest::AliMUONTest(const AliMUONTest& rhs) |
69 | : TObject(rhs) |
70 | { |
71 | // Protected copy constructor |
72 | |
73 | AliFatal("Not implemented."); |
74 | } |
75 | |
76 | //____________________________________________________________________ |
77 | AliMUONTest::~AliMUONTest() |
78 | { |
79 | // Destructor |
152d6f4e |
80 | |
81 | delete fCanvas; |
e118b27e |
82 | } |
83 | |
84 | //________________________________________________________________________ |
85 | AliMUONTest& AliMUONTest::operator = (const AliMUONTest& rhs) |
86 | { |
87 | // Protected assignement operator |
88 | |
89 | if (this == &rhs) return *this; |
90 | |
91 | AliFatal("Not implemented."); |
92 | |
93 | return *this; |
94 | } |
95 | |
96 | // |
152d6f4e |
97 | // private methods |
e118b27e |
98 | // |
99 | |
152d6f4e |
100 | //________________________________________________________________________ |
101 | AliMUONGeometrySegmentation* |
102 | AliMUONTest::CreateSt1Segmentation(Int_t chamberId, Int_t cathod) |
e118b27e |
103 | { |
152d6f4e |
104 | // Create St1 geometry segmentation for given chamber and cathod |
e118b27e |
105 | |
106 | AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON"); |
107 | if (!muon) { |
108 | AliFatal("MUON detector not defined."); |
152d6f4e |
109 | return 0; |
e118b27e |
110 | } |
111 | |
152d6f4e |
112 | AliMUONGeometrySegmentation* segmentation |
113 | = new AliMUONGeometrySegmentation(muon->Chamber(chamberId).GetGeometry()); |
e118b27e |
114 | |
152d6f4e |
115 | // Quadrant segmentations: |
116 | AliMUONSt12QuadrantSegmentation* bendSt1 |
117 | = new AliMUONSt12QuadrantSegmentation(kStation1, kBendingPlane); |
118 | AliMUONSt12QuadrantSegmentation* nonbendSt1 |
119 | = new AliMUONSt12QuadrantSegmentation(kStation1, kNonBendingPlane); |
120 | |
121 | // The same configuration for both chambers of Station 1 |
122 | Int_t id0 = (chamberId+1)*100; |
123 | |
124 | // Configure St1 chamber segmentations |
125 | if (cathod == 0) { |
152d6f4e |
126 | segmentation->Add(id0, bendSt1); |
b413978f |
127 | segmentation->Add(id0 + 3, nonbendSt1); |
128 | segmentation->Add(id0 + 2, bendSt1); |
152d6f4e |
129 | segmentation->Add(id0 + 1, nonbendSt1); |
152d6f4e |
130 | } |
131 | else if (cathod == 1) { |
152d6f4e |
132 | segmentation->Add(id0, nonbendSt1); |
b413978f |
133 | segmentation->Add(id0 + 3, bendSt1); |
134 | segmentation->Add(id0 + 2, nonbendSt1); |
152d6f4e |
135 | segmentation->Add(id0 + 1, bendSt1); |
152d6f4e |
136 | } |
137 | else { |
138 | AliError("Wrong cathod number"); |
139 | return 0; |
24def874 |
140 | } |
e118b27e |
141 | |
152d6f4e |
142 | return segmentation; |
143 | } |
e118b27e |
144 | |
580c28fd |
145 | //________________________________________________________________________ |
146 | AliMUONGeometrySegmentation* |
147 | AliMUONTest::CreateSt2Segmentation(Int_t chamberId, Int_t cathod) |
148 | { |
149 | // Create St1 geometry segmentation for given chamber and cathod |
150 | |
151 | AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON"); |
152 | if (!muon) { |
153 | AliFatal("MUON detector not defined."); |
154 | return 0; |
155 | } |
156 | |
157 | AliMUONGeometrySegmentation* segmentation |
158 | = new AliMUONGeometrySegmentation(muon->Chamber(chamberId).GetGeometry()); |
159 | |
160 | // Quadrant segmentations: |
161 | AliMUONSt12QuadrantSegmentation* bendSt2 |
162 | = new AliMUONSt12QuadrantSegmentation(kStation2, kBendingPlane); |
163 | AliMUONSt12QuadrantSegmentation* nonbendSt2 |
164 | = new AliMUONSt12QuadrantSegmentation(kStation2, kNonBendingPlane); |
165 | |
166 | // The same configuration for both chambers of Station 2 |
167 | Int_t id0 = (chamberId+1)*100; |
168 | |
169 | // Configure St2 chamber segmentations |
170 | if (cathod == 0) { |
171 | segmentation->Add(id0, bendSt2); |
b413978f |
172 | segmentation->Add(id0 + 3, nonbendSt2); |
173 | segmentation->Add(id0 + 2, bendSt2); |
580c28fd |
174 | segmentation->Add(id0 + 1, nonbendSt2); |
580c28fd |
175 | } |
176 | else if (cathod == 1) { |
177 | segmentation->Add(id0, nonbendSt2); |
b413978f |
178 | segmentation->Add(id0 + 3, bendSt2); |
179 | segmentation->Add(id0 + 2, nonbendSt2); |
580c28fd |
180 | segmentation->Add(id0 + 1, bendSt2); |
580c28fd |
181 | } |
182 | else { |
183 | AliError("Wrong cathod number"); |
184 | return 0; |
185 | } |
186 | |
187 | return segmentation; |
188 | } |
189 | |
24def874 |
190 | //_____________________________________________________________________________ |
152d6f4e |
191 | AliMUONGeometrySegmentation* |
192 | AliMUONTest::CreateSlatSegmentation(Int_t chamberId, Int_t cathod) |
24def874 |
193 | { |
152d6f4e |
194 | // Create St1 geometry segmentation for given chamber and cathod |
24def874 |
195 | |
196 | AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON"); |
197 | if (!muon) { |
198 | AliFatal("MUON detector not defined."); |
152d6f4e |
199 | return 0; |
24def874 |
200 | } |
201 | |
f48459ab |
202 | AliMUONGeometrySegmentation *chamberSeg = new AliMUONGeometrySegmentation(muon->Chamber(chamberId).GetGeometry()); |
203 | |
24def874 |
204 | //Slats Segmentations |
f48459ab |
205 | AliMUONSt345SlatSegmentation *slatsegB[14]; // Types of segmentation for St3 in this framework |
206 | AliMUONSt345SlatSegmentation *slatsegNB[14]; // Types of segmentation for St3 in this framework |
207 | // Bending |
24def874 |
208 | Int_t ndiv[4] ={ 4, 4, 2, 1}; // densities zones |
f48459ab |
209 | for(Int_t i=0; i<14; i++) { |
210 | slatsegB[i] = new AliMUONSt345SlatSegmentation(1); |
211 | slatsegB[i]->SetPadSize(10.,0.5); |
212 | slatsegB[i]->SetPadDivision(ndiv); |
213 | slatsegB[i]->SetId(1); |
214 | slatsegB[i]->SetDAnod(0.25); |
215 | slatsegNB[i] = new AliMUONSt345SlatSegmentation(0); |
216 | slatsegNB[i]->SetPadSize(1.,10.); // must be 0.713 !!! |
217 | slatsegNB[i]->SetPadDivision(ndiv); |
218 | slatsegNB[i]->SetId(1); |
219 | slatsegNB[i]->SetDAnod(0.25); |
24def874 |
220 | } |
221 | |
f48459ab |
222 | |
24def874 |
223 | //****************************************************************************************** |
224 | // Station 3 |
225 | //****************************************************************************************** |
226 | |
f48459ab |
227 | if (chamberId == 4 || chamberId == 5) { |
228 | // Type 112200 for 500, 501, 508, 509, 510, 517 in Ch5 (similar for Ch6) for the futur official numbering |
229 | // Type 112200 for 503, 504, 505, 555, 554, 553 in Ch5 (similar for Ch6) actual numbering in the code to be changed in jan05 |
230 | Int_t n0[4] = { 0, 2, 2, 0 }; |
231 | slatsegB[0]->SetPcbBoards(n0); |
232 | slatsegB[0]->Init(0); |
233 | slatsegNB[0]->SetPcbBoards(n0); |
234 | slatsegNB[0]->Init(0); |
235 | |
236 | // Type 122200 for 502, 507, 511, 516 (similar in Ch6) for future official numbering of ALICE |
237 | // Type 122200 for 502, 506, 556, 552 (similiarin Ch6) for actual numbering in muon code to be changed in jan05 |
238 | Int_t n1[4] = { 0, 1, 3, 0 }; |
239 | slatsegB[1]->SetPcbBoards(n1); |
240 | slatsegB[1]->Init(0); |
241 | slatsegNB[1]->SetPcbBoards(n1); |
242 | slatsegNB[1]->Init(0); |
243 | |
244 | // Type 222000 for 503, 506, 512, 515 (similar in Ch6) for future official numbering of ALICE |
245 | // Type 222000 for 501, 507, 557, 551 (similiarin Ch6) for actual numbering in muon code to be changed in jan05 |
246 | Int_t n2[4] = { 0, 0, 3, 0 }; |
247 | slatsegB[2]->SetPcbBoards(n2); |
248 | slatsegB[2]->Init(0); |
249 | slatsegNB[2]->SetPcbBoards(n2); |
250 | slatsegNB[2]->Init(0); |
251 | |
252 | // Type 220000 for 504, 505, 513, 514 (similar in Ch6) for future official numbering of ALICE |
253 | // Type 220000 for 500, 508, 558, 550 (similiarin Ch6) for actual numbering in muon code to be changed in jan05 |
254 | Int_t n3[4] = { 0, 0, 2, 0 }; |
255 | slatsegB[3]->SetPcbBoards(n3); |
256 | slatsegB[3]->Init(0); |
257 | slatsegNB[3]->SetPcbBoards(n3); |
258 | slatsegNB[3]->Init(0); |
259 | } |
24def874 |
260 | |
24def874 |
261 | |
f48459ab |
262 | //*************************************************************************************** |
24def874 |
263 | // Station 4 & 5 |
264 | //**************************************************************************************** |
265 | |
f48459ab |
266 | if (chamberId >= 6 && chamberId <= 9) { |
267 | // Type 122330 for 700, 713 in Ch7 (similar for Ch8) for the futur official numbering |
268 | // Type 122330 for 706, 756 in Ch7 (similar for Ch8) actual numbering in the code to be changed in jan05 |
269 | // Type 122330 for 900, 913 in Ch9 (similar for Ch10) for the futur official numbering |
270 | // Type 122330 for 906, 956 in Ch9 (similar for Ch10) actual numbering in the code to be changed in jan05 |
271 | |
272 | Int_t n4[4] = { 0, 1, 2, 2 }; |
273 | slatsegB[4]->SetPcbBoards(n4); |
274 | slatsegB[4]->Init(0); // 0 detection element id |
275 | slatsegNB[4]->SetPcbBoards(n4); |
276 | slatsegNB[4]->Init(0); // 0 detection element id |
277 | |
278 | // Type 112233 for 701, 712, 714, 725 in Ch7 (similar for Ch8) for the futur official numbering |
279 | // Type 112233 for 705, 707, 755, 757 in Ch7 (similar for Ch8) actual numbering in the code to be changed in jan05 |
280 | // Type 112233 for 901, 902, 911, 912, 914, 915, 924, 925 in Ch9 (similar for Ch10) for the futur official numbering |
281 | // Type 112233 for 904, 905, 907, 908, 954, 955, 957, 958 in Ch9 (similar for Ch10) actual numbering in the code to be changed in jan05 |
282 | Int_t n5[4] = { 0, 2, 2, 2 }; |
283 | slatsegB[5]->SetPcbBoards(n5); |
284 | slatsegB[5]->Init(0); // 0 detection element id |
285 | slatsegNB[5]->SetPcbBoards(n5); |
286 | slatsegNB[5]->Init(0); // 0 detection element id |
287 | |
288 | // Type 112230 for 702, 711, 715, 724 in Ch7 (similar for Ch8) for the futur official numbering |
289 | // Type 112230 for 704, 708, 754, 758 in Ch7 (similar for Ch8) actual numbering in the code to be changed in jan05 |
290 | Int_t n6[4] = { 0, 2, 2, 1 }; |
291 | slatsegB[6]->SetPcbBoards(n6); |
292 | slatsegB[6]->Init(0); // 0 detection element id |
293 | slatsegNB[6]->SetPcbBoards(n6); |
294 | slatsegNB[6]->Init(0); // 0 detection element id |
295 | |
296 | // Type 222330 for 703, 710, 716, 723 in Ch7 (similar for Ch8) for the futur official numbering |
297 | // Type 222330 for 703, 709, 753, 759 in Ch7 (similar for Ch8) actual numbering in the code to be changed in jan05 |
298 | Int_t n7[4] = { 0, 0, 3, 2 }; |
299 | slatsegB[7]->SetPcbBoards(n7); |
300 | slatsegB[7]->Init(0); // 0 detection element id |
301 | slatsegNB[7]->SetPcbBoards(n7); |
302 | slatsegNB[7]->Init(0); // 0 detection element id |
303 | |
304 | // Type 223300 for 704, 709, 717, 722 in Ch7 (similar for Ch8) for the futur official numbering |
305 | // Type 223300 for 702, 710, 752, 760 in Ch7 (similar for Ch8) actual numbering in the code to be changed in jan05 |
306 | Int_t n8[4] = { 0, 0, 2, 2 }; |
307 | slatsegB[8]->SetPcbBoards(n8); |
308 | slatsegB[8]->Init(0); // 0 detection element id |
309 | slatsegNB[8]->SetPcbBoards(n8); |
310 | slatsegNB[8]->Init(0); // 0 detection element id |
311 | |
312 | // Type 333000 for 705, 708, 718, 721 in Ch7 (similar for Ch8) for the futur official numbering |
313 | // Type 333000 for 701, 711, 751, 761 in Ch7 (similar for Ch8) actual numbering in the code to be changed in jan05 |
314 | // Type 333000 for 906, 907, 919, 920 in Ch9 (similar for Ch10) for the futur official numbering |
315 | // Type 333000 for 900, 912, 950, 962 in Ch9 (similar for Ch10) actual numbering in the code to be changed in jan05 |
316 | Int_t n9[4] = { 0, 0, 0, 3 }; |
317 | slatsegB[9]->SetPcbBoards(n9); |
318 | slatsegB[9]->Init(0); // 0 detection element id |
319 | slatsegNB[9]->SetPcbBoards(n9); |
320 | slatsegNB[9]->Init(0); // 0 detection element id |
321 | |
322 | // Type 330000 for 706, 707, 719, 720 in Ch7 (similar for Ch8) for the futur official numbering |
323 | // Type 330000 for 700, 712, 750, 762 in Ch7 (similar for Ch8) actual numbering in the code to be changed in jan05 |
324 | Int_t n10[4] = { 0, 0, 0, 2 }; |
325 | slatsegB[10]->SetPcbBoards(n10); |
326 | slatsegB[10]->Init(0); // 0 detection element id |
327 | slatsegNB[10]->SetPcbBoards(n10); |
328 | slatsegNB[10]->Init(0); // 0 detection element id |
329 | |
330 | // Type 222333 for 903, 910, 916, 923 in Ch9 (similar for Ch10) for the futur official numbering |
331 | // Type 222333 for 903, 909, 953, 959 in Ch9 (similar for Ch10) actual numbering in the code to be changed in jan05 |
332 | Int_t n11[4] = { 0, 0, 3, 3 }; |
333 | slatsegB[11]->SetPcbBoards(n11); |
334 | slatsegB[11]->Init(0); // 0 detection element id |
335 | slatsegNB[11]->SetPcbBoards(n11); |
336 | slatsegNB[11]->Init(0); // 0 detection element id |
24def874 |
337 | |
f48459ab |
338 | // Type 223330 for 904, 909, 917, 922 in Ch9 (similar for Ch10) for the futur official numbering |
339 | // Type 223330 for 902, 910, 952, 960 in Ch9 (similar for Ch10) actual numbering in the code to be changed in jan05 |
340 | Int_t n12[4] = { 0, 0, 2, 3 }; |
341 | slatsegB[12]->SetPcbBoards(n12); |
342 | slatsegB[12]->Init(0); // 0 detection element id |
343 | slatsegNB[12]->SetPcbBoards(n12); |
344 | slatsegNB[12]->Init(0); // 0 detection element id |
345 | |
346 | // Type 333300 for 905, 908, 918, 921 in Ch9 (similar for Ch10) for the futur official numbering |
347 | // Type 333300 for 901, 911, 951, 961 in Ch9 (similar for Ch10) actual numbering in the code to be changed in jan05 |
348 | Int_t n13[4] = { 0, 0, 0, 4 }; |
349 | slatsegB[13]->SetPcbBoards(n13); |
350 | slatsegB[13]->Init(0); // 0 detection element id |
351 | slatsegNB[13]->SetPcbBoards(n13); |
352 | slatsegNB[13]->Init(0); // 0 detection element id |
24def874 |
353 | |
f48459ab |
354 | } |
355 | |
356 | Int_t id0 = 0; |
357 | |
358 | // For St3 |
359 | if (chamberId == 4 || chamberId == 5) { |
360 | // Create chamber segmentations |
361 | |
362 | id0=(chamberId+1)*100; |
24def874 |
363 | // type 220000 |
f48459ab |
364 | if (cathod == 0) { |
b413978f |
365 | chamberSeg->Add(id0+14, slatsegB[3]); |
366 | chamberSeg->Add(id0+ 4, slatsegB[3]); |
367 | chamberSeg->Add(id0+13, slatsegB[3]); |
368 | chamberSeg->Add(id0+ 5, slatsegB[3]); |
f48459ab |
369 | } else { |
b413978f |
370 | chamberSeg->Add(id0+14, slatsegNB[3]); |
371 | chamberSeg->Add(id0+ 4, slatsegNB[3]); |
372 | chamberSeg->Add(id0+13, slatsegNB[3]); |
373 | chamberSeg->Add(id0+ 5, slatsegNB[3]); |
f48459ab |
374 | } |
24def874 |
375 | // type 222000 |
f48459ab |
376 | if (cathod == 0) { |
b413978f |
377 | chamberSeg->Add(id0+15, slatsegB[2]); |
378 | chamberSeg->Add(id0+ 3, slatsegB[2]); |
379 | chamberSeg->Add(id0+12, slatsegB[2]); |
380 | chamberSeg->Add(id0+ 6, slatsegB[2]); |
f48459ab |
381 | } else { |
b413978f |
382 | chamberSeg->Add(id0+15, slatsegNB[2]); |
383 | chamberSeg->Add(id0+ 3, slatsegNB[2]); |
384 | chamberSeg->Add(id0+12, slatsegNB[2]); |
385 | chamberSeg->Add(id0+ 6, slatsegNB[2]); |
f48459ab |
386 | } |
24def874 |
387 | // type 122200 |
f48459ab |
388 | if (cathod == 0) { |
b413978f |
389 | chamberSeg->Add(id0+16, slatsegB[1]); |
390 | chamberSeg->Add(id0+ 2, slatsegB[1]); |
391 | chamberSeg->Add(id0+11, slatsegB[1]); |
392 | chamberSeg->Add(id0+ 7, slatsegB[1]); |
f48459ab |
393 | } else { |
b413978f |
394 | chamberSeg->Add(id0+16, slatsegNB[1]); |
395 | chamberSeg->Add(id0+ 2, slatsegNB[1]); |
396 | chamberSeg->Add(id0+11, slatsegNB[1]); |
397 | chamberSeg->Add(id0+ 7, slatsegNB[1]); |
f48459ab |
398 | } |
24def874 |
399 | // type 112200 |
f48459ab |
400 | if (cathod == 0) { |
b413978f |
401 | chamberSeg->Add(id0+17, slatsegB[0]); |
402 | chamberSeg->Add(id0, slatsegB[0]); |
403 | chamberSeg->Add(id0+ 1, slatsegB[0]); |
404 | chamberSeg->Add(id0+10, slatsegB[0]); |
405 | chamberSeg->Add(id0+ 9, slatsegB[0]); |
406 | chamberSeg->Add(id0+ 8, slatsegB[0]); |
f48459ab |
407 | } else { |
b413978f |
408 | chamberSeg->Add(id0+17, slatsegNB[0]); |
409 | chamberSeg->Add(id0, slatsegNB[0]); |
410 | chamberSeg->Add(id0+ 1, slatsegNB[0]); |
411 | chamberSeg->Add(id0+10, slatsegNB[0]); |
412 | chamberSeg->Add(id0+ 9, slatsegNB[0]); |
413 | chamberSeg->Add(id0+ 8, slatsegNB[0]); |
f48459ab |
414 | } |
152d6f4e |
415 | |
24def874 |
416 | } |
417 | |
f48459ab |
418 | // For St4 |
419 | if (chamberId == 6 || chamberId == 7) { |
24def874 |
420 | // Create chamber segmentations |
f48459ab |
421 | id0=(chamberId+1)*100; |
24def874 |
422 | // type 122330 |
f48459ab |
423 | if (cathod == 0) { |
b413978f |
424 | chamberSeg->Add(id0+13, slatsegB[4]); |
425 | chamberSeg->Add(id0 , slatsegB[4]); |
f48459ab |
426 | } else { |
b413978f |
427 | chamberSeg->Add(id0+13, slatsegNB[4]); |
428 | chamberSeg->Add(id0 , slatsegNB[4]); |
f48459ab |
429 | } |
24def874 |
430 | // type 112233 |
f48459ab |
431 | if (cathod == 0) { |
b413978f |
432 | chamberSeg->Add(id0+14, slatsegB[5]); |
433 | chamberSeg->Add(id0+12, slatsegB[5]); |
434 | chamberSeg->Add(id0+25, slatsegB[5]); |
435 | chamberSeg->Add(id0+ 1, slatsegB[5]); |
f48459ab |
436 | } else { |
b413978f |
437 | chamberSeg->Add(id0+14, slatsegNB[5]); |
438 | chamberSeg->Add(id0+12, slatsegNB[5]); |
439 | chamberSeg->Add(id0+25, slatsegNB[5]); |
440 | chamberSeg->Add(id0+ 1, slatsegNB[5]); |
f48459ab |
441 | } |
24def874 |
442 | // type 112230 |
f48459ab |
443 | if (cathod == 0) { |
b413978f |
444 | chamberSeg->Add(id0+15, slatsegB[6]); |
445 | chamberSeg->Add(id0+11, slatsegB[6]); |
446 | chamberSeg->Add(id0+24, slatsegB[6]); |
447 | chamberSeg->Add(id0+ 2, slatsegB[6]); |
f48459ab |
448 | } else { |
b413978f |
449 | chamberSeg->Add(id0+15, slatsegNB[6]); |
450 | chamberSeg->Add(id0+11, slatsegNB[6]); |
451 | chamberSeg->Add(id0+24, slatsegNB[6]); |
452 | chamberSeg->Add(id0+ 2, slatsegNB[6]); |
f48459ab |
453 | } |
24def874 |
454 | // type 222330 |
f48459ab |
455 | if (cathod == 0) { |
b413978f |
456 | chamberSeg->Add(id0+16, slatsegB[7]); |
457 | chamberSeg->Add(id0+10, slatsegB[7]); |
458 | chamberSeg->Add(id0+23, slatsegB[7]); |
f48459ab |
459 | chamberSeg->Add(id0+ 3, slatsegB[7]); |
f48459ab |
460 | } else { |
b413978f |
461 | chamberSeg->Add(id0+16, slatsegNB[7]); |
462 | chamberSeg->Add(id0+10, slatsegNB[7]); |
463 | chamberSeg->Add(id0+23, slatsegNB[7]); |
f48459ab |
464 | chamberSeg->Add(id0+ 3, slatsegNB[7]); |
f48459ab |
465 | } |
24def874 |
466 | // type 223300 |
f48459ab |
467 | if (cathod == 0) { |
b413978f |
468 | chamberSeg->Add(id0+17, slatsegB[8]); |
469 | chamberSeg->Add(id0+ 9, slatsegB[8]); |
470 | chamberSeg->Add(id0+22, slatsegB[8]); |
471 | chamberSeg->Add(id0+ 4, slatsegB[8]); |
f48459ab |
472 | } else { |
b413978f |
473 | chamberSeg->Add(id0+17, slatsegNB[8]); |
474 | chamberSeg->Add(id0+ 9, slatsegNB[8]); |
475 | chamberSeg->Add(id0+22, slatsegNB[8]); |
476 | chamberSeg->Add(id0+ 4, slatsegNB[8]); |
f48459ab |
477 | } |
24def874 |
478 | // type 333000 |
f48459ab |
479 | if (cathod == 0) { |
b413978f |
480 | chamberSeg->Add(id0+18, slatsegB[9]); |
481 | chamberSeg->Add(id0+ 8, slatsegB[9]); |
482 | chamberSeg->Add(id0+21, slatsegB[9]); |
483 | chamberSeg->Add(id0+ 5, slatsegB[9]); |
f48459ab |
484 | } else { |
b413978f |
485 | chamberSeg->Add(id0+18, slatsegNB[9]); |
486 | chamberSeg->Add(id0+ 8, slatsegNB[9]); |
487 | chamberSeg->Add(id0+21, slatsegNB[9]); |
488 | chamberSeg->Add(id0+ 5, slatsegNB[9]); |
f48459ab |
489 | } |
24def874 |
490 | // type 330000 |
f48459ab |
491 | if (cathod == 0) { |
b413978f |
492 | chamberSeg->Add(id0+19, slatsegB[10]); |
493 | chamberSeg->Add(id0+ 7, slatsegB[10]); |
494 | chamberSeg->Add(id0+20, slatsegB[10]); |
495 | chamberSeg->Add(id0+ 6, slatsegB[10]); |
f48459ab |
496 | } else { |
b413978f |
497 | chamberSeg->Add(id0+19, slatsegNB[10]); |
498 | chamberSeg->Add(id0+ 7, slatsegNB[10]); |
499 | chamberSeg->Add(id0+20, slatsegNB[10]); |
500 | chamberSeg->Add(id0+ 6, slatsegNB[10]); |
f48459ab |
501 | } |
24def874 |
502 | } |
503 | |
f48459ab |
504 | // For St5 |
505 | if (chamberId == 8 || chamberId == 9) { |
506 | // Create chamber segmentations |
507 | id0=(chamberId+1)*100; |
24def874 |
508 | // type 122330 |
f48459ab |
509 | if (cathod == 0) { |
b413978f |
510 | chamberSeg->Add(id0+13, slatsegB[4]); |
511 | chamberSeg->Add(id0 , slatsegB[4]); |
f48459ab |
512 | } else { |
b413978f |
513 | chamberSeg->Add(id0+13, slatsegNB[4]); |
514 | chamberSeg->Add(id0 , slatsegNB[4]); |
f48459ab |
515 | } |
24def874 |
516 | // type 112233 |
f48459ab |
517 | if (cathod == 0) { |
b413978f |
518 | chamberSeg->Add(id0+15, slatsegB[5]); |
519 | chamberSeg->Add(id0+14, slatsegB[5]); |
520 | chamberSeg->Add(id0+12, slatsegB[5]); |
521 | chamberSeg->Add(id0+11, slatsegB[5]); |
522 | chamberSeg->Add(id0+24, slatsegB[5]); |
523 | chamberSeg->Add(id0+25, slatsegB[5]); |
524 | chamberSeg->Add(id0+ 1, slatsegB[5]); |
525 | chamberSeg->Add(id0+ 2, slatsegB[5]); |
f48459ab |
526 | } else { |
b413978f |
527 | chamberSeg->Add(id0+15, slatsegNB[5]); |
528 | chamberSeg->Add(id0+14, slatsegNB[5]); |
529 | chamberSeg->Add(id0+12, slatsegNB[5]); |
530 | chamberSeg->Add(id0+11, slatsegNB[5]); |
531 | chamberSeg->Add(id0+24, slatsegNB[5]); |
532 | chamberSeg->Add(id0+25, slatsegNB[5]); |
533 | chamberSeg->Add(id0+ 1, slatsegNB[5]); |
534 | chamberSeg->Add(id0+ 2, slatsegNB[5]); |
f48459ab |
535 | } |
24def874 |
536 | // type 222333 |
f48459ab |
537 | if (cathod == 0) { |
b413978f |
538 | chamberSeg->Add(id0+16, slatsegB[11]); |
539 | chamberSeg->Add(id0+10, slatsegB[11]); |
540 | chamberSeg->Add(id0+23, slatsegB[11]); |
f48459ab |
541 | chamberSeg->Add(id0+ 3, slatsegB[11]); |
f48459ab |
542 | } else { |
b413978f |
543 | chamberSeg->Add(id0+16, slatsegNB[11]); |
544 | chamberSeg->Add(id0+10, slatsegNB[11]); |
545 | chamberSeg->Add(id0+23, slatsegNB[11]); |
f48459ab |
546 | chamberSeg->Add(id0+ 3, slatsegNB[11]); |
f48459ab |
547 | } |
24def874 |
548 | // type 223330 |
f48459ab |
549 | if (cathod == 0) { |
b413978f |
550 | chamberSeg->Add(id0+17, slatsegB[12]); |
551 | chamberSeg->Add(id0+ 9, slatsegB[12]); |
552 | chamberSeg->Add(id0+22, slatsegB[12]); |
553 | chamberSeg->Add(id0+ 4, slatsegB[12]); |
f48459ab |
554 | } else { |
b413978f |
555 | chamberSeg->Add(id0+17, slatsegNB[12]); |
556 | chamberSeg->Add(id0+ 9, slatsegNB[12]); |
557 | chamberSeg->Add(id0+22, slatsegNB[12]); |
558 | chamberSeg->Add(id0+ 4, slatsegNB[12]); |
f48459ab |
559 | } |
24def874 |
560 | // type 333300 |
f48459ab |
561 | if (cathod == 0) { |
b413978f |
562 | chamberSeg->Add(id0+18, slatsegB[13]); |
563 | chamberSeg->Add(id0+ 8, slatsegB[13]); |
564 | chamberSeg->Add(id0+21, slatsegB[13]); |
565 | chamberSeg->Add(id0+ 5, slatsegB[13]); |
f48459ab |
566 | } else { |
b413978f |
567 | chamberSeg->Add(id0+18, slatsegNB[13]); |
568 | chamberSeg->Add(id0+ 8, slatsegNB[13]); |
569 | chamberSeg->Add(id0+21, slatsegNB[13]); |
570 | chamberSeg->Add(id0+ 5, slatsegNB[13]); |
f48459ab |
571 | } |
24def874 |
572 | // type 333000 |
f48459ab |
573 | if (cathod == 0) { |
b413978f |
574 | chamberSeg->Add(id0+19, slatsegB[9]); |
575 | chamberSeg->Add(id0+ 7, slatsegB[9]); |
576 | chamberSeg->Add(id0+20, slatsegB[9]); |
577 | chamberSeg->Add(id0+ 6, slatsegB[9]); |
f48459ab |
578 | } else { |
b413978f |
579 | chamberSeg->Add(id0+19, slatsegNB[9]); |
580 | chamberSeg->Add(id0+ 7, slatsegNB[9]); |
581 | chamberSeg->Add(id0+20, slatsegNB[9]); |
582 | chamberSeg->Add(id0+ 6, slatsegNB[9]); |
f48459ab |
583 | } |
584 | } |
585 | |
586 | |
587 | if (!id0) { |
588 | AliWarning(Form("Segmentation for chamber %d , cathod %d is not yet defined", |
589 | chamberId, cathod)); |
590 | return 0; |
24def874 |
591 | |
152d6f4e |
592 | } |
f48459ab |
593 | |
594 | DrawSegmentation(chamberSeg); |
595 | return chamberSeg; |
596 | |
152d6f4e |
597 | } |
58d53b65 |
598 | //_____________________________________________________________________________ |
79b4ba23 |
599 | |
58d53b65 |
600 | AliMUONGeometrySegmentation* |
601 | AliMUONTest::CreateTriggerSegmentation(Int_t chamberId, Int_t cathod) |
602 | { |
603 | // Create Trigger geometry segmentation for given chamber and cathod |
604 | |
605 | printf("in CreateTriggerSegmentation chamber=%d cathode=%d\n", |
606 | chamberId,cathod); |
607 | AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON"); |
608 | if (!muon) { |
609 | AliFatal("MUON detector not defined."); |
610 | return 0; |
611 | } |
612 | |
613 | AliMUONGeometrySegmentation *chamberSeg = new AliMUONGeometrySegmentation(muon->Chamber(chamberId).GetGeometry()); |
614 | |
79b4ba23 |
615 | //Trigger Segmentation |
58d53b65 |
616 | AliMUONTriggerSegmentation *trigSegX[9]; |
617 | AliMUONTriggerSegmentation *trigSegY[9]; |
618 | for(Int_t i=0; i<9; i++) { |
79b4ba23 |
619 | trigSegX[i] = new AliMUONTriggerSegmentation(1); |
620 | trigSegY[i] = new AliMUONTriggerSegmentation(0); |
621 | trigSegX[i]->SetLineNumber(9-i); |
622 | trigSegY[i]->SetLineNumber(9-i); |
58d53b65 |
623 | } |
624 | |
625 | AliMUONChamber *iChamber, *iChamber1; |
626 | iChamber1 = &muon->Chamber(10); |
627 | iChamber = &muon->Chamber(chamberId); |
628 | Float_t zpos1= - iChamber1->Z(); |
629 | Float_t zpos = - iChamber->Z(); |
630 | Float_t zRatio = zpos / zpos1; |
631 | |
632 | // init |
79b4ba23 |
633 | Float_t stripWidth[3]={0.,0.,0.}; // 1.0625 2.125 4.25 |
634 | Float_t stripLength[4]={0.,0.,0.,0.}; // 17. 34. 51. 68. |
635 | for (Int_t i=0; i<3; i++) |
636 | stripWidth[i]=AliMUONTriggerConstants::StripWidth(i)*zRatio; |
637 | for (Int_t i=0; i<4; i++) |
638 | stripLength[i]=AliMUONTriggerConstants::StripLength(i)*zRatio; |
58d53b65 |
639 | Int_t nStrip[7]={0,0,0,0,0,0,0}; |
640 | Float_t stripYsize[7]={0.,0.,0.,0.,0.,0.,0.}; |
641 | Float_t stripXsize[7]={0.,0.,0.,0.,0.,0.,0.}; |
642 | |
79b4ba23 |
643 | // chamber 8 0 cathode 0 |
58d53b65 |
644 | for (Int_t i=0; i<7; i++) nStrip[i]=16; |
79b4ba23 |
645 | for (Int_t i=0; i<7; i++) stripYsize[i]=stripWidth[2]; |
646 | for (Int_t i=0; i<6; i++) stripXsize[i]=stripLength[1]; |
647 | stripXsize[6]=stripLength[2]; |
648 | trigSegX[8]->Init(0,nStrip,stripYsize,stripXsize,0.); |
649 | trigSegX[0]->Init(0,nStrip,stripYsize,stripXsize,0.); |
650 | |
651 | // chamber 8 7 1 0 cathode 1 |
58d53b65 |
652 | for (Int_t i=0; i<6; i++) nStrip[i]=8; |
27b0e0ab |
653 | nStrip[6]=16; |
79b4ba23 |
654 | for (Int_t i=0; i<7; i++) stripYsize[i]=stripLength[3]; |
655 | for (Int_t i=0; i<7; i++) stripXsize[i]=stripWidth[2]; |
656 | trigSegY[8]->Init(0,nStrip,stripYsize,stripXsize,0.); |
657 | trigSegY[7]->Init(0,nStrip,stripYsize,stripXsize,0.); |
658 | trigSegY[1]->Init(0,nStrip,stripYsize,stripXsize,0.); |
659 | trigSegY[0]->Init(0,nStrip,stripYsize,stripXsize,0.); |
58d53b65 |
660 | |
79b4ba23 |
661 | // chamber 7 6 2 1 cathode 0 |
58d53b65 |
662 | for (Int_t i=0; i<6; i++) nStrip[i]=32; |
58d53b65 |
663 | nStrip[6]=16; |
79b4ba23 |
664 | for (Int_t i=0; i<6; i++) stripYsize[i]=stripWidth[1]; |
665 | stripYsize[6]=stripWidth[2]; |
666 | for (Int_t i=0; i<6; i++) stripXsize[i]=stripLength[1]; |
667 | stripXsize[6]=stripLength[2]; |
668 | trigSegX[7]->Init(0,nStrip,stripYsize,stripXsize,0.); |
669 | trigSegX[6]->Init(0,nStrip,stripYsize,stripXsize,0.); |
670 | trigSegX[2]->Init(0,nStrip,stripYsize,stripXsize,0.); |
671 | trigSegX[1]->Init(0,nStrip,stripYsize,stripXsize,0.); |
672 | |
673 | // chamber 6 2 cathode 1 |
674 | for (Int_t i=0; i<5; i++) nStrip[i]=16; |
675 | for (Int_t i=5; i<6; i++) nStrip[i]=8; |
676 | nStrip[6]=16; |
677 | for (Int_t i=0; i<7; i++) stripYsize[i]=stripLength[3]; |
678 | for (Int_t i=0; i<5; i++) stripXsize[i]=stripWidth[1]; |
679 | for (Int_t i=5; i<7; i++) stripXsize[i]=stripWidth[2]; |
680 | trigSegY[6]->Init(0,nStrip,stripYsize,stripXsize,0.); |
681 | trigSegY[2]->Init(0,nStrip,stripYsize,stripXsize,0.); |
682 | |
683 | // chamber 5 3 cathode 0 |
58d53b65 |
684 | nStrip[0]=48; |
79b4ba23 |
685 | for (Int_t i=1; i<3; i++) nStrip[i]=64; |
58d53b65 |
686 | for (Int_t i=3; i<6; i++) nStrip[i]=32; |
79b4ba23 |
687 | nStrip[6]=16; |
688 | for (Int_t i=0; i<3; i++) stripYsize[i]=stripWidth[0]; |
689 | for (Int_t i=3; i<6; i++) stripYsize[i]=stripWidth[1]; |
690 | stripYsize[6]=stripWidth[2]; |
691 | for (Int_t i=0; i<6; i++) stripXsize[i]=stripLength[1]; |
692 | stripXsize[6]=stripLength[2]; |
693 | trigSegX[5]->Init(0,nStrip,stripYsize,stripXsize,stripLength[0]); |
694 | trigSegX[3]->Init(0,nStrip,stripYsize,stripXsize,0.); |
695 | |
696 | // chamber 5 3 cathode 1 |
58d53b65 |
697 | for (Int_t i=0; i<5; i++) nStrip[i]=16; |
79b4ba23 |
698 | for (Int_t i=5; i<6; i++) nStrip[5]=8; |
699 | nStrip[6]=16; |
700 | stripYsize[0]=stripLength[2]; |
701 | for (Int_t i=1; i<8; i++) stripYsize[i]=stripLength[3]; |
702 | for (Int_t i=0; i<5; i++) stripXsize[i]=stripWidth[1]; |
703 | for (Int_t i=5; i<7; i++) stripXsize[i]=stripWidth[2]; |
704 | trigSegY[5]->Init(0,nStrip,stripYsize,stripXsize,stripLength[0]); |
705 | trigSegY[3]->Init(0,nStrip,stripYsize,stripXsize,0.); |
58d53b65 |
706 | |
707 | // chamber 4 cathode 0 |
708 | nStrip[0]=0; |
709 | for (Int_t i=1; i<3; i++) nStrip[i]=64; |
710 | for (Int_t i=3; i<6; i++) nStrip[i]=32; |
711 | nStrip[6]=16; |
712 | stripYsize[0]=0.; |
79b4ba23 |
713 | for (Int_t i=1; i<3; i++) stripYsize[i]=stripWidth[0]; |
714 | for (Int_t i=3; i<6; i++) stripYsize[i]=stripWidth[1]; |
715 | stripYsize[6]=stripWidth[2]; |
58d53b65 |
716 | stripXsize[0]=0; |
79b4ba23 |
717 | stripXsize[1]=stripLength[0]; |
718 | for (Int_t i=2; i<6; i++) stripXsize[i]=stripLength[1]; |
719 | stripXsize[6]=stripLength[2]; |
720 | trigSegX[4]->Init(0,nStrip,stripYsize,stripXsize,0.); |
58d53b65 |
721 | |
722 | // chamber 4 cathode 1 |
723 | nStrip[0]=0; |
724 | nStrip[1]=8; |
725 | for (Int_t i=2; i<5; i++) nStrip[i]=16; |
79b4ba23 |
726 | for (Int_t i=5; i<6; i++) nStrip[i]=8; |
727 | nStrip[6]=16; |
58d53b65 |
728 | stripYsize[0]=0.; |
79b4ba23 |
729 | for (Int_t i=1; i<7; i++) stripYsize[i]=stripLength[3]; |
58d53b65 |
730 | stripXsize[0]=0.; |
79b4ba23 |
731 | for (Int_t i=1; i<5; i++) stripXsize[i]=stripWidth[1]; |
732 | for (Int_t i=5; i<7; i++) stripXsize[i]=stripWidth[2]; |
733 | trigSegY[4]->Init(0,nStrip,stripYsize,stripXsize,0.); |
58d53b65 |
734 | |
735 | Int_t icount=chamberId-10; // chamber counter (0 1 2 3) |
736 | Int_t id0=(10+icount+1)*100; |
737 | |
58d53b65 |
738 | for (Int_t i=0; i<9; i++) { |
739 | if (cathod==0) { |
740 | chamberSeg->Add(id0+i, trigSegX[i]); |
741 | chamberSeg->Add(id0+50+i, trigSegX[i]); |
742 | } else if (cathod==1) { |
743 | chamberSeg->Add(id0+i, trigSegY[i]); |
744 | chamberSeg->Add(id0+50+i, trigSegY[i]); |
745 | } |
746 | } |
747 | |
58d53b65 |
748 | if (!id0) { |
749 | AliWarning(Form("Segmentation for chamber %d , cathod %d is not yet defined",chamberId, cathod)); |
750 | return 0; |
751 | } |
752 | |
753 | DrawSegmentation(chamberSeg); |
754 | return chamberSeg; |
755 | } |
756 | |
152d6f4e |
757 | // |
758 | // public methods |
759 | // |
760 | |
761 | //______________________________________________________________________________ |
762 | AliMUONGeometrySegmentation* |
763 | AliMUONTest::CreateSegmentation(Int_t chamberId, Int_t cath) |
764 | { |
765 | // Create geometry segmentation for the specified chamber and cathod |
766 | |
767 | switch (chamberId) { |
768 | |
769 | // Station1 |
770 | case 0: |
771 | case 1: |
772 | return CreateSt1Segmentation(chamberId, cath); |
773 | break; |
774 | |
775 | // Station2 |
776 | case 2: |
777 | case 3: |
580c28fd |
778 | return CreateSt2Segmentation(chamberId, cath); |
152d6f4e |
779 | break; |
780 | |
781 | // Slat stations |
782 | case 4: |
783 | case 5: |
784 | case 6: |
785 | case 7: |
786 | case 8: |
787 | case 9: |
788 | return CreateSlatSegmentation(chamberId, cath); |
789 | break; |
790 | |
791 | // Trigger stations |
792 | case 10: |
793 | case 11: |
794 | case 12: |
795 | case 13: |
58d53b65 |
796 | return CreateTriggerSegmentation(chamberId, cath); |
152d6f4e |
797 | break; |
798 | |
799 | default: |
800 | AliWarning("Wrong chamber Id"); |
801 | return 0; |
802 | break; |
803 | } |
804 | } |
152d6f4e |
805 | //______________________________________________________________________________ |
806 | void AliMUONTest::DetElemTransforms() |
807 | { |
808 | // |
809 | AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON"); |
810 | if (!muon) { |
811 | AliFatal("MUON detector not defined."); |
812 | return; |
813 | } |
814 | |
815 | // Loop over chambers |
816 | for (Int_t i=0; i<AliMUONConstants::NCh(); i++) { |
817 | |
818 | AliMUONGeometryModule* geometry = muon->Chamber(i).GetGeometry(); |
819 | AliMUONGeometryStore* detElements = geometry->GetDetElementStore(); |
820 | |
821 | // Loop over detection elements |
822 | for (Int_t j=0; j<detElements->GetNofEntries(); j++) { |
823 | |
824 | //Int_t detElemId = geometry->GetDetElemId(j); |
825 | Int_t detElemId = detElements->GetEntry(j)->GetUniqueID(); |
826 | cout << "Detection element Id: " << detElemId << endl; |
827 | |
828 | Double_t x, y, z; |
829 | geometry->Local2Global(detElemId, 0., 0., 0., x, y, z); |
830 | cout << " Global DE position: " |
831 | << x << ", " << y << ", " << z << endl; |
832 | |
833 | Double_t x2, y2, z2; |
834 | geometry->Global2Local(detElemId, 0., 0., 0., x2, y2, z2); |
835 | cout << " ALIC center in the local frame: " |
836 | << x2 << ", " << y2 << ", " << z2 << endl; |
837 | |
838 | Double_t x3, y3, z3; |
839 | geometry->Global2Local(detElemId, x, y, z, x3, y3, z3); |
840 | cout << " Back in the local frame: " |
841 | << x3 << ", " << y3 << ", " << z3 << endl; |
842 | cout << endl; |
843 | } |
24def874 |
844 | } |
152d6f4e |
845 | } |
846 | |
152d6f4e |
847 | //______________________________________________________________________________ |
848 | void AliMUONTest::ForWhole(AliMUONTests testCase) |
849 | { |
850 | // Perform test for all chambers and first cathod |
851 | |
852 | AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON"); |
853 | if (!muon) { |
854 | AliFatal("MUON detector not defined."); |
855 | return; |
856 | } |
857 | |
858 | TStopwatch timer; |
859 | timer.Start(); |
860 | |
861 | // Loop over chambers |
580c28fd |
862 | for (Int_t iChamber=0; iChamber<AliMUONConstants::NCh(); iChamber++) { |
863 | // for (Int_t iChamber=0; iChamber<3; iChamber=iChamber+2) { |
152d6f4e |
864 | |
865 | // Loop over cathods |
866 | //for (Int_t cath=0; cath<2; cath++) { |
867 | for (Int_t cath=0; cath<1; cath++) { |
868 | |
869 | AliMUONGeometrySegmentation* segmentation |
870 | = CreateSegmentation(iChamber, cath); |
871 | |
872 | if (!segmentation) continue; |
873 | |
874 | cout << setw(6) << "Pads in chamber " << iChamber |
875 | << " cathod " << cath << endl; |
876 | cout << "===================================" << endl; |
877 | |
878 | ForSegmentation(testCase, segmentation); |
879 | |
880 | //if (testCase == kDrawPads) { |
881 | //} |
882 | } |
883 | } |
884 | timer.Stop(); |
885 | timer.Print(); |
886 | } |
887 | |
888 | //______________________________________________________________________________ |
889 | void AliMUONTest::ForSegmentation(AliMUONTests testCase, |
890 | AliMUONGeometrySegmentation *segmentation) |
891 | { |
892 | // Perform test for a given segmentation |
893 | |
894 | TStopwatch timer; |
895 | timer.Start(); |
896 | |
897 | Before(testCase); |
898 | |
899 | // Loop over detection elements |
900 | // |
901 | AliMUONGeometryStore* detElements |
902 | = segmentation->GetGeometry()->GetDetElementStore(); |
903 | |
904 | for (Int_t j=0; j<detElements->GetNofEntries(); j++) { |
905 | |
906 | Int_t detElemId = detElements->GetEntry(j)->GetUniqueID(); |
907 | cout << "Detection element id: " << detElemId << endl; |
908 | |
909 | ForDetElement(testCase, detElemId, segmentation); |
910 | } |
911 | |
912 | After(testCase); |
913 | |
914 | timer.Stop(); |
915 | timer.Print(); |
24def874 |
916 | } |
152d6f4e |
917 | |
918 | //______________________________________________________________________________ |
919 | void AliMUONTest::ForDetElement(AliMUONTests testCase, |
920 | Int_t detElemId, |
921 | AliMUONGeometrySegmentation *segmentation) |
922 | { |
923 | // Prints global pad positions for given detection element |
924 | // in a given geometry segmentation |
925 | |
926 | |
927 | Int_t counter = 0; |
928 | |
929 | // Loop over pads in a detection element |
930 | // |
931 | |
932 | for(Int_t ix=1; ix<=segmentation->Npx(detElemId); ix++) |
933 | for(Int_t iy=1; iy<=segmentation->Npy(detElemId); iy++) |
934 | { |
935 | switch (testCase) { |
936 | |
937 | case kPrintPads: |
938 | PrintPad(counter, detElemId, ix, iy, segmentation); |
939 | break; |
940 | |
941 | case kDrawPads: |
942 | DrawPad(counter, detElemId, ix, iy, segmentation); |
943 | break; |
944 | } |
945 | } |
946 | } |
947 | |
948 | //______________________________________________________________________________ |
949 | void AliMUONTest::Before(AliMUONTests testCase) |
950 | { |
951 | // Do some initialization if necessary |
952 | |
953 | switch (testCase) { |
954 | |
955 | case kPrintPads: |
956 | break; |
957 | |
958 | case kDrawPads: |
959 | if (!fCanvas) { |
960 | fCanvas = new TCanvas("c1","c1", 0, 0, 600, 600); |
961 | fCanvas->Range(-300,-300, 300, 300); |
962 | fCanvas->cd(); |
963 | } |
964 | break; |
965 | } |
966 | } |
967 | |
968 | //______________________________________________________________________________ |
969 | void AliMUONTest::After(AliMUONTests testCase) |
970 | { |
971 | // Do some cleanup if necessary |
972 | |
973 | switch (testCase) { |
974 | |
975 | case kPrintPads: |
976 | break; |
977 | |
978 | case kDrawPads: |
979 | fCanvas->Update(); |
980 | cout << "Print any key + enter to continue ..." << endl; |
981 | char c; |
982 | cin >> c; |
983 | fCanvas->Clear(); |
984 | break; |
985 | } |
986 | } |
987 | |
988 | //______________________________________________________________________________ |
989 | void AliMUONTest::PrintPad(Int_t& counter, |
990 | Int_t detElemId, Int_t ix, Int_t iy, |
991 | AliMUONGeometrySegmentation* segmentation) |
992 | { |
993 | // Prints global pad positions for the given pad |
994 | |
995 | Float_t x, y, z; |
996 | Bool_t success |
997 | = segmentation->GetPadC(detElemId, ix, iy, x, y, z); |
998 | |
152d6f4e |
999 | cout << setw(6) << "counter " << counter++ << " "; |
1000 | cout << "Pad indices: ( " << detElemId << "; " << ix << ", " << iy << " ) " ; |
580c28fd |
1001 | |
1002 | if (success) { |
1003 | cout << "Pad position: ( " << x << ", " << y << ", " << z << " ); "; |
1004 | Int_t sector = segmentation->Sector(detElemId, ix, iy); |
1005 | Float_t dpx = segmentation->Dpx(detElemId, sector); |
1006 | Float_t dpy = segmentation->Dpy(detElemId, sector); |
1007 | cout << " dimensions: ( " << dpx << ", " << dpy << " )" << endl; |
1008 | } |
1009 | else { |
1010 | counter--; |
1011 | cout << "... no pad " << endl; |
1012 | } |
152d6f4e |
1013 | } |
1014 | |
1015 | //______________________________________________________________________________ |
1016 | void AliMUONTest::DrawPad(Int_t& counter, |
1017 | Int_t detElemId, Int_t ix, Int_t iy, |
1018 | AliMUONGeometrySegmentation* segmentation) |
1019 | { |
1020 | // Prints global pad positions for the given pad |
1021 | |
1022 | Float_t x, y, z; |
1023 | Bool_t success |
1024 | = segmentation->GetPadC(detElemId, ix, iy, x, y, z); |
1025 | |
1026 | if (!success) return; |
1027 | |
1028 | // PrintPad(counter,detElemId, ix, iy, segmentation); |
1029 | |
1030 | counter++; |
1031 | |
1032 | Int_t sector = segmentation->Sector(detElemId, ix, iy); |
1033 | Float_t dpx = segmentation->Dpx(detElemId, sector); |
1034 | Float_t dpy = segmentation->Dpy(detElemId, sector); |
1035 | |
1036 | //printf(" ***** Pad position is ix: %d iy: %d x: %f y: %f sector: %d dpx: %f dpy: %f \n", |
1037 | // ix, iy, x, y, sector, dpx, dpy); |
1038 | |
6b1e4b22 |
1039 | if (!fCanvas) Before(kDrawPads); |
1040 | |
152d6f4e |
1041 | fCanvas->cd(); |
1042 | TPave* pave = new TPave(x-dpx/2., y-dpy/2., x+dpx/2., y+dpy/2., 1); |
1043 | pave->Draw(); |
1044 | } |
1045 | |
1046 | //______________________________________________________________________________ |
f48459ab |
1047 | void AliMUONTest::DrawSegmentation(AliMUONGeometrySegmentation *seg) |
152d6f4e |
1048 | { |
1049 | // TBR |
1050 | |
1051 | // Drawing slat504 |
1052 | Int_t ix, iy, deId; |
1053 | Float_t x, y, z; |
1054 | Float_t dpx, dpy; |
1055 | // TH2F * frame = new TH2F(" "," ",10,-10.,245.,10, -5., 45.); |
f48459ab |
1056 | // TH2F * frame = new TH2F(" "," ",10,-300.,300.,10, -300., 300.); |
1057 | TH2F * frame = new TH2F(" "," ",10,-200.,200.,10, -200., 200.); |
152d6f4e |
1058 | frame->Draw(); |
1059 | // (new TPave( 0., 0., 40., 40.,2))->Draw(); |
1060 | // (new TPave( 40., 0., 80., 40.,2))->Draw(); |
1061 | // (new TPave( 80., 0.,120., 40.,2))->Draw(); |
1062 | // (new TPave(120., 0.,160., 40.,2))->Draw(); |
1063 | // (new TPave(160., 0.,200., 40.,2))->Draw(); |
1064 | // (new TPave(200., 0.,240., 40.,2))->Draw(); |
1065 | |
f48459ab |
1066 | // Loop over detection elements |
1067 | // |
1068 | AliMUONGeometryStore* detElements |
1069 | = seg->GetGeometry()->GetDetElementStore(); |
1070 | |
1071 | for (Int_t iDE=0; iDE<detElements->GetNofEntries(); iDE++) { |
152d6f4e |
1072 | |
f48459ab |
1073 | deId = detElements->GetEntry(iDE)->GetUniqueID(); |
1074 | cout << "Detection element id: " << deId << endl; |
1075 | |
1076 | |
1077 | // for ( seg->FirstPad(detElementId, 0., 0., 0., 100., 100.); |
1078 | // seg->MorePads(detElementId); |
1079 | // seg->NextPad(detElementId) ) { |
1080 | for(ix=1; ix<=seg->Npx(deId); ix++) { |
1081 | for(iy=1; iy<=seg->Npy(deId); iy++) { |
152d6f4e |
1082 | |
f48459ab |
1083 | seg->GetPadC(deId, ix, iy, x, y, z); |
1084 | Int_t sector = seg->Sector(deId, ix, iy); |
1085 | dpx = seg->Dpx(deId,sector); |
1086 | dpy = seg->Dpy(deId,sector); |
152d6f4e |
1087 | |
f48459ab |
1088 | //printf(" ***** Pad position is ix: %d iy: %d x: %f y: %f sector: %d dpx: %f dpy: %f \n",ix, iy, x, y, sector, dpx, dpy); |
1089 | (new TPave(x-dpx/2., y-dpy/2., x+dpx/2., y+dpy/2., 1))->Draw(); |
152d6f4e |
1090 | } |
f48459ab |
1091 | |
152d6f4e |
1092 | } |
1093 | } |
1094 | } |
1095 | |
58d53b65 |
1096 | |
1097 | |