1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
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)
24 /// \author Philippe Crochet (LPCCFd)
26 #include "AliMUONTriggerCircuit.h"
28 #include "AliMpTriggerSegmentation.h"
29 #include "AliMpTrigger.h"
30 #include "AliMpSlat.h"
32 #include "AliMpSegmentation.h"
33 #include "AliMpVSegmentation.h"
34 #include "AliMpCathodType.h"
35 #include "AliMpDDLStore.h"
36 #include "AliMpLocalBoard.h"
37 #include "AliMpConstants.h"
43 #include <Riostream.h>
46 ClassImp(AliMUONTriggerCircuit)
49 //----------------------------------------------------------------------
50 AliMUONTriggerCircuit::AliMUONTriggerCircuit(const AliMUONGeometryTransformer* transformer)
52 fTransformer(transformer),
55 fCurrentLocalBoard(0x0)
59 for (Int_t i = 1; i < AliMpConstants::NofLocalBoards()+1; ++i) {
65 for (Int_t i = 1; i < AliMpConstants::NofLocalBoards()+1; ++i) { // board begins at 1
67 AliMpLocalBoard* localBoard = AliMpDDLStore::Instance()->GetLocalBoard(i);
71 AliError(Form("Did not get localboard %d",i));
82 //----------------------------------------------------------------------
83 AliMUONTriggerCircuit::~AliMUONTriggerCircuit()
86 for (Int_t i = 1; i < AliMpConstants::NofLocalBoards()+1; ++i) {
94 //----------------------------------------------------------------------
95 AliMUONTriggerCircuit::AliMUONTriggerCircuit(const AliMUONTriggerCircuit& circuit)
97 fTransformer(circuit.fTransformer), // do not copy, just pointed to
98 fCurrentSeg(circuit.fCurrentSeg),
99 fCurrentDetElem(circuit.fCurrentDetElem),
100 fCurrentLocalBoard(circuit.fCurrentLocalBoard)
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];
111 //----------------------------------------------------------------------
112 AliMUONTriggerCircuit& AliMUONTriggerCircuit::operator=(const AliMUONTriggerCircuit& circuit)
114 /// Assignment operator
116 if (this == &circuit) return *this;
118 fTransformer = circuit.fTransformer;
119 fCurrentSeg = circuit.fCurrentSeg;
120 fCurrentDetElem = circuit.fCurrentDetElem;
121 fCurrentLocalBoard = circuit.fCurrentLocalBoard;
123 for (Int_t i = 1; i < AliMpConstants::NofLocalBoards()+1; ++i) {
124 fXpos11[i] = circuit.fXpos11[i];
125 fYpos11[i] = circuit.fYpos11[i];
126 fYpos21[i] = circuit.fYpos21[i];
133 //---------------------------------------------------------------------
134 void AliMUONTriggerCircuit::LoadYPos(AliMpLocalBoard* localBoard)
136 /// fill fYpos11 and fYpos21 -> y position of X declusterized strips
138 fCurrentLocalBoard = localBoard->GetId();
142 Int_t zeroDown = localBoard->GetSwitch(AliMpLocalBoard::kZeroDown);
143 Int_t zeroUp = localBoard->GetSwitch(AliMpLocalBoard::kZeroUp);
145 Int_t iline = localBoard->GetPosition().GetFirst();
146 Int_t icol = localBoard->GetPosition().GetSecond();
147 if ( iline == 5 ) --icol;
151 fCurrentDetElem = AliMpDDLStore::Instance()->GetDEfromLocalBoard(fCurrentLocalBoard, ichamber);
153 fCurrentSeg = AliMpSegmentation::Instance()
154 ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));
156 Int_t iFirstStrip = FirstStrip(localBoard);
157 Int_t iLastStrip = iFirstStrip + 16;
158 Int_t iStripCircuit = 0;
160 FillXstrips(icol, iFirstStrip, iLastStrip,
161 iStripCircuit, fYpos11[fCurrentLocalBoard]);
165 fCurrentDetElem = AliMpDDLStore::Instance()->GetDEfromLocalBoard(fCurrentLocalBoard, ichamber);
167 fCurrentSeg = AliMpSegmentation::Instance()
168 ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));
170 // second plane middle part
171 Int_t iFirstStripMiddle = FirstStrip(localBoard);
172 Int_t iLastStripMiddle = iFirstStrip + 16;
175 FillXstrips(icol, iFirstStripMiddle, iLastStripMiddle,
176 iStripCircuit, fYpos21[fCurrentLocalBoard]);
178 // second plane upper part
179 if (zeroUp == 0) { // something up
184 // check if we need to move to another detElemId
185 AliMpPad pad = fCurrentSeg->PadByIndices(AliMpIntPair(icol-1,iLastStripMiddle+1),kFALSE);
187 if (pad.IsValid()) { // upper strips within same detElemId
188 iFirstStripUp = iLastStripMiddle;
189 iLastStripUp = iFirstStripUp + 8;
191 } else { // upper strips in another detElemId
192 fCurrentDetElem = AliMpDDLStore::Instance()->
193 GetNextDEfromLocalBoard(fCurrentLocalBoard, ichamber);
195 fCurrentSeg = AliMpSegmentation::Instance()
196 ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));
199 iLastStripUp = iFirstStripUp + 8;
200 if (iline == 4) icolUp = icol - 1; // special case
201 if (iline == 5) icolUp = icol + 1; // special case
205 FillXstrips(icolUp, iFirstStripUp, iLastStripUp,
206 iStripCircuit, fYpos21[fCurrentLocalBoard]);
208 // fill strip between middle and upper part
209 fYpos21[fCurrentLocalBoard][47] = (fYpos21[fCurrentLocalBoard][46] +
210 fYpos21[fCurrentLocalBoard][48])/2.;
211 } // end of something up
213 // restore current detElemId & segmentation
214 fCurrentDetElem = AliMpDDLStore::Instance()->GetDEfromLocalBoard(fCurrentLocalBoard, ichamber);
215 fCurrentSeg = AliMpSegmentation::Instance()
216 ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));
218 // second plane lower part
219 if (zeroDown == 0) { // something down
224 // check if we need to move to another detElemId
225 AliMpPad pad = fCurrentSeg->PadByIndices(AliMpIntPair(icol-1,iFirstStripMiddle-1),kFALSE);
226 if (pad.IsValid()) { // lower strips within same detElemId
227 iFirstStripDo = iFirstStripMiddle - 8;
228 iLastStripDo = iFirstStripDo + 8;
230 } else { // lower strips in another detElemId
231 fCurrentDetElem = AliMpDDLStore::Instance()
232 ->GetPreviousDEfromLocalBoard(fCurrentLocalBoard, ichamber);
234 fCurrentSeg = AliMpSegmentation::Instance()
235 ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));
237 // get iFirstStrip in this module
238 const AliMpTriggerSegmentation* trig = (AliMpTriggerSegmentation*)(fCurrentSeg);
239 const AliMpTrigger* t = trig->Slat();
240 const AliMpSlat* slat = t->GetLayer(0);
242 if (iline == 5) icolDo = icol + 1; // special case
243 if (iline == 6) icolDo = icol - 1; // special case
245 const AliMpPCB* pcb = slat->GetPCB(icolDo-1);
246 iFirstStripDo = (pcb->Iymax() + 1) - 8;
247 iLastStripDo = iFirstStripDo + 8;
251 FillXstrips(icolDo, iFirstStripDo, iLastStripDo,
252 iStripCircuit, fYpos21[fCurrentLocalBoard]);
254 // fill strip between middle and upper part
255 fYpos21[fCurrentLocalBoard][15] = (fYpos21[fCurrentLocalBoard][14] +
256 fYpos21[fCurrentLocalBoard][16])/2.;
257 } // end of something down
261 //----------------------------------------------------------------------
262 void AliMUONTriggerCircuit::FillXstrips(const Int_t icol,
263 const Int_t iFirstStrip, const Int_t iLastStrip,
264 Int_t liStripCircuit, TArrayF& ypos)
267 Double_t xyGlobal[2] = {0.};
268 for (Int_t istrip = iFirstStrip; istrip < iLastStrip; ++istrip) {
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;
277 Float_t yDim = pad.Dimensions().Y(); // half size!
279 XYGlobal(pad,xyGlobal);
281 ypos[2*liStripCircuit] = xyGlobal[1];
282 if (istrip != (iLastStrip - 1)) ypos[2*liStripCircuit+1] = xyGlobal[1] + yDim;
288 //----------------------------------------------------------------------
289 void AliMUONTriggerCircuit::LoadXPos(AliMpLocalBoard* localBoard)
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)
296 fCurrentLocalBoard = localBoard->GetId();
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);
306 Int_t iStripCircuit = 0;
307 Int_t iFirstStrip = 0;
308 Int_t iLastStrip = 0;
309 Bool_t doubling = kFALSE;
311 Int_t iline = localBoard->GetPosition().GetFirst();
312 Int_t icol = localBoard->GetPosition().GetSecond();
313 if ( iline == 5 ) --icol;
315 fCurrentDetElem = AliMpDDLStore::Instance()->GetDEfromLocalBoard(fCurrentLocalBoard, ichamber);
317 fCurrentSeg = AliMpSegmentation::Instance()
318 ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));
320 // check if one needs a strip doubling or not
321 if ( (x2u || x2m || x2d ) && x2m ) doubling = kTRUE;
324 // check if one starts at strip = 0 or 8 (boards 26-29 and 143-146)
325 if (zeroAllYLSB) iStripCircuit = 8;
327 // get iFirstStrip in this module
328 const AliMpTriggerSegmentation* trig = (AliMpTriggerSegmentation*)(fCurrentSeg);
329 const AliMpTrigger* t = trig->Slat();
330 const AliMpSlat* slat = t->GetLayer(0);
332 const AliMpPCB* pcb = slat->GetPCB(icol-1);
333 iFirstStrip = pcb->Ixmin();
336 if (doubling || zeroAllYLSB == 1) iLastStrip = iFirstStrip + 8;
337 else iLastStrip = iFirstStrip + 16;
339 FillYstrips(iFirstStrip, iLastStrip, iStripCircuit, doubling);
342 //----------------------------------------------------------------------
343 void AliMUONTriggerCircuit::FillYstrips(const Int_t iFirstStrip, const Int_t iLastStrip,
344 Int_t liStripCircuit,
345 const Bool_t doubling)
348 Double_t xyGlobal[2] = {0.};
350 for (Int_t istrip = iFirstStrip; istrip < iLastStrip; ++istrip) {
352 AliMpPad pad = fCurrentSeg->PadByIndices(AliMpIntPair(istrip,0),kTRUE);
354 if ( !pad.IsValid() )
356 StdoutToAliError(cout << "Pad not found in seg " << endl;
357 fCurrentSeg->Print();
358 cout << " ix,iy=" << istrip << "," << 0 << endl;
361 Float_t xDim = pad.Dimensions().X(); // half size!
363 XYGlobal(pad,xyGlobal);
366 fXpos11[fCurrentLocalBoard].AddAt(xyGlobal[0], liStripCircuit);
367 } else if (doubling) {
369 fXpos11[fCurrentLocalBoard].AddAt(TMath::Sign(1.,xyGlobal[0]) *
370 (TMath::Abs(xyGlobal[0]) - xDim/2.), 2*liStripCircuit);
372 fXpos11[fCurrentLocalBoard].AddAt(TMath::Sign(1.,xyGlobal[0]) *
373 (TMath::Abs(fXpos11[fCurrentLocalBoard][2*liStripCircuit]) + xDim),
374 2*liStripCircuit + 1);
381 //----------------------------------------------------------------------
382 void AliMUONTriggerCircuit::XYGlobal(const AliMpPad& pad,
385 /// returns pad x & y positions and x & y pad dimensions in global coordinates
386 /// note: no need for transformation for pad dimensions
388 // get the pad position and dimensions
389 Double_t xl1 = pad.Position().X();
390 Double_t yl1 = pad.Position().Y();
393 // positions from local to global
394 fTransformer->Local2Global(fCurrentDetElem, xl1, yl1, 0,
395 xyGlobal[0], xyGlobal[1], zg1);
399 //----------------------------------------------------------------------
400 //--- methods which return member data related info
401 //----------------------------------------------------------------------
402 Float_t AliMUONTriggerCircuit::GetY11Pos(Int_t localBoardId, Int_t istrip) const
404 /// returns Y position of X strip istrip in MC11
405 return fYpos11[localBoardId][istrip];
407 //----------------------------------------------------------------------
408 Float_t AliMUONTriggerCircuit::GetY21Pos(Int_t localBoardId, Int_t istrip) const
410 /// returns Y position of X strip istrip in MC21
411 return fYpos21[localBoardId][istrip];
413 //----------------------------------------------------------------------
414 Float_t AliMUONTriggerCircuit::GetX11Pos(Int_t localBoardId, Int_t istrip) const
416 /// returns X position of Y strip istrip in MC11
417 return fXpos11[localBoardId][istrip];
420 //----------------------------------------------------------------------
421 Int_t AliMUONTriggerCircuit::FirstStrip(AliMpLocalBoard* localBoard)
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;
426 Int_t boardNumber = atoi(localBoard->GetName()+6);
428 Int_t iline = localBoard->GetPosition().GetFirst();
429 Int_t icol = localBoard->GetPosition().GetSecond();
430 if ( iline == 5 ) --icol;
447 if (icol == 1 && iline == 6) iFirstStrip += 16; // special case