]>
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 | ||
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 | ||
e118b27e | 291 | //______________________________________________________________________________ |
3aadd064 | 292 | Bool_t |
293 | AliMUONGeometrySegmentation::GetPadC(Int_t detElemId, | |
294 | Int_t ix, Int_t iy, | |
295 | Float_t& xg, Float_t& yg, Float_t& zg) | |
e118b27e | 296 | { |
692de412 | 297 | /// Transform from pad to real coordinates |
e118b27e | 298 | |
4ebc2323 | 299 | if (!OwnNotify(detElemId)) return false; |
3aadd064 | 300 | |
301 | if (!fCurrentSegmentation->HasPad(ix, iy)) { | |
302 | xg = yg = zg = fgkMaxDistance; | |
303 | return false; | |
304 | } | |
305 | ||
e118b27e | 306 | Float_t xl, yl, zl; |
307 | fCurrentSegmentation->GetPadC(ix, iy, xl , yl, zl); | |
308 | ||
5db8c9c1 | 309 | fkModuleTransformer->Local2Global(detElemId, xl, yl, zl, xg, yg, zg); |
e0a49962 | 310 | return true; |
e118b27e | 311 | } |
312 | ||
e118b27e | 313 | //______________________________________________________________________________ |
75b9419c | 314 | void AliMUONGeometrySegmentation::Init(Int_t chamber) |
e118b27e | 315 | { |
692de412 | 316 | /// Initialize segmentation. |
317 | /// Check that all detection elements have segmanetation set | |
e118b27e | 318 | |
319 | // Loop over detection elements | |
5db8c9c1 | 320 | AliMUONGeometryStore* detElements = fkModuleTransformer->GetDetElementStore(); |
e118b27e | 321 | |
322 | for (Int_t i=0; i<detElements->GetNofEntries(); i++) { | |
323 | ||
324 | // Get detction element Id | |
325 | Int_t detElemId = detElements->GetEntry(i)->GetUniqueID(); | |
326 | ||
327 | // Check segmentation | |
75b9419c | 328 | if (! fDESegmentations->Get(detElemId) ) { |
e118b27e | 329 | AliError(Form("Detection element %d has not a segmentation set.", |
75b9419c | 330 | detElements->GetEntry(i)->GetUniqueID())); |
331 | } | |
332 | else { | |
333 | // Initialize DE Segmentation | |
334 | ((AliSegmentation*)fDESegmentations->Get(detElemId))->Init(chamber); | |
335 | } | |
e118b27e | 336 | } |
337 | } | |
338 | ||
339 | //______________________________________________________________________________ | |
340 | Float_t AliMUONGeometrySegmentation::Dpx(Int_t detElemId) const | |
341 | { | |
692de412 | 342 | /// Get pad size in x |
e118b27e | 343 | |
4ebc2323 | 344 | if (!OwnNotify(detElemId)) return 0.; |
e118b27e | 345 | |
346 | return fCurrentSegmentation->Dpx(); | |
347 | } | |
348 | ||
349 | //______________________________________________________________________________ | |
350 | Float_t AliMUONGeometrySegmentation::Dpy(Int_t detElemId) const | |
351 | { | |
692de412 | 352 | /// Get pad size in y |
e118b27e | 353 | |
4ebc2323 | 354 | if (!OwnNotify(detElemId)) return 0.; |
e118b27e | 355 | |
356 | return fCurrentSegmentation->Dpy(); | |
357 | } | |
358 | ||
359 | //______________________________________________________________________________ | |
360 | Float_t AliMUONGeometrySegmentation::Dpx(Int_t detElemId, Int_t isector) const | |
361 | { | |
692de412 | 362 | /// Pad size in x by sector |
e118b27e | 363 | |
4ebc2323 | 364 | if (!OwnNotify(detElemId)) return 0.; |
e118b27e | 365 | |
366 | return fCurrentSegmentation->Dpx(isector); | |
367 | } | |
368 | ||
369 | //______________________________________________________________________________ | |
370 | Float_t AliMUONGeometrySegmentation::Dpy(Int_t detElemId, Int_t isector) const | |
371 | { | |
692de412 | 372 | /// Pad size in x, y by Sector |
e118b27e | 373 | |
4ebc2323 | 374 | if (!OwnNotify(detElemId)) return 0.; |
e118b27e | 375 | |
376 | return fCurrentSegmentation->Dpy(isector); | |
377 | } | |
378 | ||
379 | //______________________________________________________________________________ | |
380 | Int_t AliMUONGeometrySegmentation::Npx(Int_t detElemId) const | |
381 | { | |
692de412 | 382 | /// Maximum number of Pads in x |
e118b27e | 383 | |
4ebc2323 | 384 | if (!OwnNotify(detElemId)) return 0; |
e118b27e | 385 | |
386 | return fCurrentSegmentation->Npx(); | |
387 | } | |
388 | ||
389 | //______________________________________________________________________________ | |
390 | Int_t AliMUONGeometrySegmentation::Npy(Int_t detElemId) const | |
391 | { | |
692de412 | 392 | /// Maximum number of Pads in y |
e118b27e | 393 | |
4ebc2323 | 394 | if (!OwnNotify(detElemId)) return 0; |
e118b27e | 395 | |
396 | return fCurrentSegmentation->Npy(); | |
397 | } | |
398 | ||
399 | //______________________________________________________________________________ | |
400 | void AliMUONGeometrySegmentation::SetPad(Int_t detElemId, Int_t ix, Int_t iy) | |
401 | { | |
692de412 | 402 | /// Set pad position. |
403 | /// Sets virtual pad coordinates, needed for evaluating pad response | |
404 | /// outside the tracking program. | |
405 | /// From AliMUONGeometrySegmentationV01. | |
e118b27e | 406 | |
4ebc2323 | 407 | if (!OwnNotify(detElemId)) return; |
e118b27e | 408 | |
409 | fCurrentSegmentation->SetPad(ix, iy); | |
410 | } | |
411 | ||
412 | //______________________________________________________________________________ | |
413 | void AliMUONGeometrySegmentation::SetHit(Int_t detElemId, | |
414 | Float_t xghit, Float_t yghit, Float_t zghit) | |
415 | { | |
692de412 | 416 | /// Set hit position |
417 | /// Sets virtual hit position, needed for evaluating pad response | |
418 | /// outside the tracking program | |
419 | /// From AliMUONGeometrySegmentationV01. | |
e118b27e | 420 | |
4ebc2323 | 421 | if (!OwnNotify(detElemId)) return; |
e118b27e | 422 | |
423 | Float_t xl, yl, zl; | |
424 | fCurrentDetElement->Global2Local(xghit, yghit, zghit, xl, yl, zl); | |
425 | ||
426 | fCurrentSegmentation->SetHit(xl, yl, zl); | |
427 | } | |
428 | ||
429 | //______________________________________________________________________________ | |
430 | void AliMUONGeometrySegmentation::FirstPad(Int_t detElemId, | |
431 | Float_t xghit, Float_t yghit, Float_t zghit, | |
432 | Float_t dx, Float_t dy) | |
433 | { | |
692de412 | 434 | /// Iterate over pads - initialiser |
e118b27e | 435 | |
4ebc2323 | 436 | if (!OwnNotify(detElemId)) return; |
e118b27e | 437 | |
5db8c9c1 | 438 | AliDebug(1,Form("xghit, yghit, zghit, dx, dy = %e,%e,%e,%e, %e", |
439 | xghit, yghit, zghit, dx, dy)); | |
440 | ||
e118b27e | 441 | Float_t xl, yl, zl; |
442 | fCurrentDetElement->Global2Local(xghit, yghit, zghit, xl, yl, zl); | |
443 | ||
444 | fCurrentSegmentation->FirstPad(xl, yl, zl, dx, dy); | |
445 | } | |
446 | ||
447 | //______________________________________________________________________________ | |
448 | void AliMUONGeometrySegmentation::NextPad(Int_t detElemId) | |
449 | { | |
692de412 | 450 | /// Iterate over pads - stepper |
e118b27e | 451 | |
4ebc2323 | 452 | if (!OwnNotify(detElemId)) return; |
e118b27e | 453 | |
454 | fCurrentSegmentation->NextPad(); | |
455 | } | |
456 | ||
457 | //______________________________________________________________________________ | |
458 | Int_t AliMUONGeometrySegmentation::MorePads(Int_t detElemId) | |
459 | { | |
692de412 | 460 | /// Iterate over pads - condition |
e118b27e | 461 | |
4ebc2323 | 462 | if (!OwnNotify(detElemId)) return 0; |
e118b27e | 463 | |
464 | return fCurrentSegmentation->MorePads(); | |
465 | } | |
466 | ||
467 | //______________________________________________________________________________ | |
468 | Float_t AliMUONGeometrySegmentation::Distance2AndOffset(Int_t detElemId, | |
469 | Int_t ix, Int_t iy, | |
470 | Float_t xg, Float_t yg, Float_t zg, | |
471 | Int_t* dummy) | |
472 | { | |
692de412 | 473 | /// Return the square of the distance between 1 pad |
474 | /// labelled by its channel numbers and a coordinate | |
e118b27e | 475 | |
4ebc2323 | 476 | if (!OwnNotify(detElemId)) return 0.; |
e118b27e | 477 | |
478 | Float_t xl, yl, zl; | |
479 | fCurrentDetElement->Global2Local(xg, yg, zg, xl, yl, zl); | |
480 | ||
481 | return fCurrentSegmentation->Distance2AndOffset(ix, iy, xl, yl, dummy); | |
482 | } | |
483 | ||
484 | //______________________________________________________________________________ | |
485 | void AliMUONGeometrySegmentation::GetNParallelAndOffset(Int_t detElemId, | |
486 | Int_t ix, Int_t iy, | |
487 | Int_t* nparallel, Int_t* offset) | |
488 | { | |
692de412 | 489 | /// Number of pads read in parallel and offset to add to x |
490 | /// (specific to LYON, but mandatory for display) | |
491 | /// CHECK | |
e118b27e | 492 | |
4ebc2323 | 493 | if (!OwnNotify(detElemId)) return; |
e118b27e | 494 | |
495 | fCurrentSegmentation->GetNParallelAndOffset(ix, iy, nparallel, offset); | |
496 | } | |
497 | ||
498 | ||
499 | //______________________________________________________________________________ | |
500 | void AliMUONGeometrySegmentation::Neighbours(Int_t detElemId, | |
501 | Int_t ix, Int_t iy, | |
502 | Int_t* nlist, | |
503 | Int_t xlist[10], Int_t ylist[10]) | |
504 | { | |
692de412 | 505 | /// Get next neighbours |
e118b27e | 506 | |
4ebc2323 | 507 | if (!OwnNotify(detElemId)) return; |
e118b27e | 508 | |
509 | fCurrentSegmentation->Neighbours(ix, iy, nlist, xlist, ylist); | |
510 | } | |
511 | ||
512 | //______________________________________________________________________________ | |
513 | Int_t AliMUONGeometrySegmentation::Ix() | |
514 | { | |
692de412 | 515 | /// Current pad cursor during disintegration |
516 | /// x, y-coordinate | |
e118b27e | 517 | |
518 | return fCurrentSegmentation->Ix(); | |
519 | } | |
520 | ||
521 | //______________________________________________________________________________ | |
522 | Int_t AliMUONGeometrySegmentation::Iy() | |
523 | { | |
692de412 | 524 | /// Current pad cursor during disintegration |
525 | /// x, y-coordinate | |
e118b27e | 526 | |
527 | return fCurrentSegmentation->Iy(); | |
528 | } | |
529 | ||
530 | //______________________________________________________________________________ | |
531 | Int_t AliMUONGeometrySegmentation::DetElemId() | |
532 | { | |
692de412 | 533 | /// Current pad cursor during disintegration |
534 | /// x, y-coordinate | |
e118b27e | 535 | |
536 | return fCurrentDetElemId; | |
537 | } | |
538 | ||
539 | //______________________________________________________________________________ | |
540 | Int_t AliMUONGeometrySegmentation::ISector() | |
541 | { | |
692de412 | 542 | /// Current sector |
e118b27e | 543 | |
544 | return fCurrentSegmentation->ISector(); | |
545 | } | |
546 | ||
547 | //______________________________________________________________________________ | |
548 | Int_t AliMUONGeometrySegmentation::Sector(Int_t detElemId, Int_t ix, Int_t iy) | |
549 | { | |
692de412 | 550 | /// Calculate sector from pad coordinates |
e118b27e | 551 | |
4ebc2323 | 552 | if (!OwnNotify(detElemId)) return 0; |
e118b27e | 553 | |
554 | return fCurrentSegmentation->Sector(ix, iy); | |
555 | } | |
556 | ||
557 | //______________________________________________________________________________ | |
558 | Int_t AliMUONGeometrySegmentation::Sector(Int_t detElemId, | |
559 | Float_t xg, Float_t yg, Float_t zg) | |
560 | { | |
692de412 | 561 | /// Calculate sector from pad coordinates |
e118b27e | 562 | |
4ebc2323 | 563 | if (!OwnNotify(detElemId)) return 0; |
e118b27e | 564 | |
565 | Float_t xl, yl, zl; | |
566 | fCurrentDetElement->Global2Local(xg, yg, zg, xl, yl, zl); | |
567 | ||
568 | return fCurrentSegmentation->Sector(xl, yl); | |
569 | } | |
570 | ||
571 | //______________________________________________________________________________ | |
572 | void AliMUONGeometrySegmentation::IntegrationLimits(Int_t detElemId, | |
573 | Float_t& x1, Float_t& x2, | |
574 | Float_t& y1, Float_t& y2) | |
575 | { | |
692de412 | 576 | /// Current integration limits |
e118b27e | 577 | |
4ebc2323 | 578 | if (!OwnNotify(detElemId)) return; |
e118b27e | 579 | |
7d54fd29 | 580 | fCurrentSegmentation->IntegrationLimits(x1, x2, y1, y2); |
e118b27e | 581 | } |
582 | ||
583 | //______________________________________________________________________________ | |
584 | Int_t AliMUONGeometrySegmentation::SigGenCond(Int_t detElemId, | |
585 | Float_t xg, Float_t yg, Float_t zg) | |
586 | { | |
692de412 | 587 | /// Signal Generation Condition during Stepping |
588 | /// 0: don't generate signal \n | |
589 | /// 1: generate signal \n | |
590 | /// Comments: \n | |
591 | /// \n | |
592 | /// Crossing of pad boundary and mid plane between neighbouring wires is checked. | |
593 | /// To correctly simulate the dependence of the spatial resolution on the angle | |
594 | /// of incidence signal must be generated for constant steps on | |
595 | /// the projection of the trajectory along the anode wire. | |
596 | /// \n | |
597 | /// Signal will be generated if particle crosses pad boundary or | |
598 | /// boundary between two wires. | |
e118b27e | 599 | |
4ebc2323 | 600 | if (!OwnNotify(detElemId)) return 0; |
e118b27e | 601 | |
602 | Float_t xl, yl, zl; | |
603 | fCurrentDetElement->Global2Local(xg, yg, zg, xl, yl, zl); | |
604 | ||
605 | return fCurrentSegmentation->SigGenCond(xl, yl, zl); | |
606 | } | |
607 | ||
e118b27e | 608 | //______________________________________________________________________________ |
609 | void AliMUONGeometrySegmentation::SigGenInit(Int_t detElemId, | |
610 | Float_t xg, Float_t yg, Float_t zg) | |
611 | { | |
692de412 | 612 | /// Initialise signal generation at coord (x,y,z) |
613 | /// Initialise pad and wire position during stepping. | |
614 | /// From AliMUONGeometrySegmentationV01 | |
e118b27e | 615 | |
4ebc2323 | 616 | if (!OwnNotify(detElemId)) return; |
e118b27e | 617 | |
618 | Float_t xl, yl, zl; | |
619 | fCurrentDetElement->Global2Local(xg, yg, zg, xl, yl, zl); | |
620 | ||
75b9419c | 621 | if (!fCurrentSegmentation->HasPad(xl, yl, zl)) { |
622 | AliWarningStream() | |
623 | << "No pad at " << detElemId | |
624 | << " global position: " << xg << " " << yg << " " << zg | |
625 | << " local position: " << xl << " " << yl << " " << zl << endl; | |
626 | return ; | |
627 | } | |
628 | ||
e118b27e | 629 | fCurrentSegmentation->SigGenInit(xl, yl, zl); |
630 | } | |
631 | ||
632 | //______________________________________________________________________________ | |
633 | void AliMUONGeometrySegmentation::GiveTestPoints(Int_t /*detElemId*/, | |
634 | Int_t& /*n*/, | |
635 | Float_t* /*xg*/, Float_t* /*yg*/) const | |
636 | { | |
692de412 | 637 | /// Test points for auto calibration |
638 | /// Return test point on the pad plane. | |
639 | /// Used during determination of the segmoid correction of the COG-method | |
640 | /// From AliMUONGeometrySegmentationV01 | |
e118b27e | 641 | |
642 | // Requires change of interface | |
643 | // to convert points from local to global we need z coordinate | |
644 | AliError("Not implemented."); | |
645 | } | |
646 | ||
647 | //______________________________________________________________________________ | |
4ebc2323 | 648 | void AliMUONGeometrySegmentation::Draw(const char* opt) |
649 | { | |
692de412 | 650 | /// Draw the segmentation zones for all detElemId |
4ebc2323 | 651 | |
652 | for (Int_t i=0; i<fDESegmentations->GetNofEntries(); i++) { | |
653 | AliMUONVGeometryDESegmentation* segmentation | |
654 | = (AliMUONVGeometryDESegmentation*)fDESegmentations->GetEntry(i); | |
655 | segmentation->Draw(opt); | |
656 | } | |
657 | } | |
658 | ||
659 | //______________________________________________________________________________ | |
660 | void AliMUONGeometrySegmentation::Draw(Int_t detElemId, const char* opt) | |
e118b27e | 661 | { |
692de412 | 662 | /// Draw the segmentation zones for a given detElemId. |
e118b27e | 663 | |
4ebc2323 | 664 | if (!OwnNotify(detElemId)) return; |
e118b27e | 665 | |
666 | fCurrentSegmentation->Draw(opt); | |
667 | } | |
668 | ||
669 | //______________________________________________________________________________ | |
670 | void AliMUONGeometrySegmentation::SetCorrFunc(Int_t detElemId, | |
671 | Int_t isec, TF1* func) | |
672 | { | |
692de412 | 673 | /// Set the correction function. |
674 | /// From AliMUONGeometrySegmentationV01 | |
e118b27e | 675 | |
4ebc2323 | 676 | if (!OwnNotify(detElemId)) return; |
e118b27e | 677 | |
678 | fCurrentSegmentation->SetCorrFunc(isec, func); | |
679 | } | |
680 | ||
681 | //______________________________________________________________________________ | |
682 | TF1* AliMUONGeometrySegmentation::CorrFunc(Int_t detElemId, Int_t isec) const | |
683 | { | |
692de412 | 684 | /// Get the correction Function. |
685 | /// From AliMUONGeometrySegmentationV01 | |
e118b27e | 686 | |
4ebc2323 | 687 | if (!OwnNotify(detElemId)) return 0; |
e118b27e | 688 | |
689 | return fCurrentSegmentation->CorrFunc(isec); | |
690 | } | |
691 |