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