]>
Commit | Line | Data |
---|---|---|
cf9a1555 | 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 | ||
490da820 | 16 | // $Id$ |
69417637 | 17 | // $MpId: AliMpSegmentation.cxx,v 1.7 2006/05/24 13:58:34 ivana Exp $ |
490da820 | 18 | // Category: management |
700013f0 | 19 | |
3d1463c8 | 20 | //----------------------------------------------------------------------------- |
69417637 | 21 | // Class AliMpSegmentation |
490da820 | 22 | // ----------------------- |
69417637 | 23 | // Singleton container class for mapping segmentations |
490da820 | 24 | // Authors: Ivana Hrivnacova, IPN Orsay |
2c605e66 | 25 | // Laurent Aphecetche, SUBATECH |
3d1463c8 | 26 | //----------------------------------------------------------------------------- |
cf9a1555 | 27 | |
69417637 | 28 | #include "AliMpSegmentation.h" |
b802839b | 29 | |
228fd720 | 30 | #include "AliMpDataStreams.h" |
cddd101e | 31 | #include "AliMpDetElement.h" |
24f9bd97 | 32 | #include "AliMpDEStore.h" |
cf9a1555 | 33 | #include "AliMpDEManager.h" |
69417637 | 34 | #include "AliMpDEIterator.h" |
b802839b | 35 | #include "AliMpExMap.h" |
7a170a5c | 36 | #include "AliMpFastSegmentation.h" |
6e97fbb8 | 37 | //#include "AliMpFastSegmentationV2.h" |
cf9a1555 | 38 | #include "AliMpSector.h" |
39 | #include "AliMpSectorReader.h" | |
40 | #include "AliMpSectorSegmentation.h" | |
41 | #include "AliMpSlat.h" | |
cf9a1555 | 42 | #include "AliMpSlatSegmentation.h" |
b802839b | 43 | #include "AliMpSt345Reader.h" |
cf9a1555 | 44 | #include "AliMpTrigger.h" |
45 | #include "AliMpTriggerReader.h" | |
46 | #include "AliMpTriggerSegmentation.h" | |
cddd101e | 47 | #include "AliMpCathodType.h" |
dede1525 | 48 | #include "AliMpSlatMotifMap.h" |
49 | ||
2c605e66 | 50 | |
51 | #include "AliLog.h" | |
52 | ||
cf9a1555 | 53 | #include <Riostream.h> |
cf9a1555 | 54 | #include <TMap.h> |
b802839b | 55 | #include <TObjString.h> |
56 | #include <TSystem.h> | |
5f377a9a | 57 | #include <TClass.h> |
cf9a1555 | 58 | |
630711ed | 59 | #include <cassert> |
60 | ||
13985652 | 61 | /// \cond CLASSIMP |
69417637 | 62 | ClassImp(AliMpSegmentation) |
13985652 | 63 | /// \endcond |
cf9a1555 | 64 | |
69417637 | 65 | AliMpSegmentation* AliMpSegmentation::fgInstance = 0; |
66 | ||
67 | // | |
68 | // static methods | |
69 | // | |
70 | ||
71 | //______________________________________________________________________________ | |
5f377a9a | 72 | AliMpSegmentation* AliMpSegmentation::Instance(Bool_t warn) |
69417637 | 73 | { |
5f377a9a | 74 | /// Return its instance |
69417637 | 75 | |
5f377a9a | 76 | if ( ! fgInstance && warn ) { |
77 | AliWarningClass("Segmentation has not been loaded"); | |
78 | } | |
69417637 | 79 | |
80 | return fgInstance; | |
81 | } | |
82 | ||
5f377a9a | 83 | //______________________________________________________________________________ |
ab167304 | 84 | AliMpSegmentation* AliMpSegmentation::ReadData(const AliMpDataStreams& dataStreams, |
877f7c6e | 85 | Bool_t warn, Bool_t empty) |
5f377a9a | 86 | { |
87 | /// Load the sementation from ASCII data files | |
877f7c6e | 88 | /// and return its instance. \n |
89 | /// If empty parameter is true, then no data is loaded and | |
90 | /// an empty object is created. | |
5f377a9a | 91 | |
92 | if ( fgInstance ) { | |
93 | if ( warn ) | |
94 | AliWarningClass("Segmentation has been already loaded"); | |
95 | return fgInstance; | |
96 | } | |
97 | ||
877f7c6e | 98 | if ( ! empty ) { |
99 | if ( dataStreams.GetReadFromFiles() ) | |
100 | AliInfoClass("Reading segmentation from ASCII files."); | |
5f377a9a | 101 | |
877f7c6e | 102 | fgInstance = new AliMpSegmentation(dataStreams); |
103 | } | |
104 | else { | |
105 | AliInfoClass("Creating invalid segmentation of minimum size."); | |
106 | fgInstance = new AliMpSegmentation(dataStreams, empty); | |
107 | } | |
108 | ||
5f377a9a | 109 | return fgInstance; |
110 | } | |
111 | ||
69417637 | 112 | // |
113 | // ctors, dtor | |
114 | // | |
0cfc27d7 | 115 | |
cf9a1555 | 116 | //______________________________________________________________________________ |
ab167304 | 117 | AliMpSegmentation::AliMpSegmentation(const AliMpDataStreams& dataStreams) |
b802839b | 118 | : TObject(), |
7d5d0cc5 | 119 | fkDataStreams(dataStreams), |
24f9bd97 | 120 | fDetElements(0), |
183279c1 | 121 | fMpSegmentations(true), |
630711ed | 122 | fElCardsMap(), |
183279c1 | 123 | fSlatMotifMap(new AliMpSlatMotifMap) |
cf9a1555 | 124 | { |
5f377a9a | 125 | /// Standard constructor - segmentation is loaded from ASCII data files |
69417637 | 126 | |
127 | AliDebug(1,""); | |
24f9bd97 | 128 | |
183279c1 | 129 | fElCardsMap.SetOwner(kTRUE); |
130 | ||
24f9bd97 | 131 | // Load DE data |
132 | if ( ! AliMpDEStore::Instance(false) ) | |
ab167304 | 133 | AliMpDEStore::ReadData(dataStreams); |
24f9bd97 | 134 | fDetElements = AliMpDEStore::Instance(); |
877f7c6e | 135 | |
69417637 | 136 | // Create mapping segmentations for all detection elements |
69417637 | 137 | AliMpDEIterator it; |
630711ed | 138 | for ( it.First(); ! it.IsDone(); it.Next() ) |
139 | { | |
140 | Int_t n(0); | |
141 | ||
142 | for ( Int_t cath = AliMp::kCath0; cath <= AliMp::kCath1; ++cath ) | |
143 | { | |
144 | if ( CreateMpSegmentation(it.CurrentDEId(), AliMp::GetCathodType(cath)) ) ++n; | |
f54f81ea | 145 | } |
630711ed | 146 | |
147 | if ( n == 2 && // should always be the case except when we play with the CreateMpSegmentation method... | |
148 | AliMpDEManager::GetStationType(it.CurrentDEId()) != AliMp::kStationTrigger ) // only for tracker | |
149 | { | |
150 | // Fill el cards map for all detection elements | |
151 | // of tracking chambers | |
152 | FillElCardsMap(it.CurrentDEId()); | |
153 | } | |
154 | } | |
cf9a1555 | 155 | } |
156 | ||
877f7c6e | 157 | //______________________________________________________________________________ |
158 | AliMpSegmentation::AliMpSegmentation(const AliMpDataStreams& dataStreams, | |
159 | Bool_t /*empty*/) | |
160 | : TObject(), | |
161 | fkDataStreams(dataStreams), | |
162 | fDetElements(0x0), | |
163 | fMpSegmentations(true, true), | |
164 | fElCardsMap(true), | |
165 | fSlatMotifMap(0x0) | |
166 | { | |
167 | /// The special constructor for creating a minimum size object | |
168 | /// The argument minSize is used only to distinguish this ctor | |
169 | /// from the standard one, its value is not used. | |
170 | ||
171 | AliDebug(1,""); | |
172 | ||
173 | fElCardsMap.SetOwner(kTRUE); | |
174 | } | |
175 | ||
cf9a1555 | 176 | //______________________________________________________________________________ |
630711ed | 177 | AliMpSegmentation::AliMpSegmentation(TRootIOCtor* ioCtor) |
69417637 | 178 | : TObject(), |
7d5d0cc5 | 179 | fkDataStreams(ioCtor), |
24f9bd97 | 180 | fDetElements(0), |
69417637 | 181 | fMpSegmentations(), |
630711ed | 182 | fElCardsMap(ioCtor), |
dede1525 | 183 | fSlatMotifMap(0) |
69417637 | 184 | { |
185 | /// Constructor for IO | |
186 | ||
cddd101e | 187 | AliDebug(1,""); |
188 | ||
69417637 | 189 | fgInstance = this; |
190 | } | |
cf9a1555 | 191 | |
69417637 | 192 | //______________________________________________________________________________ |
193 | AliMpSegmentation::~AliMpSegmentation() | |
cf9a1555 | 194 | { |
195 | /// Destructor | |
196 | ||
b802839b | 197 | AliDebug(1,""); |
490da820 | 198 | |
24f9bd97 | 199 | delete fDetElements; |
200 | ||
69417637 | 201 | // Segmentations are deleted with fMpSegmentations |
202 | // El cards arrays are deleted with fElCardsMap | |
490da820 | 203 | |
183279c1 | 204 | delete fSlatMotifMap; |
205 | ||
69417637 | 206 | fgInstance = 0; |
490da820 | 207 | } |
208 | ||
cf9a1555 | 209 | // |
69417637 | 210 | // private methods |
cf9a1555 | 211 | // |
212 | ||
213 | //______________________________________________________________________________ | |
214 | AliMpVSegmentation* | |
cddd101e | 215 | AliMpSegmentation::CreateMpSegmentation(Int_t detElemId, AliMp::CathodType cath) |
cf9a1555 | 216 | { |
217 | /// Create mapping segmentation for given detElemId and cath | |
218 | /// or return it if it was already built | |
219 | ||
220 | // Check detElemId & cath | |
cddd101e | 221 | if ( ! AliMpDEManager::IsValidDetElemId(detElemId, true) ) return 0; |
cf9a1555 | 222 | |
223 | // If segmentation is already built, just return it | |
224 | // | |
cddd101e | 225 | AliMpDetElement* detElement = AliMpDEManager::GetDetElement(detElemId); |
226 | TString deSegName = detElement->GetSegName(cath); | |
227 | TObject* object = fMpSegmentations.Get(deSegName); | |
cf9a1555 | 228 | if ( object ) return (AliMpVSegmentation*)object; |
229 | ||
0cfc27d7 | 230 | AliDebugStream(3) |
231 | << "Creating segmentation for detElemId=" << detElemId | |
232 | << " cath=" << cath << endl; | |
b802839b | 233 | |
cf9a1555 | 234 | // Read mapping data and create segmentation |
235 | // | |
cddd101e | 236 | AliMp::StationType stationType = detElement->GetStationType(); |
237 | AliMp::PlaneType planeType = detElement->GetPlaneType(cath); | |
238 | TString deTypeName = detElement->GetSegType(); | |
cf9a1555 | 239 | |
240 | AliMpVSegmentation* mpSegmentation = 0; | |
241 | ||
4e51cfd2 | 242 | if ( stationType == AliMp::kStation12 ) { |
243 | AliMq::Station12Type station12Type = detElement->GetStation12Type(); | |
7d5d0cc5 | 244 | AliMpSectorReader reader(fkDataStreams, station12Type, planeType); |
cf9a1555 | 245 | AliMpSector* sector = reader.BuildSector(); |
7a170a5c | 246 | mpSegmentation = new AliMpFastSegmentation(new AliMpSectorSegmentation(sector, true)); |
cf9a1555 | 247 | } |
cddd101e | 248 | else if ( stationType == AliMp::kStation345 ) { |
7d5d0cc5 | 249 | AliMpSt345Reader reader(fkDataStreams,fSlatMotifMap); |
f54f81ea | 250 | AliMpSlat* slat = reader.ReadSlat(deTypeName, planeType); |
7a170a5c | 251 | mpSegmentation = new AliMpFastSegmentation(new AliMpSlatSegmentation(slat, true)); |
cf9a1555 | 252 | } |
cddd101e | 253 | else if ( stationType == AliMp::kStationTrigger ) { |
7d5d0cc5 | 254 | AliMpTriggerReader reader(fkDataStreams,fSlatMotifMap); |
f54f81ea | 255 | AliMpTrigger* trigger = reader.ReadSlat(deTypeName, planeType); |
69417637 | 256 | mpSegmentation = new AliMpTriggerSegmentation(trigger, true); |
cf9a1555 | 257 | } |
258 | else | |
259 | AliErrorStream() << "Unknown station type" << endl; | |
260 | ||
630711ed | 261 | if ( mpSegmentation ) fMpSegmentations.Add(deSegName, mpSegmentation); |
f54f81ea | 262 | |
1a3b5b04 | 263 | // StdoutToAliDebug(3, fSlatMotifMap.Print();); |
f54f81ea | 264 | |
cf9a1555 | 265 | return mpSegmentation; |
266 | } | |
b802839b | 267 | |
268 | //_____________________________________________________________________________ | |
69417637 | 269 | AliMpExMap* |
270 | AliMpSegmentation::FillElCardsMap(Int_t detElemId) | |
b802839b | 271 | { |
69417637 | 272 | /// Fill the map of electronic cards IDs to segmentations for |
273 | /// given detElemId | |
490da820 | 274 | |
69417637 | 275 | AliDebugStream(2) << "detElemId=" << detElemId << endl;; |
b802839b | 276 | |
630711ed | 277 | AliMpExMap* mde = new AliMpExMap; |
69417637 | 278 | mde->SetOwner(kFALSE); |
279 | fElCardsMap.Add(detElemId,mde); | |
280 | ||
281 | const AliMpVSegmentation* seg[2]; | |
282 | TArrayI ecn[2]; | |
283 | ||
cddd101e | 284 | for ( Int_t cathode = AliMp::kCath0; cathode <= AliMp::kCath1; ++cathode ) |
b802839b | 285 | { |
cddd101e | 286 | seg[cathode] = GetMpSegmentation(detElemId,AliMp::GetCathodType(cathode)); |
69417637 | 287 | seg[cathode]->GetAllElectronicCardIDs(ecn[cathode]); |
69417637 | 288 | for ( Int_t i = 0; i < ecn[cathode].GetSize(); ++i ) |
289 | { | |
290 | mde->Add(ecn[cathode][i],const_cast<AliMpVSegmentation*>(seg[cathode])); | |
291 | } | |
292 | } | |
293 | ||
630711ed | 294 | assert( mde->GetSize() > 0 ); |
295 | ||
69417637 | 296 | return mde; |
630711ed | 297 | |
b802839b | 298 | } |
69417637 | 299 | |
300 | // | |
301 | // public methods | |
302 | // | |
303 | ||
cf9a1555 | 304 | //______________________________________________________________________________ |
69417637 | 305 | const AliMpVSegmentation* |
306 | AliMpSegmentation::GetMpSegmentation( | |
cddd101e | 307 | Int_t detElemId, AliMp::CathodType cath, Bool_t warn) const |
cf9a1555 | 308 | { |
69417637 | 309 | /// Return mapping segmentation for given detElemId and cath |
310 | ||
311 | // Check detElemId & cath | |
cddd101e | 312 | if ( ! AliMpDEManager::IsValidDetElemId(detElemId, false) ) { |
69417637 | 313 | |
314 | if ( warn ) { | |
315 | AliWarningStream() | |
cddd101e | 316 | << "Invalid detElemId " << detElemId << endl; |
69417637 | 317 | } |
318 | return 0; | |
319 | } | |
320 | ||
cddd101e | 321 | // If segmentation is already built, just return it |
322 | // | |
323 | AliMpDetElement* detElement = AliMpDEManager::GetDetElement(detElemId); | |
324 | TString deSegName = detElement->GetSegName(cath); | |
325 | TObject* object = fMpSegmentations.Get(deSegName); | |
69417637 | 326 | if ( ! object ) { |
327 | // Should never happen | |
328 | AliErrorStream() | |
329 | << "Segmentation for detElemId/cathod " | |
330 | << detElemId << ", " << cath << " not defined" << endl; | |
331 | return 0; | |
332 | } | |
333 | ||
334 | return static_cast<AliMpVSegmentation*>(object); | |
335 | } | |
cf9a1555 | 336 | |
69417637 | 337 | //_____________________________________________________________________________ |
338 | const AliMpVSegmentation* | |
339 | AliMpSegmentation::GetMpSegmentationByElectronics( | |
340 | Int_t detElemId, Int_t ecId, Bool_t warn) const | |
341 | { | |
342 | /// Return mapping segmentation for given detElemId and electronic card Id | |
343 | /// (motif position Id) | |
344 | ||
345 | AliMpExMap* m = static_cast<AliMpExMap*>(fElCardsMap.GetValue(detElemId)); | |
346 | ||
347 | if (!m) { | |
348 | // Should never happen | |
349 | AliErrorStream() | |
350 | << "Cannot find the el cards map for detElemId " << detElemId << endl; | |
351 | return 0; | |
352 | } | |
353 | ||
354 | TObject* object = m->GetValue(ecId); | |
355 | if ( ! object ) { | |
356 | if ( warn ) { | |
357 | AliErrorStream() | |
358 | << "Segmentation for electronic card " | |
359 | << ecId << " not found" << endl; | |
360 | } | |
361 | return 0; | |
362 | } | |
363 | ||
364 | return static_cast<AliMpVSegmentation*>(object); | |
365 | } | |
f3ed9a44 | 366 | |
367 | //_____________________________________________________________________________ | |
368 | const AliMpSector* | |
369 | AliMpSegmentation::GetSector(const AliMpVSegmentation* kSegmentation, | |
370 | Bool_t warn) const | |
371 | { | |
372 | /// Return sector for given mapping segmentation. | |
373 | /// If segmentation is not of sector type, zero is returned | |
374 | /// and an Error is issued if warn is set true (default). | |
375 | ||
376 | if ( ! kSegmentation ) return 0; | |
377 | ||
378 | if ( kSegmentation->StationType() != AliMp::kStation12 ) { | |
379 | if ( warn ) { | |
380 | AliErrorStream() | |
381 | << "Segmentation is not of sector type" << endl; | |
382 | } | |
383 | return 0; | |
384 | } | |
7a170a5c | 385 | |
386 | // If fast segmentation | |
387 | const AliMpFastSegmentation* fseg | |
388 | = dynamic_cast<const AliMpFastSegmentation*>(kSegmentation); | |
389 | if ( fseg ) { | |
390 | return | |
391 | static_cast<const AliMpSectorSegmentation*>(fseg->GetHelper())->GetSector(); | |
392 | } | |
393 | ||
6e97fbb8 | 394 | // If fast segmentation V2 |
395 | /* | |
396 | const AliMpFastSegmentationV2* fsegV2 | |
397 | = dynamic_cast<const AliMpFastSegmentationV2*>(kSegmentation); | |
398 | if ( fsegV2 ) { | |
399 | return | |
400 | static_cast<const AliMpSectorSegmentation*>(fsegV2->GetHelper())->GetSector(); | |
401 | } | |
402 | */ | |
7a170a5c | 403 | // If sector segmentation |
404 | const AliMpSectorSegmentation* sseg | |
405 | = dynamic_cast<const AliMpSectorSegmentation*>(kSegmentation); | |
406 | if ( sseg ) { | |
407 | return sseg->GetSector(); | |
408 | } | |
f3ed9a44 | 409 | |
7a170a5c | 410 | // Should not get to this line |
411 | AliErrorStream() << "Segemntation type not identified." << endl; | |
412 | return 0; | |
f3ed9a44 | 413 | } |
414 | ||
415 | //_____________________________________________________________________________ | |
416 | const AliMpSector* | |
417 | AliMpSegmentation::GetSector(Int_t detElemId, AliMp::CathodType cath, | |
418 | Bool_t warn) const | |
419 | { | |
420 | /// Return sector for given detElemId and cath. | |
421 | /// If segmentation is not of sector type, zero is returned | |
422 | /// and an Error is issued if warn is set true (default). | |
423 | ||
424 | return GetSector(GetMpSegmentation(detElemId, cath, warn), warn); | |
425 | } | |
426 | ||
427 | //_____________________________________________________________________________ | |
428 | const AliMpSector* | |
429 | AliMpSegmentation::GetSectorByElectronics(Int_t detElemId, Int_t elCardID, | |
430 | Bool_t warn) const | |
431 | { | |
432 | /// Return sector for given detElemId and elCardID. | |
433 | /// If segmentation is not of sector type, zero is returned | |
434 | /// and an Error is issued if warn is set true (default). | |
435 | ||
436 | return GetSector(GetMpSegmentationByElectronics(detElemId, elCardID, warn), warn); | |
437 | } | |
438 | ||
439 | //_____________________________________________________________________________ | |
440 | const AliMpSlat* | |
441 | AliMpSegmentation::GetSlat(const AliMpVSegmentation* kSegmentation, | |
442 | Bool_t warn) const | |
443 | { | |
444 | /// Return slat for given mapping segmentation. | |
445 | /// If segmentation is not of slat type, zero is returned | |
446 | /// and an Error is issued if warn is set true (default). | |
447 | ||
448 | if ( ! kSegmentation ) return 0; | |
449 | ||
450 | if ( kSegmentation->StationType() != AliMp::kStation345 ) { | |
451 | if ( warn ) { | |
452 | AliErrorStream() | |
453 | << "Segmentation is not of slat type" << endl; | |
454 | } | |
455 | return 0; | |
456 | } | |
457 | ||
7a170a5c | 458 | // If fast segmentation |
459 | const AliMpFastSegmentation* fseg | |
460 | = dynamic_cast<const AliMpFastSegmentation*>(kSegmentation); | |
461 | if ( fseg ) { | |
462 | return | |
463 | static_cast<const AliMpSlatSegmentation*>(fseg->GetHelper())->Slat(); | |
464 | } | |
465 | ||
6e97fbb8 | 466 | // If fast segmentation V2 |
467 | /* | |
468 | const AliMpFastSegmentationV2* fsegV2 | |
469 | = dynamic_cast<const AliMpFastSegmentationV2*>(kSegmentation); | |
470 | if ( fsegV2 ) { | |
471 | return | |
472 | static_cast<const AliMpSlatSegmentation*>(fsegV2->GetHelper())->Slat(); | |
473 | } | |
474 | */ | |
7a170a5c | 475 | // If slat segmentation |
476 | const AliMpSlatSegmentation* sseg | |
477 | = dynamic_cast<const AliMpSlatSegmentation*>(kSegmentation); | |
478 | ||
479 | if ( sseg ) { | |
480 | return sseg->Slat(); | |
481 | } | |
482 | ||
483 | // Should not get to this line | |
484 | AliErrorStream() << "Segemntation type not identified." << endl; | |
485 | return 0; | |
f3ed9a44 | 486 | } |
487 | ||
488 | //_____________________________________________________________________________ | |
489 | const AliMpSlat* | |
490 | AliMpSegmentation::GetSlat(Int_t detElemId, AliMp::CathodType cath, | |
491 | Bool_t warn) const | |
492 | { | |
493 | /// Return slat for given detElemId and cath. | |
494 | /// If segmentation is not of slat type, zero is returned | |
495 | /// and an Error is issued if warn is set true (default). | |
496 | ||
497 | return GetSlat(GetMpSegmentation(detElemId, cath, warn), warn); | |
498 | } | |
499 | ||
500 | //_____________________________________________________________________________ | |
501 | const AliMpSlat* | |
502 | AliMpSegmentation::GetSlatByElectronics(Int_t detElemId, Int_t elCardID, | |
503 | Bool_t warn) const | |
504 | { | |
505 | /// Return slat for given detElemId and elCardID. | |
506 | /// If segmentation is not of slat type, zero is returned | |
507 | /// and an Error is issued if warn is set true (default). | |
508 | ||
509 | return GetSlat(GetMpSegmentationByElectronics(detElemId, elCardID, warn), warn); | |
510 | } | |
511 | ||
512 | //_____________________________________________________________________________ | |
513 | const AliMpTrigger* | |
514 | AliMpSegmentation::GetTrigger(const AliMpVSegmentation* kSegmentation, | |
515 | Bool_t warn) const | |
516 | { | |
517 | /// Return trigger for given mapping segmentation. | |
518 | /// If segmentation is not of trigger type, zero is returned | |
519 | /// and an Error is issued if warn is set true (default). | |
520 | ||
521 | if ( ! kSegmentation ) return 0; | |
522 | ||
523 | if ( kSegmentation->StationType() != AliMp::kStationTrigger ) { | |
524 | if ( warn ) { | |
525 | AliErrorStream() | |
526 | << "Segmentation is not of trigger type" << endl; | |
527 | } | |
528 | return 0; | |
529 | } | |
530 | ||
7a170a5c | 531 | // If slat segmentation |
532 | const AliMpTriggerSegmentation* tseg | |
533 | = dynamic_cast<const AliMpTriggerSegmentation*>(kSegmentation); | |
534 | if ( tseg ) { | |
535 | return tseg->Slat(); | |
536 | } | |
537 | ||
538 | // If fast segmentation | |
539 | const AliMpFastSegmentation* fseg | |
540 | = dynamic_cast<const AliMpFastSegmentation*>(kSegmentation); | |
541 | ||
542 | if ( fseg ) { | |
543 | return | |
544 | static_cast<const AliMpTriggerSegmentation*>(fseg->GetHelper())->Slat(); | |
545 | } | |
546 | ||
6e97fbb8 | 547 | // If fast segmentation V2 |
548 | /* | |
549 | const AliMpFastSegmentationV2* fsegV2 | |
550 | = dynamic_cast<const AliMpFastSegmentationV2*>(kSegmentation); | |
551 | ||
552 | if ( fsegV2 ) { | |
553 | return | |
554 | static_cast<const AliMpTriggerSegmentation*>(fsegV2->GetHelper())->Slat(); | |
555 | } | |
556 | */ | |
557 | ||
7a170a5c | 558 | // Should not get to this line |
559 | AliErrorStream() << "Segemntation type not identified." << endl; | |
560 | return 0; | |
f3ed9a44 | 561 | } |
562 | ||
563 | //_____________________________________________________________________________ | |
564 | const AliMpTrigger* | |
565 | AliMpSegmentation::GetTrigger(Int_t detElemId, AliMp::CathodType cath, | |
566 | Bool_t warn) const | |
567 | { | |
568 | /// Return trigger for given detElemId and cath. | |
569 | /// If segmentation is not of trigger type, zero is returned | |
570 | /// and an Error is issued if warn is set true (default). | |
571 | ||
572 | return GetTrigger(GetMpSegmentation(detElemId, cath, warn), warn); | |
573 | } | |
574 | ||
575 | //_____________________________________________________________________________ | |
576 | const AliMpTrigger* | |
577 | AliMpSegmentation::GetTriggerByElectronics(Int_t detElemId, Int_t elCardID, | |
578 | Bool_t warn) const | |
579 | { | |
580 | /// Return trigger for given detElemId and elCardID. | |
581 | /// If segmentation is not of trigger type, zero is returned | |
582 | /// and an Error is issued if warn is set true (default). | |
583 | ||
584 | return GetTrigger(GetMpSegmentationByElectronics(detElemId, elCardID, warn), warn); | |
585 | } |