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