]>
Commit | Line | Data |
---|---|---|
e118b27e | 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 | ||
c4ee792d | 16 | /* $Id$ */ |
17 | ||
e118b27e | 18 | // |
19 | // Class AliMUONGeometrySegmentation | |
20 | // ------------------------------- | |
21 | // New class for the module segmentation | |
22 | // composed of the segmentations of detection elements. | |
23 | // Applies transformations defined in geometry. | |
24 | // | |
25 | // Author:Ivana Hrivnacova, IPN Orsay | |
26 | ||
e118b27e | 27 | #include "AliMUONGeometrySegmentation.h" |
e0a49962 | 28 | #include "AliMUONVGeometryDESegmentation.h" |
5db8c9c1 | 29 | #include "AliMUONGeometryModuleTransformer.h" |
e118b27e | 30 | #include "AliMUONGeometryDetElement.h" |
21f7f426 | 31 | |
32 | #include "AliMpExMap.h" | |
e118b27e | 33 | |
e2d5c9df | 34 | #include "AliLog.h" |
35 | ||
36 | #include <Riostream.h> | |
37 | #include <TObjString.h> | |
38 | #include <TClass.h> | |
39 | ||
30f9168e | 40 | const Float_t AliMUONGeometrySegmentation::fgkMaxDistance = 1.0e6; |
3aadd064 | 41 | |
a9aad96e | 42 | /// \cond CLASSIMP |
63ed9c6b | 43 | ClassImp(AliMUONGeometrySegmentation) |
a9aad96e | 44 | /// \endcond |
63ed9c6b | 45 | |
e118b27e | 46 | //______________________________________________________________________________ |
47 | AliMUONGeometrySegmentation::AliMUONGeometrySegmentation( | |
5db8c9c1 | 48 | const AliMUONGeometryModuleTransformer* transformer) |
e118b27e | 49 | : TObject(), |
50 | fCurrentDetElemId(0), | |
51 | fCurrentDetElement(0), | |
52 | fCurrentSegmentation(0), | |
5db8c9c1 | 53 | fkModuleTransformer(transformer), |
54 | fDESegmentations(0), | |
55 | fDENames(0) | |
e118b27e | 56 | |
57 | { | |
692de412 | 58 | /// Standard constructor |
e118b27e | 59 | |
21f7f426 | 60 | fDESegmentations = new AliMpExMap(true); |
61 | fDESegmentations->SetOwner(false); | |
5db8c9c1 | 62 | |
21f7f426 | 63 | fDENames = new AliMpExMap(true); |
5db8c9c1 | 64 | |
65 | AliDebug(1, Form("ctor this = %p", this) ); | |
e118b27e | 66 | } |
67 | ||
68 | //______________________________________________________________________________ | |
69 | AliMUONGeometrySegmentation::AliMUONGeometrySegmentation() | |
70 | : TObject(), | |
71 | fCurrentDetElemId(0), | |
72 | fCurrentDetElement(0), | |
73 | fCurrentSegmentation(0), | |
5db8c9c1 | 74 | fkModuleTransformer(0), |
75 | fDESegmentations(0), | |
76 | fDENames(0) | |
77 | ||
e118b27e | 78 | { |
692de412 | 79 | /// Default Constructor |
5db8c9c1 | 80 | |
81 | AliDebug(1, Form("default (empty) ctor this = %p", this)); | |
e118b27e | 82 | } |
83 | ||
e118b27e | 84 | //______________________________________________________________________________ |
692de412 | 85 | AliMUONGeometrySegmentation::~AliMUONGeometrySegmentation() |
86 | { | |
87 | /// Destructor | |
e118b27e | 88 | |
5db8c9c1 | 89 | AliDebug(1, Form("dtor this = %p", this)); |
90 | ||
e118b27e | 91 | delete fDESegmentations; |
5db8c9c1 | 92 | delete fDENames; |
e118b27e | 93 | } |
94 | ||
e118b27e | 95 | // |
96 | // private methods | |
97 | // | |
98 | ||
99 | //______________________________________________________________________________ | |
dec74ccc | 100 | Bool_t AliMUONGeometrySegmentation::OwnNotify(Int_t detElemId, Bool_t warn) const |
e118b27e | 101 | { |
692de412 | 102 | /// Update current detection element and segmentation, |
103 | /// and checks if they exist. | |
104 | /// Return true if success. | |
e118b27e | 105 | |
106 | if (detElemId != fCurrentDetElemId) { | |
107 | ||
108 | // Find detection element and its segmentation | |
109 | AliMUONGeometryDetElement* detElement | |
dec74ccc | 110 | = fkModuleTransformer->GetDetElement(detElemId, warn); |
e118b27e | 111 | if (!detElement) { |
dec74ccc | 112 | if (warn) |
113 | AliError(Form("Detection element %d not defined", detElemId)); | |
e118b27e | 114 | return false; |
115 | } | |
116 | ||
e0a49962 | 117 | AliMUONVGeometryDESegmentation* segmentation |
21f7f426 | 118 | = (AliMUONVGeometryDESegmentation*) fDESegmentations->GetValue(detElemId); |
e118b27e | 119 | if (!segmentation) { |
dec74ccc | 120 | if (warn) |
121 | AliError(Form("Segmentation for detection element %d not defined", | |
122 | detElemId)); | |
e118b27e | 123 | return false; |
124 | } | |
125 | ||
126 | fCurrentDetElemId = detElemId; | |
127 | fCurrentDetElement = detElement; | |
128 | fCurrentSegmentation = segmentation; | |
129 | } | |
130 | ||
131 | return true; | |
132 | } | |
133 | ||
134 | // | |
135 | // public methods | |
136 | // | |
137 | ||
138 | //______________________________________________________________________________ | |
5db8c9c1 | 139 | void AliMUONGeometrySegmentation::Add(Int_t detElemId, const TString& detElemName, |
e0a49962 | 140 | AliMUONVGeometryDESegmentation* segmentation) |
e118b27e | 141 | { |
692de412 | 142 | /// Add detection element segmentation |
e118b27e | 143 | |
144 | fDESegmentations->Add(detElemId, segmentation); | |
5db8c9c1 | 145 | fDENames->Add(detElemId, new TObjString(detElemName)); |
e118b27e | 146 | } |
147 | ||
f5ed7890 | 148 | |
149 | //______________________________________________________________________________ | |
150 | const AliMUONVGeometryDESegmentation* | |
dec74ccc | 151 | AliMUONGeometrySegmentation::GetDESegmentation(Int_t detElemId, Bool_t warn) const |
f5ed7890 | 152 | { |
692de412 | 153 | /// Return the DE segmentation |
f5ed7890 | 154 | |
dec74ccc | 155 | if (!OwnNotify(detElemId, warn)) return 0; |
f5ed7890 | 156 | |
157 | return fCurrentSegmentation; | |
158 | } | |
159 | ||
6b1e4b22 | 160 | //______________________________________________________________________________ |
161 | AliMUONGeometryDirection | |
162 | AliMUONGeometrySegmentation::GetDirection(Int_t detElemId) const | |
163 | { | |
a9aad96e | 164 | /// Return direction with a constant pad size. |
692de412 | 165 | /// (Direction or coordinate where the resolution is the best) |
6b1e4b22 | 166 | |
4ebc2323 | 167 | if (!OwnNotify(detElemId)) return kDirUndefined; |
6b1e4b22 | 168 | |
169 | return fCurrentSegmentation->GetDirection(); | |
170 | } | |
171 | ||
5db8c9c1 | 172 | //______________________________________________________________________________ |
173 | TString AliMUONGeometrySegmentation::GetDEName(Int_t detElemId) const | |
174 | { | |
175 | /// Return name of the given detection element | |
176 | ||
21f7f426 | 177 | TObjString* deName = (TObjString*)fDENames->GetValue(detElemId); |
5db8c9c1 | 178 | |
179 | if (deName) | |
180 | return deName->GetString(); | |
181 | else { | |
182 | AliWarningStream() | |
183 | << "Detection element " << detElemId << " not defined. " << endl; | |
184 | return "Undefined"; | |
185 | } | |
186 | } | |
187 | ||
1d7b6529 | 188 | //______________________________________________________________________________ |
189 | void AliMUONGeometrySegmentation::Print(Option_t* opt) const | |
190 | { | |
a9aad96e | 191 | /// Print DE segmentations |
1d7b6529 | 192 | |
193 | std::cout << "fDESegmentations (class " | |
194 | << fDESegmentations->Class()->GetName() << ") entries=" | |
21f7f426 | 195 | << fDESegmentations->GetSize() |
1d7b6529 | 196 | << std::endl; |
197 | fDESegmentations->Print(opt); | |
198 | } | |
199 | ||
e118b27e | 200 | //______________________________________________________________________________ |
201 | void AliMUONGeometrySegmentation::SetPadSize(Float_t p1, Float_t p2) | |
202 | { | |
692de412 | 203 | /// Set pad size Dx*Dy to all detection element segmentations |
e118b27e | 204 | |
21f7f426 | 205 | for (Int_t i=0; i<fDESegmentations->GetSize(); i++) { |
e0a49962 | 206 | AliMUONVGeometryDESegmentation* segmentation |
21f7f426 | 207 | = (AliMUONVGeometryDESegmentation*)fDESegmentations->GetObject(i); |
e118b27e | 208 | segmentation->SetPadSize(p1, p2); |
209 | } | |
210 | } | |
211 | ||
212 | //______________________________________________________________________________ | |
213 | void AliMUONGeometrySegmentation::SetDAnod(Float_t d) | |
214 | { | |
692de412 | 215 | /// Set anod pitch to all detection element segmentations |
e118b27e | 216 | |
21f7f426 | 217 | for (Int_t i=0; i<fDESegmentations->GetSize(); i++) { |
e0a49962 | 218 | AliMUONVGeometryDESegmentation* segmentation |
21f7f426 | 219 | = (AliMUONVGeometryDESegmentation*)fDESegmentations->GetObject(i); |
e118b27e | 220 | segmentation->SetDAnod(d); |
221 | } | |
222 | } | |
223 | ||
224 | //______________________________________________________________________________ | |
225 | Float_t AliMUONGeometrySegmentation::GetAnod(Int_t detElemId, Float_t xhit) const | |
226 | { | |
692de412 | 227 | /// Anod wire coordinate closest to xhit |
228 | /// Returns for a hit position xhit the position of the nearest anode wire | |
229 | /// !!! xhit is understand a a distance, not as a position in the space | |
230 | /// CHECK | |
e118b27e | 231 | |
4ebc2323 | 232 | if (!OwnNotify(detElemId)) return 0; |
e118b27e | 233 | |
234 | return fCurrentSegmentation->GetAnod(xhit); | |
235 | } | |
236 | ||
237 | //______________________________________________________________________________ | |
e0a49962 | 238 | Bool_t AliMUONGeometrySegmentation::GetPadI(Int_t detElemId, |
e118b27e | 239 | Float_t xg, Float_t yg, Float_t zg, |
240 | Int_t& ix, Int_t& iy) | |
241 | { | |
692de412 | 242 | /// Return pad coordinates (ix,iy) for given real coordinates (x,y) |
e118b27e | 243 | |
4ebc2323 | 244 | if (!OwnNotify(detElemId)) return false; |
245 | ||
e118b27e | 246 | Float_t xl, yl, zl; |
247 | fCurrentDetElement->Global2Local(xg, yg, zg, xl, yl, zl); | |
248 | ||
6ce4d43a | 249 | if (!fCurrentSegmentation->HasPad(xl, yl, zl)) return false; |
250 | ||
e118b27e | 251 | fCurrentSegmentation->GetPadI(xl, yl, zl, ix, iy); |
e0a49962 | 252 | return true; |
e118b27e | 253 | } |
1d7b6529 | 254 | |
255 | //______________________________________________________________________________ | |
256 | Bool_t | |
257 | AliMUONGeometrySegmentation::HasPad(Int_t detElemId, Int_t ix, Int_t iy) | |
258 | { | |
a9aad96e | 259 | /// Tell if a given pad exists in a given detector element |
1d7b6529 | 260 | |
3aadd064 | 261 | if (!OwnNotify(detElemId)) return false; |
1d7b6529 | 262 | |
3aadd064 | 263 | return fCurrentSegmentation->HasPad(ix,iy); |
1d7b6529 | 264 | } |
265 | ||
e2d5c9df | 266 | //______________________________________________________________________________ |
267 | Bool_t | |
268 | AliMUONGeometrySegmentation::HasPad(Int_t detElemId, | |
d0ef3a7b | 269 | Float_t xg, Float_t yg, Float_t zg) |
e2d5c9df | 270 | { |
a9aad96e | 271 | /// Tell if a given pad exists in a given detector element |
e2d5c9df | 272 | |
273 | if (!OwnNotify(detElemId)) return false; | |
274 | ||
275 | Float_t xl, yl, zl; | |
276 | fCurrentDetElement->Global2Local(xg, yg, zg, xl, yl, zl); | |
277 | ||
278 | return fCurrentSegmentation->HasPad(xl, yl, zl); | |
279 | } | |
280 | ||
e118b27e | 281 | //______________________________________________________________________________ |
3aadd064 | 282 | Bool_t |
283 | AliMUONGeometrySegmentation::GetPadC(Int_t detElemId, | |
284 | Int_t ix, Int_t iy, | |
285 | Float_t& xg, Float_t& yg, Float_t& zg) | |
e118b27e | 286 | { |
692de412 | 287 | /// Transform from pad to real coordinates |
e118b27e | 288 | |
4ebc2323 | 289 | if (!OwnNotify(detElemId)) return false; |
3aadd064 | 290 | |
291 | if (!fCurrentSegmentation->HasPad(ix, iy)) { | |
292 | xg = yg = zg = fgkMaxDistance; | |
293 | return false; | |
294 | } | |
295 | ||
e118b27e | 296 | Float_t xl, yl, zl; |
297 | fCurrentSegmentation->GetPadC(ix, iy, xl , yl, zl); | |
298 | ||
5db8c9c1 | 299 | fkModuleTransformer->Local2Global(detElemId, xl, yl, zl, xg, yg, zg); |
e0a49962 | 300 | return true; |
e118b27e | 301 | } |
302 | ||
e118b27e | 303 | //______________________________________________________________________________ |
75b9419c | 304 | void AliMUONGeometrySegmentation::Init(Int_t chamber) |
e118b27e | 305 | { |
692de412 | 306 | /// Initialize segmentation. |
307 | /// Check that all detection elements have segmanetation set | |
e118b27e | 308 | |
309 | // Loop over detection elements | |
21f7f426 | 310 | AliMpExMap* detElements = fkModuleTransformer->GetDetElementStore(); |
311 | ||
312 | for (Int_t i=0; i<detElements->GetSize(); i++) { | |
e118b27e | 313 | |
21f7f426 | 314 | // Skip not filled entries |
315 | if (!detElements->GetObject(i)) continue; | |
e118b27e | 316 | |
317 | // Get detction element Id | |
21f7f426 | 318 | Int_t detElemId = detElements->GetObject(i)->GetUniqueID(); |
e118b27e | 319 | |
320 | // Check segmentation | |
21f7f426 | 321 | if (! fDESegmentations->GetValue(detElemId) ) { |
322 | AliErrorStream() | |
323 | << "Detection element " << detElemId << " has not a segmentation set." | |
324 | << endl; | |
75b9419c | 325 | } |
326 | else { | |
327 | // Initialize DE Segmentation | |
21f7f426 | 328 | ((AliSegmentation*)fDESegmentations->GetValue(detElemId))->Init(chamber); |
75b9419c | 329 | } |
e118b27e | 330 | } |
331 | } | |
332 | ||
333 | //______________________________________________________________________________ | |
334 | Float_t AliMUONGeometrySegmentation::Dpx(Int_t detElemId) const | |
335 | { | |
692de412 | 336 | /// Get pad size in x |
e118b27e | 337 | |
4ebc2323 | 338 | if (!OwnNotify(detElemId)) return 0.; |
e118b27e | 339 | |
340 | return fCurrentSegmentation->Dpx(); | |
341 | } | |
342 | ||
343 | //______________________________________________________________________________ | |
344 | Float_t AliMUONGeometrySegmentation::Dpy(Int_t detElemId) const | |
345 | { | |
692de412 | 346 | /// Get pad size in y |
e118b27e | 347 | |
4ebc2323 | 348 | if (!OwnNotify(detElemId)) return 0.; |
e118b27e | 349 | |
350 | return fCurrentSegmentation->Dpy(); | |
351 | } | |
352 | ||
353 | //______________________________________________________________________________ | |
354 | Float_t AliMUONGeometrySegmentation::Dpx(Int_t detElemId, Int_t isector) const | |
355 | { | |
692de412 | 356 | /// Pad size in x by sector |
e118b27e | 357 | |
4ebc2323 | 358 | if (!OwnNotify(detElemId)) return 0.; |
e118b27e | 359 | |
360 | return fCurrentSegmentation->Dpx(isector); | |
361 | } | |
362 | ||
363 | //______________________________________________________________________________ | |
364 | Float_t AliMUONGeometrySegmentation::Dpy(Int_t detElemId, Int_t isector) const | |
365 | { | |
a9aad96e | 366 | /// Pad size in y by Sector |
e118b27e | 367 | |
4ebc2323 | 368 | if (!OwnNotify(detElemId)) return 0.; |
e118b27e | 369 | |
370 | return fCurrentSegmentation->Dpy(isector); | |
371 | } | |
372 | ||
373 | //______________________________________________________________________________ | |
374 | Int_t AliMUONGeometrySegmentation::Npx(Int_t detElemId) const | |
375 | { | |
692de412 | 376 | /// Maximum number of Pads in x |
e118b27e | 377 | |
4ebc2323 | 378 | if (!OwnNotify(detElemId)) return 0; |
e118b27e | 379 | |
380 | return fCurrentSegmentation->Npx(); | |
381 | } | |
382 | ||
383 | //______________________________________________________________________________ | |
384 | Int_t AliMUONGeometrySegmentation::Npy(Int_t detElemId) const | |
385 | { | |
692de412 | 386 | /// Maximum number of Pads in y |
e118b27e | 387 | |
4ebc2323 | 388 | if (!OwnNotify(detElemId)) return 0; |
e118b27e | 389 | |
390 | return fCurrentSegmentation->Npy(); | |
391 | } | |
392 | ||
393 | //______________________________________________________________________________ | |
394 | void AliMUONGeometrySegmentation::SetPad(Int_t detElemId, Int_t ix, Int_t iy) | |
395 | { | |
692de412 | 396 | /// Set pad position. |
397 | /// Sets virtual pad coordinates, needed for evaluating pad response | |
398 | /// outside the tracking program. | |
399 | /// From AliMUONGeometrySegmentationV01. | |
e118b27e | 400 | |
4ebc2323 | 401 | if (!OwnNotify(detElemId)) return; |
e118b27e | 402 | |
403 | fCurrentSegmentation->SetPad(ix, iy); | |
404 | } | |
405 | ||
406 | //______________________________________________________________________________ | |
407 | void AliMUONGeometrySegmentation::SetHit(Int_t detElemId, | |
408 | Float_t xghit, Float_t yghit, Float_t zghit) | |
409 | { | |
a9aad96e | 410 | /// Set hit position. |
692de412 | 411 | /// Sets virtual hit position, needed for evaluating pad response |
412 | /// outside the tracking program | |
413 | /// From AliMUONGeometrySegmentationV01. | |
e118b27e | 414 | |
4ebc2323 | 415 | if (!OwnNotify(detElemId)) return; |
e118b27e | 416 | |
417 | Float_t xl, yl, zl; | |
418 | fCurrentDetElement->Global2Local(xghit, yghit, zghit, xl, yl, zl); | |
419 | ||
420 | fCurrentSegmentation->SetHit(xl, yl, zl); | |
421 | } | |
422 | ||
423 | //______________________________________________________________________________ | |
424 | void AliMUONGeometrySegmentation::FirstPad(Int_t detElemId, | |
425 | Float_t xghit, Float_t yghit, Float_t zghit, | |
426 | Float_t dx, Float_t dy) | |
427 | { | |
692de412 | 428 | /// Iterate over pads - initialiser |
e118b27e | 429 | |
4ebc2323 | 430 | if (!OwnNotify(detElemId)) return; |
e118b27e | 431 | |
5db8c9c1 | 432 | AliDebug(1,Form("xghit, yghit, zghit, dx, dy = %e,%e,%e,%e, %e", |
433 | xghit, yghit, zghit, dx, dy)); | |
434 | ||
e118b27e | 435 | Float_t xl, yl, zl; |
436 | fCurrentDetElement->Global2Local(xghit, yghit, zghit, xl, yl, zl); | |
437 | ||
438 | fCurrentSegmentation->FirstPad(xl, yl, zl, dx, dy); | |
439 | } | |
440 | ||
441 | //______________________________________________________________________________ | |
442 | void AliMUONGeometrySegmentation::NextPad(Int_t detElemId) | |
443 | { | |
692de412 | 444 | /// Iterate over pads - stepper |
e118b27e | 445 | |
4ebc2323 | 446 | if (!OwnNotify(detElemId)) return; |
e118b27e | 447 | |
448 | fCurrentSegmentation->NextPad(); | |
449 | } | |
450 | ||
451 | //______________________________________________________________________________ | |
452 | Int_t AliMUONGeometrySegmentation::MorePads(Int_t detElemId) | |
453 | { | |
692de412 | 454 | /// Iterate over pads - condition |
e118b27e | 455 | |
4ebc2323 | 456 | if (!OwnNotify(detElemId)) return 0; |
e118b27e | 457 | |
458 | return fCurrentSegmentation->MorePads(); | |
459 | } | |
460 | ||
461 | //______________________________________________________________________________ | |
462 | Float_t AliMUONGeometrySegmentation::Distance2AndOffset(Int_t detElemId, | |
463 | Int_t ix, Int_t iy, | |
464 | Float_t xg, Float_t yg, Float_t zg, | |
465 | Int_t* dummy) | |
466 | { | |
692de412 | 467 | /// Return the square of the distance between 1 pad |
468 | /// labelled by its channel numbers and a coordinate | |
e118b27e | 469 | |
4ebc2323 | 470 | if (!OwnNotify(detElemId)) return 0.; |
e118b27e | 471 | |
472 | Float_t xl, yl, zl; | |
473 | fCurrentDetElement->Global2Local(xg, yg, zg, xl, yl, zl); | |
474 | ||
475 | return fCurrentSegmentation->Distance2AndOffset(ix, iy, xl, yl, dummy); | |
476 | } | |
477 | ||
478 | //______________________________________________________________________________ | |
479 | void AliMUONGeometrySegmentation::GetNParallelAndOffset(Int_t detElemId, | |
480 | Int_t ix, Int_t iy, | |
481 | Int_t* nparallel, Int_t* offset) | |
482 | { | |
692de412 | 483 | /// Number of pads read in parallel and offset to add to x |
484 | /// (specific to LYON, but mandatory for display) | |
485 | /// CHECK | |
e118b27e | 486 | |
4ebc2323 | 487 | if (!OwnNotify(detElemId)) return; |
e118b27e | 488 | |
489 | fCurrentSegmentation->GetNParallelAndOffset(ix, iy, nparallel, offset); | |
490 | } | |
491 | ||
492 | ||
493 | //______________________________________________________________________________ | |
494 | void AliMUONGeometrySegmentation::Neighbours(Int_t detElemId, | |
495 | Int_t ix, Int_t iy, | |
496 | Int_t* nlist, | |
497 | Int_t xlist[10], Int_t ylist[10]) | |
498 | { | |
692de412 | 499 | /// Get next neighbours |
e118b27e | 500 | |
4ebc2323 | 501 | if (!OwnNotify(detElemId)) return; |
e118b27e | 502 | |
503 | fCurrentSegmentation->Neighbours(ix, iy, nlist, xlist, ylist); | |
504 | } | |
505 | ||
506 | //______________________________________________________________________________ | |
507 | Int_t AliMUONGeometrySegmentation::Ix() | |
508 | { | |
692de412 | 509 | /// Current pad cursor during disintegration |
510 | /// x, y-coordinate | |
e118b27e | 511 | |
512 | return fCurrentSegmentation->Ix(); | |
513 | } | |
514 | ||
515 | //______________________________________________________________________________ | |
516 | Int_t AliMUONGeometrySegmentation::Iy() | |
517 | { | |
692de412 | 518 | /// Current pad cursor during disintegration |
519 | /// x, y-coordinate | |
e118b27e | 520 | |
521 | return fCurrentSegmentation->Iy(); | |
522 | } | |
523 | ||
524 | //______________________________________________________________________________ | |
525 | Int_t AliMUONGeometrySegmentation::DetElemId() | |
526 | { | |
692de412 | 527 | /// Current pad cursor during disintegration |
528 | /// x, y-coordinate | |
e118b27e | 529 | |
530 | return fCurrentDetElemId; | |
531 | } | |
532 | ||
533 | //______________________________________________________________________________ | |
534 | Int_t AliMUONGeometrySegmentation::ISector() | |
535 | { | |
692de412 | 536 | /// Current sector |
e118b27e | 537 | |
538 | return fCurrentSegmentation->ISector(); | |
539 | } | |
540 | ||
541 | //______________________________________________________________________________ | |
542 | Int_t AliMUONGeometrySegmentation::Sector(Int_t detElemId, Int_t ix, Int_t iy) | |
543 | { | |
a9aad96e | 544 | /// Calculate sector from pad indices |
e118b27e | 545 | |
4ebc2323 | 546 | if (!OwnNotify(detElemId)) return 0; |
e118b27e | 547 | |
548 | return fCurrentSegmentation->Sector(ix, iy); | |
549 | } | |
550 | ||
551 | //______________________________________________________________________________ | |
552 | Int_t AliMUONGeometrySegmentation::Sector(Int_t detElemId, | |
553 | Float_t xg, Float_t yg, Float_t zg) | |
554 | { | |
692de412 | 555 | /// Calculate sector from pad coordinates |
e118b27e | 556 | |
4ebc2323 | 557 | if (!OwnNotify(detElemId)) return 0; |
e118b27e | 558 | |
559 | Float_t xl, yl, zl; | |
560 | fCurrentDetElement->Global2Local(xg, yg, zg, xl, yl, zl); | |
561 | ||
562 | return fCurrentSegmentation->Sector(xl, yl); | |
563 | } | |
564 | ||
565 | //______________________________________________________________________________ | |
566 | void AliMUONGeometrySegmentation::IntegrationLimits(Int_t detElemId, | |
567 | Float_t& x1, Float_t& x2, | |
568 | Float_t& y1, Float_t& y2) | |
569 | { | |
692de412 | 570 | /// Current integration limits |
e118b27e | 571 | |
4ebc2323 | 572 | if (!OwnNotify(detElemId)) return; |
e118b27e | 573 | |
7d54fd29 | 574 | fCurrentSegmentation->IntegrationLimits(x1, x2, y1, y2); |
e118b27e | 575 | } |
576 | ||
577 | //______________________________________________________________________________ | |
578 | Int_t AliMUONGeometrySegmentation::SigGenCond(Int_t detElemId, | |
579 | Float_t xg, Float_t yg, Float_t zg) | |
580 | { | |
692de412 | 581 | /// Signal Generation Condition during Stepping |
582 | /// 0: don't generate signal \n | |
583 | /// 1: generate signal \n | |
584 | /// Comments: \n | |
585 | /// \n | |
586 | /// Crossing of pad boundary and mid plane between neighbouring wires is checked. | |
587 | /// To correctly simulate the dependence of the spatial resolution on the angle | |
588 | /// of incidence signal must be generated for constant steps on | |
589 | /// the projection of the trajectory along the anode wire. | |
590 | /// \n | |
591 | /// Signal will be generated if particle crosses pad boundary or | |
592 | /// boundary between two wires. | |
e118b27e | 593 | |
4ebc2323 | 594 | if (!OwnNotify(detElemId)) return 0; |
e118b27e | 595 | |
596 | Float_t xl, yl, zl; | |
597 | fCurrentDetElement->Global2Local(xg, yg, zg, xl, yl, zl); | |
598 | ||
599 | return fCurrentSegmentation->SigGenCond(xl, yl, zl); | |
600 | } | |
601 | ||
e118b27e | 602 | //______________________________________________________________________________ |
603 | void AliMUONGeometrySegmentation::SigGenInit(Int_t detElemId, | |
604 | Float_t xg, Float_t yg, Float_t zg) | |
605 | { | |
692de412 | 606 | /// Initialise signal generation at coord (x,y,z) |
607 | /// Initialise pad and wire position during stepping. | |
608 | /// From AliMUONGeometrySegmentationV01 | |
e118b27e | 609 | |
4ebc2323 | 610 | if (!OwnNotify(detElemId)) return; |
e118b27e | 611 | |
612 | Float_t xl, yl, zl; | |
613 | fCurrentDetElement->Global2Local(xg, yg, zg, xl, yl, zl); | |
614 | ||
75b9419c | 615 | if (!fCurrentSegmentation->HasPad(xl, yl, zl)) { |
616 | AliWarningStream() | |
617 | << "No pad at " << detElemId | |
618 | << " global position: " << xg << " " << yg << " " << zg | |
619 | << " local position: " << xl << " " << yl << " " << zl << endl; | |
620 | return ; | |
621 | } | |
622 | ||
e118b27e | 623 | fCurrentSegmentation->SigGenInit(xl, yl, zl); |
624 | } | |
625 | ||
626 | //______________________________________________________________________________ | |
627 | void AliMUONGeometrySegmentation::GiveTestPoints(Int_t /*detElemId*/, | |
628 | Int_t& /*n*/, | |
629 | Float_t* /*xg*/, Float_t* /*yg*/) const | |
630 | { | |
692de412 | 631 | /// Test points for auto calibration |
632 | /// Return test point on the pad plane. | |
633 | /// Used during determination of the segmoid correction of the COG-method | |
634 | /// From AliMUONGeometrySegmentationV01 | |
e118b27e | 635 | |
636 | // Requires change of interface | |
637 | // to convert points from local to global we need z coordinate | |
638 | AliError("Not implemented."); | |
639 | } | |
640 | ||
641 | //______________________________________________________________________________ | |
4ebc2323 | 642 | void AliMUONGeometrySegmentation::Draw(const char* opt) |
643 | { | |
692de412 | 644 | /// Draw the segmentation zones for all detElemId |
4ebc2323 | 645 | |
21f7f426 | 646 | for (Int_t i=0; i<fDESegmentations->GetSize(); i++) { |
4ebc2323 | 647 | AliMUONVGeometryDESegmentation* segmentation |
21f7f426 | 648 | = (AliMUONVGeometryDESegmentation*)fDESegmentations->GetObject(i); |
4ebc2323 | 649 | segmentation->Draw(opt); |
650 | } | |
651 | } | |
652 | ||
653 | //______________________________________________________________________________ | |
654 | void AliMUONGeometrySegmentation::Draw(Int_t detElemId, const char* opt) | |
e118b27e | 655 | { |
692de412 | 656 | /// Draw the segmentation zones for a given detElemId. |
e118b27e | 657 | |
4ebc2323 | 658 | if (!OwnNotify(detElemId)) return; |
e118b27e | 659 | |
660 | fCurrentSegmentation->Draw(opt); | |
661 | } | |
662 | ||
663 | //______________________________________________________________________________ | |
664 | void AliMUONGeometrySegmentation::SetCorrFunc(Int_t detElemId, | |
665 | Int_t isec, TF1* func) | |
666 | { | |
692de412 | 667 | /// Set the correction function. |
668 | /// From AliMUONGeometrySegmentationV01 | |
e118b27e | 669 | |
4ebc2323 | 670 | if (!OwnNotify(detElemId)) return; |
e118b27e | 671 | |
672 | fCurrentSegmentation->SetCorrFunc(isec, func); | |
673 | } | |
674 | ||
675 | //______________________________________________________________________________ | |
676 | TF1* AliMUONGeometrySegmentation::CorrFunc(Int_t detElemId, Int_t isec) const | |
677 | { | |
692de412 | 678 | /// Get the correction Function. |
679 | /// From AliMUONGeometrySegmentationV01 | |
e118b27e | 680 | |
4ebc2323 | 681 | if (!OwnNotify(detElemId)) return 0; |
e118b27e | 682 | |
683 | return fCurrentSegmentation->CorrFunc(isec); | |
684 | } | |
685 |