]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONTriggerCircuit.cxx
In AliMUONPairLight, AliMUONTrackLight:
[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 /// Contains as data members the Y positions of the X declusturized strips and 
21 /// the X positions of the (doubled or not) Y strips.
22 /// This is used to associate the global positions to the fired strips of the 
23 /// local trigger output (see AliMUONTrackReconstructor::MakeTriggerTrack)
24 ///
25 /// \author Philippe Crochet (LPCCFd)
26 //-----------------------------------------------------------------------------
27
28 #include "AliMUONTriggerCircuit.h"
29 #include "AliMUONConstants.h"
30 #include "AliMUONGeometryTransformer.h"
31
32 #include "AliMpTrigger.h"
33 #include "AliMpSlat.h"
34 #include "AliMpPCB.h"
35 #include "AliMpSegmentation.h"
36 #include "AliMpVSegmentation.h"
37 #include "AliMpCathodType.h"
38 #include "AliMpDDLStore.h"
39 #include "AliMpLocalBoard.h"
40 #include "AliMpConstants.h"
41 #include "AliMpPad.h"
42 #include "AliMpEncodePair.h"
43
44 #include "AliRun.h"
45 #include "AliLog.h"
46
47 #include <TMath.h>
48 #include <Riostream.h>
49
50 /// \cond CLASSIMP
51 ClassImp(AliMUONTriggerCircuit)
52 /// \endcond
53
54 //----------------------------------------------------------------------
55 AliMUONTriggerCircuit::AliMUONTriggerCircuit(const AliMUONGeometryTransformer* transformer)
56     : TObject(),
57       fkTransformer(transformer),
58       fkCurrentSeg(0x0),
59       fCurrentDetElem(0x0),
60       fCurrentLocalBoard(0x0)
61 {
62 /// Constructor
63   
64     for (Int_t i = 1; i < AliMpConstants::NofLocalBoards()+1; ++i) {
65       fXpos11[i].Set(16); 
66       fYpos11[i].Set(32);
67       fYpos21[i].Set(64);
68       fZpos11[i].Set(32);
69       fZpos21[i].Set(64);
70       fXwidth11[i].Set(16); 
71       fYwidth11[i].Set(32);
72       fYwidth21[i].Set(64);
73     }
74
75     for (Int_t i = 1; i < AliMpConstants::NofLocalBoards()+1; ++i) { // board begins at 1
76   
77     AliMpLocalBoard* localBoard = AliMpDDLStore::Instance()->GetLocalBoard(i);
78
79     if (!localBoard)
80     {
81       AliError(Form("Did not get localboard %d",i));
82       continue;
83     }
84
85     LoadXPos(localBoard);
86     LoadYPos(localBoard);
87     /*
88     printf("LocalBoard %03d \n",i);
89     printf("fXpos11 \n");
90     for (Int_t i1 = 0; i1 < 16; i1++) 
91       printf("%02d   %7.2f \n",i1,fXpos11[i][i1]);
92     printf("fYpos11 \n");
93     for (Int_t i2 = 0; i2 < 32; i2++) 
94       printf("%02d   %7.2f \n",i2,fYpos11[i][i2]);
95     printf("fYpos21 \n");
96     for (Int_t i3 = 0; i3 < 64; i3++) 
97       printf("%02d   %7.2f \n",i3,fYpos21[i][i3]);
98     printf("fZpos11 \n");
99     for (Int_t i4 = 0; i4 < 32; i4++) 
100       printf("%02d   %8.2f \n",i4,fZpos11[i][i4]);
101     printf("fZpos21 \n");
102     for (Int_t i5 = 0; i5 < 64; i5++) 
103       printf("%02d   %8.2f \n",i5,fZpos21[i][i5]);
104     */
105   }
106
107 }
108
109 //----------------------------------------------------------------------
110 AliMUONTriggerCircuit::~AliMUONTriggerCircuit()
111 {
112 /// Destructor
113    for (Int_t i = 1; i < AliMpConstants::NofLocalBoards()+1; ++i) {
114      fXpos11[i].Reset();
115      fYpos11[i].Reset();
116      fYpos21[i].Reset();
117      fZpos11[i].Reset();
118      fZpos21[i].Reset();
119      fXwidth11[i].Reset();
120      fYwidth11[i].Reset();
121      fYwidth21[i].Reset();
122     }
123
124
125
126 //----------------------------------------------------------------------
127 AliMUONTriggerCircuit::AliMUONTriggerCircuit(const AliMUONTriggerCircuit& circuit)
128     :  TObject(circuit),
129        fkTransformer(circuit.fkTransformer), // do not copy, just pointed to
130        fkCurrentSeg(circuit.fkCurrentSeg),
131        fCurrentDetElem(circuit.fCurrentDetElem),
132        fCurrentLocalBoard(circuit.fCurrentLocalBoard)
133 {
134 /// Copy constructor
135
136     for (Int_t i = 1; i < AliMpConstants::NofLocalBoards()+1; ++i) {
137       fXpos11[i] = circuit.fXpos11[i];
138       fYpos11[i] = circuit.fYpos11[i];
139       fYpos21[i] = circuit.fYpos21[i];
140       fZpos11[i] = circuit.fZpos11[i];
141       fZpos21[i] = circuit.fZpos21[i];
142       fXwidth11[i] = circuit.fXwidth11[i];
143       fYwidth11[i] = circuit.fYwidth11[i];
144       fYwidth21[i] = circuit.fYwidth21[i];
145     }
146
147 }
148 //----------------------------------------------------------------------
149 AliMUONTriggerCircuit& AliMUONTriggerCircuit::operator=(const AliMUONTriggerCircuit& circuit) 
150 {
151 /// Assignment operator
152
153   if (this == &circuit) return *this;
154
155   fkTransformer      = circuit.fkTransformer;
156   fkCurrentSeg       = circuit.fkCurrentSeg;
157   fCurrentDetElem    = circuit.fCurrentDetElem;
158   fCurrentLocalBoard = circuit.fCurrentLocalBoard;
159
160   for (Int_t i = 1; i < AliMpConstants::NofLocalBoards()+1; ++i) {
161     fXpos11[i] = circuit.fXpos11[i];
162     fYpos11[i] = circuit.fYpos11[i];
163     fYpos21[i] = circuit.fYpos21[i];
164     fZpos11[i] = circuit.fZpos11[i];
165     fZpos21[i] = circuit.fZpos21[i];
166     fXwidth11[i] = circuit.fXwidth11[i];
167     fYwidth11[i] = circuit.fYwidth11[i];
168     fYwidth21[i] = circuit.fYwidth21[i];
169   }
170
171   return *this;
172
173 }
174
175 //---------------------------------------------------------------------
176 void AliMUONTriggerCircuit::LoadYPos(AliMpLocalBoard* const localBoard)
177 {
178 /// fill fYpos11 and fYpos21 -> y position of X declusterized strips
179   
180   fCurrentLocalBoard = localBoard->GetId();
181   Int_t ichamber = 0;
182   Int_t icathode = 0;    
183     
184   Int_t zeroDown = localBoard->GetSwitch(AliMpLocalBoard::kZeroDown);
185   Int_t zeroUp   = localBoard->GetSwitch(AliMpLocalBoard::kZeroUp);
186  
187   Int_t iline = AliMp::PairFirst(localBoard->GetPosition());
188   Int_t icol  = AliMp::PairSecond(localBoard->GetPosition());
189   if ( iline == 5 ) --icol;
190
191   //--- first plane 
192   ichamber = 10;
193   fCurrentDetElem = AliMpDDLStore::Instance()->GetDEfromLocalBoard(fCurrentLocalBoard, ichamber);
194
195   fkCurrentSeg = AliMpSegmentation::Instance()
196         ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));  
197
198   Int_t iFirstStrip = FirstStrip(localBoard);
199   Int_t iLastStrip  = iFirstStrip + 16;    
200   Int_t iStripCircuit = 0;
201
202   FillXstrips(icol, iFirstStrip, iLastStrip, 
203               iStripCircuit, kTRUE);
204   
205   //--- second plane 
206   ichamber = 12;
207   fCurrentDetElem = AliMpDDLStore::Instance()->GetDEfromLocalBoard(fCurrentLocalBoard, ichamber);
208
209   fkCurrentSeg = AliMpSegmentation::Instance()
210         ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));  
211
212   // second plane middle part
213   Int_t iFirstStripMiddle = FirstStrip(localBoard);
214   Int_t iLastStripMiddle  = iFirstStrip + 16;
215   iStripCircuit = 8;
216
217   FillXstrips(icol, iFirstStripMiddle, iLastStripMiddle,
218               iStripCircuit, kFALSE);
219   
220   // second plane upper part
221   if (zeroUp == 0) { // something up
222     Int_t iFirstStripUp;
223     Int_t iLastStripUp;
224     Int_t icolUp = icol;
225
226     // check if we need to move to another detElemId
227     AliMpPad pad = fkCurrentSeg->PadByIndices(icol-1,iLastStripMiddle+1,kFALSE);
228
229     if (pad.IsValid()) { // upper strips within same detElemId
230       iFirstStripUp = iLastStripMiddle;
231       iLastStripUp  = iFirstStripUp + 8;
232
233     } else {             // upper strips in another detElemId
234       fCurrentDetElem = AliMpDDLStore::Instance()->
235                    GetNextDEfromLocalBoard(fCurrentLocalBoard, ichamber);
236
237       fkCurrentSeg = AliMpSegmentation::Instance()
238             ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));  
239
240       iFirstStripUp = 0;
241       iLastStripUp  = iFirstStripUp + 8;
242       if (iline == 4) icolUp = icol - 1; // special case
243       if (iline == 5) icolUp = icol + 1; // special case
244     }
245     
246     iStripCircuit = 24;
247     FillXstrips(icolUp, iFirstStripUp, iLastStripUp,
248                 iStripCircuit, kFALSE);
249     
250     // fill strip between middle and upper part
251     fYpos21[fCurrentLocalBoard][47] = (fYpos21[fCurrentLocalBoard][46] + 
252                                        fYpos21[fCurrentLocalBoard][48])/2.;
253     fZpos21[fCurrentLocalBoard][47] = (fZpos21[fCurrentLocalBoard][46] + 
254                                        fZpos21[fCurrentLocalBoard][48])/2.;
255     fYwidth21[fCurrentLocalBoard][47] = (fYwidth21[fCurrentLocalBoard][46] + 
256                                          fYwidth21[fCurrentLocalBoard][48])/2.;
257   } // end of something up
258   
259   // restore current detElemId & segmentation
260   fCurrentDetElem = AliMpDDLStore::Instance()->GetDEfromLocalBoard(fCurrentLocalBoard, ichamber);
261   fkCurrentSeg = AliMpSegmentation::Instance()
262       ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));  
263
264   // second plane lower part
265   if (zeroDown == 0) { // something down
266     Int_t iFirstStripDo;
267     Int_t iLastStripDo;
268     Int_t icolDo = icol;
269     
270     // check if we need to move to another detElemId      
271     AliMpPad pad = fkCurrentSeg->PadByIndices(icol-1,iFirstStripMiddle-1,kFALSE);
272     if (pad.IsValid()) { // lower strips within same detElemId
273       iFirstStripDo = iFirstStripMiddle - 8;
274       iLastStripDo  = iFirstStripDo + 8;              
275
276     } else {             // lower strips in another detElemId 
277       fCurrentDetElem = AliMpDDLStore::Instance()
278           ->GetPreviousDEfromLocalBoard(fCurrentLocalBoard, ichamber);
279
280       fkCurrentSeg = AliMpSegmentation::Instance()
281           ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));  
282
283       // get iFirstStrip in this module 
284       const AliMpTrigger* t = AliMpSegmentation::Instance()->GetTrigger(fkCurrentSeg);
285       const AliMpSlat* slat = t->GetLayer(0);
286
287       if (iline == 5) icolDo = icol + 1; // special case
288       if (iline == 6) icolDo = icol - 1; // special case
289             
290       const AliMpPCB* pcb = slat->GetPCB(icolDo-1);
291       iFirstStripDo = (pcb->Iymax() + 1) - 8;
292       iLastStripDo =  iFirstStripDo + 8;
293     }  
294     
295     iStripCircuit = 0;
296     FillXstrips(icolDo, iFirstStripDo, iLastStripDo,
297                 iStripCircuit, kFALSE);
298     
299     // fill strip between middle and upper part
300     fYpos21[fCurrentLocalBoard][15] = (fYpos21[fCurrentLocalBoard][14] + 
301                                        fYpos21[fCurrentLocalBoard][16])/2.;
302     fZpos21[fCurrentLocalBoard][15] = (fZpos21[fCurrentLocalBoard][14] + 
303                                        fZpos21[fCurrentLocalBoard][16])/2.;
304     fYwidth21[fCurrentLocalBoard][15] = (fYwidth21[fCurrentLocalBoard][14] + 
305                                          fYwidth21[fCurrentLocalBoard][16])/2.;
306   } // end of something down
307   
308 }
309
310 //----------------------------------------------------------------------
311 void AliMUONTriggerCircuit::FillXstrips(const Int_t icol, 
312                                         const Int_t iFirstStrip, const Int_t iLastStrip, 
313                                         Int_t liStripCircuit, const Bool_t is11)
314 {    
315 /// fill 
316   TArrayF& ypos   = (is11) ? fYpos11[fCurrentLocalBoard] : fYpos21[fCurrentLocalBoard];
317   TArrayF& zpos   = (is11) ? fZpos11[fCurrentLocalBoard] : fZpos21[fCurrentLocalBoard];
318   TArrayF& ywidth = (is11) ? fYwidth11[fCurrentLocalBoard] : fYwidth21[fCurrentLocalBoard];
319
320   Double_t xyGlobal[3] = {0.};
321   for (Int_t istrip = iFirstStrip; istrip < iLastStrip; ++istrip) {
322
323     AliMpPad pad = fkCurrentSeg->PadByIndices(icol-1,istrip,kTRUE);
324     if ( !pad.IsValid() ) {
325       StdoutToAliError(cout << "Pad not found in seg " << endl;
326                        fkCurrentSeg->Print();
327                        cout << " ix,iy=" << icol-1 << "," << istrip << endl;
328                        );
329     }
330     Float_t yDim = pad.GetDimensionY(); // half size! 
331
332     XYGlobal(pad,xyGlobal);
333     
334     ypos[2*liStripCircuit] = xyGlobal[1];
335     zpos[2*liStripCircuit] = xyGlobal[2];
336     ywidth[2*liStripCircuit] = 2. * yDim;
337     if (istrip != (iLastStrip - 1)) {
338       ypos[2*liStripCircuit+1] = xyGlobal[1] + yDim;
339       zpos[2*liStripCircuit+1] = xyGlobal[2];
340       ywidth[2*liStripCircuit+1] = 2. * yDim;
341     }
342     liStripCircuit++;
343   }    
344 }
345
346
347 //----------------------------------------------------------------------
348 void AliMUONTriggerCircuit::LoadXPos(AliMpLocalBoard* const localBoard)
349 {
350 /// fill fXpos11 -> x position of Y strips for the first plane only
351 /// fXpos11 contains the x position of Y strip for the current circuit
352 /// taking into account whether or nor not part(s) of the circuit
353 /// (middle, up or down) has(have) 16 strips (handdled by means of switchs)
354
355   fCurrentLocalBoard = localBoard->GetId();
356
357   Int_t ichamber = 10;
358   Int_t icathode = 1;
359   
360   Int_t x2u = localBoard->GetSwitch(AliMpLocalBoard::kX2u);
361   Int_t x2m = localBoard->GetSwitch(AliMpLocalBoard::kX2m);
362   Int_t x2d = localBoard->GetSwitch(AliMpLocalBoard::kX2d);
363   Int_t zeroAllYLSB = localBoard->GetSwitch(AliMpLocalBoard::kZeroAllYLSB);
364
365   Int_t  iStripCircuit = 0;
366   Int_t  iFirstStrip   = 0;
367   Int_t  iLastStrip    = 0;
368   Bool_t doubling      = kFALSE;
369   
370   Int_t iline = AliMp::PairFirst(localBoard->GetPosition());
371   Int_t icol  = AliMp::PairSecond(localBoard->GetPosition());
372   if ( iline == 5 ) --icol;
373
374   fCurrentDetElem = AliMpDDLStore::Instance()->GetDEfromLocalBoard(fCurrentLocalBoard, ichamber);
375
376   fkCurrentSeg = AliMpSegmentation::Instance()
377         ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));  
378
379   // check if one needs a strip doubling or not
380   if ( (x2u || x2m || x2d ) && x2m ) doubling = kTRUE;
381   
382
383   // check if one starts at strip = 0 or 8 (boards 26-29 and 143-146)
384   if (zeroAllYLSB) iStripCircuit = 8;
385   
386   // get iFirstStrip in this module 
387   const AliMpTrigger* t = AliMpSegmentation::Instance()->GetTrigger(fkCurrentSeg);
388   const AliMpSlat* slat = t->GetLayer(0);
389   
390   const AliMpPCB* pcb = slat->GetPCB(icol-1);
391   iFirstStrip = pcb->Ixmin();
392   
393
394   if (doubling || zeroAllYLSB == 1) iLastStrip = iFirstStrip + 8;
395   else iLastStrip = iFirstStrip + 16;
396   
397   FillYstrips(iFirstStrip, iLastStrip, iStripCircuit, doubling);  
398 }
399
400 //----------------------------------------------------------------------
401 void AliMUONTriggerCircuit::FillYstrips(const Int_t iFirstStrip, const Int_t iLastStrip, 
402                                         Int_t liStripCircuit,
403                                         const Bool_t doubling)
404 {    
405 /// fill
406   Double_t xyGlobal[3] = {0.};
407
408   for (Int_t istrip = iFirstStrip; istrip < iLastStrip; ++istrip) {
409
410     AliMpPad pad = fkCurrentSeg->PadByIndices(istrip,0,kTRUE);
411
412     if ( !pad.IsValid() )
413     {
414         StdoutToAliError(cout << "Pad not found in seg " << endl;
415                          fkCurrentSeg->Print();
416                          cout << " ix,iy=" << istrip << "," << 0 << endl;
417                          );
418     }
419     Float_t xDim = pad.GetDimensionX(); // half size!
420
421     XYGlobal(pad,xyGlobal);
422     
423     if (!doubling) {    
424       fXpos11[fCurrentLocalBoard].AddAt(xyGlobal[0], liStripCircuit);
425       fXwidth11[fCurrentLocalBoard].AddAt(2. * xDim, liStripCircuit);
426     } else if (doubling) {
427
428       fXpos11[fCurrentLocalBoard].AddAt(TMath::Sign(1.,xyGlobal[0]) * 
429                                   (TMath::Abs(xyGlobal[0]) - xDim/2.), 2*liStripCircuit);
430       fXwidth11[fCurrentLocalBoard].AddAt(2. * xDim, 2*liStripCircuit);
431
432       fXpos11[fCurrentLocalBoard].AddAt(TMath::Sign(1.,xyGlobal[0]) *
433                                   (TMath::Abs(fXpos11[fCurrentLocalBoard][2*liStripCircuit]) + xDim),
434                                         2*liStripCircuit + 1); 
435       fXwidth11[fCurrentLocalBoard].AddAt(2. * xDim, 2*liStripCircuit + 1);
436     }
437
438     liStripCircuit++;
439   }    
440 }
441
442 //----------------------------------------------------------------------
443 void AliMUONTriggerCircuit::XYGlobal(const AliMpPad& pad,
444                                      Double_t* xyGlobal)
445 {
446 /// returns pad x & y positions and x & y pad dimensions in global coordinates
447 /// note: no need for transformation for pad dimensions
448   
449   // get the pad position and dimensions
450   Double_t xl1 = pad.GetPositionX();
451   Double_t yl1 = pad.GetPositionY();
452   
453   // positions from local to global 
454   fkTransformer->Local2Global(fCurrentDetElem, xl1, yl1, 0, 
455                                  xyGlobal[0], xyGlobal[1], xyGlobal[2]);
456 }
457
458
459 //----------------------------------------------------------------------
460 //--- methods which return member data related info
461 //----------------------------------------------------------------------
462 //----------------------------------------------------------------------
463 Float_t AliMUONTriggerCircuit::GetX11Pos(Int_t localBoardId, Int_t istrip) const 
464 {
465 /// returns X position of Y strip istrip in MC11
466   return fXpos11[localBoardId][istrip];
467 }
468 Float_t AliMUONTriggerCircuit::GetY11Pos(Int_t localBoardId, Int_t istrip) const 
469 {
470 /// returns Y position of X strip istrip in MC11
471   return fYpos11[localBoardId][istrip];
472 }
473 //----------------------------------------------------------------------
474 Float_t AliMUONTriggerCircuit::GetY21Pos(Int_t localBoardId, Int_t istrip) const 
475 {
476 /// returns Y position of X strip istrip in MC21
477   return fYpos21[localBoardId][istrip];
478 }
479 //----------------------------------------------------------------------
480 Float_t AliMUONTriggerCircuit::GetZ11Pos(Int_t localBoardId, Int_t istrip) const 
481 {
482 /// returns Z position of X strip istrip in MC11
483   return fZpos11[localBoardId][istrip];
484 }
485 //----------------------------------------------------------------------
486 Float_t AliMUONTriggerCircuit::GetZ21Pos(Int_t localBoardId, Int_t istrip) const 
487 {
488 /// returns Z position of X strip istrip in MC21
489   return fZpos21[localBoardId][istrip];
490 }
491 Float_t AliMUONTriggerCircuit::GetX11Width(Int_t localBoardId, Int_t istrip) const 
492 {
493 /// returns width of Y strip istrip in MC11
494   return fXwidth11[localBoardId][istrip];
495 }
496 Float_t AliMUONTriggerCircuit::GetY11Width(Int_t localBoardId, Int_t istrip) const 
497 {
498 /// returns width of X strip istrip in MC11
499   return fYwidth11[localBoardId][istrip];
500 }
501 //----------------------------------------------------------------------
502 Float_t AliMUONTriggerCircuit::GetY21Width(Int_t localBoardId, Int_t istrip) const 
503 {
504 /// returns width of X strip istrip in MC21
505   return fYwidth21[localBoardId][istrip];
506 }
507
508 //----------------------------------------------------------------------
509 Int_t AliMUONTriggerCircuit::FirstStrip(AliMpLocalBoard* localBoard)
510 {
511 /// returns the first strip from mapping for board boardName
512 /// take care of special case for boards RC1L6B12 & LC1L6B12
513   Int_t iFirstStrip = -1;
514   Int_t boardNumber = atoi(localBoard->GetName()+6);
515
516   Int_t iline = AliMp::PairFirst(localBoard->GetPosition());
517   Int_t icol  = AliMp::PairSecond(localBoard->GetPosition());
518   if ( iline == 5 ) --icol;
519
520   switch (boardNumber)
521   {
522     case 12:
523       iFirstStrip = 0;
524       break;            
525     case 34:
526       iFirstStrip = 16;
527       break;            
528     case 56:
529       iFirstStrip = 32;
530       break;            
531     case 78:
532       iFirstStrip = 48;
533       break;            
534   }
535   if (icol == 1 && iline == 6) iFirstStrip += 16; // special case
536   return iFirstStrip;
537 }
538
539 //----------------------------------------------------------------------
540 Float_t AliMUONTriggerCircuit::PtCal(Int_t localBoardId, Int_t istripX, Int_t idev, Int_t istripY) const{
541 /// returns calculated pt for circuit/istripX/idev/istripY according 
542 /// to the formula of the TRD. Note : idev (input) is in [0+30]
543
544   Int_t istripX2=istripX+idev+1; // find istripX2 using istripX and idev
545
546   Float_t yPosX1=fYpos11[localBoardId][istripX];
547   Float_t yPosX2=fYpos21[localBoardId][istripX2];
548   Float_t xPosY1=fXpos11[localBoardId][istripY];
549
550 // Z distance between IP and center of dipole
551   Float_t zf= 0.5 *(AliMUONConstants::CoilZ() + AliMUONConstants::YokeZ());
552   Float_t z1=fZpos11[localBoardId][istripX];
553   Float_t z2=fZpos21[localBoardId][istripX2];
554   Float_t thetaDev=(1./TMath::Abs(zf))*(yPosX1*z2-yPosX2*z1)/(z2-z1);
555   Float_t xf=xPosY1*zf/z1; 
556   Float_t yf=yPosX2-((yPosX2-yPosX1)*(z2-zf))/(z2-z1);
557   return (3.*0.3/TMath::Abs(thetaDev)) * TMath::Sqrt(xf*xf+yf*yf)/TMath::Abs(zf);
558 }