1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
20 // Class with functions for testing
22 // Author: Ivana Hrivnacova, IPN Orsay
24 #include <TStopwatch.h>
25 #include <Riostream.h>
31 #include "AliSegmentation.h"
34 #include "AliMUONTest.h"
36 #include "AliMUONConstants.h"
37 #include "AliMUONGeometryModule.h"
38 #include "AliMUONGeometryStore.h"
39 #include "AliMUONGeometrySegmentation.h"
40 #include "AliMUONSt12QuadrantSegmentation.h"
41 #include "AliMUONSt345SlatSegmentation.h"
42 #include "AliMUONTriggerSegmentation.h"
43 #include "AliMUONTriggerConstants.h"
47 //__________________________________________________________________
48 AliMUONTest::AliMUONTest(const TString& configMacro)
52 // Standard Constructor
55 gAlice->Init(configMacro.Data());
58 //__________________________________________________________________
59 AliMUONTest::AliMUONTest()
63 // Default Constructor
67 //____________________________________________________________________
68 AliMUONTest::AliMUONTest(const AliMUONTest& rhs)
71 // Protected copy constructor
73 AliFatal("Not implemented.");
76 //____________________________________________________________________
77 AliMUONTest::~AliMUONTest()
84 //________________________________________________________________________
85 AliMUONTest& AliMUONTest::operator = (const AliMUONTest& rhs)
87 // Protected assignement operator
89 if (this == &rhs) return *this;
91 AliFatal("Not implemented.");
100 //________________________________________________________________________
101 AliMUONGeometrySegmentation*
102 AliMUONTest::CreateSt1Segmentation(Int_t chamberId, Int_t cathod)
104 // Create St1 geometry segmentation for given chamber and cathod
106 AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON");
108 AliFatal("MUON detector not defined.");
112 AliMUONGeometrySegmentation* segmentation
113 = new AliMUONGeometrySegmentation(muon->Chamber(chamberId).GetGeometry());
115 // Quadrant segmentations:
116 AliMUONSt12QuadrantSegmentation* bendSt1
117 = new AliMUONSt12QuadrantSegmentation(kStation1, kBendingPlane);
118 AliMUONSt12QuadrantSegmentation* nonbendSt1
119 = new AliMUONSt12QuadrantSegmentation(kStation1, kNonBendingPlane);
121 // The same configuration for both chambers of Station 1
122 Int_t id0 = (chamberId+1)*100;
124 // Configure St1 chamber segmentations
126 segmentation->Add(id0, bendSt1);
127 segmentation->Add(id0 + 1, nonbendSt1);
128 segmentation->Add(id0 + 50, bendSt1);
129 segmentation->Add(id0 + 51, nonbendSt1);
131 else if (cathod == 1) {
132 segmentation->Add(id0, nonbendSt1);
133 segmentation->Add(id0 + 1, bendSt1);
134 segmentation->Add(id0 + 50, nonbendSt1);
135 segmentation->Add(id0 + 51, bendSt1);
138 AliError("Wrong cathod number");
145 //_____________________________________________________________________________
146 AliMUONGeometrySegmentation*
147 AliMUONTest::CreateSlatSegmentation(Int_t chamberId, Int_t cathod)
149 // Create St1 geometry segmentation for given chamber and cathod
151 AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON");
153 AliFatal("MUON detector not defined.");
157 AliMUONGeometrySegmentation *chamberSeg = new AliMUONGeometrySegmentation(muon->Chamber(chamberId).GetGeometry());
159 //Slats Segmentations
160 AliMUONSt345SlatSegmentation *slatsegB[14]; // Types of segmentation for St3 in this framework
161 AliMUONSt345SlatSegmentation *slatsegNB[14]; // Types of segmentation for St3 in this framework
163 Int_t ndiv[4] ={ 4, 4, 2, 1}; // densities zones
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);
178 //******************************************************************************************
180 //******************************************************************************************
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);
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);
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);
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);
217 //***************************************************************************************
219 //****************************************************************************************
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
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
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
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
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
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
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
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
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
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
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
314 if (chamberId == 4 || chamberId == 5) {
315 // Create chamber segmentations
317 id0=(chamberId+1)*100;
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]);
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]);
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]);
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]);
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]);
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]);
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]);
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]);
374 if (chamberId == 6 || chamberId == 7) {
375 // Create chamber segmentations
376 id0=(chamberId+1)*100;
379 chamberSeg->Add(id0+ 6, slatsegB[4]);
380 chamberSeg->Add(id0+56, slatsegB[4]);
382 chamberSeg->Add(id0+ 6, slatsegNB[4]);
383 chamberSeg->Add(id0+56, slatsegNB[4]);
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]);
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]);
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]);
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]);
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]);
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]);
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]);
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]);
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]);
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]);
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]);
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]);
460 if (chamberId == 8 || chamberId == 9) {
461 // Create chamber segmentations
462 id0=(chamberId+1)*100;
465 chamberSeg->Add(id0+ 6, slatsegB[4]);
466 chamberSeg->Add(id0+56, slatsegB[4]);
468 chamberSeg->Add(id0+ 6, slatsegNB[4]);
469 chamberSeg->Add(id0+56, slatsegNB[4]);
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]);
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]);
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]);
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]);
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]);
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]);
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]);
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]);
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]);
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]);
543 AliWarning(Form("Segmentation for chamber %d , cathod %d is not yet defined",
549 DrawSegmentation(chamberSeg);
553 //_____________________________________________________________________________
555 AliMUONGeometrySegmentation*
556 AliMUONTest::CreateTriggerSegmentation(Int_t chamberId, Int_t cathod)
558 // Create Trigger geometry segmentation for given chamber and cathod
560 printf("in CreateTriggerSegmentation chamber=%d cathode=%d\n",
562 AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON");
564 AliFatal("MUON detector not defined.");
568 AliMUONGeometrySegmentation *chamberSeg = new AliMUONGeometrySegmentation(muon->Chamber(chamberId).GetGeometry());
570 //Trigger Segmentation
571 AliMUONTriggerSegmentation *trigSegX[9];
572 AliMUONTriggerSegmentation *trigSegY[9];
573 for(Int_t i=0; i<9; i++) {
574 trigSegX[i] = new AliMUONTriggerSegmentation(1);
575 trigSegY[i] = new AliMUONTriggerSegmentation(0);
576 trigSegX[i]->SetLineNumber(9-i);
577 trigSegY[i]->SetLineNumber(9-i);
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;
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;
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.};
598 // chamber 8 0 cathode 0
599 for (Int_t i=0; i<7; i++) nStrip[i]=16;
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.);
606 // chamber 8 7 1 0 cathode 1
607 for (Int_t i=0; i<6; i++) nStrip[i]=8;
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.);
616 // chamber 7 6 2 1 cathode 0
617 for (Int_t i=0; i<6; i++) nStrip[i]=32;
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.);
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;
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.);
638 // chamber 5 3 cathode 0
640 for (Int_t i=1; i<3; i++) nStrip[i]=64;
641 for (Int_t i=3; i<6; i++) nStrip[i]=32;
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.);
651 // chamber 5 3 cathode 1
652 for (Int_t i=0; i<5; i++) nStrip[i]=16;
653 for (Int_t i=5; i<6; i++) nStrip[5]=8;
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.);
662 // chamber 4 cathode 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;
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];
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.);
677 // chamber 4 cathode 1
680 for (Int_t i=2; i<5; i++) nStrip[i]=16;
681 for (Int_t i=5; i<6; i++) nStrip[i]=8;
684 for (Int_t i=1; i<7; i++) stripYsize[i]=stripLength[3];
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.);
690 Int_t icount=chamberId-10; // chamber counter (0 1 2 3)
691 Int_t id0=(10+icount+1)*100;
693 for (Int_t i=0; i<9; i++) {
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]);
704 AliWarning(Form("Segmentation for chamber %d , cathod %d is not yet defined",chamberId, cathod));
708 DrawSegmentation(chamberSeg);
716 //______________________________________________________________________________
717 AliMUONGeometrySegmentation*
718 AliMUONTest::CreateSegmentation(Int_t chamberId, Int_t cath)
720 // Create geometry segmentation for the specified chamber and cathod
727 return CreateSt1Segmentation(chamberId, cath);
733 AliWarning("Not yet implemented");
744 return CreateSlatSegmentation(chamberId, cath);
752 return CreateTriggerSegmentation(chamberId, cath);
756 AliWarning("Wrong chamber Id");
761 //______________________________________________________________________________
762 void AliMUONTest::DetElemTransforms()
765 AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON");
767 AliFatal("MUON detector not defined.");
771 // Loop over chambers
772 for (Int_t i=0; i<AliMUONConstants::NCh(); i++) {
774 AliMUONGeometryModule* geometry = muon->Chamber(i).GetGeometry();
775 AliMUONGeometryStore* detElements = geometry->GetDetElementStore();
777 // Loop over detection elements
778 for (Int_t j=0; j<detElements->GetNofEntries(); j++) {
780 //Int_t detElemId = geometry->GetDetElemId(j);
781 Int_t detElemId = detElements->GetEntry(j)->GetUniqueID();
782 cout << "Detection element Id: " << detElemId << endl;
785 geometry->Local2Global(detElemId, 0., 0., 0., x, y, z);
786 cout << " Global DE position: "
787 << x << ", " << y << ", " << z << endl;
790 geometry->Global2Local(detElemId, 0., 0., 0., x2, y2, z2);
791 cout << " ALIC center in the local frame: "
792 << x2 << ", " << y2 << ", " << z2 << endl;
795 geometry->Global2Local(detElemId, x, y, z, x3, y3, z3);
796 cout << " Back in the local frame: "
797 << x3 << ", " << y3 << ", " << z3 << endl;
803 //________________________________________________________________________
804 void AliMUONTest::PrintPadPositionsOld()
806 // Iterate over all old chamber segmentations and prints
807 // global pad positions
809 AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON");
811 AliFatal("MUON detector not defined.");
815 // Loop over chambers
816 for (Int_t i=0; i<1; i++) {
818 // Create chamber segmentations
819 AliSegmentation* seg[2];
820 seg[0] = muon->Chamber(i).SegmentationModel(0);
821 seg[1] = muon->Chamber(i).SegmentationModel(1);
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++) {
828 cout << setw(6) << "Pads in chamber " << i << " cathod " << cath << endl;
829 cout << "===================================" << endl;
834 for ( seg[cath]->FirstPad(70., 70., 0., 80., 80.);
835 seg[cath]->MorePads();
836 seg[cath]->NextPad() )
838 cout << setw(6) << "counter " << counter++ << " ";
840 Int_t ix = seg[cath]->Ix();
841 Int_t iy = seg[cath]->Iy();
842 cout << "Pad indices: ( " << ix << ", " << iy << " ) " ;
845 seg[cath]->GetPadC(ix, iy, x, y, z);
846 cout << "Pad position: ( " << x << ", " << y << ", " << z << " )" << endl;
854 //______________________________________________________________________________
855 void AliMUONTest::ForWhole(AliMUONTests testCase)
857 // Perform test for all chambers and first cathod
859 AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON");
861 AliFatal("MUON detector not defined.");
868 // Loop over chambers
869 // for (Int_t iChamber=0; iChamber<AliMUONConstants::NCh(); iChamber++) {
870 for (Int_t iChamber=10; iChamber<14; iChamber++) {
873 //for (Int_t cath=0; cath<2; cath++) {
874 for (Int_t cath=0; cath<1; cath++) {
876 AliMUONGeometrySegmentation* segmentation
877 = CreateSegmentation(iChamber, cath);
879 if (!segmentation) continue;
881 cout << setw(6) << "Pads in chamber " << iChamber
882 << " cathod " << cath << endl;
883 cout << "===================================" << endl;
885 ForSegmentation(testCase, segmentation);
887 //if (testCase == kDrawPads) {
895 //______________________________________________________________________________
896 void AliMUONTest::ForSegmentation(AliMUONTests testCase,
897 AliMUONGeometrySegmentation *segmentation)
899 // Perform test for a given segmentation
906 // Loop over detection elements
908 AliMUONGeometryStore* detElements
909 = segmentation->GetGeometry()->GetDetElementStore();
911 for (Int_t j=0; j<detElements->GetNofEntries(); j++) {
913 Int_t detElemId = detElements->GetEntry(j)->GetUniqueID();
914 cout << "Detection element id: " << detElemId << endl;
916 ForDetElement(testCase, detElemId, segmentation);
925 //______________________________________________________________________________
926 void AliMUONTest::ForDetElement(AliMUONTests testCase,
928 AliMUONGeometrySegmentation *segmentation)
930 // Prints global pad positions for given detection element
931 // in a given geometry segmentation
936 // Loop over pads in a detection element
939 for(Int_t ix=1; ix<=segmentation->Npx(detElemId); ix++)
940 for(Int_t iy=1; iy<=segmentation->Npy(detElemId); iy++)
945 PrintPad(counter, detElemId, ix, iy, segmentation);
949 DrawPad(counter, detElemId, ix, iy, segmentation);
955 //______________________________________________________________________________
956 void AliMUONTest::Before(AliMUONTests testCase)
958 // Do some initialization if necessary
967 fCanvas = new TCanvas("c1","c1", 0, 0, 600, 600);
968 fCanvas->Range(-300,-300, 300, 300);
975 //______________________________________________________________________________
976 void AliMUONTest::After(AliMUONTests testCase)
978 // Do some cleanup if necessary
987 cout << "Print any key + enter to continue ..." << endl;
995 //______________________________________________________________________________
996 void AliMUONTest::PrintPad(Int_t& counter,
997 Int_t detElemId, Int_t ix, Int_t iy,
998 AliMUONGeometrySegmentation* segmentation)
1000 // Prints global pad positions for the given pad
1004 = segmentation->GetPadC(detElemId, ix, iy, x, y, z);
1006 if (!success) return;
1008 cout << setw(6) << "counter " << counter++ << " ";
1009 cout << "Pad indices: ( " << detElemId << "; " << ix << ", " << iy << " ) " ;
1010 cout << "Pad position: ( " << x << ", " << y << ", " << z << " )" << endl;
1013 //______________________________________________________________________________
1014 void AliMUONTest::DrawPad(Int_t& counter,
1015 Int_t detElemId, Int_t ix, Int_t iy,
1016 AliMUONGeometrySegmentation* segmentation)
1018 // Prints global pad positions for the given pad
1022 = segmentation->GetPadC(detElemId, ix, iy, x, y, z);
1024 if (!success) return;
1026 // PrintPad(counter,detElemId, ix, iy, segmentation);
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);
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);
1037 if (!fCanvas) Before(kDrawPads);
1040 TPave* pave = new TPave(x-dpx/2., y-dpy/2., x+dpx/2., y+dpy/2., 1);
1044 //______________________________________________________________________________
1045 void AliMUONTest::DrawSegmentation(AliMUONGeometrySegmentation *seg)
1053 // TH2F * frame = new TH2F(" "," ",10,-10.,245.,10, -5., 45.);
1054 // TH2F * frame = new TH2F(" "," ",10,-300.,300.,10, -300., 300.);
1055 TH2F * frame = new TH2F(" "," ",10,-200.,200.,10, -200., 200.);
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();
1064 // Loop over detection elements
1066 AliMUONGeometryStore* detElements
1067 = seg->GetGeometry()->GetDetElementStore();
1069 for (Int_t iDE=0; iDE<detElements->GetNofEntries(); iDE++) {
1071 deId = detElements->GetEntry(iDE)->GetUniqueID();
1072 cout << "Detection element id: " << deId << endl;
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++) {
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);
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();