]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONTriggerCircuit.cxx
Removing, as not used anymore (Laurent)
[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
18/// \class AliMUONTriggerCircuit
19/// Contains as data members the Y positions of the X declusturized strips and
20/// the X positions of the (doubled or not) Y strips.
21/// This is used to associate the global positions to the fired strips of the
22/// local trigger output (see AliMUONTrackReconstructor::MakeTriggerTrack)
78649106 23///
24/// \author Philippe Crochet (LPCCFd)
8ff54bb6 25
26#include "AliMUONTriggerCircuit.h"
8ff54bb6 27
28#include "AliMpTriggerSegmentation.h"
29#include "AliMpTrigger.h"
30#include "AliMpSlat.h"
31#include "AliMpPCB.h"
32#include "AliMpSegmentation.h"
33#include "AliMpVSegmentation.h"
866c3232 34#include "AliMpCathodType.h"
7103ac2d 35#include "AliMpDDLStore.h"
36#include "AliMpLocalBoard.h"
37#include "AliMpConstants.h"
8ff54bb6 38
39#include "AliRun.h"
40#include "AliLog.h"
41
42#include <TMath.h>
9de45220 43#include <Riostream.h>
8ff54bb6 44
45/// \cond CLASSIMP
46ClassImp(AliMUONTriggerCircuit)
47/// \endcond
48
49//----------------------------------------------------------------------
7103ac2d 50AliMUONTriggerCircuit::AliMUONTriggerCircuit(const AliMUONGeometryTransformer* transformer)
51 : TObject(),
52 fTransformer(transformer),
53 fCurrentSeg(0x0),
54 fCurrentDetElem(0x0),
55 fCurrentLocalBoard(0x0)
8ff54bb6 56{
57/// Constructor
58
7103ac2d 59 for (Int_t i = 1; i < AliMpConstants::NofLocalBoards()+1; ++i) {
60 fXpos11[i].Set(16);
61 fYpos11[i].Set(31);
62 fYpos21[i].Set(63);
63 }
64
65 for (Int_t i = 1; i < AliMpConstants::NofLocalBoards()+1; ++i) { // board begins at 1
66
67 AliMpLocalBoard* localBoard = AliMpDDLStore::Instance()->GetLocalBoard(i);
68
69 if (!localBoard)
70 {
71 AliError(Form("Did not get localboard %d",i));
72 continue;
73 }
74
75 LoadXPos(localBoard);
76 LoadYPos(localBoard);
77
78 }
79
8ff54bb6 80}
81
82//----------------------------------------------------------------------
83AliMUONTriggerCircuit::~AliMUONTriggerCircuit()
84{
85/// Destructor
7103ac2d 86 for (Int_t i = 1; i < AliMpConstants::NofLocalBoards()+1; ++i) {
87 fXpos11[i].Reset();
88 fYpos11[i].Reset();
89 fYpos21[i].Reset();
90 }
91
8ff54bb6 92}
93
94//----------------------------------------------------------------------
95AliMUONTriggerCircuit::AliMUONTriggerCircuit(const AliMUONTriggerCircuit& circuit)
7103ac2d 96 : TObject(circuit),
97 fTransformer(circuit.fTransformer), // do not copy, just pointed to
98 fCurrentSeg(circuit.fCurrentSeg),
99 fCurrentDetElem(circuit.fCurrentDetElem),
100 fCurrentLocalBoard(circuit.fCurrentLocalBoard)
8ff54bb6 101{
102/// Copy constructor
103
7103ac2d 104 for (Int_t i = 1; i < AliMpConstants::NofLocalBoards()+1; ++i) {
105 fXpos11[i] = circuit.fXpos11[i];
106 fYpos11[i] = circuit.fYpos11[i];
107 fYpos21[i] = circuit.fYpos21[i];
108 }
8ff54bb6 109
110}
111//----------------------------------------------------------------------
112AliMUONTriggerCircuit& AliMUONTriggerCircuit::operator=(const AliMUONTriggerCircuit& circuit)
113{
114/// Assignment operator
115
116 if (this == &circuit) return *this;
117
7103ac2d 118 fTransformer = circuit.fTransformer;
119 fCurrentSeg = circuit.fCurrentSeg;
120 fCurrentDetElem = circuit.fCurrentDetElem;
121 fCurrentLocalBoard = circuit.fCurrentLocalBoard;
8ff54bb6 122
7103ac2d 123 for (Int_t i = 1; i < AliMpConstants::NofLocalBoards()+1; ++i) {
8ff54bb6 124 fXpos11[i] = circuit.fXpos11[i];
8ff54bb6 125 fYpos11[i] = circuit.fYpos11[i];
8ff54bb6 126 fYpos21[i] = circuit.fYpos21[i];
7103ac2d 127 }
8ff54bb6 128
129 return *this;
130
8ff54bb6 131}
132
133//---------------------------------------------------------------------
7103ac2d 134void AliMUONTriggerCircuit::LoadYPos(AliMpLocalBoard* localBoard)
8ff54bb6 135{
136/// fill fYpos11 and fYpos21 -> y position of X declusterized strips
137
7103ac2d 138 fCurrentLocalBoard = localBoard->GetId();
8ff54bb6 139 Int_t ichamber = 0;
140 Int_t icathode = 0;
7103ac2d 141
142 Int_t zeroDown = localBoard->GetSwitch(AliMpLocalBoard::kZeroDown);
143 Int_t zeroUp = localBoard->GetSwitch(AliMpLocalBoard::kZeroUp);
144
145 Int_t iline = localBoard->GetPosition().GetFirst();
146 Int_t icol = localBoard->GetPosition().GetSecond();
147 if ( iline == 5 ) --icol;
148
8ff54bb6 149 //--- first plane
150 ichamber = 10;
7103ac2d 151 fCurrentDetElem = AliMpDDLStore::Instance()->GetDEfromLocalBoard(fCurrentLocalBoard, ichamber);
8ff54bb6 152
7103ac2d 153 fCurrentSeg = AliMpSegmentation::Instance()
154 ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));
155
156 Int_t iFirstStrip = FirstStrip(localBoard);
157 Int_t iLastStrip = iFirstStrip + 16;
8ff54bb6 158 Int_t iStripCircuit = 0;
7103ac2d 159
160 FillXstrips(icol, iFirstStrip, iLastStrip,
161 iStripCircuit, fYpos11[fCurrentLocalBoard]);
8ff54bb6 162
163 //--- second plane
164 ichamber = 12;
7103ac2d 165 fCurrentDetElem = AliMpDDLStore::Instance()->GetDEfromLocalBoard(fCurrentLocalBoard, ichamber);
166
167 fCurrentSeg = AliMpSegmentation::Instance()
168 ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));
8ff54bb6 169
170 // second plane middle part
7103ac2d 171 Int_t iFirstStripMiddle = FirstStrip(localBoard);
172 Int_t iLastStripMiddle = iFirstStrip + 16;
173 iStripCircuit = 8;
174
175 FillXstrips(icol, iFirstStripMiddle, iLastStripMiddle,
176 iStripCircuit, fYpos21[fCurrentLocalBoard]);
8ff54bb6 177
178 // second plane upper part
179 if (zeroUp == 0) { // something up
180 Int_t iFirstStripUp;
181 Int_t iLastStripUp;
7103ac2d 182 Int_t icolUp = icol;
183
8ff54bb6 184 // check if we need to move to another detElemId
7103ac2d 185 AliMpPad pad = fCurrentSeg->PadByIndices(AliMpIntPair(icol-1,iLastStripMiddle+1),kFALSE);
186
8ff54bb6 187 if (pad.IsValid()) { // upper strips within same detElemId
188 iFirstStripUp = iLastStripMiddle;
7103ac2d 189 iLastStripUp = iFirstStripUp + 8;
190
8ff54bb6 191 } else { // upper strips in another detElemId
7103ac2d 192 fCurrentDetElem = AliMpDDLStore::Instance()->
193 GetNextDEfromLocalBoard(fCurrentLocalBoard, ichamber);
194
195 fCurrentSeg = AliMpSegmentation::Instance()
196 ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));
8ff54bb6 197
198 iFirstStripUp = 0;
7103ac2d 199 iLastStripUp = iFirstStripUp + 8;
8ff54bb6 200 if (iline == 4) icolUp = icol - 1; // special case
201 if (iline == 5) icolUp = icol + 1; // special case
202 }
203
7103ac2d 204 iStripCircuit = 24;
205 FillXstrips(icolUp, iFirstStripUp, iLastStripUp,
206 iStripCircuit, fYpos21[fCurrentLocalBoard]);
8ff54bb6 207
208 // fill strip between middle and upper part
7103ac2d 209 fYpos21[fCurrentLocalBoard][47] = (fYpos21[fCurrentLocalBoard][46] +
210 fYpos21[fCurrentLocalBoard][48])/2.;
8ff54bb6 211 } // end of something up
212
213 // restore current detElemId & segmentation
7103ac2d 214 fCurrentDetElem = AliMpDDLStore::Instance()->GetDEfromLocalBoard(fCurrentLocalBoard, ichamber);
215 fCurrentSeg = AliMpSegmentation::Instance()
216 ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));
8ff54bb6 217
218 // second plane lower part
219 if (zeroDown == 0) { // something down
220 Int_t iFirstStripDo;
221 Int_t iLastStripDo;
7103ac2d 222 Int_t icolDo = icol;
8ff54bb6 223
224 // check if we need to move to another detElemId
7103ac2d 225 AliMpPad pad = fCurrentSeg->PadByIndices(AliMpIntPair(icol-1,iFirstStripMiddle-1),kFALSE);
8ff54bb6 226 if (pad.IsValid()) { // lower strips within same detElemId
227 iFirstStripDo = iFirstStripMiddle - 8;
7103ac2d 228 iLastStripDo = iFirstStripDo + 8;
229
8ff54bb6 230 } else { // lower strips in another detElemId
7103ac2d 231 fCurrentDetElem = AliMpDDLStore::Instance()
232 ->GetPreviousDEfromLocalBoard(fCurrentLocalBoard, ichamber);
233
234 fCurrentSeg = AliMpSegmentation::Instance()
235 ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));
8ff54bb6 236
237 // get iFirstStrip in this module
7103ac2d 238 const AliMpTriggerSegmentation* trig = (AliMpTriggerSegmentation*)(fCurrentSeg);
8ff54bb6 239 const AliMpTrigger* t = trig->Slat();
240 const AliMpSlat* slat = t->GetLayer(0);
7103ac2d 241
8ff54bb6 242 if (iline == 5) icolDo = icol + 1; // special case
7103ac2d 243 if (iline == 6) icolDo = icol - 1; // special case
244
8ff54bb6 245 const AliMpPCB* pcb = slat->GetPCB(icolDo-1);
246 iFirstStripDo = (pcb->Iymax() + 1) - 8;
247 iLastStripDo = iFirstStripDo + 8;
248 }
249
7103ac2d 250 iStripCircuit = 0;
251 FillXstrips(icolDo, iFirstStripDo, iLastStripDo,
252 iStripCircuit, fYpos21[fCurrentLocalBoard]);
8ff54bb6 253
254 // fill strip between middle and upper part
7103ac2d 255 fYpos21[fCurrentLocalBoard][15] = (fYpos21[fCurrentLocalBoard][14] +
256 fYpos21[fCurrentLocalBoard][16])/2.;
8ff54bb6 257 } // end of something down
258
259}
260
261//----------------------------------------------------------------------
7103ac2d 262void AliMUONTriggerCircuit::FillXstrips(const Int_t icol,
263 const Int_t iFirstStrip, const Int_t iLastStrip,
264 Int_t liStripCircuit, TArrayF& ypos)
265{
266/// fill
267 Double_t xyGlobal[2] = {0.};
268 for (Int_t istrip = iFirstStrip; istrip < iLastStrip; ++istrip) {
269
270 AliMpPad pad = fCurrentSeg->PadByIndices(AliMpIntPair(icol-1,istrip),kTRUE);
271 if ( !pad.IsValid() ) {
272 StdoutToAliError(cout << "Pad not found in seg " << endl;
273 fCurrentSeg->Print();
274 cout << " ix,iy=" << icol-1 << "," << istrip << endl;
275 );
276 }
277 Float_t yDim = pad.Dimensions().Y(); // half size!
278
279 XYGlobal(pad,xyGlobal);
280
281 ypos[2*liStripCircuit] = xyGlobal[1];
282 if (istrip != (iLastStrip - 1)) ypos[2*liStripCircuit+1] = xyGlobal[1] + yDim;
283 liStripCircuit++;
284 }
285}
286
287
288//----------------------------------------------------------------------
289void AliMUONTriggerCircuit::LoadXPos(AliMpLocalBoard* localBoard)
8ff54bb6 290{
291/// fill fXpos11 -> x position of Y strips for the first plane only
292/// fXpos11 contains the x position of Y strip for the current circuit
293/// taking into account whether or nor not part(s) of the circuit
294/// (middle, up or down) has(have) 16 strips (handdled by means of switchs)
7103ac2d 295
296 fCurrentLocalBoard = localBoard->GetId();
297
8ff54bb6 298 Int_t ichamber = 10;
299 Int_t icathode = 1;
300
7103ac2d 301 Int_t x2u = localBoard->GetSwitch(AliMpLocalBoard::kX2u);
302 Int_t x2m = localBoard->GetSwitch(AliMpLocalBoard::kX2m);
303 Int_t x2d = localBoard->GetSwitch(AliMpLocalBoard::kX2d);
304 Int_t zeroAllYLSB = localBoard->GetSwitch(AliMpLocalBoard::kZeroAllYLSB);
305
306 Int_t iStripCircuit = 0;
307 Int_t iFirstStrip = 0;
308 Int_t iLastStrip = 0;
309 Bool_t doubling = kFALSE;
8ff54bb6 310
7103ac2d 311 Int_t iline = localBoard->GetPosition().GetFirst();
312 Int_t icol = localBoard->GetPosition().GetSecond();
313 if ( iline == 5 ) --icol;
8ff54bb6 314
7103ac2d 315 fCurrentDetElem = AliMpDDLStore::Instance()->GetDEfromLocalBoard(fCurrentLocalBoard, ichamber);
316
317 fCurrentSeg = AliMpSegmentation::Instance()
318 ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));
8ff54bb6 319
320 // check if one needs a strip doubling or not
7103ac2d 321 if ( (x2u || x2m || x2d ) && x2m ) doubling = kTRUE;
322
0d528e1f 323
8ff54bb6 324 // check if one starts at strip = 0 or 8 (boards 26-29 and 143-146)
7103ac2d 325 if (zeroAllYLSB) iStripCircuit = 8;
8ff54bb6 326
327 // get iFirstStrip in this module
7103ac2d 328 const AliMpTriggerSegmentation* trig = (AliMpTriggerSegmentation*)(fCurrentSeg);
8ff54bb6 329 const AliMpTrigger* t = trig->Slat();
330 const AliMpSlat* slat = t->GetLayer(0);
331
332 const AliMpPCB* pcb = slat->GetPCB(icol-1);
333 iFirstStrip = pcb->Ixmin();
334
7103ac2d 335
0d528e1f 336 if (doubling || zeroAllYLSB == 1) iLastStrip = iFirstStrip + 8;
8ff54bb6 337 else iLastStrip = iFirstStrip + 16;
338
7103ac2d 339 FillYstrips(iFirstStrip, iLastStrip, iStripCircuit, doubling);
8ff54bb6 340}
341
342//----------------------------------------------------------------------
7103ac2d 343void AliMUONTriggerCircuit::FillYstrips(const Int_t iFirstStrip, const Int_t iLastStrip,
344 Int_t liStripCircuit,
345 const Bool_t doubling)
8ff54bb6 346{
347/// fill
7103ac2d 348 Double_t xyGlobal[2] = {0.};
349
350 for (Int_t istrip = iFirstStrip; istrip < iLastStrip; ++istrip) {
0d528e1f 351
7103ac2d 352 AliMpPad pad = fCurrentSeg->PadByIndices(AliMpIntPair(istrip,0),kTRUE);
0d528e1f 353
8ff54bb6 354 if ( !pad.IsValid() )
355 {
356 StdoutToAliError(cout << "Pad not found in seg " << endl;
7103ac2d 357 fCurrentSeg->Print();
8ff54bb6 358 cout << " ix,iy=" << istrip << "," << 0 << endl;
359 );
360 }
7103ac2d 361 Float_t xDim = pad.Dimensions().X(); // half size!
8ff54bb6 362
7103ac2d 363 XYGlobal(pad,xyGlobal);
8ff54bb6 364
7103ac2d 365 if (!doubling) {
366 fXpos11[fCurrentLocalBoard].AddAt(xyGlobal[0], liStripCircuit);
367 } else if (doubling) {
368
369 fXpos11[fCurrentLocalBoard].AddAt(TMath::Sign(1.,xyGlobal[0]) *
370 (TMath::Abs(xyGlobal[0]) - xDim/2.), 2*liStripCircuit);
371
372 fXpos11[fCurrentLocalBoard].AddAt(TMath::Sign(1.,xyGlobal[0]) *
373 (TMath::Abs(fXpos11[fCurrentLocalBoard][2*liStripCircuit]) + xDim),
374 2*liStripCircuit + 1);
375 }
376
8ff54bb6 377 liStripCircuit++;
378 }
379}
380
381//----------------------------------------------------------------------
7103ac2d 382void AliMUONTriggerCircuit::XYGlobal(const AliMpPad& pad,
383 Double_t* xyGlobal)
8ff54bb6 384{
7103ac2d 385/// returns pad x & y positions and x & y pad dimensions in global coordinates
386/// note: no need for transformation for pad dimensions
8ff54bb6 387
7103ac2d 388 // get the pad position and dimensions
389 Double_t xl1 = pad.Position().X();
390 Double_t yl1 = pad.Position().Y();
391 Double_t zg1 = 0;
392
393 // positions from local to global
394 fTransformer->Local2Global(fCurrentDetElem, xl1, yl1, 0,
395 xyGlobal[0], xyGlobal[1], zg1);
8ff54bb6 396}
7103ac2d 397
8ff54bb6 398
399//----------------------------------------------------------------------
7103ac2d 400//--- methods which return member data related info
401//----------------------------------------------------------------------
402Float_t AliMUONTriggerCircuit::GetY11Pos(Int_t localBoardId, Int_t istrip) const
8ff54bb6 403{
7103ac2d 404/// returns Y position of X strip istrip in MC11
405 return fYpos11[localBoardId][istrip];
8ff54bb6 406}
8ff54bb6 407//----------------------------------------------------------------------
7103ac2d 408Float_t AliMUONTriggerCircuit::GetY21Pos(Int_t localBoardId, Int_t istrip) const
8ff54bb6 409{
7103ac2d 410/// returns Y position of X strip istrip in MC21
411 return fYpos21[localBoardId][istrip];
8ff54bb6 412}
8ff54bb6 413//----------------------------------------------------------------------
7103ac2d 414Float_t AliMUONTriggerCircuit::GetX11Pos(Int_t localBoardId, Int_t istrip) const
8ff54bb6 415{
7103ac2d 416/// returns X position of Y strip istrip in MC11
417 return fXpos11[localBoardId][istrip];
8ff54bb6 418}
419
420//----------------------------------------------------------------------
7103ac2d 421Int_t AliMUONTriggerCircuit::FirstStrip(AliMpLocalBoard* localBoard)
8ff54bb6 422{
423/// returns the first strip from mapping for board boardName
424/// take care of special case for boards RC1L6B12 & LC1L6B12
425 Int_t iFirstStrip = -1;
7103ac2d 426 Int_t boardNumber = atoi(localBoard->GetName()+6);
427
428 Int_t iline = localBoard->GetPosition().GetFirst();
429 Int_t icol = localBoard->GetPosition().GetSecond();
430 if ( iline == 5 ) --icol;
431
8ff54bb6 432 switch (boardNumber)
433 {
434 case 12:
435 iFirstStrip = 0;
436 break;
437 case 34:
438 iFirstStrip = 16;
439 break;
440 case 56:
441 iFirstStrip = 32;
442 break;
443 case 78:
444 iFirstStrip = 48;
445 break;
446 }
7103ac2d 447 if (icol == 1 && iline == 6) iFirstStrip += 16; // special case
8ff54bb6 448 return iFirstStrip;
449}
450