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::CreateSt2Segmentation(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* segmentation
158 = new AliMUONGeometrySegmentation(muon->Chamber(chamberId).GetGeometry());
160 // Quadrant segmentations:
161 AliMUONSt12QuadrantSegmentation* bendSt2
162 = new AliMUONSt12QuadrantSegmentation(kStation2, kBendingPlane);
163 AliMUONSt12QuadrantSegmentation* nonbendSt2
164 = new AliMUONSt12QuadrantSegmentation(kStation2, kNonBendingPlane);
166 // The same configuration for both chambers of Station 2
167 Int_t id0 = (chamberId+1)*100;
169 // Configure St2 chamber segmentations
171 segmentation->Add(id0, bendSt2);
172 segmentation->Add(id0 + 1, nonbendSt2);
173 segmentation->Add(id0 + 50, bendSt2);
174 segmentation->Add(id0 + 51, nonbendSt2);
176 else if (cathod == 1) {
177 segmentation->Add(id0, nonbendSt2);
178 segmentation->Add(id0 + 1, bendSt2);
179 segmentation->Add(id0 + 50, nonbendSt2);
180 segmentation->Add(id0 + 51, bendSt2);
183 AliError("Wrong cathod number");
190 //_____________________________________________________________________________
191 AliMUONGeometrySegmentation*
192 AliMUONTest::CreateSlatSegmentation(Int_t chamberId, Int_t cathod)
194 // Create St1 geometry segmentation for given chamber and cathod
196 AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON");
198 AliFatal("MUON detector not defined.");
202 AliMUONGeometrySegmentation *chamberSeg = new AliMUONGeometrySegmentation(muon->Chamber(chamberId).GetGeometry());
204 //Slats Segmentations
205 AliMUONSt345SlatSegmentation *slatsegB[14]; // Types of segmentation for St3 in this framework
206 AliMUONSt345SlatSegmentation *slatsegNB[14]; // Types of segmentation for St3 in this framework
208 Int_t ndiv[4] ={ 4, 4, 2, 1}; // densities zones
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);
223 //******************************************************************************************
225 //******************************************************************************************
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);
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);
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);
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);
262 //***************************************************************************************
264 //****************************************************************************************
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
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
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
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
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
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
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
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
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
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
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
359 if (chamberId == 4 || chamberId == 5) {
360 // Create chamber segmentations
362 id0=(chamberId+1)*100;
365 chamberSeg->Add(id0, slatsegB[3]);
366 chamberSeg->Add(id0+ 8, slatsegB[3]);
367 chamberSeg->Add(id0+50, slatsegB[3]);
368 chamberSeg->Add(id0+58, slatsegB[3]);
370 chamberSeg->Add(id0, slatsegNB[3]);
371 chamberSeg->Add(id0+ 8, slatsegNB[3]);
372 chamberSeg->Add(id0+50, slatsegNB[3]);
373 chamberSeg->Add(id0+58, slatsegNB[3]);
377 chamberSeg->Add(id0+ 1, slatsegB[2]);
378 chamberSeg->Add(id0+ 7, slatsegB[2]);
379 chamberSeg->Add(id0+51, slatsegB[2]);
380 chamberSeg->Add(id0+57, slatsegB[2]);
382 chamberSeg->Add(id0+ 1, slatsegNB[2]);
383 chamberSeg->Add(id0+ 7, slatsegNB[2]);
384 chamberSeg->Add(id0+51, slatsegNB[2]);
385 chamberSeg->Add(id0+57, slatsegNB[2]);
389 chamberSeg->Add(id0+ 2, slatsegB[1]);
390 chamberSeg->Add(id0+ 6, slatsegB[1]);
391 chamberSeg->Add(id0+52, slatsegB[1]);
392 chamberSeg->Add(id0+56, slatsegB[1]);
394 chamberSeg->Add(id0+ 2, slatsegNB[1]);
395 chamberSeg->Add(id0+ 6, slatsegNB[1]);
396 chamberSeg->Add(id0+52, slatsegNB[1]);
397 chamberSeg->Add(id0+56, slatsegNB[1]);
401 chamberSeg->Add(id0+ 3, slatsegB[0]);
402 chamberSeg->Add(id0+ 4, slatsegB[0]);
403 chamberSeg->Add(id0+ 5, slatsegB[0]);
404 chamberSeg->Add(id0+53, slatsegB[0]);
405 chamberSeg->Add(id0+54, slatsegB[0]);
406 chamberSeg->Add(id0+55, slatsegB[0]);
408 chamberSeg->Add(id0+ 3, slatsegNB[0]);
409 chamberSeg->Add(id0+ 4, slatsegNB[0]);
410 chamberSeg->Add(id0+ 5, slatsegNB[0]);
411 chamberSeg->Add(id0+53, slatsegNB[0]);
412 chamberSeg->Add(id0+54, slatsegNB[0]);
413 chamberSeg->Add(id0+55, slatsegNB[0]);
419 if (chamberId == 6 || chamberId == 7) {
420 // Create chamber segmentations
421 id0=(chamberId+1)*100;
424 chamberSeg->Add(id0+ 6, slatsegB[4]);
425 chamberSeg->Add(id0+56, slatsegB[4]);
427 chamberSeg->Add(id0+ 6, slatsegNB[4]);
428 chamberSeg->Add(id0+56, slatsegNB[4]);
432 chamberSeg->Add(id0+ 5, slatsegB[5]);
433 chamberSeg->Add(id0+ 7, slatsegB[5]);
434 chamberSeg->Add(id0+55, slatsegB[5]);
435 chamberSeg->Add(id0+57, slatsegB[5]);
437 chamberSeg->Add(id0+ 5, slatsegNB[5]);
438 chamberSeg->Add(id0+ 7, slatsegNB[5]);
439 chamberSeg->Add(id0+55, slatsegNB[5]);
440 chamberSeg->Add(id0+57, slatsegNB[5]);
444 chamberSeg->Add(id0+ 4, slatsegB[6]);
445 chamberSeg->Add(id0+ 8, slatsegB[6]);
446 chamberSeg->Add(id0+54, slatsegB[6]);
447 chamberSeg->Add(id0+58, slatsegB[6]);
449 chamberSeg->Add(id0+ 4, slatsegNB[6]);
450 chamberSeg->Add(id0+ 8, slatsegNB[6]);
451 chamberSeg->Add(id0+54, slatsegNB[6]);
452 chamberSeg->Add(id0+58, slatsegNB[6]);
456 chamberSeg->Add(id0+ 3, slatsegB[7]);
457 chamberSeg->Add(id0+ 9, slatsegB[7]);
458 chamberSeg->Add(id0+53, slatsegB[7]);
459 chamberSeg->Add(id0+59, slatsegB[7]);
461 chamberSeg->Add(id0+ 3, slatsegNB[7]);
462 chamberSeg->Add(id0+ 9, slatsegNB[7]);
463 chamberSeg->Add(id0+53, slatsegNB[7]);
464 chamberSeg->Add(id0+59, slatsegNB[7]);
468 chamberSeg->Add(id0+ 2, slatsegB[8]);
469 chamberSeg->Add(id0+10, slatsegB[8]);
470 chamberSeg->Add(id0+52, slatsegB[8]);
471 chamberSeg->Add(id0+60, slatsegB[8]);
473 chamberSeg->Add(id0+ 2, slatsegNB[8]);
474 chamberSeg->Add(id0+10, slatsegNB[8]);
475 chamberSeg->Add(id0+52, slatsegNB[8]);
476 chamberSeg->Add(id0+60, slatsegNB[8]);
480 chamberSeg->Add(id0+ 1, slatsegB[9]);
481 chamberSeg->Add(id0+11, slatsegB[9]);
482 chamberSeg->Add(id0+51, slatsegB[9]);
483 chamberSeg->Add(id0+61, slatsegB[9]);
485 chamberSeg->Add(id0+ 1, slatsegNB[9]);
486 chamberSeg->Add(id0+11, slatsegNB[9]);
487 chamberSeg->Add(id0+51, slatsegNB[9]);
488 chamberSeg->Add(id0+61, slatsegNB[9]);
492 chamberSeg->Add(id0 , slatsegB[10]);
493 chamberSeg->Add(id0+12, slatsegB[10]);
494 chamberSeg->Add(id0+50, slatsegB[10]);
495 chamberSeg->Add(id0+62, slatsegB[10]);
497 chamberSeg->Add(id0 , slatsegNB[10]);
498 chamberSeg->Add(id0+12, slatsegNB[10]);
499 chamberSeg->Add(id0+50, slatsegNB[10]);
500 chamberSeg->Add(id0+62, slatsegNB[10]);
505 if (chamberId == 8 || chamberId == 9) {
506 // Create chamber segmentations
507 id0=(chamberId+1)*100;
510 chamberSeg->Add(id0+ 6, slatsegB[4]);
511 chamberSeg->Add(id0+56, slatsegB[4]);
513 chamberSeg->Add(id0+ 6, slatsegNB[4]);
514 chamberSeg->Add(id0+56, slatsegNB[4]);
518 chamberSeg->Add(id0+ 4, slatsegB[5]);
519 chamberSeg->Add(id0+ 5, slatsegB[5]);
520 chamberSeg->Add(id0+ 7, slatsegB[5]);
521 chamberSeg->Add(id0+ 8, slatsegB[5]);
522 chamberSeg->Add(id0+54, slatsegB[5]);
523 chamberSeg->Add(id0+55, slatsegB[5]);
524 chamberSeg->Add(id0+57, slatsegB[5]);
525 chamberSeg->Add(id0+58, slatsegB[5]);
527 chamberSeg->Add(id0+ 4, slatsegNB[5]);
528 chamberSeg->Add(id0+ 5, slatsegNB[5]);
529 chamberSeg->Add(id0+ 7, slatsegNB[5]);
530 chamberSeg->Add(id0+ 8, slatsegNB[5]);
531 chamberSeg->Add(id0+54, slatsegNB[5]);
532 chamberSeg->Add(id0+55, slatsegNB[5]);
533 chamberSeg->Add(id0+57, slatsegNB[5]);
534 chamberSeg->Add(id0+58, slatsegNB[5]);
538 chamberSeg->Add(id0+ 3, slatsegB[11]);
539 chamberSeg->Add(id0+ 9, slatsegB[11]);
540 chamberSeg->Add(id0+53, slatsegB[11]);
541 chamberSeg->Add(id0+59, slatsegB[11]);
543 chamberSeg->Add(id0+ 3, slatsegNB[11]);
544 chamberSeg->Add(id0+ 9, slatsegNB[11]);
545 chamberSeg->Add(id0+53, slatsegNB[11]);
546 chamberSeg->Add(id0+59, slatsegNB[11]);
550 chamberSeg->Add(id0+ 2, slatsegB[12]);
551 chamberSeg->Add(id0+10, slatsegB[12]);
552 chamberSeg->Add(id0+52, slatsegB[12]);
553 chamberSeg->Add(id0+60, slatsegB[12]);
555 chamberSeg->Add(id0+ 2, slatsegNB[12]);
556 chamberSeg->Add(id0+10, slatsegNB[12]);
557 chamberSeg->Add(id0+52, slatsegNB[12]);
558 chamberSeg->Add(id0+60, slatsegNB[12]);
562 chamberSeg->Add(id0+ 1, slatsegB[13]);
563 chamberSeg->Add(id0+11, slatsegB[13]);
564 chamberSeg->Add(id0+51, slatsegB[13]);
565 chamberSeg->Add(id0+61, slatsegB[13]);
567 chamberSeg->Add(id0+ 1, slatsegNB[13]);
568 chamberSeg->Add(id0+11, slatsegNB[13]);
569 chamberSeg->Add(id0+51, slatsegNB[13]);
570 chamberSeg->Add(id0+61, slatsegNB[13]);
574 chamberSeg->Add(id0 , slatsegB[9]);
575 chamberSeg->Add(id0+12, slatsegB[9]);
576 chamberSeg->Add(id0+50, slatsegB[9]);
577 chamberSeg->Add(id0+62, slatsegB[9]);
579 chamberSeg->Add(id0 , slatsegNB[9]);
580 chamberSeg->Add(id0+12, slatsegNB[9]);
581 chamberSeg->Add(id0+50, slatsegNB[9]);
582 chamberSeg->Add(id0+62, slatsegNB[9]);
588 AliWarning(Form("Segmentation for chamber %d , cathod %d is not yet defined",
594 DrawSegmentation(chamberSeg);
598 //_____________________________________________________________________________
600 AliMUONGeometrySegmentation*
601 AliMUONTest::CreateTriggerSegmentation(Int_t chamberId, Int_t cathod)
603 // Create Trigger geometry segmentation for given chamber and cathod
605 printf("in CreateTriggerSegmentation chamber=%d cathode=%d\n",
607 AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON");
609 AliFatal("MUON detector not defined.");
613 AliMUONGeometrySegmentation *chamberSeg = new AliMUONGeometrySegmentation(muon->Chamber(chamberId).GetGeometry());
615 //Trigger Segmentation
616 AliMUONTriggerSegmentation *trigSegX[9];
617 AliMUONTriggerSegmentation *trigSegY[9];
618 for(Int_t i=0; i<9; i++) {
619 trigSegX[i] = new AliMUONTriggerSegmentation(1);
620 trigSegY[i] = new AliMUONTriggerSegmentation(0);
621 trigSegX[i]->SetLineNumber(9-i);
622 trigSegY[i]->SetLineNumber(9-i);
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;
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;
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.};
643 // chamber 8 0 cathode 0
644 for (Int_t i=0; i<7; i++) nStrip[i]=16;
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.);
651 // chamber 8 7 1 0 cathode 1
652 for (Int_t i=0; i<6; i++) nStrip[i]=8;
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.);
661 // chamber 7 6 2 1 cathode 0
662 for (Int_t i=0; i<6; i++) nStrip[i]=32;
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.);
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;
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.);
683 // chamber 5 3 cathode 0
685 for (Int_t i=1; i<3; i++) nStrip[i]=64;
686 for (Int_t i=3; i<6; i++) nStrip[i]=32;
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.);
696 // chamber 5 3 cathode 1
697 for (Int_t i=0; i<5; i++) nStrip[i]=16;
698 for (Int_t i=5; i<6; i++) nStrip[5]=8;
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.);
707 // chamber 4 cathode 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;
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];
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.);
722 // chamber 4 cathode 1
725 for (Int_t i=2; i<5; i++) nStrip[i]=16;
726 for (Int_t i=5; i<6; i++) nStrip[i]=8;
729 for (Int_t i=1; i<7; i++) stripYsize[i]=stripLength[3];
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.);
735 Int_t icount=chamberId-10; // chamber counter (0 1 2 3)
736 Int_t id0=(10+icount+1)*100;
738 for (Int_t i=0; i<9; i++) {
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]);
749 AliWarning(Form("Segmentation for chamber %d , cathod %d is not yet defined",chamberId, cathod));
753 DrawSegmentation(chamberSeg);
761 //______________________________________________________________________________
762 AliMUONGeometrySegmentation*
763 AliMUONTest::CreateSegmentation(Int_t chamberId, Int_t cath)
765 // Create geometry segmentation for the specified chamber and cathod
772 return CreateSt1Segmentation(chamberId, cath);
778 return CreateSt2Segmentation(chamberId, cath);
788 return CreateSlatSegmentation(chamberId, cath);
796 return CreateTriggerSegmentation(chamberId, cath);
800 AliWarning("Wrong chamber Id");
805 //______________________________________________________________________________
806 void AliMUONTest::DetElemTransforms()
809 AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON");
811 AliFatal("MUON detector not defined.");
815 // Loop over chambers
816 for (Int_t i=0; i<AliMUONConstants::NCh(); i++) {
818 AliMUONGeometryModule* geometry = muon->Chamber(i).GetGeometry();
819 AliMUONGeometryStore* detElements = geometry->GetDetElementStore();
821 // Loop over detection elements
822 for (Int_t j=0; j<detElements->GetNofEntries(); j++) {
824 //Int_t detElemId = geometry->GetDetElemId(j);
825 Int_t detElemId = detElements->GetEntry(j)->GetUniqueID();
826 cout << "Detection element Id: " << detElemId << endl;
829 geometry->Local2Global(detElemId, 0., 0., 0., x, y, z);
830 cout << " Global DE position: "
831 << x << ", " << y << ", " << z << endl;
834 geometry->Global2Local(detElemId, 0., 0., 0., x2, y2, z2);
835 cout << " ALIC center in the local frame: "
836 << x2 << ", " << y2 << ", " << z2 << endl;
839 geometry->Global2Local(detElemId, x, y, z, x3, y3, z3);
840 cout << " Back in the local frame: "
841 << x3 << ", " << y3 << ", " << z3 << endl;
847 //______________________________________________________________________________
848 void AliMUONTest::ForWhole(AliMUONTests testCase)
850 // Perform test for all chambers and first cathod
852 AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON");
854 AliFatal("MUON detector not defined.");
861 // Loop over chambers
862 for (Int_t iChamber=0; iChamber<AliMUONConstants::NCh(); iChamber++) {
863 // for (Int_t iChamber=0; iChamber<3; iChamber=iChamber+2) {
866 //for (Int_t cath=0; cath<2; cath++) {
867 for (Int_t cath=0; cath<1; cath++) {
869 AliMUONGeometrySegmentation* segmentation
870 = CreateSegmentation(iChamber, cath);
872 if (!segmentation) continue;
874 cout << setw(6) << "Pads in chamber " << iChamber
875 << " cathod " << cath << endl;
876 cout << "===================================" << endl;
878 ForSegmentation(testCase, segmentation);
880 //if (testCase == kDrawPads) {
888 //______________________________________________________________________________
889 void AliMUONTest::ForSegmentation(AliMUONTests testCase,
890 AliMUONGeometrySegmentation *segmentation)
892 // Perform test for a given segmentation
899 // Loop over detection elements
901 AliMUONGeometryStore* detElements
902 = segmentation->GetGeometry()->GetDetElementStore();
904 for (Int_t j=0; j<detElements->GetNofEntries(); j++) {
906 Int_t detElemId = detElements->GetEntry(j)->GetUniqueID();
907 cout << "Detection element id: " << detElemId << endl;
909 ForDetElement(testCase, detElemId, segmentation);
918 //______________________________________________________________________________
919 void AliMUONTest::ForDetElement(AliMUONTests testCase,
921 AliMUONGeometrySegmentation *segmentation)
923 // Prints global pad positions for given detection element
924 // in a given geometry segmentation
929 // Loop over pads in a detection element
932 for(Int_t ix=1; ix<=segmentation->Npx(detElemId); ix++)
933 for(Int_t iy=1; iy<=segmentation->Npy(detElemId); iy++)
938 PrintPad(counter, detElemId, ix, iy, segmentation);
942 DrawPad(counter, detElemId, ix, iy, segmentation);
948 //______________________________________________________________________________
949 void AliMUONTest::Before(AliMUONTests testCase)
951 // Do some initialization if necessary
960 fCanvas = new TCanvas("c1","c1", 0, 0, 600, 600);
961 fCanvas->Range(-300,-300, 300, 300);
968 //______________________________________________________________________________
969 void AliMUONTest::After(AliMUONTests testCase)
971 // Do some cleanup if necessary
980 cout << "Print any key + enter to continue ..." << endl;
988 //______________________________________________________________________________
989 void AliMUONTest::PrintPad(Int_t& counter,
990 Int_t detElemId, Int_t ix, Int_t iy,
991 AliMUONGeometrySegmentation* segmentation)
993 // Prints global pad positions for the given pad
997 = segmentation->GetPadC(detElemId, ix, iy, x, y, z);
999 cout << setw(6) << "counter " << counter++ << " ";
1000 cout << "Pad indices: ( " << detElemId << "; " << ix << ", " << iy << " ) " ;
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;
1011 cout << "... no pad " << endl;
1015 //______________________________________________________________________________
1016 void AliMUONTest::DrawPad(Int_t& counter,
1017 Int_t detElemId, Int_t ix, Int_t iy,
1018 AliMUONGeometrySegmentation* segmentation)
1020 // Prints global pad positions for the given pad
1024 = segmentation->GetPadC(detElemId, ix, iy, x, y, z);
1026 if (!success) return;
1028 // PrintPad(counter,detElemId, ix, iy, segmentation);
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);
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);
1039 if (!fCanvas) Before(kDrawPads);
1042 TPave* pave = new TPave(x-dpx/2., y-dpy/2., x+dpx/2., y+dpy/2., 1);
1046 //______________________________________________________________________________
1047 void AliMUONTest::DrawSegmentation(AliMUONGeometrySegmentation *seg)
1055 // TH2F * frame = new TH2F(" "," ",10,-10.,245.,10, -5., 45.);
1056 // TH2F * frame = new TH2F(" "," ",10,-300.,300.,10, -300., 300.);
1057 TH2F * frame = new TH2F(" "," ",10,-200.,200.,10, -200., 200.);
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();
1066 // Loop over detection elements
1068 AliMUONGeometryStore* detElements
1069 = seg->GetGeometry()->GetDetElementStore();
1071 for (Int_t iDE=0; iDE<detElements->GetNofEntries(); iDE++) {
1073 deId = detElements->GetEntry(iDE)->GetUniqueID();
1074 cout << "Detection element id: " << deId << endl;
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++) {
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);
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();