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