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 //_____________________________________________________________________________
554 AliMUONGeometrySegmentation*
555 AliMUONTest::CreateTriggerSegmentation(Int_t chamberId, Int_t cathod)
557 // Create Trigger geometry segmentation for given chamber and cathod
559 printf("in CreateTriggerSegmentation chamber=%d cathode=%d\n",
561 AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON");
563 AliFatal("MUON detector not defined.");
567 AliMUONGeometrySegmentation *chamberSeg = new AliMUONGeometrySegmentation(muon->Chamber(chamberId).GetGeometry());
569 //Trigger Segmentations
570 AliMUONTriggerSegmentation *trigSegX[9];
571 AliMUONTriggerSegmentation *trigSegY[9];
572 for(Int_t i=0; i<9; i++) {
573 trigSegX[i] = new AliMUONTriggerSegmentation(0);
574 trigSegY[i] = new AliMUONTriggerSegmentation(1);
577 AliMUONChamber *iChamber, *iChamber1;
578 iChamber1 = &muon->Chamber(10);
579 iChamber = &muon->Chamber(chamberId);
580 Float_t zpos1= - iChamber1->Z();
581 Float_t zpos = - iChamber->Z();
582 Float_t zRatio = zpos / zpos1;
585 Int_t nStrip[7]={0,0,0,0,0,0,0};
586 Float_t stripYsize[7]={0.,0.,0.,0.,0.,0.,0.};
587 Float_t stripXsize[7]={0.,0.,0.,0.,0.,0.,0.};
589 // chamber 8 cathode 0
590 for (Int_t i=0; i<7; i++) nStrip[i]=16;
591 for (Int_t i=0; i<7; i++)
592 stripYsize[i]=AliMUONTriggerConstants::StripWidth(2)*zRatio;
593 for (Int_t i=0; i<6; i++)
594 stripXsize[i]=AliMUONTriggerConstants::StripLength(1)*zRatio;
595 stripXsize[6]=AliMUONTriggerConstants::StripLength(2)*zRatio;
596 trigSegX[8]->Init(0,1,nStrip,stripYsize,stripXsize,0.);
598 // chamber 8 cathode 1
599 for (Int_t i=0; i<6; i++) nStrip[i]=8;
601 for (Int_t i=0; i<7; i++)
602 stripYsize[i]=AliMUONTriggerConstants::StripLength(3)*zRatio;
603 for (Int_t i=0; i<7; i++)
604 stripXsize[i]=AliMUONTriggerConstants::StripWidth(2)*zRatio;
605 trigSegY[8]->Init(0,1,nStrip,stripYsize,stripXsize,0.);
607 // chamber 7 cathode 0
608 for (Int_t i=0; i<6; i++) nStrip[i]=32;
610 for (Int_t i=0; i<6; i++)
611 stripYsize[i]=AliMUONTriggerConstants::StripWidth(1)*zRatio;
612 stripYsize[6]=AliMUONTriggerConstants::StripWidth(2)*zRatio;
613 for (Int_t i=0; i<6; i++)
614 stripXsize[i]=AliMUONTriggerConstants::StripLength(1)*zRatio;
615 stripXsize[6]=AliMUONTriggerConstants::StripLength(2)*zRatio;
616 trigSegX[7]->Init(0,2,nStrip,stripYsize,stripXsize,0.);
618 // chamber 7 cathode 1
619 for (Int_t i=0; i<6; i++) nStrip[i]=8;
621 for (Int_t i=0; i<7; i++)
622 stripYsize[i]=AliMUONTriggerConstants::StripLength(3)*zRatio;
623 for (Int_t i=0; i<7; i++)
624 stripXsize[i]=AliMUONTriggerConstants::StripWidth(2)*zRatio;
625 trigSegY[7]->Init(0,2,nStrip,stripYsize,stripXsize,0.);
627 // chamber 6 cathode 0
628 for (Int_t i=0; i<6; i++) nStrip[i]=32;
630 for (Int_t i=0; i<6; i++)
631 stripYsize[i]=AliMUONTriggerConstants::StripWidth(1)*zRatio;
632 stripYsize[6]=AliMUONTriggerConstants::StripWidth(2)*zRatio;
633 for (Int_t i=0; i<6; i++)
634 stripXsize[i]=AliMUONTriggerConstants::StripLength(1)*zRatio;
635 stripXsize[6]=AliMUONTriggerConstants::StripLength(2)*zRatio;
636 trigSegX[6]->Init(0,3,nStrip,stripYsize,stripXsize,0.);
638 // chamber 6 cathode 1
639 for (Int_t i=0; i<5; i++) nStrip[i]=16;
642 for (Int_t i=0; i<7; i++)
643 stripYsize[i]=AliMUONTriggerConstants::StripLength(3)*zRatio;
644 for (Int_t i=0; i<5; i++)
645 stripXsize[i]=AliMUONTriggerConstants::StripWidth(1)*zRatio;
646 stripXsize[5]=AliMUONTriggerConstants::StripWidth(2)*zRatio;
647 stripXsize[6]=AliMUONTriggerConstants::StripWidth(2)*zRatio;
648 trigSegY[6]->Init(0,3,nStrip,stripYsize,stripXsize,0.);
650 // chamber 5 cathode 0
652 for (Int_t i=1; i<3; i++) nStrip[i]=64;
653 for (Int_t i=3; i<6; i++) nStrip[i]=32;
655 for (Int_t i=0; i<3; i++)
656 stripYsize[i]=AliMUONTriggerConstants::StripWidth(0)*zRatio;
657 for (Int_t i=3; i<6; i++)
658 stripYsize[i]=AliMUONTriggerConstants::StripWidth(1)*zRatio;
659 stripYsize[6]=AliMUONTriggerConstants::StripWidth(2)*zRatio;
660 for (Int_t i=0; i<6; i++)
661 stripXsize[i]=AliMUONTriggerConstants::StripLength(1)*zRatio;
662 stripXsize[6]=AliMUONTriggerConstants::StripLength(2)*zRatio;
663 trigSegX[5]->Init(0,4,nStrip,stripYsize,stripXsize,AliMUONTriggerConstants::StripLength(0)*zRatio);
665 // chamber 5 cathode 1
666 for (Int_t i=0; i<5; i++) nStrip[i]=16;
669 stripYsize[0]=AliMUONTriggerConstants::StripLength(2)*zRatio;
670 for (Int_t i=1; i<7; i++)
671 stripYsize[i]=AliMUONTriggerConstants::StripLength(3)*zRatio;
672 for (Int_t i=0; i<5; i++)
673 stripXsize[i]=AliMUONTriggerConstants::StripWidth(1)*zRatio;
674 stripXsize[5]=AliMUONTriggerConstants::StripWidth(2)*zRatio;
675 stripXsize[6]=AliMUONTriggerConstants::StripWidth(2)*zRatio;
676 trigSegY[5]->Init(0,4,nStrip,stripYsize,stripXsize,AliMUONTriggerConstants::StripLength(0)*zRatio);
678 // chamber 4 cathode 0
680 for (Int_t i=1; i<3; i++) nStrip[i]=64;
681 for (Int_t i=3; i<6; i++) nStrip[i]=32;
684 for (Int_t i=1; i<3; i++)
685 stripYsize[i]=AliMUONTriggerConstants::StripWidth(0)*zRatio;
686 for (Int_t i=3; i<6; i++)
687 stripYsize[i]=AliMUONTriggerConstants::StripWidth(1)*zRatio;
688 stripYsize[6]=AliMUONTriggerConstants::StripWidth(2)*zRatio;
690 stripXsize[1]=AliMUONTriggerConstants::StripLength(0)*zRatio;
691 for (Int_t i=2; i<6; i++)
692 stripXsize[i]=AliMUONTriggerConstants::StripLength(1)*zRatio;
693 stripXsize[6]=AliMUONTriggerConstants::StripLength(2)*zRatio;
694 trigSegX[4]->Init(0,5,nStrip,stripYsize,stripXsize,0.);
696 // chamber 4 cathode 1
699 for (Int_t i=2; i<5; i++) nStrip[i]=16;
703 for (Int_t i=1; i<7; i++)
704 stripYsize[i]=AliMUONTriggerConstants::StripLength(3)*zRatio;
706 for (Int_t i=1; i<5; i++)
707 stripXsize[i]=AliMUONTriggerConstants::StripWidth(1)*zRatio;
708 stripXsize[5]=AliMUONTriggerConstants::StripWidth(2)*zRatio;
709 stripXsize[6]=AliMUONTriggerConstants::StripWidth(2)*zRatio;
710 trigSegY[4]->Init(0,5,nStrip,stripYsize,stripXsize,0.);
712 // chamber 3 cathode 0
714 for (Int_t i=1; i<3; i++) nStrip[i]=64;
715 for (Int_t i=3; i<6; i++) nStrip[i]=32;
717 for (Int_t i=0; i<3; i++)
718 stripYsize[i]=AliMUONTriggerConstants::StripWidth(0)*zRatio;
719 for (Int_t i=3; i<6; i++)
720 stripYsize[i]=AliMUONTriggerConstants::StripWidth(1)*zRatio;
721 stripYsize[6]=AliMUONTriggerConstants::StripWidth(2)*zRatio;
722 for (Int_t i=0; i<6; i++)
723 stripXsize[i]=AliMUONTriggerConstants::StripLength(1)*zRatio;
724 stripXsize[6]=AliMUONTriggerConstants::StripLength(2)*zRatio;
725 trigSegX[3]->Init(0,6,nStrip,stripYsize,stripXsize,0.);
727 // chamber 3 cathode 1
728 for (Int_t i=0; i<5; i++) nStrip[i]=16;
731 stripYsize[0]=AliMUONTriggerConstants::StripLength(2)*zRatio;
732 for (Int_t i=1; i<7; i++)
733 stripYsize[i]=AliMUONTriggerConstants::StripLength(3)*zRatio;
734 for (Int_t i=0; i<5; i++)
735 stripXsize[i]=AliMUONTriggerConstants::StripWidth(1)*zRatio;
736 stripXsize[5]=AliMUONTriggerConstants::StripWidth(2)*zRatio;
737 stripXsize[6]=AliMUONTriggerConstants::StripWidth(2)*zRatio;
738 trigSegY[3]->Init(0,6,nStrip,stripYsize,stripXsize,0.);
740 // chamber 2 cathode 0
741 for (Int_t i=0; i<6; i++) nStrip[i]=32;
743 for (Int_t i=0; i<6; i++)
744 stripYsize[i]=AliMUONTriggerConstants::StripWidth(1)*zRatio;
745 stripYsize[6]=AliMUONTriggerConstants::StripWidth(2)*zRatio;
746 for (Int_t i=0; i<6; i++)
747 stripXsize[i]=AliMUONTriggerConstants::StripLength(1)*zRatio;
748 stripXsize[6]=AliMUONTriggerConstants::StripLength(2)*zRatio;
749 trigSegX[2]->Init(0,7,nStrip,stripYsize,stripXsize,0.);
751 // chamber 2 cathode 1
752 for (Int_t i=0; i<5; i++) nStrip[i]=16;
755 for (Int_t i=0; i<7; i++)
756 stripYsize[i]=AliMUONTriggerConstants::StripLength(3)*zRatio;
757 for (Int_t i=0; i<5; i++)
758 stripXsize[i]=AliMUONTriggerConstants::StripWidth(1)*zRatio;
759 stripXsize[5]=AliMUONTriggerConstants::StripWidth(2)*zRatio;
760 stripXsize[6]=AliMUONTriggerConstants::StripWidth(2)*zRatio;
761 trigSegY[2]->Init(0,7,nStrip,stripYsize,stripXsize,0.);
763 // chamber 1 cathode 0
764 for (Int_t i=0; i<6; i++) nStrip[i]=32;
766 for (Int_t i=0; i<6; i++)
767 stripYsize[i]=AliMUONTriggerConstants::StripWidth(1)*zRatio;
768 stripYsize[6]=AliMUONTriggerConstants::StripWidth(2)*zRatio;
769 for (Int_t i=0; i<6; i++)
770 stripXsize[i]=AliMUONTriggerConstants::StripLength(1)*zRatio;
771 stripXsize[6]=AliMUONTriggerConstants::StripLength(2)*zRatio;
772 trigSegX[1]->Init(0,8,nStrip,stripYsize,stripXsize,0.);
774 // chamber 1 cathode 1
775 for (Int_t i=0; i<6; i++) nStrip[i]=8;
777 for (Int_t i=0; i<7; i++)
778 stripYsize[i]=AliMUONTriggerConstants::StripLength(3)*zRatio;
779 for (Int_t i=0; i<7; i++)
780 stripXsize[i]=AliMUONTriggerConstants::StripWidth(2)*zRatio;
781 trigSegY[1]->Init(0,8,nStrip,stripYsize,stripXsize,0.);
783 // chamber 0 cathode 0
784 for (Int_t i=0; i<7; i++) nStrip[i]=16;
785 for (Int_t i=0; i<7; i++)
786 stripYsize[i]=AliMUONTriggerConstants::StripWidth(2)*zRatio;
787 for (Int_t i=0; i<6; i++)
788 stripXsize[i]=AliMUONTriggerConstants::StripLength(1)*zRatio;
789 stripXsize[6]=AliMUONTriggerConstants::StripLength(2)*zRatio;
790 trigSegX[0]->Init(0,9,nStrip,stripYsize,stripXsize,0.);
792 // chamber 0 cathode 1
793 for (Int_t i=0; i<6; i++) nStrip[i]=8;
795 for (Int_t i=0; i<7; i++)
796 stripYsize[i]=AliMUONTriggerConstants::StripLength(3)*zRatio;
797 for (Int_t i=0; i<7; i++)
798 stripXsize[i]=AliMUONTriggerConstants::StripWidth(2)*zRatio;
799 trigSegY[0]->Init(0,9,nStrip,stripYsize,stripXsize,0.);
801 Int_t icount=chamberId-10; // chamber counter (0 1 2 3)
802 Int_t id0=(10+icount+1)*100;
804 printf("in CreateTriggerSegmentation here 0 id0=%i \n",id0);
806 for (Int_t i=0; i<9; i++) {
808 chamberSeg->Add(id0+i, trigSegX[i]);
809 chamberSeg->Add(id0+50+i, trigSegX[i]);
810 } else if (cathod==1) {
811 chamberSeg->Add(id0+i, trigSegY[i]);
812 chamberSeg->Add(id0+50+i, trigSegY[i]);
816 printf("in CreateTriggerSegmentation here 1\n");
819 AliWarning(Form("Segmentation for chamber %d , cathod %d is not yet defined",chamberId, cathod));
823 DrawSegmentation(chamberSeg);
832 //______________________________________________________________________________
833 AliMUONGeometrySegmentation*
834 AliMUONTest::CreateSegmentation(Int_t chamberId, Int_t cath)
836 // Create geometry segmentation for the specified chamber and cathod
843 return CreateSt1Segmentation(chamberId, cath);
849 AliWarning("Not yet implemented");
860 return CreateSlatSegmentation(chamberId, cath);
868 return CreateTriggerSegmentation(chamberId, cath);
872 AliWarning("Wrong chamber Id");
877 //______________________________________________________________________________
878 void AliMUONTest::DetElemTransforms()
881 AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON");
883 AliFatal("MUON detector not defined.");
887 // Loop over chambers
888 for (Int_t i=0; i<AliMUONConstants::NCh(); i++) {
890 AliMUONGeometryModule* geometry = muon->Chamber(i).GetGeometry();
891 AliMUONGeometryStore* detElements = geometry->GetDetElementStore();
893 // Loop over detection elements
894 for (Int_t j=0; j<detElements->GetNofEntries(); j++) {
896 //Int_t detElemId = geometry->GetDetElemId(j);
897 Int_t detElemId = detElements->GetEntry(j)->GetUniqueID();
898 cout << "Detection element Id: " << detElemId << endl;
901 geometry->Local2Global(detElemId, 0., 0., 0., x, y, z);
902 cout << " Global DE position: "
903 << x << ", " << y << ", " << z << endl;
906 geometry->Global2Local(detElemId, 0., 0., 0., x2, y2, z2);
907 cout << " ALIC center in the local frame: "
908 << x2 << ", " << y2 << ", " << z2 << endl;
911 geometry->Global2Local(detElemId, x, y, z, x3, y3, z3);
912 cout << " Back in the local frame: "
913 << x3 << ", " << y3 << ", " << z3 << endl;
919 //________________________________________________________________________
920 void AliMUONTest::PrintPadPositionsOld()
922 // Iterate over all old chamber segmentations and prints
923 // global pad positions
925 AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON");
927 AliFatal("MUON detector not defined.");
931 // Loop over chambers
932 for (Int_t i=0; i<1; i++) {
934 // Create chamber segmentations
935 AliSegmentation* seg[2];
936 seg[0] = muon->Chamber(i).SegmentationModel(0);
937 seg[1] = muon->Chamber(i).SegmentationModel(1);
939 // Iterate over the whole plane and return pad indices and
940 // global/local positions
941 cout << "Go to loop over pads" << endl;
942 for (Int_t cath=0; cath<2; cath++) {
944 cout << setw(6) << "Pads in chamber " << i << " cathod " << cath << endl;
945 cout << "===================================" << endl;
950 for ( seg[cath]->FirstPad(70., 70., 0., 80., 80.);
951 seg[cath]->MorePads();
952 seg[cath]->NextPad() )
954 cout << setw(6) << "counter " << counter++ << " ";
956 Int_t ix = seg[cath]->Ix();
957 Int_t iy = seg[cath]->Iy();
958 cout << "Pad indices: ( " << ix << ", " << iy << " ) " ;
961 seg[cath]->GetPadC(ix, iy, x, y, z);
962 cout << "Pad position: ( " << x << ", " << y << ", " << z << " )" << endl;
970 //______________________________________________________________________________
971 void AliMUONTest::ForWhole(AliMUONTests testCase)
973 // Perform test for all chambers and first cathod
975 AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON");
977 AliFatal("MUON detector not defined.");
984 // Loop over chambers
985 // for (Int_t iChamber=0; iChamber<AliMUONConstants::NCh(); iChamber++) {
986 for (Int_t iChamber=10; iChamber<14; iChamber++) {
989 //for (Int_t cath=0; cath<2; cath++) {
990 for (Int_t cath=0; cath<1; cath++) {
992 AliMUONGeometrySegmentation* segmentation
993 = CreateSegmentation(iChamber, cath);
995 if (!segmentation) continue;
997 cout << setw(6) << "Pads in chamber " << iChamber
998 << " cathod " << cath << endl;
999 cout << "===================================" << endl;
1001 ForSegmentation(testCase, segmentation);
1003 //if (testCase == kDrawPads) {
1011 //______________________________________________________________________________
1012 void AliMUONTest::ForSegmentation(AliMUONTests testCase,
1013 AliMUONGeometrySegmentation *segmentation)
1015 // Perform test for a given segmentation
1022 // Loop over detection elements
1024 AliMUONGeometryStore* detElements
1025 = segmentation->GetGeometry()->GetDetElementStore();
1027 for (Int_t j=0; j<detElements->GetNofEntries(); j++) {
1029 Int_t detElemId = detElements->GetEntry(j)->GetUniqueID();
1030 cout << "Detection element id: " << detElemId << endl;
1032 ForDetElement(testCase, detElemId, segmentation);
1041 //______________________________________________________________________________
1042 void AliMUONTest::ForDetElement(AliMUONTests testCase,
1044 AliMUONGeometrySegmentation *segmentation)
1046 // Prints global pad positions for given detection element
1047 // in a given geometry segmentation
1052 // Loop over pads in a detection element
1055 for(Int_t ix=1; ix<=segmentation->Npx(detElemId); ix++)
1056 for(Int_t iy=1; iy<=segmentation->Npy(detElemId); iy++)
1061 PrintPad(counter, detElemId, ix, iy, segmentation);
1065 DrawPad(counter, detElemId, ix, iy, segmentation);
1071 //______________________________________________________________________________
1072 void AliMUONTest::Before(AliMUONTests testCase)
1074 // Do some initialization if necessary
1083 fCanvas = new TCanvas("c1","c1", 0, 0, 600, 600);
1084 fCanvas->Range(-300,-300, 300, 300);
1091 //______________________________________________________________________________
1092 void AliMUONTest::After(AliMUONTests testCase)
1094 // Do some cleanup if necessary
1103 cout << "Print any key + enter to continue ..." << endl;
1111 //______________________________________________________________________________
1112 void AliMUONTest::PrintPad(Int_t& counter,
1113 Int_t detElemId, Int_t ix, Int_t iy,
1114 AliMUONGeometrySegmentation* segmentation)
1116 // Prints global pad positions for the given pad
1120 = segmentation->GetPadC(detElemId, ix, iy, x, y, z);
1122 if (!success) return;
1124 cout << setw(6) << "counter " << counter++ << " ";
1125 cout << "Pad indices: ( " << detElemId << "; " << ix << ", " << iy << " ) " ;
1126 cout << "Pad position: ( " << x << ", " << y << ", " << z << " )" << endl;
1129 //______________________________________________________________________________
1130 void AliMUONTest::DrawPad(Int_t& counter,
1131 Int_t detElemId, Int_t ix, Int_t iy,
1132 AliMUONGeometrySegmentation* segmentation)
1134 // Prints global pad positions for the given pad
1138 = segmentation->GetPadC(detElemId, ix, iy, x, y, z);
1140 if (!success) return;
1142 // PrintPad(counter,detElemId, ix, iy, segmentation);
1146 Int_t sector = segmentation->Sector(detElemId, ix, iy);
1147 Float_t dpx = segmentation->Dpx(detElemId, sector);
1148 Float_t dpy = segmentation->Dpy(detElemId, sector);
1150 //printf(" ***** Pad position is ix: %d iy: %d x: %f y: %f sector: %d dpx: %f dpy: %f \n",
1151 // ix, iy, x, y, sector, dpx, dpy);
1153 if (!fCanvas) Before(kDrawPads);
1156 TPave* pave = new TPave(x-dpx/2., y-dpy/2., x+dpx/2., y+dpy/2., 1);
1160 //______________________________________________________________________________
1161 void AliMUONTest::DrawSegmentation(AliMUONGeometrySegmentation *seg)
1169 // TH2F * frame = new TH2F(" "," ",10,-10.,245.,10, -5., 45.);
1170 // TH2F * frame = new TH2F(" "," ",10,-300.,300.,10, -300., 300.);
1171 TH2F * frame = new TH2F(" "," ",10,-200.,200.,10, -200., 200.);
1173 // (new TPave( 0., 0., 40., 40.,2))->Draw();
1174 // (new TPave( 40., 0., 80., 40.,2))->Draw();
1175 // (new TPave( 80., 0.,120., 40.,2))->Draw();
1176 // (new TPave(120., 0.,160., 40.,2))->Draw();
1177 // (new TPave(160., 0.,200., 40.,2))->Draw();
1178 // (new TPave(200., 0.,240., 40.,2))->Draw();
1180 // Loop over detection elements
1182 AliMUONGeometryStore* detElements
1183 = seg->GetGeometry()->GetDetElementStore();
1185 for (Int_t iDE=0; iDE<detElements->GetNofEntries(); iDE++) {
1187 deId = detElements->GetEntry(iDE)->GetUniqueID();
1188 cout << "Detection element id: " << deId << endl;
1191 // for ( seg->FirstPad(detElementId, 0., 0., 0., 100., 100.);
1192 // seg->MorePads(detElementId);
1193 // seg->NextPad(detElementId) ) {
1194 for(ix=1; ix<=seg->Npx(deId); ix++) {
1195 for(iy=1; iy<=seg->Npy(deId); iy++) {
1197 seg->GetPadC(deId, ix, iy, x, y, z);
1198 Int_t sector = seg->Sector(deId, ix, iy);
1199 dpx = seg->Dpx(deId,sector);
1200 dpy = seg->Dpy(deId,sector);
1202 //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);
1203 (new TPave(x-dpx/2., y-dpy/2., x+dpx/2., y+dpy/2., 1))->Draw();