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