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 //-----------------------------------------------------------------------------
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)
25 /// \author Philippe Crochet (LPCCFd)
26 //-----------------------------------------------------------------------------
28 #include "AliMUONTriggerCircuit.h"
30 #include "AliMpTriggerSegmentation.h"
31 #include "AliMpTrigger.h"
32 #include "AliMpSlat.h"
34 #include "AliMpSegmentation.h"
35 #include "AliMpVSegmentation.h"
36 #include "AliMpCathodType.h"
37 #include "AliMpDDLStore.h"
38 #include "AliMpLocalBoard.h"
39 #include "AliMpConstants.h"
45 #include <Riostream.h>
48 ClassImp(AliMUONTriggerCircuit)
51 //----------------------------------------------------------------------
52 AliMUONTriggerCircuit::AliMUONTriggerCircuit(const AliMUONGeometryTransformer* transformer)
54 fTransformer(transformer),
57 fCurrentLocalBoard(0x0)
61 for (Int_t i = 1; i < AliMpConstants::NofLocalBoards()+1; ++i) {
67 for (Int_t i = 1; i < AliMpConstants::NofLocalBoards()+1; ++i) { // board begins at 1
69 AliMpLocalBoard* localBoard = AliMpDDLStore::Instance()->GetLocalBoard(i);
73 AliError(Form("Did not get localboard %d",i));
84 //----------------------------------------------------------------------
85 AliMUONTriggerCircuit::~AliMUONTriggerCircuit()
88 for (Int_t i = 1; i < AliMpConstants::NofLocalBoards()+1; ++i) {
96 //----------------------------------------------------------------------
97 AliMUONTriggerCircuit::AliMUONTriggerCircuit(const AliMUONTriggerCircuit& circuit)
99 fTransformer(circuit.fTransformer), // do not copy, just pointed to
100 fCurrentSeg(circuit.fCurrentSeg),
101 fCurrentDetElem(circuit.fCurrentDetElem),
102 fCurrentLocalBoard(circuit.fCurrentLocalBoard)
106 for (Int_t i = 1; i < AliMpConstants::NofLocalBoards()+1; ++i) {
107 fXpos11[i] = circuit.fXpos11[i];
108 fYpos11[i] = circuit.fYpos11[i];
109 fYpos21[i] = circuit.fYpos21[i];
113 //----------------------------------------------------------------------
114 AliMUONTriggerCircuit& AliMUONTriggerCircuit::operator=(const AliMUONTriggerCircuit& circuit)
116 /// Assignment operator
118 if (this == &circuit) return *this;
120 fTransformer = circuit.fTransformer;
121 fCurrentSeg = circuit.fCurrentSeg;
122 fCurrentDetElem = circuit.fCurrentDetElem;
123 fCurrentLocalBoard = circuit.fCurrentLocalBoard;
125 for (Int_t i = 1; i < AliMpConstants::NofLocalBoards()+1; ++i) {
126 fXpos11[i] = circuit.fXpos11[i];
127 fYpos11[i] = circuit.fYpos11[i];
128 fYpos21[i] = circuit.fYpos21[i];
135 //---------------------------------------------------------------------
136 void AliMUONTriggerCircuit::LoadYPos(AliMpLocalBoard* localBoard)
138 /// fill fYpos11 and fYpos21 -> y position of X declusterized strips
140 fCurrentLocalBoard = localBoard->GetId();
144 Int_t zeroDown = localBoard->GetSwitch(AliMpLocalBoard::kZeroDown);
145 Int_t zeroUp = localBoard->GetSwitch(AliMpLocalBoard::kZeroUp);
147 Int_t iline = localBoard->GetPosition().GetFirst();
148 Int_t icol = localBoard->GetPosition().GetSecond();
149 if ( iline == 5 ) --icol;
153 fCurrentDetElem = AliMpDDLStore::Instance()->GetDEfromLocalBoard(fCurrentLocalBoard, ichamber);
155 fCurrentSeg = AliMpSegmentation::Instance()
156 ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));
158 Int_t iFirstStrip = FirstStrip(localBoard);
159 Int_t iLastStrip = iFirstStrip + 16;
160 Int_t iStripCircuit = 0;
162 FillXstrips(icol, iFirstStrip, iLastStrip,
163 iStripCircuit, fYpos11[fCurrentLocalBoard]);
167 fCurrentDetElem = AliMpDDLStore::Instance()->GetDEfromLocalBoard(fCurrentLocalBoard, ichamber);
169 fCurrentSeg = AliMpSegmentation::Instance()
170 ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));
172 // second plane middle part
173 Int_t iFirstStripMiddle = FirstStrip(localBoard);
174 Int_t iLastStripMiddle = iFirstStrip + 16;
177 FillXstrips(icol, iFirstStripMiddle, iLastStripMiddle,
178 iStripCircuit, fYpos21[fCurrentLocalBoard]);
180 // second plane upper part
181 if (zeroUp == 0) { // something up
186 // check if we need to move to another detElemId
187 AliMpPad pad = fCurrentSeg->PadByIndices(AliMpIntPair(icol-1,iLastStripMiddle+1),kFALSE);
189 if (pad.IsValid()) { // upper strips within same detElemId
190 iFirstStripUp = iLastStripMiddle;
191 iLastStripUp = iFirstStripUp + 8;
193 } else { // upper strips in another detElemId
194 fCurrentDetElem = AliMpDDLStore::Instance()->
195 GetNextDEfromLocalBoard(fCurrentLocalBoard, ichamber);
197 fCurrentSeg = AliMpSegmentation::Instance()
198 ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));
201 iLastStripUp = iFirstStripUp + 8;
202 if (iline == 4) icolUp = icol - 1; // special case
203 if (iline == 5) icolUp = icol + 1; // special case
207 FillXstrips(icolUp, iFirstStripUp, iLastStripUp,
208 iStripCircuit, fYpos21[fCurrentLocalBoard]);
210 // fill strip between middle and upper part
211 fYpos21[fCurrentLocalBoard][47] = (fYpos21[fCurrentLocalBoard][46] +
212 fYpos21[fCurrentLocalBoard][48])/2.;
213 } // end of something up
215 // restore current detElemId & segmentation
216 fCurrentDetElem = AliMpDDLStore::Instance()->GetDEfromLocalBoard(fCurrentLocalBoard, ichamber);
217 fCurrentSeg = AliMpSegmentation::Instance()
218 ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));
220 // second plane lower part
221 if (zeroDown == 0) { // something down
226 // check if we need to move to another detElemId
227 AliMpPad pad = fCurrentSeg->PadByIndices(AliMpIntPair(icol-1,iFirstStripMiddle-1),kFALSE);
228 if (pad.IsValid()) { // lower strips within same detElemId
229 iFirstStripDo = iFirstStripMiddle - 8;
230 iLastStripDo = iFirstStripDo + 8;
232 } else { // lower strips in another detElemId
233 fCurrentDetElem = AliMpDDLStore::Instance()
234 ->GetPreviousDEfromLocalBoard(fCurrentLocalBoard, ichamber);
236 fCurrentSeg = AliMpSegmentation::Instance()
237 ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));
239 // get iFirstStrip in this module
240 const AliMpTriggerSegmentation* trig = (AliMpTriggerSegmentation*)(fCurrentSeg);
241 const AliMpTrigger* t = trig->Slat();
242 const AliMpSlat* slat = t->GetLayer(0);
244 if (iline == 5) icolDo = icol + 1; // special case
245 if (iline == 6) icolDo = icol - 1; // special case
247 const AliMpPCB* pcb = slat->GetPCB(icolDo-1);
248 iFirstStripDo = (pcb->Iymax() + 1) - 8;
249 iLastStripDo = iFirstStripDo + 8;
253 FillXstrips(icolDo, iFirstStripDo, iLastStripDo,
254 iStripCircuit, fYpos21[fCurrentLocalBoard]);
256 // fill strip between middle and upper part
257 fYpos21[fCurrentLocalBoard][15] = (fYpos21[fCurrentLocalBoard][14] +
258 fYpos21[fCurrentLocalBoard][16])/2.;
259 } // end of something down
263 //----------------------------------------------------------------------
264 void AliMUONTriggerCircuit::FillXstrips(const Int_t icol,
265 const Int_t iFirstStrip, const Int_t iLastStrip,
266 Int_t liStripCircuit, TArrayF& ypos)
269 Double_t xyGlobal[2] = {0.};
270 for (Int_t istrip = iFirstStrip; istrip < iLastStrip; ++istrip) {
272 AliMpPad pad = fCurrentSeg->PadByIndices(AliMpIntPair(icol-1,istrip),kTRUE);
273 if ( !pad.IsValid() ) {
274 StdoutToAliError(cout << "Pad not found in seg " << endl;
275 fCurrentSeg->Print();
276 cout << " ix,iy=" << icol-1 << "," << istrip << endl;
279 Float_t yDim = pad.Dimensions().Y(); // half size!
281 XYGlobal(pad,xyGlobal);
283 ypos[2*liStripCircuit] = xyGlobal[1];
284 if (istrip != (iLastStrip - 1)) ypos[2*liStripCircuit+1] = xyGlobal[1] + yDim;
290 //----------------------------------------------------------------------
291 void AliMUONTriggerCircuit::LoadXPos(AliMpLocalBoard* localBoard)
293 /// fill fXpos11 -> x position of Y strips for the first plane only
294 /// fXpos11 contains the x position of Y strip for the current circuit
295 /// taking into account whether or nor not part(s) of the circuit
296 /// (middle, up or down) has(have) 16 strips (handdled by means of switchs)
298 fCurrentLocalBoard = localBoard->GetId();
303 Int_t x2u = localBoard->GetSwitch(AliMpLocalBoard::kX2u);
304 Int_t x2m = localBoard->GetSwitch(AliMpLocalBoard::kX2m);
305 Int_t x2d = localBoard->GetSwitch(AliMpLocalBoard::kX2d);
306 Int_t zeroAllYLSB = localBoard->GetSwitch(AliMpLocalBoard::kZeroAllYLSB);
308 Int_t iStripCircuit = 0;
309 Int_t iFirstStrip = 0;
310 Int_t iLastStrip = 0;
311 Bool_t doubling = kFALSE;
313 Int_t iline = localBoard->GetPosition().GetFirst();
314 Int_t icol = localBoard->GetPosition().GetSecond();
315 if ( iline == 5 ) --icol;
317 fCurrentDetElem = AliMpDDLStore::Instance()->GetDEfromLocalBoard(fCurrentLocalBoard, ichamber);
319 fCurrentSeg = AliMpSegmentation::Instance()
320 ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));
322 // check if one needs a strip doubling or not
323 if ( (x2u || x2m || x2d ) && x2m ) doubling = kTRUE;
326 // check if one starts at strip = 0 or 8 (boards 26-29 and 143-146)
327 if (zeroAllYLSB) iStripCircuit = 8;
329 // get iFirstStrip in this module
330 const AliMpTriggerSegmentation* trig = (AliMpTriggerSegmentation*)(fCurrentSeg);
331 const AliMpTrigger* t = trig->Slat();
332 const AliMpSlat* slat = t->GetLayer(0);
334 const AliMpPCB* pcb = slat->GetPCB(icol-1);
335 iFirstStrip = pcb->Ixmin();
338 if (doubling || zeroAllYLSB == 1) iLastStrip = iFirstStrip + 8;
339 else iLastStrip = iFirstStrip + 16;
341 FillYstrips(iFirstStrip, iLastStrip, iStripCircuit, doubling);
344 //----------------------------------------------------------------------
345 void AliMUONTriggerCircuit::FillYstrips(const Int_t iFirstStrip, const Int_t iLastStrip,
346 Int_t liStripCircuit,
347 const Bool_t doubling)
350 Double_t xyGlobal[2] = {0.};
352 for (Int_t istrip = iFirstStrip; istrip < iLastStrip; ++istrip) {
354 AliMpPad pad = fCurrentSeg->PadByIndices(AliMpIntPair(istrip,0),kTRUE);
356 if ( !pad.IsValid() )
358 StdoutToAliError(cout << "Pad not found in seg " << endl;
359 fCurrentSeg->Print();
360 cout << " ix,iy=" << istrip << "," << 0 << endl;
363 Float_t xDim = pad.Dimensions().X(); // half size!
365 XYGlobal(pad,xyGlobal);
368 fXpos11[fCurrentLocalBoard].AddAt(xyGlobal[0], liStripCircuit);
369 } else if (doubling) {
371 fXpos11[fCurrentLocalBoard].AddAt(TMath::Sign(1.,xyGlobal[0]) *
372 (TMath::Abs(xyGlobal[0]) - xDim/2.), 2*liStripCircuit);
374 fXpos11[fCurrentLocalBoard].AddAt(TMath::Sign(1.,xyGlobal[0]) *
375 (TMath::Abs(fXpos11[fCurrentLocalBoard][2*liStripCircuit]) + xDim),
376 2*liStripCircuit + 1);
383 //----------------------------------------------------------------------
384 void AliMUONTriggerCircuit::XYGlobal(const AliMpPad& pad,
387 /// returns pad x & y positions and x & y pad dimensions in global coordinates
388 /// note: no need for transformation for pad dimensions
390 // get the pad position and dimensions
391 Double_t xl1 = pad.Position().X();
392 Double_t yl1 = pad.Position().Y();
395 // positions from local to global
396 fTransformer->Local2Global(fCurrentDetElem, xl1, yl1, 0,
397 xyGlobal[0], xyGlobal[1], zg1);
401 //----------------------------------------------------------------------
402 //--- methods which return member data related info
403 //----------------------------------------------------------------------
404 Float_t AliMUONTriggerCircuit::GetY11Pos(Int_t localBoardId, Int_t istrip) const
406 /// returns Y position of X strip istrip in MC11
407 return fYpos11[localBoardId][istrip];
409 //----------------------------------------------------------------------
410 Float_t AliMUONTriggerCircuit::GetY21Pos(Int_t localBoardId, Int_t istrip) const
412 /// returns Y position of X strip istrip in MC21
413 return fYpos21[localBoardId][istrip];
415 //----------------------------------------------------------------------
416 Float_t AliMUONTriggerCircuit::GetX11Pos(Int_t localBoardId, Int_t istrip) const
418 /// returns X position of Y strip istrip in MC11
419 return fXpos11[localBoardId][istrip];
422 //----------------------------------------------------------------------
423 Int_t AliMUONTriggerCircuit::FirstStrip(AliMpLocalBoard* localBoard)
425 /// returns the first strip from mapping for board boardName
426 /// take care of special case for boards RC1L6B12 & LC1L6B12
427 Int_t iFirstStrip = -1;
428 Int_t boardNumber = atoi(localBoard->GetName()+6);
430 Int_t iline = localBoard->GetPosition().GetFirst();
431 Int_t icol = localBoard->GetPosition().GetSecond();
432 if ( iline == 5 ) --icol;
449 if (icol == 1 && iline == 6) iFirstStrip += 16; // special case