AliRoot Core  3abf5b4 (3abf5b4)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMUONGeometryModule.cxx
Go to the documentation of this file.
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"
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 
46 
47 //______________________________________________________________________________
49  : TObject(),
50  fIsVirtual(true),
51  fNofSVs(0),
52  fSVVolumeIds(0),
53  fEnvelopes(0),
54  fSVMap(0),
55  fTransformer(0)
56 {
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 //______________________________________________________________________________
76  : TObject(),
77  fIsVirtual(true),
78  fNofSVs(0),
79  fSVVolumeIds(0),
80  fEnvelopes(0),
81  fSVMap(0),
82  fTransformer(0)
83 {
85 }
86 
87 //______________________________________________________________________________
89 {
91 
92  delete fSVVolumeIds;
93  delete fEnvelopes;
94  delete fSVMap;
95  delete fTransformer;
96 }
97 
98 //
99 // private methods
100 //
101 
102 //______________________________________________________________________________
103 Int_t AliMUONGeometryModule::GetSVIndex(Int_t svVolId) const
104 {
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 //______________________________________________________________________________
120 void AliMUONGeometryModule::SetTransformation(const TGeoCombiTrans& transform)
121 {
123 
124  fTransformer->SetTransformation(transform);
125 }
126 
127 //______________________________________________________________________________
128 void AliMUONGeometryModule::SetVolumePath(const TString& volumePath)
129 {
131 
132  fTransformer->SetVolumePath(volumePath);
133 }
134 
135 //______________________________________________________________________________
137 {
140 
141  // Resize TArrayI if needed
142  if (fSVVolumeIds->GetSize() == fNofSVs) fSVVolumeIds->Set(2*fNofSVs);
143 
144  fSVVolumeIds->AddAt(svVolId, fNofSVs++);
145 }
146 
147 //______________________________________________________________________________
148 void AliMUONGeometryModule::SetSensitiveVolume(const TString& volName)
149 {
152 
153  SetSensitiveVolume(TVirtualMC::GetMC()->VolId(volName));
154 }
155 
156 //______________________________________________________________________________
158 {
160 
161  fEnvelopes->SetAlign(align);
162 }
163 
164 //______________________________________________________________________________
166 AliMUONGeometryModule::FindBySensitiveVolume(const TString& sensVolume) const
167 {
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 //______________________________________________________________________________
180 {
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 //______________________________________________________________________________
191 Bool_t AliMUONGeometryModule::IsSensitiveVolume(const TString& volName) const
192 {
195 
196  return IsSensitiveVolume(TVirtualMC::GetMC()->VolId(volName));
197 }
void SetVolumePath(const TString &volumePath)
Set the full path of aligned module volume or envelope in geometry.
Geometry transformer for a detector module.
AliTPCcalibAlign align
Definition: CalibAlign.C:43
AliMUONGeometryDetElement * FindBySensitiveVolume(const TString &volumePath) const
AliMUONGeometryEnvelopeStore * fEnvelopes
envelopes
Int_t GetSVIndex(Int_t svVolId) const
void SetVolumePath(const TString &volumePath)
void SetSensitiveVolume(Int_t volId)
void SetTransformation(const TGeoCombiTrans &transform)
Substitutes map <string, int> which ALICE does not allow to use.
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
AliMUONStringIntMap * fSVMap
sensitive volumes map
Int_t Get(const TString &first) const
Store for temporary volumes envelopes.
TArrayI * fSVVolumeIds
sensitive volumes IDs
Geometry parameters for detector module.
void SetTransformation(const TGeoHMatrix &transform)
Class for storing detection element transformations.
Int_t fNofSVs
number of sensitive volumes
Bool_t IsSensitiveVolume(Int_t volId) const
AliMUONGeometryDetElement * GetDetElement(Int_t detElemId, Bool_t warn=true) const
AliMUONGeometryModuleTransformer * fTransformer
geometry transformations
virtual void SetAlign(Bool_t align)
Set align option - if true, transformations are read from a file.