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"
22 ClassImp(AliMUONChamberGeometry)
24 //______________________________________________________________________________
25 AliMUONChamberGeometry::AliMUONChamberGeometry(Int_t chamberId)
27 fChamberId(chamberId),
28 fMotherVolume("ALIC"),
36 // Standard constructor
38 // Chamber transformation
39 fTransformation = new TGeoCombiTrans("");
41 // Arrays of volumes Ids
42 fSVVolumeIds = new TArrayI(20);
44 // Sensitive volumes map
45 fSVMap = new AliMUONGeometrySVMap(100);
47 // Det elements transformation store
48 fDETransforms = new AliMUONGeometryTransformStore(
49 AliMUONConstants::GetFirstDetElemId(chamberId),
50 AliMUONConstants::NofDetElements(chamberId),
53 fEnvelopes = new AliMUONGeometryEnvelopeStore(fDETransforms);
57 //______________________________________________________________________________
58 AliMUONChamberGeometry::AliMUONChamberGeometry()
69 // Default constructor
73 //______________________________________________________________________________
74 AliMUONChamberGeometry::AliMUONChamberGeometry(const AliMUONChamberGeometry& rhs)
77 AliFatal("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;
98 AliFatal("Assignment operator is not implemented.");
107 //______________________________________________________________________________
108 Int_t AliMUONChamberGeometry::GetSVIndex(Int_t svVolId) const
110 // Returns the index of the volume specified by volId
111 // if it is present in the list of sensitive volumes
112 // (or -1 if not present).
114 for (Int_t i=0; i<fNofSVs; i++) {
115 if (fSVVolumeIds->At(i) == svVolId) return i;
124 //______________________________________________________________________________
125 void AliMUONChamberGeometry::SetTranslation(const TGeoTranslation& translation)
127 // Sets the chamber position wrt ALIC.
131 ->SetTranslation(const_cast<Double_t*>(translation.GetTranslation()));
134 //______________________________________________________________________________
135 void AliMUONChamberGeometry::SetRotation(const TGeoRotation& rotation)
137 // Sets the chamber rotation wrt ALIC.
140 TGeoRotation* rot = new TGeoRotation();
141 rot->SetMatrix(const_cast<Double_t*>(rotation.GetRotationMatrix()));
143 fTransformation->SetRotation(rot);
146 //______________________________________________________________________________
147 void AliMUONChamberGeometry::SetSensitiveVolume(Int_t svVolId)
149 // Adds the volume specified by volId to the list of sensitive
153 // Resize TArrayI if needed
154 if (fSVVolumeIds->GetSize() == fNofSVs) fSVVolumeIds->Set(2*fNofSVs);
156 fSVVolumeIds->AddAt(svVolId, fNofSVs++);
159 //______________________________________________________________________________
160 void AliMUONChamberGeometry::SetSensitiveVolume(const TString& volName)
162 // Adds the volume specified by volName to the list of sensitive
166 SetSensitiveVolume(gMC->VolId(volName));
169 //______________________________________________________________________________
170 void AliMUONChamberGeometry::SetAlign(Bool_t align)
172 // Sets alignement option to enevelope store.
175 fEnvelopes->SetAlign(align);
178 //______________________________________________________________________________
179 Bool_t AliMUONChamberGeometry::IsSensitiveVolume(Int_t volId) const
181 // Checks if the volume specified by volId is present in the list
182 // of sensitive volumes.
185 for (Int_t i=0; i<fNofSVs; i++) {
186 if (fSVVolumeIds->At(i) == volId) return kTRUE;
191 //______________________________________________________________________________
192 Bool_t AliMUONChamberGeometry::IsSensitiveVolume(const TString& volName) const
194 // Checks if the volume specified by volName is present in the list
195 // of sensitive volumes.
198 return IsSensitiveVolume(gMC->VolId(volName));