1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 // Class AliMUONGeometryModule
19 // -----------------------------
20 // Class for definition of the detector module parameters
21 // (the transformations of detection elements, mapping between
22 // sensitive volumes and detection elements).
24 // Author: Ivana Hrivnacova, IPN Orsay
26 #include "AliMUONGeometryModule.h"
27 #include "AliMUONGeometryModuleTransformer.h"
28 #include "AliMUONGeometryEnvelope.h"
29 #include "AliMUONGeometryEnvelopeStore.h"
30 #include "AliMUONGeometryDetElement.h"
31 #include "AliMUONStringIntMap.h"
35 #include <TVirtualMC.h>
36 #include <TGeoMatrix.h>
37 #include <TObjArray.h>
39 #include <Riostream.h>
42 ClassImp(AliMUONGeometryModule)
45 //______________________________________________________________________________
46 AliMUONGeometryModule::AliMUONGeometryModule(Int_t moduleId)
55 /// Standard constructor
57 // Arrays of volumes Ids
58 fSVVolumeIds = new TArrayI(20);
60 // Sensitive volumes map
61 fSVMap = new AliMUONStringIntMap();
63 // Geometry parametrisation
64 fTransformer = new AliMUONGeometryModuleTransformer(moduleId);
67 fEnvelopes = new AliMUONGeometryEnvelopeStore(
68 fTransformer->GetDetElementStore());
72 //______________________________________________________________________________
73 AliMUONGeometryModule::AliMUONGeometryModule()
82 /// Default constructor
85 //______________________________________________________________________________
86 AliMUONGeometryModule::~AliMUONGeometryModule()
100 //______________________________________________________________________________
101 Int_t AliMUONGeometryModule::GetSVIndex(Int_t svVolId) const
103 /// Return the index of the volume specified by volId
104 /// if it is present in the list of sensitive volumes
105 /// (or -1 if not present).
107 for (Int_t i=0; i<fNofSVs; i++) {
108 if (fSVVolumeIds->At(i) == svVolId) return i;
117 //______________________________________________________________________________
118 void AliMUONGeometryModule::SetTransformation(const TGeoCombiTrans& transform)
120 /// Set the module position wrt world.
122 fTransformer->SetTransformation(transform);
125 //______________________________________________________________________________
126 void AliMUONGeometryModule::SetVolumePath(const TString& volumePath)
128 /// Set the volume path to transformer
130 fTransformer->SetVolumePath(volumePath);
133 //______________________________________________________________________________
134 void AliMUONGeometryModule::SetSensitiveVolume(Int_t svVolId)
136 /// Add the volume specified by volId to the list of sensitive
139 // Resize TArrayI if needed
140 if (fSVVolumeIds->GetSize() == fNofSVs) fSVVolumeIds->Set(2*fNofSVs);
142 fSVVolumeIds->AddAt(svVolId, fNofSVs++);
145 //______________________________________________________________________________
146 void AliMUONGeometryModule::SetSensitiveVolume(const TString& volName)
148 /// Add the volume specified by volName to the list of sensitive
151 SetSensitiveVolume(gMC->VolId(volName));
154 //______________________________________________________________________________
155 void AliMUONGeometryModule::SetAlign(Bool_t align)
157 /// Set alignement option to envelope store.
159 fEnvelopes->SetAlign(align);
162 //______________________________________________________________________________
163 AliMUONGeometryDetElement*
164 AliMUONGeometryModule::FindBySensitiveVolume(const TString& sensVolume) const
166 /// Find detection element which the sensitive volume specified by name belongs to
168 Int_t detElemId = fSVMap->Get(sensVolume);
170 if (!detElemId) return 0;
171 // The specified sensitive volume is not in the map
173 return fTransformer->GetDetElement(detElemId);
176 //______________________________________________________________________________
177 Bool_t AliMUONGeometryModule::IsSensitiveVolume(Int_t volId) const
179 /// Check if the volume specified by volId is present in the list
180 /// of sensitive volumes.
182 for (Int_t i=0; i<fNofSVs; i++) {
183 if (fSVVolumeIds->At(i) == volId) return kTRUE;
188 //______________________________________________________________________________
189 Bool_t AliMUONGeometryModule::IsSensitiveVolume(const TString& volName) const
191 /// Check if the volume specified by volName is present in the list
192 /// of sensitive volumes.
194 return IsSensitiveVolume(gMC->VolId(volName));