3 // Class AliMUONChamberGeometry
4 // -----------------------------
5 // Class for definititon of the MUON chamber positions in ALIC
6 // Author: Ivana Hrivnacova, IPN Orsay
9 #include <TVirtualMC.h>
10 #include <TGeoMatrix.h>
11 #include <TObjArray.h>
13 #include <Riostream.h>
15 #include "AliMUONChamberGeometry.h"
16 #include "AliMUONGeometryEnvelope.h"
17 #include "AliMUONGeometryEnvelopeStore.h"
18 #include "AliMUONGeometryTransformStore.h"
19 #include "AliMUONConstants.h"
21 ClassImp(AliMUONChamberGeometry)
23 //______________________________________________________________________________
24 AliMUONChamberGeometry::AliMUONChamberGeometry(Int_t chamberId)
26 fChamberId(chamberId),
27 fMotherVolume("ALIC"),
35 // Standard constructor
37 // Chamber transformation
38 fTransformation = new TGeoCombiTrans("");
40 // Arrays of volumes Ids
41 fSVVolumeIds = new TArrayI(20);
43 // Sensitive volumes map
44 fSVMap = new AliMUONGeometrySVMap(100);
46 // Det elements transformation store
47 fDETransforms = new AliMUONGeometryTransformStore(
48 AliMUONConstants::GetFirstDetElemId(chamberId),
49 AliMUONConstants::NofDetElements(chamberId),
52 fEnvelopes = new AliMUONGeometryEnvelopeStore(fDETransforms);
56 //______________________________________________________________________________
57 AliMUONChamberGeometry::AliMUONChamberGeometry()
68 // Default constructor
72 //______________________________________________________________________________
73 AliMUONChamberGeometry::AliMUONChamberGeometry(const AliMUONChamberGeometry& rhs)
76 Fatal("Copy constructor",
77 "Copy constructor is not implemented.");
80 //______________________________________________________________________________
81 AliMUONChamberGeometry::~AliMUONChamberGeometry() {
84 delete fTransformation;
91 //______________________________________________________________________________
92 AliMUONChamberGeometry&
93 AliMUONChamberGeometry::operator = (const AliMUONChamberGeometry& rhs)
95 // check assignement to self
96 if (this == &rhs) return *this;
99 "Assignment operator is not implemented.");
108 //______________________________________________________________________________
109 Int_t AliMUONChamberGeometry::GetSVIndex(Int_t svVolId) const
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).
115 for (Int_t i=0; i<fNofSVs; i++) {
116 if (fSVVolumeIds->At(i) == svVolId) return i;
125 //______________________________________________________________________________
126 void AliMUONChamberGeometry::SetTranslation(const TGeoTranslation& translation)
128 // Sets the chamber position wrt ALIC.
132 ->SetTranslation(const_cast<Double_t*>(translation.GetTranslation()));
135 //______________________________________________________________________________
136 void AliMUONChamberGeometry::SetRotation(const TGeoRotation& rotation)
138 // Sets the chamber rotation wrt ALIC.
141 TGeoRotation* rot = new TGeoRotation();
142 rot->SetMatrix(const_cast<Double_t*>(rotation.GetRotationMatrix()));
144 fTransformation->SetRotation(rot);
147 //______________________________________________________________________________
148 void AliMUONChamberGeometry::SetSensitiveVolume(Int_t svVolId)
150 // Adds the volume specified by volId to the list of sensitive
154 // Resize TArrayI if needed
155 if (fSVVolumeIds->GetSize() == fNofSVs) fSVVolumeIds->Set(2*fNofSVs);
157 fSVVolumeIds->AddAt(svVolId, fNofSVs++);
160 //______________________________________________________________________________
161 void AliMUONChamberGeometry::SetSensitiveVolume(const TString& volName)
163 // Adds the volume specified by volName to the list of sensitive
167 SetSensitiveVolume(gMC->VolId(volName));
170 //______________________________________________________________________________
171 void AliMUONChamberGeometry::SetAlign(Bool_t align)
173 // Sets alignement option to enevelope store.
176 fEnvelopes->SetAlign(align);
179 //______________________________________________________________________________
180 Bool_t AliMUONChamberGeometry::IsSensitiveVolume(Int_t volId) const
182 // Checks if the volume specified by volId is present in the list
183 // of sensitive volumes.
186 for (Int_t i=0; i<fNofSVs; i++) {
187 if (fSVVolumeIds->At(i) == volId) return kTRUE;
192 //______________________________________________________________________________
193 Bool_t AliMUONChamberGeometry::IsSensitiveVolume(const TString& volName) const
195 // Checks if the volume specified by volName is present in the list
196 // of sensitive volumes.
199 return IsSensitiveVolume(gMC->VolId(volName));