]>
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 | ||
e118b27e | 26 | #include "AliMUONGeometryModule.h" |
6cfb12b4 | 27 | #include "AliMUONGeometryModuleTransformer.h" |
e118b27e | 28 | #include "AliMUONGeometryEnvelope.h" |
29 | #include "AliMUONGeometryEnvelopeStore.h" | |
30 | #include "AliMUONGeometryDetElement.h" | |
31 | #include "AliMUONGeometryStore.h" | |
fbdfcd24 | 32 | #include "AliMUONStringIntMap.h" |
33 | ||
34 | #include "AliLog.h" | |
35 | ||
36 | #include <TVirtualMC.h> | |
37 | #include <TGeoMatrix.h> | |
38 | #include <TObjArray.h> | |
39 | #include <TArrayI.h> | |
40 | #include <Riostream.h> | |
e118b27e | 41 | |
a9aad96e | 42 | /// \cond CLASSIMP |
e118b27e | 43 | ClassImp(AliMUONGeometryModule) |
a9aad96e | 44 | /// \endcond |
e118b27e | 45 | |
46 | //______________________________________________________________________________ | |
47 | AliMUONGeometryModule::AliMUONGeometryModule(Int_t moduleId) | |
48 | : TObject(), | |
cfbf2f7d | 49 | fIsVirtual(true), |
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 | |
fbdfcd24 | 62 | fSVMap = new AliMUONStringIntMap(); |
e118b27e | 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 | fNofSVs(0), |
78 | fSVVolumeIds(0), | |
e118b27e | 79 | fEnvelopes(0), |
6cfb12b4 | 80 | fSVMap(0), |
81 | fTransformer(0) | |
e118b27e | 82 | { |
692de412 | 83 | /// Default constructor |
e118b27e | 84 | } |
85 | ||
e118b27e | 86 | //______________________________________________________________________________ |
692de412 | 87 | AliMUONGeometryModule::~AliMUONGeometryModule() |
88 | { | |
89 | /// Destructor | |
e118b27e | 90 | |
e118b27e | 91 | delete fSVVolumeIds; |
92 | delete fEnvelopes; | |
e118b27e | 93 | delete fSVMap; |
6cfb12b4 | 94 | delete fTransformer; |
e118b27e | 95 | } |
96 | ||
e118b27e | 97 | // |
98 | // private methods | |
99 | // | |
100 | ||
101 | //______________________________________________________________________________ | |
102 | Int_t AliMUONGeometryModule::GetSVIndex(Int_t svVolId) const | |
103 | { | |
692de412 | 104 | /// Return the index of the volume specified by volId |
105 | /// if it is present in the list of sensitive volumes | |
106 | /// (or -1 if not present). | |
e118b27e | 107 | |
108 | for (Int_t i=0; i<fNofSVs; i++) { | |
109 | if (fSVVolumeIds->At(i) == svVolId) return i; | |
110 | } | |
111 | return -1; | |
112 | } | |
113 | ||
114 | // | |
115 | // public methods | |
116 | // | |
117 | ||
e118b27e | 118 | //______________________________________________________________________________ |
6cfb12b4 | 119 | void AliMUONGeometryModule::SetTransformation(const TGeoCombiTrans& transform) |
e118b27e | 120 | { |
692de412 | 121 | /// Set the module position wrt world. |
e118b27e | 122 | |
6cfb12b4 | 123 | fTransformer->SetTransformation(transform); |
e118b27e | 124 | } |
125 | ||
fbdfcd24 | 126 | //______________________________________________________________________________ |
127 | void AliMUONGeometryModule::SetVolumePath(const TString& volumePath) | |
128 | { | |
129 | /// Set the volume path to transformer | |
130 | ||
131 | fTransformer->SetVolumePath(volumePath); | |
132 | } | |
133 | ||
e118b27e | 134 | //______________________________________________________________________________ |
135 | void AliMUONGeometryModule::SetSensitiveVolume(Int_t svVolId) | |
136 | { | |
692de412 | 137 | /// Add the volume specified by volId to the list of sensitive |
138 | /// volumes | |
e118b27e | 139 | |
140 | // Resize TArrayI if needed | |
141 | if (fSVVolumeIds->GetSize() == fNofSVs) fSVVolumeIds->Set(2*fNofSVs); | |
142 | ||
143 | fSVVolumeIds->AddAt(svVolId, fNofSVs++); | |
144 | } | |
145 | ||
146 | //______________________________________________________________________________ | |
147 | void AliMUONGeometryModule::SetSensitiveVolume(const TString& volName) | |
148 | { | |
692de412 | 149 | /// Add the volume specified by volName to the list of sensitive |
150 | /// volumes | |
e118b27e | 151 | |
152 | SetSensitiveVolume(gMC->VolId(volName)); | |
153 | } | |
154 | ||
155 | //______________________________________________________________________________ | |
156 | void AliMUONGeometryModule::SetAlign(Bool_t align) | |
157 | { | |
6cfb12b4 | 158 | /// Set alignement option to envelope store. |
e118b27e | 159 | |
160 | fEnvelopes->SetAlign(align); | |
161 | } | |
162 | ||
163 | //______________________________________________________________________________ | |
164 | AliMUONGeometryDetElement* | |
165 | AliMUONGeometryModule::FindBySensitiveVolume(const TString& sensVolume) const | |
166 | { | |
a9aad96e | 167 | /// Find detection element which the sensitive volume specified by name belongs to |
e118b27e | 168 | |
fbdfcd24 | 169 | Int_t detElemId = fSVMap->Get(sensVolume); |
e118b27e | 170 | |
171 | if (!detElemId) return 0; | |
172 | // The specified sensitive volume is not in the map | |
173 | ||
6cfb12b4 | 174 | return fTransformer->GetDetElement(detElemId); |
e118b27e | 175 | } |
176 | ||
177 | //______________________________________________________________________________ | |
178 | Bool_t AliMUONGeometryModule::IsSensitiveVolume(Int_t volId) const | |
179 | { | |
692de412 | 180 | /// Check if the volume specified by volId is present in the list |
181 | /// of sensitive volumes. | |
e118b27e | 182 | |
183 | for (Int_t i=0; i<fNofSVs; i++) { | |
184 | if (fSVVolumeIds->At(i) == volId) return kTRUE; | |
185 | } | |
186 | return kFALSE; | |
187 | } | |
188 | ||
189 | //______________________________________________________________________________ | |
190 | Bool_t AliMUONGeometryModule::IsSensitiveVolume(const TString& volName) const | |
191 | { | |
692de412 | 192 | /// Check if the volume specified by volName is present in the list |
193 | /// of sensitive volumes. | |
e118b27e | 194 | |
195 | return IsSensitiveVolume(gMC->VolId(volName)); | |
196 | } |