]>
Commit | Line | Data |
---|---|---|
d1cd2474 | 1 | // $Id$ |
2 | // | |
3 | // Class AliMUONChamberGeometry | |
4 | // ----------------------------- | |
5f1df83a | 5 | // Class for definititon of the MUON chamber positions in ALIC |
d1cd2474 | 6 | // Author: Ivana Hrivnacova, IPN Orsay |
5f1df83a | 7 | // 23/01/2004 |
d1cd2474 | 8 | |
9 | #include <TVirtualMC.h> | |
10 | #include <TGeoMatrix.h> | |
11 | #include <TObjArray.h> | |
12 | #include <TArrayI.h> | |
13 | #include <Riostream.h> | |
14 | ||
15 | #include "AliMUONChamberGeometry.h" | |
16 | #include "AliMUONGeometryEnvelope.h" | |
87894cc7 | 17 | #include "AliMUONGeometryEnvelopeStore.h" |
18 | #include "AliMUONGeometryTransformStore.h" | |
19 | #include "AliMUONConstants.h" | |
d1cd2474 | 20 | |
21 | ClassImp(AliMUONChamberGeometry) | |
22 | ||
23 | //______________________________________________________________________________ | |
24 | AliMUONChamberGeometry::AliMUONChamberGeometry(Int_t chamberId) | |
25 | : TObject(), | |
26 | fChamberId(chamberId), | |
27 | fMotherVolume("ALIC"), | |
87894cc7 | 28 | fNofSVs(0), |
29 | fSVVolumeIds(0), | |
d1cd2474 | 30 | fTransformation(0), |
87894cc7 | 31 | fDETransforms(0), |
d1cd2474 | 32 | fEnvelopes(0), |
87894cc7 | 33 | fSVMap(0) |
d1cd2474 | 34 | { |
35 | // Standard constructor | |
36 | ||
87894cc7 | 37 | // Chamber transformation |
d1cd2474 | 38 | fTransformation = new TGeoCombiTrans(""); |
87894cc7 | 39 | |
40 | // Arrays of volumes Ids | |
41 | fSVVolumeIds = new TArrayI(20); | |
42 | ||
43 | // Sensitive volumes map | |
44 | fSVMap = new AliMUONGeometrySVMap(100); | |
45 | ||
46 | // Det elements transformation store | |
47 | fDETransforms = new AliMUONGeometryTransformStore( | |
48 | AliMUONConstants::GetFirstDetElemId(chamberId), | |
49 | AliMUONConstants::NofDetElements(chamberId), | |
50 | fSVMap); | |
51 | // Envelope store | |
52 | fEnvelopes = new AliMUONGeometryEnvelopeStore(fDETransforms); | |
d1cd2474 | 53 | } |
54 | ||
55 | ||
56 | //______________________________________________________________________________ | |
57 | AliMUONChamberGeometry::AliMUONChamberGeometry() | |
58 | : TObject(), | |
59 | fChamberId(0), | |
60 | fMotherVolume(), | |
87894cc7 | 61 | fNofSVs(0), |
62 | fSVVolumeIds(0), | |
d1cd2474 | 63 | fTransformation(0), |
87894cc7 | 64 | fDETransforms(0), |
d1cd2474 | 65 | fEnvelopes(0), |
87894cc7 | 66 | fSVMap(0) |
d1cd2474 | 67 | { |
68 | // Default constructor | |
69 | } | |
70 | ||
71 | ||
72 | //______________________________________________________________________________ | |
73 | AliMUONChamberGeometry::AliMUONChamberGeometry(const AliMUONChamberGeometry& rhs) | |
74 | : TObject(rhs) | |
75 | { | |
76 | Fatal("Copy constructor", | |
77 | "Copy constructor is not implemented."); | |
78 | } | |
79 | ||
80 | //______________________________________________________________________________ | |
81 | AliMUONChamberGeometry::~AliMUONChamberGeometry() { | |
82 | // | |
83 | ||
d1cd2474 | 84 | delete fTransformation; |
87894cc7 | 85 | delete fSVVolumeIds; |
86 | delete fEnvelopes; | |
87 | delete fDETransforms; | |
88 | delete fSVMap; | |
d1cd2474 | 89 | } |
90 | ||
91 | //______________________________________________________________________________ | |
92 | AliMUONChamberGeometry& | |
93 | AliMUONChamberGeometry::operator = (const AliMUONChamberGeometry& rhs) | |
94 | { | |
95 | // check assignement to self | |
96 | if (this == &rhs) return *this; | |
97 | ||
98 | Fatal("operator=", | |
99 | "Assignment operator is not implemented."); | |
100 | ||
101 | return *this; | |
102 | } | |
103 | ||
104 | // | |
105 | // private methods | |
106 | // | |
107 | ||
108 | //______________________________________________________________________________ | |
87894cc7 | 109 | Int_t AliMUONChamberGeometry::GetSVIndex(Int_t svVolId) const |
d1cd2474 | 110 | { |
87894cc7 | 111 | // Returns the index of the volume specified by volId |
112 | // if it is present in the list of sensitive volumes | |
113 | // (or -1 if not present). | |
114 | ||
115 | for (Int_t i=0; i<fNofSVs; i++) { | |
116 | if (fSVVolumeIds->At(i) == svVolId) return i; | |
d1cd2474 | 117 | } |
87894cc7 | 118 | return -1; |
119 | } | |
d1cd2474 | 120 | |
121 | // | |
122 | // public methods | |
123 | // | |
124 | ||
d1cd2474 | 125 | //______________________________________________________________________________ |
126 | void AliMUONChamberGeometry::SetTranslation(const TGeoTranslation& translation) | |
127 | { | |
128 | // Sets the chamber position wrt ALIC. | |
129 | // --- | |
130 | ||
131 | fTransformation | |
132 | ->SetTranslation(const_cast<Double_t*>(translation.GetTranslation())); | |
133 | } | |
134 | ||
135 | //______________________________________________________________________________ | |
136 | void AliMUONChamberGeometry::SetRotation(const TGeoRotation& rotation) | |
137 | { | |
138 | // Sets the chamber rotation wrt ALIC. | |
139 | // --- | |
140 | ||
141 | TGeoRotation* rot = new TGeoRotation(); | |
142 | rot->SetMatrix(const_cast<Double_t*>(rotation.GetRotationMatrix())); | |
143 | ||
144 | fTransformation->SetRotation(rot); | |
145 | } | |
146 | ||
147 | //______________________________________________________________________________ | |
87894cc7 | 148 | void AliMUONChamberGeometry::SetSensitiveVolume(Int_t svVolId) |
d1cd2474 | 149 | { |
150 | // Adds the volume specified by volId to the list of sensitive | |
151 | // volumes | |
87894cc7 | 152 | // --- |
d1cd2474 | 153 | |
87894cc7 | 154 | // Resize TArrayI if needed |
155 | if (fSVVolumeIds->GetSize() == fNofSVs) fSVVolumeIds->Set(2*fNofSVs); | |
156 | ||
157 | fSVVolumeIds->AddAt(svVolId, fNofSVs++); | |
d1cd2474 | 158 | } |
159 | ||
160 | //______________________________________________________________________________ | |
161 | void AliMUONChamberGeometry::SetSensitiveVolume(const TString& volName) | |
162 | { | |
87894cc7 | 163 | // Adds the volume specified by volName to the list of sensitive |
d1cd2474 | 164 | // volumes |
87894cc7 | 165 | // --- |
d1cd2474 | 166 | |
87894cc7 | 167 | SetSensitiveVolume(gMC->VolId(volName)); |
d1cd2474 | 168 | } |
169 | ||
87894cc7 | 170 | //______________________________________________________________________________ |
171 | void AliMUONChamberGeometry::SetAlign(Bool_t align) | |
172 | { | |
173 | // Sets alignement option to enevelope store. | |
174 | // --- | |
175 | ||
176 | fEnvelopes->SetAlign(align); | |
177 | } | |
178 | ||
d1cd2474 | 179 | //______________________________________________________________________________ |
180 | Bool_t AliMUONChamberGeometry::IsSensitiveVolume(Int_t volId) const | |
181 | { | |
182 | // Checks if the volume specified by volId is present in the list | |
183 | // of sensitive volumes. | |
87894cc7 | 184 | // --- |
d1cd2474 | 185 | |
87894cc7 | 186 | for (Int_t i=0; i<fNofSVs; i++) { |
187 | if (fSVVolumeIds->At(i) == volId) return kTRUE; | |
d1cd2474 | 188 | } |
189 | return kFALSE; | |
190 | } | |
87894cc7 | 191 | |
192 | //______________________________________________________________________________ | |
193 | Bool_t AliMUONChamberGeometry::IsSensitiveVolume(const TString& volName) const | |
194 | { | |
195 | // Checks if the volume specified by volName is present in the list | |
196 | // of sensitive volumes. | |
197 | // --- | |
198 | ||
199 | return IsSensitiveVolume(gMC->VolId(volName)); | |
200 | } |