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