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