]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONTriggerCircuit.cxx
Splitting Draw option in cluaster finder AZ (Sacha)
[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 "AliMUONChamber.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   AliMUONChamber*  iChamber;
320   AliMUONGeometrySegmentation* segmentation;    
321   
322 // first plane (11)
323   chamber=11;
324   cathode=1;
325   iChamber = &(pMUON->Chamber(chamber-1));
326   segmentation=iChamber->SegmentationModel2(cathode);
327   
328   if (!segmentation) {
329     AliWarning("Segmentation not defined.");
330     return;
331   }  
332
333   for (istrip=0; istrip<16; istrip++) {
334     code=fXcode[0][istrip];           // decode current strip
335     idModule=Int_t(code/100);           // corresponding module Id.
336     idDE = DetElemId(chamber, idModule);
337     idStrip=TMath::Abs(code-idModule*100); // corresp. strip number in module
338     idSector=segmentation->Sector(idDE, idModule, idStrip); // corresponding sector
339     width=segmentation->Dpy(idDE, idSector);      // corresponding strip width
340     segmentation->GetPadC(idDE, idModule,idStrip,x,y,z); // get strip real position
341     
342     fYpos11[2*istrip]=y;
343     if (istrip!=15) fYpos11[2*istrip+1]=y+width/2.;
344   }   
345    
346 // second plane (21)
347   chamber=13;
348   cathode=1;
349   iChamber = &(pMUON->Chamber(chamber-1));
350   segmentation=iChamber->SegmentationModel2(cathode);
351   
352   for (istrip=0; istrip<32; istrip++) {
353     code=fXcode[2][istrip];    // decode current strip
354     idModule=Int_t(code/100);           // corresponding module Id.
355     idDE = DetElemId(chamber, idModule);
356     if (idModule == 0) continue;
357     idStrip=TMath::Abs(code-idModule*100); // corresp. strip number in module
358     idSector=segmentation->Sector(idDE, idModule, idStrip); // corresponding sector
359     width=segmentation->Dpy(idDE, idSector);      // corresponding strip width
360     segmentation->GetPadC(idDE, idModule,idStrip,x,y,z); // get strip real position
361     
362 // using idModule!=0 prevents to fill garbage in case of circuits 
363 // in the first and last rows 
364     if (idModule!=0) { 
365       fYpos21[2*istrip]=y;
366       if (istrip!=31) fYpos21[2*istrip+1]=y+width/2.;
367     }
368   }   
369 }
370
371 //----------------------------------------------------------------------
372 void AliMUONTriggerCircuit::LoadXPos2(){
373 // fill fXpos11 -> x position of Y strips for the first plane only
374 // fXpos11 contains the x position of Y strip for the current circuit
375 // taking into account whether or nor not part(s) of the circuit
376 // (middle, up or down) has(have) 16 strips
377   
378   Float_t x, y, z;
379   Int_t istrip, idDE;  
380
381   Int_t chamber=11;
382   Int_t cathode=2;
383   AliMUON *pMUON  = (AliMUON*)gAlice->GetModule("MUON");  
384   AliMUONChamber*  iChamber;
385   AliMUONGeometrySegmentation*  segmentation; 
386   iChamber = &(pMUON->Chamber(chamber-1));
387   segmentation=iChamber->SegmentationModel2(cathode);
388
389   if (!segmentation) {
390     AliWarning("Segmentation not defined.");
391     return;
392   }  
393   
394   Int_t idModule=Module(fIdCircuit);        // corresponding module Id.  
395 // number of Y strips
396   idDE = DetElemId(chamber, idModule);
397
398   Int_t nStrY=AliMUONTriggerConstants::NstripY(ModuleNumber(idModule)); 
399   Int_t idSector=segmentation->Sector(idDE, idModule,0); // corresp. sector
400   Float_t width=segmentation->Dpx(idDE, idSector);      // corresponding strip width
401   
402 // first case : up middle and down parts have all 8 or 16 strip 
403   if ((nStrY==16)||(nStrY==8&&fX2m==0&&fX2ud==0)) { 
404     for (istrip=0; istrip<nStrY; istrip++) {
405       segmentation->GetPadC(idDE, idModule,istrip,x,y,z); 
406       AliDebug(1,Form("idDE %d idModule %d istrip %d x,y,z=%e,%e,%e\n",
407                       idDE,idModule,istrip,x,y,z));
408       fXpos11[istrip]=x;
409     }
410 // second case : mixing 8 and 16 strips within same circuit      
411   } else {
412     for (istrip=0; istrip<nStrY; istrip++) {
413       if (nStrY!=8) { printf(" bug in LoadXpos \n");}
414       segmentation->GetPadC(idDE, idModule, istrip, x, y, z); 
415       fXpos11[2*istrip]=x-width/4.;
416       fXpos11[2*istrip+1]=fXpos11[2*istrip]+width/2.;
417     }
418   }   
419 }
420
421 //----------------------------------------------------------------------
422 //--- methods which return member data related info
423 //----------------------------------------------------------------------
424 Int_t AliMUONTriggerCircuit::GetIdCircuit() const { 
425 // returns circuit Id
426   return fIdCircuit;
427 }
428 //----------------------------------------------------------------------
429 Int_t AliMUONTriggerCircuit::GetIdModule() const { 
430 // returns module Id
431   return Module(fIdCircuit);
432 }
433 //----------------------------------------------------------------------
434 Int_t AliMUONTriggerCircuit::GetNstripX() const { 
435 // returns the number of X strips in the module where the circuit is sitting
436   return AliMUONTriggerConstants::NstripX(ModuleNumber(Module(fIdCircuit)));
437 }
438 //----------------------------------------------------------------------
439 Int_t AliMUONTriggerCircuit::GetNstripY() const { 
440 // returns the number of Y strips in the module where the circuit is sitting
441   return AliMUONTriggerConstants::NstripY(ModuleNumber(Module(fIdCircuit)));
442 }
443 //----------------------------------------------------------------------
444 Int_t AliMUONTriggerCircuit::GetPosCircuit() const { 
445 // returns the position of the circuit in its module
446   return Position(fIdCircuit);
447 }
448 //----------------------------------------------------------------------
449 Int_t AliMUONTriggerCircuit::GetIdCircuitD() const {
450 // returns the Id of the circuit down 
451   Int_t idModule=Module(fIdCircuit);
452   Int_t idModuleD=(TMath::Abs(idModule)+10)*(TMath::Abs(idModule)/idModule); 
453   return (TMath::Abs(idModuleD)*10+1)*(TMath::Abs(idModule)/idModule);
454 }
455 //----------------------------------------------------------------------
456 Int_t AliMUONTriggerCircuit::GetICircuitD() const {
457 // returns the number of the circuit down 
458   Int_t idModule=Module(fIdCircuit);
459   Int_t idModuleD=(TMath::Abs(idModule)+10)*(TMath::Abs(idModule)/idModule); 
460   Int_t idCircuitD=
461     (TMath::Abs(idModuleD)*10+1)*(TMath::Abs(idModule)/idModule);
462   return CircuitNumber(idCircuitD);
463 }
464 //----------------------------------------------------------------------
465 Int_t AliMUONTriggerCircuit::GetIdCircuitU() const {
466 // returns the Id of the circuit up 
467   Int_t idModule=Module(fIdCircuit);
468   Int_t idModuleU=(TMath::Abs(idModule)-10)*(TMath::Abs(idModule)/idModule); 
469   return (TMath::Abs(idModuleU)*10+1)*(TMath::Abs(idModule)/idModule);
470 }
471 //----------------------------------------------------------------------
472 Int_t AliMUONTriggerCircuit::GetICircuitU() const {
473 // returns the number of the circuit up 
474   Int_t idModule=Module(fIdCircuit);
475   Int_t idModuleU=(TMath::Abs(idModule)-10)*(TMath::Abs(idModule)/idModule); 
476   Int_t idCircuitU=
477     (TMath::Abs(idModuleU)*10+1)*(TMath::Abs(idModule)/idModule);
478   return CircuitNumber(idCircuitU);
479 }
480 //----------------------------------------------------------------------
481 Int_t AliMUONTriggerCircuit::GetX2m() const { 
482 // returns fX2m
483   return fX2m;
484 }
485 //----------------------------------------------------------------------
486 Int_t AliMUONTriggerCircuit::GetX2ud() const { 
487 // returns fX2ud
488   return fX2ud;
489 }
490 //----------------------------------------------------------------------
491 void AliMUONTriggerCircuit::GetOrMud(Int_t orMud[2]) const {
492 // returns fOrMud 
493   orMud[0]=fOrMud[0];
494   orMud[1]=fOrMud[1];
495 }
496 //----------------------------------------------------------------------
497 Int_t AliMUONTriggerCircuit::GetXcode(Int_t chamber, Int_t istrip) const {
498 // returns X code of circuit/chamber/istrip (warning : chamber in [0,3])
499   return fXcode[chamber][istrip];
500 }
501 //----------------------------------------------------------------------
502 Int_t AliMUONTriggerCircuit::GetYcode(Int_t chamber, Int_t istrip) const {
503 // returns Y code of circuit/chamber/istrip (warning : chamber in [0,3])
504   return fYcode[chamber][istrip];
505 }
506 //----------------------------------------------------------------------
507 Float_t AliMUONTriggerCircuit::GetY11Pos(Int_t istrip) const {
508 // returns Y position of X strip istrip in MC11
509   return fYpos11[istrip];
510 }
511 //----------------------------------------------------------------------
512 Float_t AliMUONTriggerCircuit::GetY21Pos(Int_t istrip) const {
513 // returns Y position of X strip istrip in MC21
514   return fYpos21[istrip];
515 }
516 //----------------------------------------------------------------------
517 Float_t AliMUONTriggerCircuit::GetX11Pos(Int_t istrip) const {
518 // returns X position of Y strip istrip in MC11
519   return fXpos11[istrip];
520 }
521 //----------------------------------------------------------------------
522 //--- end of methods which return member data related info
523 //----------------------------------------------------------------------
524
525 void dump(const char* what, const Float_t* array, Int_t size)
526 {
527   cout << what << " " << endl;
528   for ( Int_t i = 0; i < size; ++i )
529   {
530     cout << array[i] << " , ";
531   }
532   cout << endl;
533 }
534
535 void dump(const char* what, const Int_t* array, Int_t size)
536 {
537   cout << what << " " << endl;
538   for ( Int_t i = 0; i < size; ++i )
539   {
540     cout << array[i] << " , ";
541   }
542   cout << endl;
543 }
544
545 //_____________________________________________________________________________
546 void
547 AliMUONTriggerCircuit::Print(Option_t* ) const
548 {
549   cout << "IdCircuit " << fIdCircuit << " X2m,X2ud=" << fX2m << ","
550   << fX2ud;
551   for ( Int_t i = 0; i < 2; ++i )
552   {
553     cout << " OrMud[" << i << "]=" << fOrMud[i];
554   }
555   cout << endl;
556   dump("Xpos11",fXpos11,16);
557   dump("Ypos11",fYpos11,31);
558   dump("Ypos21",fYpos21,63);
559   for ( Int_t i = 0; i < 4; ++i )
560   {
561     char s[80];
562     sprintf(s,"Xcode[%d]",i);
563     dump(s,fXcode[i],32);
564     sprintf(s,"Ycode[%d]",i);
565     dump(s,fYcode[i],32);
566   }
567  // Int_t fIdCircuit;            // circuit Id number
568 //  Int_t fX2m;                  // internal info needed by TriggerDecision
569 //  Int_t fX2ud;                 // internal info needed by TriggerDecision
570 //  Int_t fOrMud[2];             // internal info needed by TriggerDecision
571 //  Int_t fXcode[4][32];         // code of X strips
572 //  Int_t fYcode[4][32];         // code of Y strips 
573 //  Float_t fXpos11[16];         // X position of Y strips in MC11
574 //  Float_t fYpos11[31];         // Y position of X strips in MC11
575 //  Float_t fYpos21[63];         // Y position of X strips in MC21
576   
577 }
578
579 Int_t AliMUONTriggerCircuit::DetElemId(Int_t ichamber, Int_t idModule)
580 {
581 // adpated to official numbering (09/20/05)
582 // returns the detection element Id for given chamber and module
583 // ichamber (from 11 to 14), idModule (from -97 to 97)
584 //    
585     Int_t itmp=0;    
586     Int_t linenumber=Int_t(idModule/10);    
587     switch (linenumber) // (from 1 to 9, from top to bottom)
588     {
589     case 1:
590         itmp = 4;
591         break;  
592     case 2:
593         itmp = 3;
594         break;          
595     case 3:
596         itmp = 2;
597         break;
598     case 4:
599         itmp = 1;
600         break;      
601     case 5:
602         itmp = 0;
603         break;          
604     case 6:
605         itmp = 17;
606         break;          
607     case 7:
608         itmp = 16;
609         break;          
610     case 8:
611         itmp = 15;
612         break;          
613     case 9:
614         itmp = 14;
615         break;          
616 // left
617     case -1:
618         itmp = 5;
619         break;          
620     case -2:
621         itmp = 6;
622         break;          
623     case -3:
624         itmp = 7;
625         break;          
626     case -4:
627         itmp = 8;
628         break;          
629     case -5:
630         itmp = 9;
631         break;          
632     case -6:
633         itmp = 10;
634         break;          
635     case -7:
636         itmp = 11;
637         break;          
638     case -8:
639         itmp = 12;
640         break;
641     case -9:
642         itmp = 13;
643         break;          
644     }
645     return (ichamber*100)+itmp;    
646 }
647
648
649
650