]>
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 | ||
16 | //////////////////////////////////////////////////////////// | |
17 | // Factory for muon chambers, segmentations and response // | |
18 | //////////////////////////////////////////////////////////// | |
19 | ||
20 | /* $Id$ */ | |
21 | ||
22 | #include "AliMpSegFactory.h" | |
23 | #include "AliMpDEManager.h" | |
24 | #include "AliMpSector.h" | |
25 | #include "AliMpSectorReader.h" | |
26 | #include "AliMpSectorSegmentation.h" | |
27 | #include "AliMpSlat.h" | |
28 | #include "AliMpSt345Reader.h" | |
29 | #include "AliMpSlatSegmentation.h" | |
30 | #include "AliMpTrigger.h" | |
31 | #include "AliMpTriggerReader.h" | |
32 | #include "AliMpTriggerSegmentation.h" | |
33 | ||
34 | #include "AliLog.h" | |
35 | ||
36 | #include <Riostream.h> | |
37 | #include <TSystem.h> | |
38 | #include <TObjString.h> | |
39 | #include <TMap.h> | |
40 | ||
41 | ClassImp(AliMpSegFactory) | |
42 | ||
43 | //______________________________________________________________________________ | |
44 | AliMpSegFactory::AliMpSegFactory() | |
45 | : TObject(), | |
46 | fMpSegmentations() | |
47 | { | |
48 | /// Standard constructor | |
49 | } | |
50 | ||
51 | //______________________________________________________________________________ | |
52 | AliMpSegFactory::AliMpSegFactory(const AliMpSegFactory& rhs) | |
53 | : TObject(rhs) | |
54 | { | |
55 | /// Protected copy constructor | |
56 | ||
57 | AliFatal("Not implemented."); | |
58 | } | |
59 | ||
60 | //______________________________________________________________________________ | |
61 | ||
62 | AliMpSegFactory::~AliMpSegFactory() | |
63 | { | |
64 | /// Destructor | |
65 | ||
66 | // The segmentations is supposed to be deleted in the client code | |
67 | } | |
68 | ||
69 | //______________________________________________________________________________ | |
70 | AliMpSegFactory& AliMpSegFactory::operator=(const AliMpSegFactory& rhs) | |
71 | { | |
72 | // Protected assignement operator | |
73 | ||
74 | if (this == &rhs) return *this; | |
75 | ||
76 | AliFatal("Not implemented."); | |
77 | ||
78 | return *this; | |
79 | } | |
80 | ||
81 | // | |
82 | // public methods | |
83 | // | |
84 | ||
85 | //______________________________________________________________________________ | |
86 | AliMpVSegmentation* | |
87 | AliMpSegFactory::CreateMpSegmentation(Int_t detElemId, Int_t cath) | |
88 | { | |
89 | /// Create mapping segmentation for given detElemId and cath | |
90 | /// or return it if it was already built | |
91 | ||
92 | // Check detElemId & cath | |
93 | if ( ! AliMpDEManager::IsValid(detElemId, cath, true) ) return 0; | |
94 | ||
95 | // If segmentation is already built, just return it | |
96 | // | |
97 | TString deName = AliMpDEManager::GetDEName(detElemId, cath); | |
98 | TObject* object = fMpSegmentations.Get(deName); | |
99 | if ( object ) return (AliMpVSegmentation*)object; | |
100 | ||
101 | // Read mapping data and create segmentation | |
102 | // | |
103 | AliMpStationType stationType = AliMpDEManager::GetStationType(detElemId); | |
104 | AliMpPlaneType planeType = AliMpDEManager::GetPlaneType(detElemId, cath); | |
105 | TString deTypeName = AliMpDEManager::GetDETypeName(detElemId, cath); | |
106 | ||
107 | AliMpVSegmentation* mpSegmentation = 0; | |
108 | ||
109 | if ( stationType == kStation1 || stationType == kStation2 ) { | |
110 | AliMpSectorReader reader(stationType, planeType); | |
111 | AliMpSector* sector = reader.BuildSector(); | |
112 | mpSegmentation = new AliMpSectorSegmentation(sector); | |
113 | } | |
114 | else if ( stationType == kStation345 ) { | |
115 | AliMpSlat* slat = AliMpSt345Reader::ReadSlat(deTypeName, planeType); | |
116 | mpSegmentation = new AliMpSlatSegmentation(slat); | |
117 | } | |
118 | else if ( stationType == kStationTrigger ) { | |
119 | AliMpTrigger* trigger = AliMpTriggerReader::ReadSlat(deTypeName, planeType); | |
120 | mpSegmentation = new AliMpTriggerSegmentation(trigger); | |
121 | } | |
122 | else | |
123 | AliErrorStream() << "Unknown station type" << endl; | |
124 | ||
125 | fMpSegmentations.Add(deName, mpSegmentation); | |
126 | return mpSegmentation; | |
127 | } | |
128 | ||
129 | //______________________________________________________________________________ | |
744ae0cb | 130 | void AliMpSegFactory::DeleteSegmentations() |
cf9a1555 | 131 | { |
132 | /// Delete all segmentations created with this manager | |
133 | ||
134 | fMpSegmentations.Clear(); | |
135 | } | |
136 |