]>
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 | // $Id$ | |
17 | // | |
18 | // Class AliMUONGeometryModule | |
19 | // ----------------------------- | |
20 | // Class for definition of the detector module parameters | |
21 | // (the transformations of detection elements, mapping between | |
22 | // sensitive volumes and detection elements). | |
23 | // | |
24 | // Author: Ivana Hrivnacova, IPN Orsay | |
25 | ||
26 | #include <TVirtualMC.h> | |
27 | #include <TGeoMatrix.h> | |
28 | #include <TObjArray.h> | |
29 | #include <TArrayI.h> | |
30 | #include <Riostream.h> | |
31 | ||
32 | #include "AliLog.h" | |
33 | ||
34 | #include "AliMUONGeometryModule.h" | |
6cfb12b4 | 35 | #include "AliMUONGeometryModuleTransformer.h" |
e118b27e | 36 | #include "AliMUONGeometryEnvelope.h" |
37 | #include "AliMUONGeometryEnvelopeStore.h" | |
38 | #include "AliMUONGeometryDetElement.h" | |
39 | #include "AliMUONGeometryStore.h" | |
40 | #include "AliMUONGeometrySVMap.h" | |
e118b27e | 41 | |
42 | ClassImp(AliMUONGeometryModule) | |
43 | ||
44 | //______________________________________________________________________________ | |
45 | AliMUONGeometryModule::AliMUONGeometryModule(Int_t moduleId) | |
46 | : TObject(), | |
cfbf2f7d | 47 | fIsVirtual(true), |
e118b27e | 48 | fMotherVolume("ALIC"), |
cfbf2f7d | 49 | fVolume("NONE"), |
e118b27e | 50 | fNofSVs(0), |
51 | fSVVolumeIds(0), | |
e118b27e | 52 | fEnvelopes(0), |
6cfb12b4 | 53 | fSVMap(0), |
54 | fTransformer(0) | |
e118b27e | 55 | { |
692de412 | 56 | /// Standard constructor |
e118b27e | 57 | |
e118b27e | 58 | // Arrays of volumes Ids |
59 | fSVVolumeIds = new TArrayI(20); | |
60 | ||
61 | // Sensitive volumes map | |
62 | fSVMap = new AliMUONGeometrySVMap(100); | |
63 | ||
6cfb12b4 | 64 | // Geometry parametrisation |
65 | fTransformer = new AliMUONGeometryModuleTransformer(moduleId); | |
e118b27e | 66 | |
67 | // Envelope store | |
6cfb12b4 | 68 | fEnvelopes = new AliMUONGeometryEnvelopeStore( |
69 | fTransformer->GetDetElementStore()); | |
e118b27e | 70 | } |
71 | ||
72 | ||
73 | //______________________________________________________________________________ | |
74 | AliMUONGeometryModule::AliMUONGeometryModule() | |
75 | : TObject(), | |
cfbf2f7d | 76 | fIsVirtual(true), |
e118b27e | 77 | fMotherVolume(), |
cfbf2f7d | 78 | fVolume(), |
e118b27e | 79 | fNofSVs(0), |
80 | fSVVolumeIds(0), | |
e118b27e | 81 | fEnvelopes(0), |
6cfb12b4 | 82 | fSVMap(0), |
83 | fTransformer(0) | |
e118b27e | 84 | { |
692de412 | 85 | /// Default constructor |
e118b27e | 86 | } |
87 | ||
88 | ||
89 | //______________________________________________________________________________ | |
90 | AliMUONGeometryModule::AliMUONGeometryModule(const AliMUONGeometryModule& rhs) | |
91 | : TObject(rhs) | |
92 | { | |
692de412 | 93 | /// Protected copy constructor |
94 | ||
e118b27e | 95 | AliFatal("Copy constructor is not implemented."); |
96 | } | |
97 | ||
98 | //______________________________________________________________________________ | |
692de412 | 99 | AliMUONGeometryModule::~AliMUONGeometryModule() |
100 | { | |
101 | /// Destructor | |
e118b27e | 102 | |
e118b27e | 103 | delete fSVVolumeIds; |
104 | delete fEnvelopes; | |
e118b27e | 105 | delete fSVMap; |
6cfb12b4 | 106 | delete fTransformer; |
e118b27e | 107 | } |
108 | ||
109 | //______________________________________________________________________________ | |
110 | AliMUONGeometryModule& | |
111 | AliMUONGeometryModule::operator = (const AliMUONGeometryModule& rhs) | |
112 | { | |
692de412 | 113 | /// Protected assignement operator |
114 | ||
e118b27e | 115 | // check assignement to self |
116 | if (this == &rhs) return *this; | |
117 | ||
118 | AliFatal("Assignment operator is not implemented."); | |
119 | ||
120 | return *this; | |
121 | } | |
122 | ||
123 | // | |
124 | // private methods | |
125 | // | |
126 | ||
127 | //______________________________________________________________________________ | |
128 | Int_t AliMUONGeometryModule::GetSVIndex(Int_t svVolId) const | |
129 | { | |
692de412 | 130 | /// Return the index of the volume specified by volId |
131 | /// if it is present in the list of sensitive volumes | |
132 | /// (or -1 if not present). | |
e118b27e | 133 | |
134 | for (Int_t i=0; i<fNofSVs; i++) { | |
135 | if (fSVVolumeIds->At(i) == svVolId) return i; | |
136 | } | |
137 | return -1; | |
138 | } | |
139 | ||
140 | // | |
141 | // public methods | |
142 | // | |
143 | ||
cfbf2f7d | 144 | //______________________________________________________________________________ |
145 | void AliMUONGeometryModule::SetVolume(const TString& volumeName) | |
146 | { | |
692de412 | 147 | /// Set the concrete volume associated with this module. |
148 | /// The module in not virtual in this case | |
cfbf2f7d | 149 | |
150 | fVolume = volumeName; | |
151 | fIsVirtual = false; | |
152 | } | |
153 | ||
e118b27e | 154 | //______________________________________________________________________________ |
6cfb12b4 | 155 | void AliMUONGeometryModule::SetTransformation(const TGeoCombiTrans& transform) |
e118b27e | 156 | { |
692de412 | 157 | /// Set the module position wrt world. |
e118b27e | 158 | |
6cfb12b4 | 159 | fTransformer->SetTransformation(transform); |
e118b27e | 160 | } |
161 | ||
162 | //______________________________________________________________________________ | |
163 | void AliMUONGeometryModule::SetSensitiveVolume(Int_t svVolId) | |
164 | { | |
692de412 | 165 | /// Add the volume specified by volId to the list of sensitive |
166 | /// volumes | |
e118b27e | 167 | |
168 | // Resize TArrayI if needed | |
169 | if (fSVVolumeIds->GetSize() == fNofSVs) fSVVolumeIds->Set(2*fNofSVs); | |
170 | ||
171 | fSVVolumeIds->AddAt(svVolId, fNofSVs++); | |
172 | } | |
173 | ||
174 | //______________________________________________________________________________ | |
175 | void AliMUONGeometryModule::SetSensitiveVolume(const TString& volName) | |
176 | { | |
692de412 | 177 | /// Add the volume specified by volName to the list of sensitive |
178 | /// volumes | |
e118b27e | 179 | |
180 | SetSensitiveVolume(gMC->VolId(volName)); | |
181 | } | |
182 | ||
183 | //______________________________________________________________________________ | |
184 | void AliMUONGeometryModule::SetAlign(Bool_t align) | |
185 | { | |
6cfb12b4 | 186 | /// Set alignement option to envelope store. |
e118b27e | 187 | |
188 | fEnvelopes->SetAlign(align); | |
189 | } | |
190 | ||
191 | //______________________________________________________________________________ | |
192 | AliMUONGeometryDetElement* | |
193 | AliMUONGeometryModule::FindBySensitiveVolume(const TString& sensVolume) const | |
194 | { | |
692de412 | 195 | /// Find TGeoCombiTrans for the detector element Id specified by aligned volume |
e118b27e | 196 | |
197 | Int_t detElemId = fSVMap->GetDetElemId(sensVolume); | |
198 | ||
199 | if (!detElemId) return 0; | |
200 | // The specified sensitive volume is not in the map | |
201 | ||
6cfb12b4 | 202 | return fTransformer->GetDetElement(detElemId); |
e118b27e | 203 | } |
204 | ||
205 | //______________________________________________________________________________ | |
206 | Bool_t AliMUONGeometryModule::IsSensitiveVolume(Int_t volId) const | |
207 | { | |
692de412 | 208 | /// Check if the volume specified by volId is present in the list |
209 | /// of sensitive volumes. | |
e118b27e | 210 | |
211 | for (Int_t i=0; i<fNofSVs; i++) { | |
212 | if (fSVVolumeIds->At(i) == volId) return kTRUE; | |
213 | } | |
214 | return kFALSE; | |
215 | } | |
216 | ||
217 | //______________________________________________________________________________ | |
218 | Bool_t AliMUONGeometryModule::IsSensitiveVolume(const TString& volName) const | |
219 | { | |
692de412 | 220 | /// Check if the volume specified by volName is present in the list |
221 | /// of sensitive volumes. | |
e118b27e | 222 | |
223 | return IsSensitiveVolume(gMC->VolId(volName)); | |
224 | } |