]>
Commit | Line | Data |
---|---|---|
9ff9fab7 | 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 | ||
bdb9f2a3 | 18 | // ------------------------------------- |
19 | // Class AliMUONTriggerSegmentation | |
20 | // ------------------------------------- | |
21 | // Segmentation for MUON trigger stations using | |
22 | // the mapping package | |
23 | ||
9ff9fab7 | 24 | #include "AliMUONTriggerSegmentationV2.h" |
25 | ||
9ff9fab7 | 26 | #include "AliMpPCB.h" |
27 | #include "AliMpTrigger.h" | |
28 | #include "AliMpTriggerSegmentation.h" | |
29 | #include "AliMpSlat.h" | |
30 | ||
8fbf5237 | 31 | #include "AliLog.h" |
9ff9fab7 | 32 | |
33 | #include "Riostream.h" | |
34 | #include "TClass.h" | |
35 | #include "TString.h" | |
36 | ||
37 | ClassImp(AliMUONTriggerSegmentationV2) | |
38 | ||
39 | namespace | |
40 | { | |
41 | // Int_t SPECIAL_SECTOR = 8; | |
42 | Int_t fgIntOffset(1); | |
43 | Float_t FMAX(1E9); | |
44 | Int_t CODEMAKER(1000); | |
45 | ||
46 | Int_t Code(Int_t ixLA, Int_t iyLA) | |
47 | { | |
48 | return iyLA*CODEMAKER + ixLA; | |
49 | } | |
50 | ||
51 | void Decode(Int_t code, Int_t& ixLA, Int_t& iyLA) | |
52 | { | |
53 | iyLA = code/CODEMAKER; | |
54 | ixLA = code - iyLA*CODEMAKER; | |
55 | } | |
56 | } | |
57 | ||
58 | //_____________________________________________________________________________ | |
59 | AliMUONTriggerSegmentationV2::AliMUONTriggerSegmentationV2() | |
60 | : AliMUONVGeometryDESegmentation(), | |
61 | fDetElemId(-1), | |
62 | fPlaneType(kNonBendingPlane), | |
63 | fSlat(0), | |
64 | fSlatSegmentation(0), | |
65 | fXhit(FMAX), | |
66 | fYhit(FMAX), | |
67 | fLineNumber(-1) | |
68 | { | |
69 | // | |
70 | // Default ctor (empty). | |
71 | // | |
72 | AliDebug(1,Form("this=%p default (empty) ctor",this)); | |
73 | } | |
74 | ||
75 | //_____________________________________________________________________________ | |
8fbf5237 | 76 | AliMUONTriggerSegmentationV2::AliMUONTriggerSegmentationV2( |
77 | AliMpVSegmentation* segmentation, | |
78 | Int_t detElemId, AliMpPlaneType bendingOrNonBending) | |
9ff9fab7 | 79 | : AliMUONVGeometryDESegmentation(), |
80 | fDetElemId(detElemId), | |
81 | fPlaneType(bendingOrNonBending), | |
82 | fSlat(0), | |
83 | fSlatSegmentation(0), | |
84 | fXhit(FMAX), | |
85 | fYhit(FMAX), | |
86 | fLineNumber(-1) | |
87 | { | |
88 | // | |
89 | // Normal ctor. | |
90 | // | |
8fbf5237 | 91 | |
92 | fSlatSegmentation = dynamic_cast<AliMpTriggerSegmentation*>(segmentation); | |
93 | if (fSlatSegmentation) | |
94 | fSlat = fSlatSegmentation->Slat(); | |
95 | else | |
96 | AliFatal("Wrong mapping segmentation type"); | |
97 | ||
dda778c2 | 98 | TString id(fSlat->GetID()); |
99 | Ssiz_t pos = id.Last('L'); | |
100 | if ( pos <= 0 ) | |
101 | { | |
102 | AliFatal(Form("Cannot infer line number for slat %s",id.Data())); | |
103 | } | |
104 | fLineNumber = TString(id(pos+1),1).Atoi(); | |
9ff9fab7 | 105 | |
106 | AliDebug(1,Form("this=%p detElemId=%3d %s fSlatSegmentation=%p",this,detElemId, | |
107 | ( (bendingOrNonBending==kBendingPlane)?"Bending":"NonBending" ), | |
108 | fSlatSegmentation)); | |
109 | } | |
110 | ||
111 | //_____________________________________________________________________________ | |
112 | AliMUONTriggerSegmentationV2::AliMUONTriggerSegmentationV2(const AliMUONTriggerSegmentationV2& rhs) : AliMUONVGeometryDESegmentation(rhs) | |
113 | { | |
bdb9f2a3 | 114 | // Copy constructor |
9ff9fab7 | 115 | AliFatal("Not implemented."); |
116 | } | |
117 | ||
118 | //_____________________________________________________________________________ | |
119 | AliMUONTriggerSegmentationV2::~AliMUONTriggerSegmentationV2() | |
120 | { | |
9ff9fab7 | 121 | // Destructor |
bdb9f2a3 | 122 | AliDebug(1,Form("this=%p",this)); |
9ff9fab7 | 123 | } |
124 | ||
125 | //_____________________________________________________________________________ | |
126 | AliMUONTriggerSegmentationV2& AliMUONTriggerSegmentationV2::operator=(const AliMUONTriggerSegmentationV2& rhs) | |
127 | { | |
128 | // Protected assignement operator | |
129 | if (this == &rhs) return *this; | |
130 | AliFatal("Not implemented."); | |
131 | return *this; | |
132 | } | |
133 | ||
134 | //_____________________________________________________________________________ | |
135 | TF1* | |
136 | AliMUONTriggerSegmentationV2::CorrFunc(Int_t) const | |
137 | { | |
bdb9f2a3 | 138 | // Not implemented |
139 | ||
9ff9fab7 | 140 | AliFatal("Not implemented"); |
141 | return 0x0; | |
142 | } | |
143 | ||
144 | //_____________________________________________________________________________ | |
145 | Float_t | |
146 | AliMUONTriggerSegmentationV2::Distance2AndOffset(Int_t, Int_t, | |
147 | Float_t, Float_t, Int_t*) | |
148 | { | |
bdb9f2a3 | 149 | // Not implemented |
150 | ||
9ff9fab7 | 151 | AliFatal("Not implemented"); |
152 | return 0; | |
153 | } | |
154 | ||
155 | //_____________________________________________________________________________ | |
156 | void | |
157 | AliMUONTriggerSegmentationV2::Draw(Option_t*) | |
158 | { | |
bdb9f2a3 | 159 | // Not implemented |
160 | ||
9ff9fab7 | 161 | AliFatal("Not Implemented"); |
162 | } | |
163 | ||
164 | //_____________________________________________________________________________ | |
165 | Float_t | |
166 | AliMUONTriggerSegmentationV2::Dpx() const | |
167 | { | |
bdb9f2a3 | 168 | // Not implemented |
169 | ||
9ff9fab7 | 170 | AliFatal("Not Implemented"); |
171 | return 0.0; | |
172 | } | |
173 | ||
174 | //_____________________________________________________________________________ | |
175 | Float_t | |
176 | AliMUONTriggerSegmentationV2::Dpy() const | |
177 | { | |
bdb9f2a3 | 178 | // Not implemented |
179 | ||
9ff9fab7 | 180 | AliFatal("Not Implemented"); |
181 | return 0.0; | |
182 | } | |
183 | ||
184 | //_____________________________________________________________________________ | |
185 | Float_t | |
186 | AliMUONTriggerSegmentationV2::Dpx(int sectorCode) const | |
187 | { | |
bdb9f2a3 | 188 | // Get pad size in x |
189 | ||
190 | Int_t ixLA, iyLA; | |
9ff9fab7 | 191 | Decode(sectorCode,ixLA,iyLA); |
192 | AliMpPad pad = fSlatSegmentation->PadByIndices(AliMpIntPair(ixLA,iyLA),kFALSE); | |
193 | if ( !pad.IsValid() ) return 0.0; | |
194 | return pad.Dimensions().X()*2.0; | |
195 | } | |
196 | ||
197 | //_____________________________________________________________________________ | |
198 | Float_t | |
199 | AliMUONTriggerSegmentationV2::Dpy(int sectorCode) const | |
200 | { | |
bdb9f2a3 | 201 | // Get pad size in y |
202 | ||
9ff9fab7 | 203 | Int_t ixLA, iyLA; |
204 | Decode(sectorCode,ixLA,iyLA); | |
205 | AliMpPad pad = fSlatSegmentation->PadByIndices(AliMpIntPair(ixLA,iyLA),kFALSE); | |
206 | if ( !pad.IsValid() ) return 0.0; | |
207 | return pad.Dimensions().Y()*2.0; | |
208 | } | |
209 | ||
210 | //_____________________________________________________________________________ | |
211 | void | |
bdb9f2a3 | 212 | AliMUONTriggerSegmentationV2::FirstPad(Float_t /*xhit*/, Float_t /*yhit*/, Float_t /*zhit*/, |
213 | Float_t /*dx*/, Float_t /*dy*/) | |
9ff9fab7 | 214 | { |
bdb9f2a3 | 215 | // Not implemented |
216 | ||
9ff9fab7 | 217 | AliFatal("Not implemented"); |
218 | } | |
219 | ||
220 | //_____________________________________________________________________________ | |
221 | Float_t | |
222 | AliMUONTriggerSegmentationV2::GetAnod(Float_t) const | |
223 | { | |
bdb9f2a3 | 224 | // Not implemented |
225 | ||
9ff9fab7 | 226 | AliFatal("Not implemented"); |
227 | return 0.0; | |
228 | } | |
229 | ||
230 | //_____________________________________________________________________________ | |
231 | AliMUONGeometryDirection | |
232 | AliMUONTriggerSegmentationV2::GetDirection() | |
233 | { | |
bdb9f2a3 | 234 | // Not implemented |
235 | ||
9ff9fab7 | 236 | //AliWarning("Not Implemented"); |
237 | return kDirUndefined; | |
238 | } | |
239 | ||
b7ef3c96 | 240 | //______________________________________________________________________________ |
241 | const AliMpVSegmentation* | |
242 | AliMUONTriggerSegmentationV2::GetMpSegmentation() const | |
243 | { | |
244 | // Returns the mapping segmentation | |
245 | // (provides access to electronics info) | |
246 | ||
247 | return fSlatSegmentation; | |
248 | } | |
249 | ||
9ff9fab7 | 250 | //_____________________________________________________________________________ |
251 | void | |
252 | AliMUONTriggerSegmentationV2::GetNParallelAndOffset(Int_t,Int_t,Int_t*,Int_t*) | |
253 | { | |
bdb9f2a3 | 254 | // Not implemented |
255 | ||
9ff9fab7 | 256 | AliFatal("Not Implemented"); |
257 | } | |
258 | ||
259 | //_____________________________________________________________________________ | |
260 | void | |
261 | AliMUONTriggerSegmentationV2::GetPadC(Int_t ix, Int_t iy, | |
262 | Float_t& x, Float_t& y, Float_t& z) | |
263 | { | |
bdb9f2a3 | 264 | // Transform from pad to real coordinates |
265 | ||
9ff9fab7 | 266 | z = 0; |
267 | GetPadC(ix,iy,x,y); | |
268 | } | |
269 | ||
270 | //_____________________________________________________________________________ | |
271 | void | |
272 | AliMUONTriggerSegmentationV2::GetPadC(Int_t ixGlo, Int_t iyGlo, | |
273 | Float_t& x, Float_t& y) | |
274 | { | |
bdb9f2a3 | 275 | // Transform from pad to real coordinates |
276 | ||
9ff9fab7 | 277 | Int_t ixLA,iyLA; |
278 | IGlo2ILoc(ixGlo,iyGlo,ixLA,iyLA); | |
279 | AliMpPad pad = fSlatSegmentation->PadByIndices(AliMpIntPair(ixLA,iyLA),kTRUE); | |
280 | x = pad.Position().X(); | |
281 | y = pad.Position().Y(); | |
282 | } | |
283 | ||
284 | //_____________________________________________________________________________ | |
285 | void | |
286 | AliMUONTriggerSegmentationV2::GetPadI(Float_t x, Float_t y, Float_t, | |
287 | Int_t& ix, Int_t& iy) | |
288 | { | |
bdb9f2a3 | 289 | // Returns pad coordinates (ix,iy) for given real coordinates (x,y) |
290 | ||
9ff9fab7 | 291 | GetPadI(x,y,ix,iy); |
292 | } | |
293 | ||
294 | //_____________________________________________________________________________ | |
295 | void | |
296 | AliMUONTriggerSegmentationV2::GetPadI(Float_t x, Float_t y, | |
297 | Int_t& ixGlo, Int_t& iyGlo) | |
298 | { | |
bdb9f2a3 | 299 | // Returns pad coordinates (ix,iy) for given real coordinates (x,y) |
300 | ||
9ff9fab7 | 301 | AliDebug(2,Form("%s x=%e y=%e ixGlo,iyGlo=%d,%d\n", |
302 | fSlatSegmentation->GetName(), | |
303 | x,y,ixGlo,iyGlo)); | |
304 | ||
9ff9fab7 | 305 | AliMpPad pad = |
c608ca37 | 306 | fSlatSegmentation->PadByPosition(TVector2(x,y), kTRUE); |
9ff9fab7 | 307 | |
308 | if ( pad != AliMpPad::Invalid() ) | |
309 | { | |
310 | Int_t ix = pad.GetIndices().GetFirst(); | |
311 | Int_t iy = pad.GetIndices().GetSecond(); | |
312 | ILoc2IGlo(ix,iy,ixGlo,iyGlo); | |
313 | } | |
314 | else | |
315 | { | |
316 | ixGlo=iyGlo=-1; | |
317 | } | |
318 | AliDebug(2,Form("ixGlo,iyGlo=%d,%d\n",ixGlo,iyGlo)); | |
319 | } | |
320 | ||
321 | //_____________________________________________________________________________ | |
322 | void | |
323 | AliMUONTriggerSegmentationV2::GetPadLoc2Glo(Int_t ix, Int_t iy, | |
324 | Int_t& ixGlo, Int_t& iyGlo) const | |
325 | { | |
326 | // | |
327 | // Converts from local (in PC convention) to (ix,iy) to global (ix,iy) | |
328 | // | |
329 | ||
330 | ixGlo=iyGlo=-1; // starts with invalid values | |
331 | ||
332 | if ( fPlaneType == kBendingPlane ) | |
333 | { | |
334 | ixGlo = 10*LineNumber() + ix; | |
335 | iyGlo = iy - fgIntOffset; | |
336 | } | |
337 | else if ( fPlaneType == kNonBendingPlane ) | |
338 | { | |
339 | Int_t i = fSlat->GetLayer(0)->FindPCBIndex(ix-fgIntOffset); | |
340 | if (i<0) | |
341 | { | |
342 | AliError(Form("Invalid local (ix=%d,iy=%d) ?",ix,iy)); | |
343 | return ; | |
344 | } | |
345 | AliMpPCB* pcb = fSlat->GetLayer(0)->FindPCB(ix-fgIntOffset); | |
346 | iyGlo = ix - pcb->Ixmin() - fgIntOffset; | |
347 | if ( LineNumber() == 5 ) ++i; | |
348 | ixGlo = 10*LineNumber() + i + fgIntOffset; | |
349 | } | |
350 | } | |
351 | ||
352 | //_____________________________________________________________________________ | |
353 | void | |
354 | AliMUONTriggerSegmentationV2::GetPadGlo2Loc(Int_t ixGlo, Int_t iyGlo, | |
355 | Int_t& ix, Int_t& iy) const | |
356 | { | |
357 | // | |
358 | // Converts from global (ix,iy) to local (ix,iy) (in PC convention) | |
359 | // | |
360 | ||
361 | ix=iy=-1; // starts with invalid values | |
362 | ||
363 | if ( abs(ixGlo) == 51 ) return; | |
364 | ||
365 | Int_t column = ModuleColNum(ixGlo); | |
366 | ||
367 | if ( fPlaneType == kBendingPlane ) | |
368 | { | |
369 | ix = column + fgIntOffset; | |
370 | iy = iyGlo + fgIntOffset; | |
371 | } | |
372 | else if ( fPlaneType == kNonBendingPlane ) | |
373 | { | |
374 | if ( LineNumber()==5 ) --column; | |
375 | AliMpPCB* pcb = fSlat->GetLayer(0)->GetPCB(column); | |
376 | if (!pcb) | |
377 | { | |
378 | AliError(Form("Invalid global (ix=%d,iy=%d)",ixGlo,iyGlo)); | |
379 | return; | |
380 | } | |
381 | ix = pcb->Ixmin() + iyGlo + fgIntOffset; | |
382 | iy = fgIntOffset; | |
383 | } | |
384 | } | |
385 | ||
386 | //_____________________________________________________________________________ | |
387 | void | |
388 | AliMUONTriggerSegmentationV2::GiveTestPoints(Int_t&,Float_t*,Float_t*) const | |
389 | { | |
bdb9f2a3 | 390 | // Not implemented |
391 | ||
9ff9fab7 | 392 | AliFatal("Not Implemented"); |
393 | } | |
394 | ||
395 | //_____________________________________________________________________________ | |
396 | Bool_t | |
bdb9f2a3 | 397 | AliMUONTriggerSegmentationV2::HasPad(Float_t x, Float_t y, Float_t /*z*/) |
9ff9fab7 | 398 | { |
bdb9f2a3 | 399 | // Returns true if a pad exists in the given position |
400 | ||
9ff9fab7 | 401 | // |
402 | // Well, 2 implementations are possible here | |
403 | // Either reuse HasPad(int,int), or get it from scratch using | |
404 | // underlying fSlatSegmentation. | |
405 | // Took second option, but w/o checking whether this is the faster. | |
406 | // The second option is commented out below, for the record. | |
407 | ||
408 | // Int_t ix, iy; | |
409 | // GetPadI(x,y,z,ix,iy); | |
410 | // Int_t ixLA, iyLA; | |
411 | // IGlo2ILoc(ix,iy,ixLA,iyLA); | |
412 | // Int_t ixPC, iyPC; | |
413 | // LA2PC(ixLA,iyLA,ixPC,iyPC); | |
414 | // Bool_t ok1 = HasPad(ixPC,iyPC); | |
415 | ||
416 | AliMpPad pad = | |
c608ca37 | 417 | fSlatSegmentation->PadByPosition(TVector2(x,y),kFALSE); |
9ff9fab7 | 418 | return pad.IsValid(); |
419 | } | |
420 | ||
421 | //_____________________________________________________________________________ | |
422 | Bool_t | |
423 | AliMUONTriggerSegmentationV2::HasPad(Int_t ixGlo, Int_t iyGlo) | |
424 | { | |
bdb9f2a3 | 425 | // Returns true if a pad with given indices exists |
426 | ||
9ff9fab7 | 427 | Int_t ixLA, iyLA; |
428 | IGlo2ILoc(ixGlo,iyGlo,ixLA,iyLA); | |
429 | return fSlatSegmentation->HasPad(AliMpIntPair(ixLA,iyLA)); | |
430 | } | |
431 | ||
432 | //_____________________________________________________________________________ | |
433 | void | |
434 | AliMUONTriggerSegmentationV2::IGlo2ILoc(Int_t ixGlo, Int_t iyGlo, | |
6c92c893 | 435 | Int_t& ixLA, Int_t& iyLA) const |
9ff9fab7 | 436 | { |
bdb9f2a3 | 437 | // FIXME: add comment |
438 | ||
9ff9fab7 | 439 | Int_t ixPC, iyPC; |
440 | GetPadGlo2Loc(ixGlo,iyGlo,ixPC,iyPC); | |
441 | PC2LA(ixPC,iyPC,ixLA,iyLA); | |
442 | } | |
443 | ||
444 | //_____________________________________________________________________________ | |
445 | void | |
446 | AliMUONTriggerSegmentationV2::ILoc2IGlo(Int_t ixLA, Int_t iyLA, | |
6c92c893 | 447 | Int_t& ixGlo, Int_t& iyGlo) const |
9ff9fab7 | 448 | { |
bdb9f2a3 | 449 | // FIXME: add comment |
450 | ||
9ff9fab7 | 451 | Int_t ixPC, iyPC; |
452 | LA2PC(ixLA,iyLA,ixPC,iyPC); | |
453 | GetPadLoc2Glo(ixPC,iyPC,ixGlo,iyGlo); | |
454 | } | |
455 | ||
9ff9fab7 | 456 | //_____________________________________________________________________________ |
457 | Int_t | |
458 | AliMUONTriggerSegmentationV2::ISector() | |
459 | { | |
460 | // FIXME: remove the usage of ISector from all the code. | |
461 | return -10; | |
462 | } | |
463 | ||
464 | //_____________________________________________________________________________ | |
465 | void AliMUONTriggerSegmentationV2::IntegrationLimits(Float_t& x1, | |
466 | Float_t& x2, | |
467 | Float_t& x3, | |
468 | Float_t& x4) | |
469 | { | |
470 | // x1 : hit x(y) position | |
471 | // x2 : x(y) coordinate of the main strip | |
472 | // x3 : current strip real x(y) coordinate | |
473 | // x4 : dist. between x(y) hit pos. and the closest border of the current strip | |
474 | // | |
475 | // Note : need to return (only) x4. | |
476 | ||
477 | AliFatal("Check me before usage. ResponseTrigger does not use me, while" | |
478 | "ResponseTriggerV1 does ?"); | |
479 | ||
480 | AliMpPad strip = | |
481 | fSlatSegmentation->PadByPosition(TVector2(fXhit,fYhit),kFALSE); | |
482 | if ( !strip.IsValid() ) | |
483 | { | |
484 | AliWarning(Form("%s got invalid fXhit,fYhit=%e,%e\n", | |
485 | fSlatSegmentation->GetName(),fXhit,fYhit)); | |
486 | x1=x2=x3=x4=0; | |
487 | } | |
488 | else | |
489 | { | |
490 | Double_t xstrip = strip.Position().X(); | |
491 | Double_t ystrip = strip.Position().Y(); | |
492 | AliDebug(1,Form("fXhit,Yhit=%e,%e xstrip,ystrip=%e,%e\n", | |
493 | fXhit,fYhit,xstrip,ystrip)); | |
494 | x1 = (fPlaneType==kBendingPlane) ? fYhit : fXhit; | |
495 | x2 = (fPlaneType==kBendingPlane) ? ystrip : xstrip; | |
496 | x3 = (fPlaneType==kBendingPlane) ? | |
497 | fCurrentPad.Position().Y() : fCurrentPad.Position().X(); | |
498 | Double_t xmin = 0.0; | |
499 | Double_t xmax = 0.0; | |
500 | if (fPlaneType==kBendingPlane) | |
501 | { | |
502 | xmin = x3 - fCurrentPad.Dimensions().X(); | |
503 | xmax = x3 + fCurrentPad.Dimensions().X(); | |
504 | } | |
505 | else | |
506 | { | |
507 | xmin = x3 - fCurrentPad.Dimensions().Y(); | |
508 | xmax = x3 + fCurrentPad.Dimensions().Y(); | |
509 | } | |
510 | // dist. between the hit and the closest border of the current strip | |
511 | x4 = (TMath::Abs(xmax-x1) > TMath::Abs(xmin-x1)) ? | |
512 | TMath::Abs(xmin-x1):TMath::Abs(xmax-x1); | |
513 | ||
514 | AliDebug(1,Form("Bending %d x1=%e x2=%e x3=%e x4=%e xmin,max=%e,%e\n", | |
515 | fPlaneType,x1,x2,x3,x4,xmin,xmax)); | |
516 | ||
517 | } | |
518 | } | |
519 | ||
520 | //_____________________________________________________________________________ | |
521 | Int_t | |
522 | AliMUONTriggerSegmentationV2::Ix() | |
523 | { | |
bdb9f2a3 | 524 | // Current pad cursor during disintegration |
525 | // x, y-coordinate | |
526 | ||
9ff9fab7 | 527 | if ( fCurrentPad.IsValid() ) |
528 | { | |
529 | Int_t ixGlo,iyGlo; | |
530 | ILoc2IGlo(fCurrentPad.GetIndices().GetFirst(), | |
531 | fCurrentPad.GetIndices().GetSecond(),ixGlo,iyGlo); | |
532 | return ixGlo; | |
533 | } | |
534 | return -1; | |
535 | } | |
536 | ||
537 | //_____________________________________________________________________________ | |
538 | Int_t | |
539 | AliMUONTriggerSegmentationV2::Iy() | |
540 | { | |
bdb9f2a3 | 541 | // Current pad cursor during disintegration |
542 | // x, y-coordinate | |
543 | ||
9ff9fab7 | 544 | if ( fCurrentPad.IsValid() ) |
545 | { | |
546 | Int_t ixGlo,iyGlo; | |
547 | ILoc2IGlo(fCurrentPad.GetIndices().GetFirst(), | |
548 | fCurrentPad.GetIndices().GetSecond(),ixGlo,iyGlo); | |
549 | return iyGlo; | |
550 | } | |
551 | return -1; | |
552 | } | |
553 | ||
554 | ||
555 | //_____________________________________________________________________________ | |
556 | void | |
557 | AliMUONTriggerSegmentationV2::LA2PC(Int_t ixLA, Int_t iyLA, | |
6c92c893 | 558 | Int_t& ixPC, Int_t& iyPC) const |
9ff9fab7 | 559 | { |
560 | // | |
561 | // From LA to PC conventions for integers indices. | |
562 | // | |
563 | ixPC=iyPC=-1; | |
564 | ||
565 | if ( ixLA<0 || iyLA<0 ) return; | |
566 | ||
567 | ixPC = ixLA + 1; | |
568 | iyPC = iyLA + 1; | |
569 | ||
570 | if ( fPlaneType == kBendingPlane ) | |
571 | { | |
572 | if ( LineNumber()==5 ) | |
573 | { | |
574 | ++ixPC; | |
575 | } | |
576 | if ( LineNumber()==4 && ixLA==0 ) | |
577 | { | |
578 | iyPC -= 16; | |
579 | } | |
580 | } | |
581 | ||
582 | AliDebug(3,Form("ix,iy LA (%d,%d) -> PC (%d,%d)",ixLA,iyLA,ixPC,iyPC)); | |
583 | ||
584 | } | |
585 | ||
586 | //_____________________________________________________________________________ | |
587 | Int_t | |
588 | AliMUONTriggerSegmentationV2::LineNumber() const | |
589 | { | |
bdb9f2a3 | 590 | // FIXME: add comment |
591 | ||
592 | return 10-fLineNumber; | |
9ff9fab7 | 593 | } |
594 | ||
595 | //_____________________________________________________________________________ | |
596 | Int_t | |
597 | AliMUONTriggerSegmentationV2::ModuleColNum(Int_t ixGlo) const | |
598 | { | |
599 | // returns column number (from 0 to 6) in which the (global) module | |
600 | // ix is sitting (could return 7 if ix=isec) | |
601 | return TMath::Abs(ixGlo)-Int_t(TMath::Abs(ixGlo)/10)*10-1; | |
602 | } | |
603 | ||
604 | //_____________________________________________________________________________ | |
605 | Int_t | |
606 | AliMUONTriggerSegmentationV2::MorePads() | |
607 | { | |
bdb9f2a3 | 608 | // Not implemented |
609 | ||
9ff9fab7 | 610 | AliFatal("Not implemented"); |
611 | return 0; | |
612 | } | |
613 | ||
614 | //_____________________________________________________________________________ | |
615 | void AliMUONTriggerSegmentationV2::Neighbours(Int_t /*iX*/, Int_t /*iY*/, | |
616 | Int_t* /*Nlist*/, | |
617 | Int_t /*Xlist*/[10], | |
618 | Int_t /*Ylist*/[10]) | |
619 | { | |
620 | //-----------------BENDING----------------------------------------- | |
621 | // Returns list of 10 next neighbours for given X strip (ix, iy) | |
622 | // neighbour number 4 in the list - | |
623 | // neighbour number 3 in the list | | |
624 | // neighbour number 2 in the list |_ Upper part | |
625 | // neighbour number 1 in the list | | |
626 | // neighbour number 0 in the list - | |
627 | // X strip (ix, iy) | |
628 | // neighbour number 5 in the list - | |
629 | // neighbour number 6 in the list | _ Lower part | |
630 | // neighbour number 7 in the list | | |
631 | // neighbour number 8 in the list | | |
632 | // neighbour number 9 in the list - | |
633 | ||
634 | //-----------------NON-BENDING------------------------------------- | |
635 | // Returns list of 10 next neighbours for given Y strip (ix, iy) | |
636 | // neighbour number 9 8 7 6 5 (Y strip (ix, iy)) 0 1 2 3 4 in the list | |
637 | // \_______/ \_______/ | |
638 | // left right | |
639 | AliFatal("Please implement me"); | |
640 | } | |
641 | ||
642 | //_____________________________________________________________________________ | |
643 | void | |
644 | AliMUONTriggerSegmentationV2::NextPad() | |
645 | { | |
bdb9f2a3 | 646 | // Not implemented |
647 | ||
9ff9fab7 | 648 | AliFatal("Not implemented"); |
649 | } | |
650 | ||
651 | //_____________________________________________________________________________ | |
652 | Int_t | |
653 | AliMUONTriggerSegmentationV2::Npx() const | |
654 | { | |
bdb9f2a3 | 655 | // Maximum number of Pads in x |
656 | // hard coded for the time being | |
657 | ||
9ff9fab7 | 658 | return 124;// FIXME: this should not have to be done, if only we'd stick |
659 | // to a local (ix,iy) convention !!! | |
660 | // return fSlatSegmentation->MaxPadIndexX()+1; | |
661 | } | |
662 | ||
663 | //_____________________________________________________________________________ | |
664 | Int_t | |
665 | AliMUONTriggerSegmentationV2::Npy() const | |
666 | { | |
bdb9f2a3 | 667 | // Maximum number of Pads in y |
668 | // hard coded for the time being | |
669 | ||
9ff9fab7 | 670 | return 64; |
671 | // return fSlatSegmentation->MaxPadIndexY()+1; | |
672 | } | |
673 | ||
674 | //_____________________________________________________________________________ | |
675 | void | |
676 | AliMUONTriggerSegmentationV2::PC2LA(Int_t ixPC, Int_t iyPC, | |
6c92c893 | 677 | Int_t& ixLA, Int_t& iyLA) const |
9ff9fab7 | 678 | { |
679 | // | |
680 | // From PC to LA conventions for integers indices. | |
681 | // | |
682 | ixLA=iyLA=-1; | |
683 | ||
684 | if ( ixPC<0 || iyPC<0 ) return; | |
685 | ||
686 | ixLA = ixPC - 1; | |
687 | iyLA = iyPC - 1; | |
688 | ||
689 | if ( fPlaneType == kBendingPlane ) | |
690 | { | |
691 | if ( LineNumber()==5 ) | |
692 | { | |
693 | --ixLA; | |
694 | } | |
695 | if ( LineNumber()==4 && ixLA==0 ) | |
696 | { | |
697 | iyLA += 16; | |
698 | } | |
699 | } | |
700 | ||
701 | AliDebug(3,Form("ix,iy PC (%d,%d) -> LA (%d,%d)",ixPC,iyPC,ixLA,iyLA)); | |
702 | } | |
703 | ||
704 | //_____________________________________________________________________________ | |
705 | void | |
706 | AliMUONTriggerSegmentationV2::Print(Option_t* opt) const | |
707 | { | |
bdb9f2a3 | 708 | // Printing |
709 | ||
9ff9fab7 | 710 | TString sopt(opt); |
711 | ||
712 | cout << "DetElemId=" << fDetElemId << " PlaneType=" | |
713 | << fPlaneType << " Npx=" << Npx() << " Npy=" << Npy() << endl; | |
714 | if ( ( sopt.Contains("SEG") || sopt.Contains("ALL") ) && fSlatSegmentation ) | |
715 | { | |
716 | fSlatSegmentation->Print(); | |
717 | } | |
718 | if ( sopt.Contains("ALL") && fSlat ) | |
719 | { | |
720 | fSlat->Print(); | |
721 | } | |
722 | } | |
723 | ||
9ff9fab7 | 724 | //_____________________________________________________________________________ |
725 | Int_t | |
726 | AliMUONTriggerSegmentationV2::Sector(Int_t ix, Int_t iy) | |
727 | { | |
bdb9f2a3 | 728 | // Calculate sector from pad coordinates |
729 | ||
9ff9fab7 | 730 | Int_t ixLA, iyLA; |
731 | IGlo2ILoc(ix,iy,ixLA,iyLA); | |
732 | AliMpPad pad = fSlatSegmentation->PadByIndices(AliMpIntPair(ixLA,iyLA),kFALSE); | |
733 | if ( !pad.IsValid() ) return -1; | |
734 | return Code(ixLA,iyLA); | |
735 | ||
736 | // AliMpPCB* pcb = fSlat->GetLayer(0)->FindPCB(ixLA); | |
737 | // if (!pcb) | |
738 | // { | |
739 | // AliError(Form("Could not find a pcb at (%d,%d) for slat %s", | |
740 | // ix,iy,fSlat->GetName())); | |
741 | // return -1; | |
742 | // } | |
743 | // if ( pcb->PadSizeX()==-1.0 ) | |
744 | // { | |
745 | // // special case of column 7 non-bending. | |
746 | // return SPECIAL_SECTOR; | |
747 | // } | |
748 | // return fSlat->GetLayer(0)->FindPCBIndex(ixLA); | |
749 | } | |
750 | ||
751 | //_____________________________________________________________________________ | |
752 | Int_t | |
753 | AliMUONTriggerSegmentationV2::Sector(Float_t, Float_t) | |
754 | { | |
bdb9f2a3 | 755 | // Not implemented |
756 | ||
9ff9fab7 | 757 | AliFatal("Not implemented"); |
758 | return 0; | |
759 | } | |
760 | ||
761 | //_____________________________________________________________________________ | |
762 | void | |
763 | AliMUONTriggerSegmentationV2::SetCorrFunc(Int_t,TF1*) | |
764 | { | |
bdb9f2a3 | 765 | // Not implemented |
766 | ||
9ff9fab7 | 767 | AliFatal("Not Implemented"); |
768 | } | |
769 | ||
770 | //_____________________________________________________________________________ | |
771 | void | |
772 | AliMUONTriggerSegmentationV2::SetDAnod(float) | |
773 | { | |
bdb9f2a3 | 774 | // Not implemented |
775 | ||
9ff9fab7 | 776 | AliFatal("Not Implemented"); |
777 | } | |
778 | ||
779 | //_____________________________________________________________________________ | |
780 | void | |
781 | AliMUONTriggerSegmentationV2::SetHit(Float_t x, Float_t y) | |
782 | { | |
bdb9f2a3 | 783 | // Set hit position |
784 | // Sets virtual hit position, needed for evaluating pad response | |
785 | // outside the tracking program | |
786 | ||
9ff9fab7 | 787 | fXhit = x; |
788 | fYhit = y; | |
789 | ||
790 | // | |
791 | // insure we're within the slat limits. If not, issue an error and sets | |
792 | // the current hit to slat center. | |
793 | // FIXME: this should probably a) not happen at all b) be a fatal error | |
794 | // | |
795 | if ( fXhit < -fSlat->DX() || fXhit > fSlat->DX() || | |
796 | fYhit < -fSlat->DY() || fYhit > fSlat->DY() ) | |
797 | { | |
798 | AliError(Form("Hit outside slat %s limits (x,y)hit = (%e,%e)." | |
799 | " Forcing to (0,0)",fSlat->GetID(),fXhit,fYhit)); | |
800 | fXhit = 0.0; | |
801 | fYhit = 0.0; | |
802 | } | |
803 | ||
804 | } | |
805 | ||
806 | //_____________________________________________________________________________ | |
807 | void | |
808 | AliMUONTriggerSegmentationV2::SetHit(Float_t x, Float_t y, Float_t) | |
809 | { | |
bdb9f2a3 | 810 | // Set hit position |
811 | // Sets virtual hit position, needed for evaluating pad response | |
812 | // outside the tracking program | |
813 | ||
9ff9fab7 | 814 | SetHit(x,y); |
815 | } | |
816 | ||
817 | //_____________________________________________________________________________ | |
818 | void | |
819 | AliMUONTriggerSegmentationV2::SetPad(Int_t ix, Int_t iy) | |
820 | { | |
bdb9f2a3 | 821 | // Set pad position. |
822 | // Sets virtual pad coordinates, needed for evaluating pad response | |
823 | // outside the tracking program. | |
824 | ||
9ff9fab7 | 825 | Int_t ixLA, iyLA; |
826 | IGlo2ILoc(ix,iy,ixLA,iyLA); | |
827 | fCurrentPad = fSlatSegmentation->PadByIndices(AliMpIntPair(ixLA,iyLA),kTRUE); | |
828 | if ( !fCurrentPad.IsValid() ) | |
829 | { | |
830 | AliError(Form("Setting current pad to invalid ! (ix,iy)=(%4d,%4d)",ix,iy)); | |
831 | } | |
832 | } | |
833 | ||
834 | //_____________________________________________________________________________ | |
835 | void | |
836 | AliMUONTriggerSegmentationV2::SetPadSize(float,float) | |
837 | { | |
bdb9f2a3 | 838 | // Not implemented |
839 | ||
9ff9fab7 | 840 | AliFatal("Not Implemented"); |
841 | } | |
842 | ||
843 | //_____________________________________________________________________________ | |
844 | Int_t | |
845 | AliMUONTriggerSegmentationV2::SigGenCond(Float_t,Float_t,Float_t) | |
846 | { | |
bdb9f2a3 | 847 | // Not implemented |
848 | ||
9ff9fab7 | 849 | AliFatal("Not Implemented"); |
850 | return 0; | |
851 | } | |
852 | ||
853 | //_____________________________________________________________________________ | |
854 | void | |
855 | AliMUONTriggerSegmentationV2::SigGenInit(Float_t,Float_t,Float_t) | |
856 | { | |
bdb9f2a3 | 857 | // Not implemented |
858 | ||
9ff9fab7 | 859 | AliFatal("Not Implemented"); |
860 | } | |
861 | ||
9ff9fab7 | 862 | |
863 | ||
864 | ||
865 |