Fix coverity defect
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerCircuit.cxx
CommitLineData
8ff54bb6 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
3d1463c8 18//-----------------------------------------------------------------------------
8ff54bb6 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)
78649106 24///
25/// \author Philippe Crochet (LPCCFd)
3d1463c8 26//-----------------------------------------------------------------------------
8ff54bb6 27
28#include "AliMUONTriggerCircuit.h"
afeb2b33 29#include "AliMUONConstants.h"
da142235 30#include "AliMUONGeometryTransformer.h"
8ff54bb6 31
8ff54bb6 32#include "AliMpTrigger.h"
33#include "AliMpSlat.h"
34#include "AliMpPCB.h"
35#include "AliMpSegmentation.h"
36#include "AliMpVSegmentation.h"
866c3232 37#include "AliMpCathodType.h"
7103ac2d 38#include "AliMpDDLStore.h"
39#include "AliMpLocalBoard.h"
40#include "AliMpConstants.h"
da142235 41#include "AliMpPad.h"
168e9c4d 42#include "AliMpEncodePair.h"
8ff54bb6 43
44#include "AliRun.h"
45#include "AliLog.h"
46
47#include <TMath.h>
9de45220 48#include <Riostream.h>
8ff54bb6 49
50/// \cond CLASSIMP
51ClassImp(AliMUONTriggerCircuit)
52/// \endcond
53
54//----------------------------------------------------------------------
7103ac2d 55AliMUONTriggerCircuit::AliMUONTriggerCircuit(const AliMUONGeometryTransformer* transformer)
56 : TObject(),
da142235 57 fkTransformer(transformer),
58 fkCurrentSeg(0x0),
7103ac2d 59 fCurrentDetElem(0x0),
60 fCurrentLocalBoard(0x0)
8ff54bb6 61{
62/// Constructor
63
7103ac2d 64 for (Int_t i = 1; i < AliMpConstants::NofLocalBoards()+1; ++i) {
65 fXpos11[i].Set(16);
1227d79c 66 fYpos11[i].Set(32);
67 fYpos21[i].Set(64);
68 fZpos11[i].Set(32);
69 fZpos21[i].Set(64);
bdfb6eef 70 fXwidth11[i].Set(16);
1227d79c 71 fYwidth11[i].Set(32);
72 fYwidth21[i].Set(64);
7103ac2d 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);
1227d79c 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 */
7103ac2d 105 }
106
8ff54bb6 107}
108
109//----------------------------------------------------------------------
110AliMUONTriggerCircuit::~AliMUONTriggerCircuit()
111{
112/// Destructor
7103ac2d 113 for (Int_t i = 1; i < AliMpConstants::NofLocalBoards()+1; ++i) {
114 fXpos11[i].Reset();
115 fYpos11[i].Reset();
116 fYpos21[i].Reset();
bdfb6eef 117 fZpos11[i].Reset();
118 fZpos21[i].Reset();
119 fXwidth11[i].Reset();
120 fYwidth11[i].Reset();
121 fYwidth21[i].Reset();
7103ac2d 122 }
123
8ff54bb6 124}
125
126//----------------------------------------------------------------------
127AliMUONTriggerCircuit::AliMUONTriggerCircuit(const AliMUONTriggerCircuit& circuit)
7103ac2d 128 : TObject(circuit),
da142235 129 fkTransformer(circuit.fkTransformer), // do not copy, just pointed to
130 fkCurrentSeg(circuit.fkCurrentSeg),
7103ac2d 131 fCurrentDetElem(circuit.fCurrentDetElem),
132 fCurrentLocalBoard(circuit.fCurrentLocalBoard)
8ff54bb6 133{
134/// Copy constructor
135
7103ac2d 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];
bdfb6eef 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];
7103ac2d 145 }
8ff54bb6 146
147}
148//----------------------------------------------------------------------
149AliMUONTriggerCircuit& AliMUONTriggerCircuit::operator=(const AliMUONTriggerCircuit& circuit)
150{
151/// Assignment operator
152
153 if (this == &circuit) return *this;
154
da142235 155 fkTransformer = circuit.fkTransformer;
156 fkCurrentSeg = circuit.fkCurrentSeg;
7103ac2d 157 fCurrentDetElem = circuit.fCurrentDetElem;
158 fCurrentLocalBoard = circuit.fCurrentLocalBoard;
8ff54bb6 159
7103ac2d 160 for (Int_t i = 1; i < AliMpConstants::NofLocalBoards()+1; ++i) {
8ff54bb6 161 fXpos11[i] = circuit.fXpos11[i];
8ff54bb6 162 fYpos11[i] = circuit.fYpos11[i];
8ff54bb6 163 fYpos21[i] = circuit.fYpos21[i];
bdfb6eef 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];
7103ac2d 169 }
8ff54bb6 170
171 return *this;
172
173}
8ff54bb6 174
175//---------------------------------------------------------------------
da142235 176void AliMUONTriggerCircuit::LoadYPos(AliMpLocalBoard* const localBoard)
8ff54bb6 177{
178/// fill fYpos11 and fYpos21 -> y position of X declusterized strips
179
7103ac2d 180 fCurrentLocalBoard = localBoard->GetId();
8ff54bb6 181 Int_t ichamber = 0;
182 Int_t icathode = 0;
7103ac2d 183
184 Int_t zeroDown = localBoard->GetSwitch(AliMpLocalBoard::kZeroDown);
185 Int_t zeroUp = localBoard->GetSwitch(AliMpLocalBoard::kZeroUp);
186
168e9c4d 187 Int_t iline = AliMp::PairFirst(localBoard->GetPosition());
188 Int_t icol = AliMp::PairSecond(localBoard->GetPosition());
7103ac2d 189 if ( iline == 5 ) --icol;
190
8ff54bb6 191 //--- first plane
192 ichamber = 10;
7103ac2d 193 fCurrentDetElem = AliMpDDLStore::Instance()->GetDEfromLocalBoard(fCurrentLocalBoard, ichamber);
8ff54bb6 194
da142235 195 fkCurrentSeg = AliMpSegmentation::Instance()
7103ac2d 196 ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));
197
198 Int_t iFirstStrip = FirstStrip(localBoard);
199 Int_t iLastStrip = iFirstStrip + 16;
8ff54bb6 200 Int_t iStripCircuit = 0;
7103ac2d 201
202 FillXstrips(icol, iFirstStrip, iLastStrip,
bdfb6eef 203 iStripCircuit, kTRUE);
8ff54bb6 204
205 //--- second plane
206 ichamber = 12;
7103ac2d 207 fCurrentDetElem = AliMpDDLStore::Instance()->GetDEfromLocalBoard(fCurrentLocalBoard, ichamber);
208
da142235 209 fkCurrentSeg = AliMpSegmentation::Instance()
7103ac2d 210 ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));
8ff54bb6 211
212 // second plane middle part
7103ac2d 213 Int_t iFirstStripMiddle = FirstStrip(localBoard);
214 Int_t iLastStripMiddle = iFirstStrip + 16;
215 iStripCircuit = 8;
216
217 FillXstrips(icol, iFirstStripMiddle, iLastStripMiddle,
bdfb6eef 218 iStripCircuit, kFALSE);
8ff54bb6 219
220 // second plane upper part
221 if (zeroUp == 0) { // something up
222 Int_t iFirstStripUp;
223 Int_t iLastStripUp;
7103ac2d 224 Int_t icolUp = icol;
225
8ff54bb6 226 // check if we need to move to another detElemId
168e9c4d 227 AliMpPad pad = fkCurrentSeg->PadByIndices(icol-1,iLastStripMiddle+1,kFALSE);
7103ac2d 228
8ff54bb6 229 if (pad.IsValid()) { // upper strips within same detElemId
230 iFirstStripUp = iLastStripMiddle;
7103ac2d 231 iLastStripUp = iFirstStripUp + 8;
232
8ff54bb6 233 } else { // upper strips in another detElemId
7103ac2d 234 fCurrentDetElem = AliMpDDLStore::Instance()->
235 GetNextDEfromLocalBoard(fCurrentLocalBoard, ichamber);
236
da142235 237 fkCurrentSeg = AliMpSegmentation::Instance()
7103ac2d 238 ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));
8ff54bb6 239
240 iFirstStripUp = 0;
7103ac2d 241 iLastStripUp = iFirstStripUp + 8;
8ff54bb6 242 if (iline == 4) icolUp = icol - 1; // special case
243 if (iline == 5) icolUp = icol + 1; // special case
244 }
245
7103ac2d 246 iStripCircuit = 24;
247 FillXstrips(icolUp, iFirstStripUp, iLastStripUp,
bdfb6eef 248 iStripCircuit, kFALSE);
8ff54bb6 249
250 // fill strip between middle and upper part
7103ac2d 251 fYpos21[fCurrentLocalBoard][47] = (fYpos21[fCurrentLocalBoard][46] +
252 fYpos21[fCurrentLocalBoard][48])/2.;
bdfb6eef 253 fZpos21[fCurrentLocalBoard][47] = (fZpos21[fCurrentLocalBoard][46] +
254 fZpos21[fCurrentLocalBoard][48])/2.;
255 fYwidth21[fCurrentLocalBoard][47] = (fYwidth21[fCurrentLocalBoard][46] +
256 fYwidth21[fCurrentLocalBoard][48])/2.;
8ff54bb6 257 } // end of something up
258
259 // restore current detElemId & segmentation
7103ac2d 260 fCurrentDetElem = AliMpDDLStore::Instance()->GetDEfromLocalBoard(fCurrentLocalBoard, ichamber);
da142235 261 fkCurrentSeg = AliMpSegmentation::Instance()
7103ac2d 262 ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));
8ff54bb6 263
264 // second plane lower part
265 if (zeroDown == 0) { // something down
266 Int_t iFirstStripDo;
267 Int_t iLastStripDo;
7103ac2d 268 Int_t icolDo = icol;
8ff54bb6 269
270 // check if we need to move to another detElemId
168e9c4d 271 AliMpPad pad = fkCurrentSeg->PadByIndices(icol-1,iFirstStripMiddle-1,kFALSE);
8ff54bb6 272 if (pad.IsValid()) { // lower strips within same detElemId
273 iFirstStripDo = iFirstStripMiddle - 8;
7103ac2d 274 iLastStripDo = iFirstStripDo + 8;
275
8ff54bb6 276 } else { // lower strips in another detElemId
7103ac2d 277 fCurrentDetElem = AliMpDDLStore::Instance()
278 ->GetPreviousDEfromLocalBoard(fCurrentLocalBoard, ichamber);
279
da142235 280 fkCurrentSeg = AliMpSegmentation::Instance()
7103ac2d 281 ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));
8ff54bb6 282
283 // get iFirstStrip in this module
da142235 284 const AliMpTrigger* t = AliMpSegmentation::Instance()->GetTrigger(fkCurrentSeg);
8ff54bb6 285 const AliMpSlat* slat = t->GetLayer(0);
7103ac2d 286
8ff54bb6 287 if (iline == 5) icolDo = icol + 1; // special case
7103ac2d 288 if (iline == 6) icolDo = icol - 1; // special case
289
8ff54bb6 290 const AliMpPCB* pcb = slat->GetPCB(icolDo-1);
291 iFirstStripDo = (pcb->Iymax() + 1) - 8;
292 iLastStripDo = iFirstStripDo + 8;
293 }
294
7103ac2d 295 iStripCircuit = 0;
296 FillXstrips(icolDo, iFirstStripDo, iLastStripDo,
bdfb6eef 297 iStripCircuit, kFALSE);
8ff54bb6 298
299 // fill strip between middle and upper part
7103ac2d 300 fYpos21[fCurrentLocalBoard][15] = (fYpos21[fCurrentLocalBoard][14] +
301 fYpos21[fCurrentLocalBoard][16])/2.;
bdfb6eef 302 fZpos21[fCurrentLocalBoard][15] = (fZpos21[fCurrentLocalBoard][14] +
303 fZpos21[fCurrentLocalBoard][16])/2.;
304 fYwidth21[fCurrentLocalBoard][15] = (fYwidth21[fCurrentLocalBoard][14] +
305 fYwidth21[fCurrentLocalBoard][16])/2.;
8ff54bb6 306 } // end of something down
307
308}
309
310//----------------------------------------------------------------------
7103ac2d 311void AliMUONTriggerCircuit::FillXstrips(const Int_t icol,
312 const Int_t iFirstStrip, const Int_t iLastStrip,
bdfb6eef 313 Int_t liStripCircuit, const Bool_t is11)
7103ac2d 314{
315/// fill
bdfb6eef 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.};
7103ac2d 321 for (Int_t istrip = iFirstStrip; istrip < iLastStrip; ++istrip) {
322
168e9c4d 323 AliMpPad pad = fkCurrentSeg->PadByIndices(icol-1,istrip,kTRUE);
7103ac2d 324 if ( !pad.IsValid() ) {
325 StdoutToAliError(cout << "Pad not found in seg " << endl;
da142235 326 fkCurrentSeg->Print();
7103ac2d 327 cout << " ix,iy=" << icol-1 << "," << istrip << endl;
328 );
329 }
6e97fbb8 330 Float_t yDim = pad.GetDimensionY(); // half size!
7103ac2d 331
332 XYGlobal(pad,xyGlobal);
333
334 ypos[2*liStripCircuit] = xyGlobal[1];
bdfb6eef 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 }
7103ac2d 342 liStripCircuit++;
343 }
344}
345
346
347//----------------------------------------------------------------------
da142235 348void AliMUONTriggerCircuit::LoadXPos(AliMpLocalBoard* const localBoard)
8ff54bb6 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)
7103ac2d 354
355 fCurrentLocalBoard = localBoard->GetId();
356
8ff54bb6 357 Int_t ichamber = 10;
358 Int_t icathode = 1;
359
7103ac2d 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;
8ff54bb6 369
168e9c4d 370 Int_t iline = AliMp::PairFirst(localBoard->GetPosition());
371 Int_t icol = AliMp::PairSecond(localBoard->GetPosition());
7103ac2d 372 if ( iline == 5 ) --icol;
8ff54bb6 373
7103ac2d 374 fCurrentDetElem = AliMpDDLStore::Instance()->GetDEfromLocalBoard(fCurrentLocalBoard, ichamber);
375
da142235 376 fkCurrentSeg = AliMpSegmentation::Instance()
7103ac2d 377 ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));
8ff54bb6 378
379 // check if one needs a strip doubling or not
7103ac2d 380 if ( (x2u || x2m || x2d ) && x2m ) doubling = kTRUE;
381
0d528e1f 382
8ff54bb6 383 // check if one starts at strip = 0 or 8 (boards 26-29 and 143-146)
7103ac2d 384 if (zeroAllYLSB) iStripCircuit = 8;
8ff54bb6 385
386 // get iFirstStrip in this module
da142235 387 const AliMpTrigger* t = AliMpSegmentation::Instance()->GetTrigger(fkCurrentSeg);
8ff54bb6 388 const AliMpSlat* slat = t->GetLayer(0);
389
390 const AliMpPCB* pcb = slat->GetPCB(icol-1);
391 iFirstStrip = pcb->Ixmin();
392
7103ac2d 393
0d528e1f 394 if (doubling || zeroAllYLSB == 1) iLastStrip = iFirstStrip + 8;
8ff54bb6 395 else iLastStrip = iFirstStrip + 16;
396
7103ac2d 397 FillYstrips(iFirstStrip, iLastStrip, iStripCircuit, doubling);
8ff54bb6 398}
399
400//----------------------------------------------------------------------
7103ac2d 401void AliMUONTriggerCircuit::FillYstrips(const Int_t iFirstStrip, const Int_t iLastStrip,
402 Int_t liStripCircuit,
403 const Bool_t doubling)
8ff54bb6 404{
405/// fill
bdfb6eef 406 Double_t xyGlobal[3] = {0.};
7103ac2d 407
408 for (Int_t istrip = iFirstStrip; istrip < iLastStrip; ++istrip) {
0d528e1f 409
168e9c4d 410 AliMpPad pad = fkCurrentSeg->PadByIndices(istrip,0,kTRUE);
0d528e1f 411
8ff54bb6 412 if ( !pad.IsValid() )
413 {
414 StdoutToAliError(cout << "Pad not found in seg " << endl;
da142235 415 fkCurrentSeg->Print();
8ff54bb6 416 cout << " ix,iy=" << istrip << "," << 0 << endl;
417 );
418 }
6e97fbb8 419 Float_t xDim = pad.GetDimensionX(); // half size!
8ff54bb6 420
7103ac2d 421 XYGlobal(pad,xyGlobal);
8ff54bb6 422
7103ac2d 423 if (!doubling) {
424 fXpos11[fCurrentLocalBoard].AddAt(xyGlobal[0], liStripCircuit);
bdfb6eef 425 fXwidth11[fCurrentLocalBoard].AddAt(2. * xDim, liStripCircuit);
7103ac2d 426 } else if (doubling) {
427
428 fXpos11[fCurrentLocalBoard].AddAt(TMath::Sign(1.,xyGlobal[0]) *
429 (TMath::Abs(xyGlobal[0]) - xDim/2.), 2*liStripCircuit);
bdfb6eef 430 fXwidth11[fCurrentLocalBoard].AddAt(2. * xDim, 2*liStripCircuit);
7103ac2d 431
432 fXpos11[fCurrentLocalBoard].AddAt(TMath::Sign(1.,xyGlobal[0]) *
433 (TMath::Abs(fXpos11[fCurrentLocalBoard][2*liStripCircuit]) + xDim),
434 2*liStripCircuit + 1);
bdfb6eef 435 fXwidth11[fCurrentLocalBoard].AddAt(2. * xDim, 2*liStripCircuit + 1);
7103ac2d 436 }
437
8ff54bb6 438 liStripCircuit++;
439 }
440}
441
442//----------------------------------------------------------------------
7103ac2d 443void AliMUONTriggerCircuit::XYGlobal(const AliMpPad& pad,
444 Double_t* xyGlobal)
8ff54bb6 445{
7103ac2d 446/// returns pad x & y positions and x & y pad dimensions in global coordinates
447/// note: no need for transformation for pad dimensions
8ff54bb6 448
7103ac2d 449 // get the pad position and dimensions
6e97fbb8 450 Double_t xl1 = pad.GetPositionX();
451 Double_t yl1 = pad.GetPositionY();
7103ac2d 452
453 // positions from local to global
da142235 454 fkTransformer->Local2Global(fCurrentDetElem, xl1, yl1, 0,
bdfb6eef 455 xyGlobal[0], xyGlobal[1], xyGlobal[2]);
8ff54bb6 456}
7103ac2d 457
8ff54bb6 458
459//----------------------------------------------------------------------
7103ac2d 460//--- methods which return member data related info
461//----------------------------------------------------------------------
bdfb6eef 462//----------------------------------------------------------------------
463Float_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}
7103ac2d 468Float_t AliMUONTriggerCircuit::GetY11Pos(Int_t localBoardId, Int_t istrip) const
8ff54bb6 469{
7103ac2d 470/// returns Y position of X strip istrip in MC11
471 return fYpos11[localBoardId][istrip];
8ff54bb6 472}
8ff54bb6 473//----------------------------------------------------------------------
7103ac2d 474Float_t AliMUONTriggerCircuit::GetY21Pos(Int_t localBoardId, Int_t istrip) const
8ff54bb6 475{
7103ac2d 476/// returns Y position of X strip istrip in MC21
477 return fYpos21[localBoardId][istrip];
8ff54bb6 478}
8ff54bb6 479//----------------------------------------------------------------------
bdfb6eef 480Float_t AliMUONTriggerCircuit::GetZ11Pos(Int_t localBoardId, Int_t istrip) const
8ff54bb6 481{
bdfb6eef 482/// returns Z position of X strip istrip in MC11
483 return fZpos11[localBoardId][istrip];
484}
485//----------------------------------------------------------------------
486Float_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}
491Float_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}
496Float_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//----------------------------------------------------------------------
502Float_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];
8ff54bb6 506}
507
508//----------------------------------------------------------------------
7103ac2d 509Int_t AliMUONTriggerCircuit::FirstStrip(AliMpLocalBoard* localBoard)
8ff54bb6 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;
7103ac2d 514 Int_t boardNumber = atoi(localBoard->GetName()+6);
515
168e9c4d 516 Int_t iline = AliMp::PairFirst(localBoard->GetPosition());
517 Int_t icol = AliMp::PairSecond(localBoard->GetPosition());
7103ac2d 518 if ( iline == 5 ) --icol;
519
8ff54bb6 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 }
7103ac2d 535 if (icol == 1 && iline == 6) iFirstStrip += 16; // special case
8ff54bb6 536 return iFirstStrip;
537}
538
afeb2b33 539//----------------------------------------------------------------------
540Float_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
afeb2b33 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
1227d79c 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);
afeb2b33 555 Float_t xf=xPosY1*zf/z1;
556 Float_t yf=yPosX2-((yPosX2-yPosX1)*(z2-zf))/(z2-z1);
1227d79c 557 return (3.*0.3/TMath::Abs(thetaDev)) * TMath::Sqrt(xf*xf+yf*yf)/TMath::Abs(zf);
afeb2b33 558}