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