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