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