]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONTriggerCircuit.cxx
Replaced with new AliMUONSegFactory and AliMpSegFactory classes
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerCircuit.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /* $Id$ */
17
18 #include <TMath.h>
19
20 #include "AliMUONTriggerCircuit.h"
21 #include "AliRun.h"
22 #include "AliMUON.h"
23 #include "AliMUONTriggerConstants.h"
24 #include "AliMUONGeometrySegmentation.h"
25 #include "AliMUONSegmentation.h"
26 #include "AliMUONConstants.h"
27 #include "AliLog.h"
28
29 ClassImp(AliMUONTriggerCircuit)
30
31 //----------------------------------------------------------------------
32 AliMUONTriggerCircuit::AliMUONTriggerCircuit()
33   : TObject(),
34     fIdCircuit(0),
35     fX2m(0),
36     fX2ud(0)
37 {
38 // Constructor
39
40   fOrMud[0]=fOrMud[1]=0;
41   Int_t i;  
42   for (i=0; i<4; i++) {
43     for (Int_t j=0; j<32; j++) {      
44       fXcode[i][j]=0;
45       fYcode[i][j]=0;
46     }
47   }
48   for (i=0; i<16; i++) { fXpos11[i]=0.; }
49   for (i=0; i<31; i++) { fYpos11[i]=0.; }
50   for (i=0; i<63; i++) { fYpos21[i]=0.; }
51 }
52
53 //----------------------------------------------------------------------
54 AliMUONTriggerCircuit::AliMUONTriggerCircuit(const AliMUONTriggerCircuit& theMUONTriggerCircuit)
55   : TObject(theMUONTriggerCircuit)
56 {
57 // Protected copy constructor
58
59   AliFatal("Not implemented.");
60 }
61
62 //----------------------------------------------------------------------
63 AliMUONTriggerCircuit & 
64 AliMUONTriggerCircuit::operator=(const AliMUONTriggerCircuit& rhs)
65 {
66 // Protected assignement operator
67
68   if (this == &rhs) return *this;
69
70   AliFatal("Not implemented.");
71     
72   return *this;  
73 }
74
75 //----------------------------------------------------------------------
76 void AliMUONTriggerCircuit::Init(Int_t iCircuit) {
77 // initialize circuit characteristics
78   fIdCircuit=AliMUONTriggerConstants::CircuitId(iCircuit);
79
80   LoadX2();
81   LoadXCode();
82   LoadYCode();
83
84   LoadXPos2();
85   LoadYPos2();
86   
87 }
88
89 //----------------------------------------------------------------------
90 Int_t AliMUONTriggerCircuit::CircuitNumber(Int_t idCircuit) const {
91 // returns circuit number iCircuit (0-234) corresponding to circuit idCircuit
92   Int_t iCircuit=0;
93   for (Int_t i=0; i<234; i++) {
94     if (AliMUONTriggerConstants::CircuitId(i)==idCircuit) {
95       iCircuit=i;
96       break;
97     }
98   }
99   return iCircuit;
100 }
101 //----------------------------------------------------------------------
102 Int_t AliMUONTriggerCircuit::ModuleNumber(Int_t idModule) const {
103 // returns module number imod (from 0 to 63) corresponding to module idmodule
104   Int_t absidModule=TMath::Abs(idModule);
105   Int_t iModule=0;
106   for (Int_t i=0; i<63; i++) {
107     if (AliMUONTriggerConstants::ModuleId(i)==absidModule) { 
108       iModule=i;
109       break;
110     }
111   }
112   return iModule;
113 }
114
115 //----------------------------------------------------------------------
116 Int_t AliMUONTriggerCircuit::Module(Int_t idCircuit) const {
117 // returns ModuleId where Circuit idCircuit is sitting
118   return Int_t(idCircuit/10);
119 }
120 //----------------------------------------------------------------------
121 Int_t AliMUONTriggerCircuit::Position(Int_t idCircuit) const {
122 // returns position of idCircuit in correcponding Module
123   return TMath::Abs(idCircuit)-TMath::Abs(Module(idCircuit))*10;
124 }
125
126 //----------------------------------------------------------------------
127 void AliMUONTriggerCircuit::LoadX2() {
128 // initialize fX2m, fX2ud and fOrMud
129   
130   Int_t idModule=Module(fIdCircuit);        // corresponding module Id.
131 // and its number of X strips
132   Int_t nStrX=AliMUONTriggerConstants::NstripX(ModuleNumber(idModule)); 
133 // and its number of Y strips
134   Int_t nStrY=AliMUONTriggerConstants::NstripY(ModuleNumber(idModule)); 
135   Int_t iPosCircuit=Position(fIdCircuit); // position of circuit in module
136   
137 // first step : look at lower part 
138   if (iPosCircuit==1) {               // need to scan lower module       
139     if(idModule<91&&TMath::Abs(idModule)!=41&&idModule>-91) { 
140       fOrMud[0]=1;
141       Int_t idModuleD=(TMath::Abs(idModule)+10)*(TMath::Abs(idModule)/idModule); 
142       Int_t nStrD=AliMUONTriggerConstants::NstripY(ModuleNumber(idModuleD));
143       
144       if (nStrY!=nStrD    
145           &&TMath::Abs(idModule)!=42&&TMath::Abs(idModule)!=52) {   
146         if (nStrY==8) fX2m=1; 
147         if (nStrD==8) fX2ud=1; 
148       }      
149     }      
150
151   } else {                         // lower strips within same module       
152     fOrMud[0]=0;
153   }    
154   
155 // second step : look at upper part
156   if ((iPosCircuit==1&&nStrX==16)||(iPosCircuit==2&&nStrX==32)|| 
157       (iPosCircuit==3&&nStrX==48)||(iPosCircuit==4&&nStrX==64)) {   
158     if ((idModule>17||idModule<-17)&&TMath::Abs(idModule)!=61) {  
159       fOrMud[1]=1;
160       Int_t idModuleU=(TMath::Abs(idModule)-10)*(TMath::Abs(idModule)/idModule); 
161       Int_t nStrU=AliMUONTriggerConstants::NstripY(ModuleNumber(idModuleU)); 
162
163       if (nStrY!=nStrU    
164           &&TMath::Abs(idModule)!=62&&TMath::Abs(idModule)!=52) {   
165         if (nStrY==8) fX2m=1; 
166         if (nStrU==8) fX2ud=1;
167       }      
168     }     
169     
170   } else {                       // upper strips within same module       
171     fOrMud[1]=0;
172   }
173 }  
174
175 //----------------------------------------------------------------------
176 void AliMUONTriggerCircuit::LoadXCode(){
177 // assign a Id. number to each X strip of current circuit 
178 // Id.=(corresponding module Id.)*100+(Id. strip of module)
179
180 // first part : fill XMC11 XMC12 and strips 8 to 24 (middle) XMC21 XMC22
181   Int_t iStripCircMT1=0, iStripCircMT2=8;
182   Int_t idModule=Module(fIdCircuit);        // corresponding module Id.
183 // and its number of strips
184   Int_t nStrX=AliMUONTriggerConstants::NstripX(ModuleNumber(idModule)); 
185   Int_t iPosCircuit=Position(fIdCircuit);   // position of circuit in module  
186   Int_t sign=TMath::Abs(idModule)/idModule; // left or right 
187   Int_t istrip;
188
189   for (istrip=(iPosCircuit-1)*16; 
190        istrip<(iPosCircuit-1)*16+16; istrip++) {
191         
192     fXcode[0][iStripCircMT1]=sign*(TMath::Abs(idModule)*100+istrip); 
193     fXcode[1][iStripCircMT1]=sign*(TMath::Abs(idModule)*100+istrip); 
194     fXcode[2][iStripCircMT2]=sign*(TMath::Abs(idModule)*100+istrip); 
195     fXcode[3][iStripCircMT2]=sign*(TMath::Abs(idModule)*100+istrip);     
196     iStripCircMT1++;
197     iStripCircMT2++;
198   }
199
200 // second part 
201 // XMC21 XMC22 strips 0 to 7 and 24 to 31 
202   Int_t idModuleD, idModuleU;
203   Int_t nStrD, nStrU;
204
205   idModule=Module(fIdCircuit); // corresponding module Id.
206 // number of X strips
207   nStrX=AliMUONTriggerConstants::NstripX(ModuleNumber(idModule));  
208   sign=TMath::Abs(idModule)/idModule;
209
210 // fill lower part (0 to 7)
211   if (iPosCircuit==1) {                 // need to scan lower module 
212     if(idModule<91&&TMath::Abs(idModule)!=41&&idModule>-91) { // non-existing
213       idModuleD=sign*(TMath::Abs(idModule)+10);  // lower module Id
214 // and its number of strips
215       nStrD=AliMUONTriggerConstants::NstripX(ModuleNumber(idModuleD)); 
216       
217       iStripCircMT2=0;
218       for (istrip=nStrD-8; istrip<nStrD; istrip++) {  
219         fXcode[2][iStripCircMT2]=sign*(TMath::Abs(idModuleD)*100+istrip); 
220         fXcode[3][iStripCircMT2]=sign*(TMath::Abs(idModuleD)*100+istrip); 
221         iStripCircMT2++;
222       }
223     }
224      
225   } else {                       // lower strips within same module 
226     
227     iStripCircMT2=0;
228     for (istrip=(iPosCircuit-1)*16-8; 
229          istrip<(iPosCircuit-1)*16; istrip++) {  
230       fXcode[2][iStripCircMT2]=sign*(TMath::Abs(idModule)*100+istrip); 
231       fXcode[3][iStripCircMT2]=sign*(TMath::Abs(idModule)*100+istrip); 
232       iStripCircMT2++;
233     }
234   }
235   
236 // fill upper part (24 to 31)
237   if ((iPosCircuit==1&&nStrX==16)||(iPosCircuit==2&&nStrX==32)|| 
238       (iPosCircuit==3&&nStrX==48)||(iPosCircuit==4&&nStrX==64)) {   
239     if ((idModule>17||idModule<-17)&&TMath::Abs(idModule)!=61) {  
240       idModuleU=sign*(TMath::Abs(idModule)-10);  // upper module Id
241 // and its number of strips
242       nStrU=AliMUONTriggerConstants::NstripX(ModuleNumber(idModuleU)); 
243       
244       iStripCircMT2=24;
245       for (istrip=0; istrip<8; istrip++) {        
246         fXcode[2][iStripCircMT2]=sign*(TMath::Abs(idModuleU)*100+istrip); 
247         fXcode[3][iStripCircMT2]=sign*(TMath::Abs(idModuleU)*100+istrip); 
248         iStripCircMT2++;
249       }
250     }
251     
252   } else if ((iPosCircuit==1&&nStrX>16)||(iPosCircuit==2&&nStrX>32)|| 
253              (iPosCircuit==3&&nStrX>48)) { // upper strips within same mod. 
254     
255     iStripCircMT2=24;
256     for (istrip=(iPosCircuit-1)*16+16; 
257          istrip<(iPosCircuit-1)*16+24; istrip++) {  
258       fXcode[2][iStripCircMT2]=sign*(TMath::Abs(idModule)*100+istrip); 
259       fXcode[3][iStripCircMT2]=sign*(TMath::Abs(idModule)*100+istrip); 
260       iStripCircMT2++;
261     }   
262   }
263 }
264
265 //----------------------------------------------------------------------
266 void AliMUONTriggerCircuit::LoadYCode(){
267 // assign a Id. number to each Y strip of current circuit 
268 // Id.=(corresponding module Id.)*100+(Id. strip of module)
269 // note : for Y plane fill only "central part" of circuit
270 // (upper and lower parts are filled in PreHandlingY of AliMUONTriggerDecision)
271     
272   Int_t idModule=Module(fIdCircuit);        // corresponding module Id.
273 // and its number of Y strips
274   Int_t nStrY=AliMUONTriggerConstants::NstripY(ModuleNumber(idModule)); 
275   Int_t sign=TMath::Abs(idModule)/idModule; // left or right 
276
277   for (Int_t istrip=0; istrip<nStrY; istrip++) {
278     fYcode[0][istrip]=sign*(TMath::Abs(idModule)*100+istrip); 
279     fYcode[1][istrip]=sign*(TMath::Abs(idModule)*100+istrip); 
280     fYcode[2][istrip]=sign*(TMath::Abs(idModule)*100+istrip); 
281     fYcode[3][istrip]=sign*(TMath::Abs(idModule)*100+istrip); 
282   }
283 }
284
285 //----------------------------------------------------------------------
286 Float_t AliMUONTriggerCircuit::PtCal(Int_t istripX, Int_t idev, Int_t istripY){
287 // returns calculated pt for circuit/istripX/idev/istripY according 
288 // to the formula of the TRD. Note : idev (input) is in [0+30]
289
290   //  Int_t jdev = idev - 15;        // jdev in [-15+15]
291   Int_t istripX2=istripX+idev+1; // find istripX2 using istripX and idev
292
293   Float_t yPosX1=fYpos11[istripX];
294   Float_t yPosX2=fYpos21[istripX2];
295   Float_t xPosY1=fXpos11[istripY];
296   
297   Float_t zf=975.;
298   Float_t z1=AliMUONConstants::DefaultChamberZ(10);
299   Float_t z2=AliMUONConstants::DefaultChamberZ(12);
300   Float_t thetaDev=(1./zf)*(yPosX1*z2-yPosX2*z1)/(z2-z1);
301   Float_t xf=xPosY1*zf/z1; 
302   Float_t yf=yPosX2-((yPosX2-yPosX1)*(z2-zf))/(z2-z1);
303   return (3.*0.3/TMath::Abs(thetaDev)) * TMath::Sqrt(xf*xf+yf*yf)/zf;
304 }
305 //---------------------------------------------------------------------
306 //----------------------- New Segmentation ----------------------------
307 //---------------------------------------------------------------------
308
309 //---------------------------------------------------------------------
310 void AliMUONTriggerCircuit::LoadYPos2(){
311 // fill fYpos11 and fYpos21 -> y position of X declusterized strips
312
313   Int_t chamber, cathode;
314   Int_t code, idModule, idStrip, idSector;
315   Float_t x, y, z, width;
316   Int_t istrip, idDE;
317
318   AliMUON *pMUON  = (AliMUON*)gAlice->GetModule("MUON");  
319   AliMUONGeometrySegmentation* segmentation;    
320   
321 // first plane (11)
322   chamber=11;
323   cathode=1;
324   segmentation
325     = pMUON->GetSegmentation()->GetModuleSegmentation(chamber-1, cathode-1);
326   
327   if (!segmentation) {
328     AliWarning("Segmentation not defined.");
329     return;
330   }  
331
332   for (istrip=0; istrip<16; istrip++) {
333     code=fXcode[0][istrip];           // decode current strip
334     idModule=Int_t(code/100);           // corresponding module Id.
335     idDE = DetElemId(chamber, idModule);
336     idStrip=TMath::Abs(code-idModule*100); // corresp. strip number in module
337     idSector=segmentation->Sector(idDE, idModule, idStrip); // corresponding sector
338     width=segmentation->Dpy(idDE, idSector);      // corresponding strip width
339     segmentation->GetPadC(idDE, idModule,idStrip,x,y,z); // get strip real position
340     
341     fYpos11[2*istrip]=y;
342     if (istrip!=15) fYpos11[2*istrip+1]=y+width/2.;
343   }   
344    
345 // second plane (21)
346   chamber=13;
347   cathode=1;
348   segmentation
349     = pMUON->GetSegmentation()->GetModuleSegmentation(chamber-1, cathode-1);
350   
351   for (istrip=0; istrip<32; istrip++) {
352     code=fXcode[2][istrip];    // decode current strip
353     idModule=Int_t(code/100);           // corresponding module Id.
354     idDE = DetElemId(chamber, idModule);
355     if (idModule == 0) continue;
356     idStrip=TMath::Abs(code-idModule*100); // corresp. strip number in module
357     idSector=segmentation->Sector(idDE, idModule, idStrip); // corresponding sector
358     width=segmentation->Dpy(idDE, idSector);      // corresponding strip width
359     segmentation->GetPadC(idDE, idModule,idStrip,x,y,z); // get strip real position
360     
361 // using idModule!=0 prevents to fill garbage in case of circuits 
362 // in the first and last rows 
363     if (idModule!=0) { 
364       fYpos21[2*istrip]=y;
365       if (istrip!=31) fYpos21[2*istrip+1]=y+width/2.;
366     }
367   }   
368 }
369
370 //----------------------------------------------------------------------
371 void AliMUONTriggerCircuit::LoadXPos2(){
372 // fill fXpos11 -> x position of Y strips for the first plane only
373 // fXpos11 contains the x position of Y strip for the current circuit
374 // taking into account whether or nor not part(s) of the circuit
375 // (middle, up or down) has(have) 16 strips
376   
377   Float_t x, y, z;
378   Int_t istrip, idDE;  
379
380   Int_t chamber=11;
381   Int_t cathode=2;
382   AliMUON *pMUON  = (AliMUON*)gAlice->GetModule("MUON");  
383   AliMUONGeometrySegmentation*  segmentation; 
384   segmentation
385     = pMUON->GetSegmentation()->GetModuleSegmentation(chamber-1, cathode-1);
386
387   if (!segmentation) {
388     AliWarning("Segmentation not defined.");
389     return;
390   }  
391   
392   Int_t idModule=Module(fIdCircuit);        // corresponding module Id.  
393 // number of Y strips
394   idDE = DetElemId(chamber, idModule);
395
396   Int_t nStrY=AliMUONTriggerConstants::NstripY(ModuleNumber(idModule)); 
397   Int_t idSector=segmentation->Sector(idDE, idModule,0); // corresp. sector
398   Float_t width=segmentation->Dpx(idDE, idSector);      // corresponding strip width
399   
400 // first case : up middle and down parts have all 8 or 16 strip 
401   if ((nStrY==16)||(nStrY==8&&fX2m==0&&fX2ud==0)) { 
402     for (istrip=0; istrip<nStrY; istrip++) {
403       segmentation->GetPadC(idDE, idModule,istrip,x,y,z); 
404       AliDebug(1,Form("idDE %d idModule %d istrip %d x,y,z=%e,%e,%e\n",
405                       idDE,idModule,istrip,x,y,z));
406       fXpos11[istrip]=x;
407     }
408 // second case : mixing 8 and 16 strips within same circuit      
409   } else {
410     for (istrip=0; istrip<nStrY; istrip++) {
411       if (nStrY!=8) { printf(" bug in LoadXpos \n");}
412       segmentation->GetPadC(idDE, idModule, istrip, x, y, z); 
413       fXpos11[2*istrip]=x-width/4.;
414       fXpos11[2*istrip+1]=fXpos11[2*istrip]+width/2.;
415     }
416   }   
417 }
418
419 //----------------------------------------------------------------------
420 //--- methods which return member data related info
421 //----------------------------------------------------------------------
422 Int_t AliMUONTriggerCircuit::GetIdCircuit() const { 
423 // returns circuit Id
424   return fIdCircuit;
425 }
426 //----------------------------------------------------------------------
427 Int_t AliMUONTriggerCircuit::GetIdModule() const { 
428 // returns module Id
429   return Module(fIdCircuit);
430 }
431 //----------------------------------------------------------------------
432 Int_t AliMUONTriggerCircuit::GetNstripX() const { 
433 // returns the number of X strips in the module where the circuit is sitting
434   return AliMUONTriggerConstants::NstripX(ModuleNumber(Module(fIdCircuit)));
435 }
436 //----------------------------------------------------------------------
437 Int_t AliMUONTriggerCircuit::GetNstripY() const { 
438 // returns the number of Y strips in the module where the circuit is sitting
439   return AliMUONTriggerConstants::NstripY(ModuleNumber(Module(fIdCircuit)));
440 }
441 //----------------------------------------------------------------------
442 Int_t AliMUONTriggerCircuit::GetPosCircuit() const { 
443 // returns the position of the circuit in its module
444   return Position(fIdCircuit);
445 }
446 //----------------------------------------------------------------------
447 Int_t AliMUONTriggerCircuit::GetIdCircuitD() const {
448 // returns the Id of the circuit down 
449   Int_t idModule=Module(fIdCircuit);
450   Int_t idModuleD=(TMath::Abs(idModule)+10)*(TMath::Abs(idModule)/idModule); 
451   return (TMath::Abs(idModuleD)*10+1)*(TMath::Abs(idModule)/idModule);
452 }
453 //----------------------------------------------------------------------
454 Int_t AliMUONTriggerCircuit::GetICircuitD() const {
455 // returns the number of the circuit down 
456   Int_t idModule=Module(fIdCircuit);
457   Int_t idModuleD=(TMath::Abs(idModule)+10)*(TMath::Abs(idModule)/idModule); 
458   Int_t idCircuitD=
459     (TMath::Abs(idModuleD)*10+1)*(TMath::Abs(idModule)/idModule);
460   return CircuitNumber(idCircuitD);
461 }
462 //----------------------------------------------------------------------
463 Int_t AliMUONTriggerCircuit::GetIdCircuitU() const {
464 // returns the Id of the circuit up 
465   Int_t idModule=Module(fIdCircuit);
466   Int_t idModuleU=(TMath::Abs(idModule)-10)*(TMath::Abs(idModule)/idModule); 
467   return (TMath::Abs(idModuleU)*10+1)*(TMath::Abs(idModule)/idModule);
468 }
469 //----------------------------------------------------------------------
470 Int_t AliMUONTriggerCircuit::GetICircuitU() const {
471 // returns the number of the circuit up 
472   Int_t idModule=Module(fIdCircuit);
473   Int_t idModuleU=(TMath::Abs(idModule)-10)*(TMath::Abs(idModule)/idModule); 
474   Int_t idCircuitU=
475     (TMath::Abs(idModuleU)*10+1)*(TMath::Abs(idModule)/idModule);
476   return CircuitNumber(idCircuitU);
477 }
478 //----------------------------------------------------------------------
479 Int_t AliMUONTriggerCircuit::GetX2m() const { 
480 // returns fX2m
481   return fX2m;
482 }
483 //----------------------------------------------------------------------
484 Int_t AliMUONTriggerCircuit::GetX2ud() const { 
485 // returns fX2ud
486   return fX2ud;
487 }
488 //----------------------------------------------------------------------
489 void AliMUONTriggerCircuit::GetOrMud(Int_t orMud[2]) const {
490 // returns fOrMud 
491   orMud[0]=fOrMud[0];
492   orMud[1]=fOrMud[1];
493 }
494 //----------------------------------------------------------------------
495 Int_t AliMUONTriggerCircuit::GetXcode(Int_t chamber, Int_t istrip) const {
496 // returns X code of circuit/chamber/istrip (warning : chamber in [0,3])
497   return fXcode[chamber][istrip];
498 }
499 //----------------------------------------------------------------------
500 Int_t AliMUONTriggerCircuit::GetYcode(Int_t chamber, Int_t istrip) const {
501 // returns Y code of circuit/chamber/istrip (warning : chamber in [0,3])
502   return fYcode[chamber][istrip];
503 }
504 //----------------------------------------------------------------------
505 Float_t AliMUONTriggerCircuit::GetY11Pos(Int_t istrip) const {
506 // returns Y position of X strip istrip in MC11
507   return fYpos11[istrip];
508 }
509 //----------------------------------------------------------------------
510 Float_t AliMUONTriggerCircuit::GetY21Pos(Int_t istrip) const {
511 // returns Y position of X strip istrip in MC21
512   return fYpos21[istrip];
513 }
514 //----------------------------------------------------------------------
515 Float_t AliMUONTriggerCircuit::GetX11Pos(Int_t istrip) const {
516 // returns X position of Y strip istrip in MC11
517   return fXpos11[istrip];
518 }
519 //----------------------------------------------------------------------
520 //--- end of methods which return member data related info
521 //----------------------------------------------------------------------
522
523 void dump(const char* what, const Float_t* array, Int_t size)
524 {
525   cout << what << " " << endl;
526   for ( Int_t i = 0; i < size; ++i )
527   {
528     cout << array[i] << " , ";
529   }
530   cout << endl;
531 }
532
533 void dump(const char* what, const Int_t* array, Int_t size)
534 {
535   cout << what << " " << endl;
536   for ( Int_t i = 0; i < size; ++i )
537   {
538     cout << array[i] << " , ";
539   }
540   cout << endl;
541 }
542
543 //_____________________________________________________________________________
544 void
545 AliMUONTriggerCircuit::Print(Option_t* ) const
546 {
547   cout << "IdCircuit " << fIdCircuit << " X2m,X2ud=" << fX2m << ","
548   << fX2ud;
549   for ( Int_t i = 0; i < 2; ++i )
550   {
551     cout << " OrMud[" << i << "]=" << fOrMud[i];
552   }
553   cout << endl;
554   dump("Xpos11",fXpos11,16);
555   dump("Ypos11",fYpos11,31);
556   dump("Ypos21",fYpos21,63);
557   for ( Int_t i = 0; i < 4; ++i )
558   {
559     char s[80];
560     sprintf(s,"Xcode[%d]",i);
561     dump(s,fXcode[i],32);
562     sprintf(s,"Ycode[%d]",i);
563     dump(s,fYcode[i],32);
564   }
565  // Int_t fIdCircuit;            // circuit Id number
566 //  Int_t fX2m;                  // internal info needed by TriggerDecision
567 //  Int_t fX2ud;                 // internal info needed by TriggerDecision
568 //  Int_t fOrMud[2];             // internal info needed by TriggerDecision
569 //  Int_t fXcode[4][32];         // code of X strips
570 //  Int_t fYcode[4][32];         // code of Y strips 
571 //  Float_t fXpos11[16];         // X position of Y strips in MC11
572 //  Float_t fYpos11[31];         // Y position of X strips in MC11
573 //  Float_t fYpos21[63];         // Y position of X strips in MC21
574   
575 }
576
577 Int_t AliMUONTriggerCircuit::DetElemId(Int_t ichamber, Int_t idModule)
578 {
579 // adpated to official numbering (09/20/05)
580 // returns the detection element Id for given chamber and module
581 // ichamber (from 11 to 14), idModule (from -97 to 97)
582 //    
583     Int_t itmp=0;    
584     Int_t linenumber=Int_t(idModule/10);    
585     switch (linenumber) // (from 1 to 9, from top to bottom)
586     {
587     case 1:
588         itmp = 4;
589         break;  
590     case 2:
591         itmp = 3;
592         break;          
593     case 3:
594         itmp = 2;
595         break;
596     case 4:
597         itmp = 1;
598         break;      
599     case 5:
600         itmp = 0;
601         break;          
602     case 6:
603         itmp = 17;
604         break;          
605     case 7:
606         itmp = 16;
607         break;          
608     case 8:
609         itmp = 15;
610         break;          
611     case 9:
612         itmp = 14;
613         break;          
614 // left
615     case -1:
616         itmp = 5;
617         break;          
618     case -2:
619         itmp = 6;
620         break;          
621     case -3:
622         itmp = 7;
623         break;          
624     case -4:
625         itmp = 8;
626         break;          
627     case -5:
628         itmp = 9;
629         break;          
630     case -6:
631         itmp = 10;
632         break;          
633     case -7:
634         itmp = 11;
635         break;          
636     case -8:
637         itmp = 12;
638         break;
639     case -9:
640         itmp = 13;
641         break;          
642     }
643     return (ichamber*100)+itmp;    
644 }
645
646
647
648