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 //-----------------------------------------------------------------------------
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).
25 // Author: Ivana Hrivnacova, IPN Orsay
26 //-----------------------------------------------------------------------------
28 #include "AliMUONGeometryModule.h"
29 #include "AliMUONGeometryModuleTransformer.h"
30 #include "AliMUONGeometryEnvelope.h"
31 #include "AliMUONGeometryEnvelopeStore.h"
32 #include "AliMUONGeometryDetElement.h"
33 #include "AliMUONStringIntMap.h"
37 #include <TVirtualMC.h>
38 #include <TGeoMatrix.h>
39 #include <TObjArray.h>
41 #include <Riostream.h>
44 ClassImp(AliMUONGeometryModule)
47 //______________________________________________________________________________
48 AliMUONGeometryModule::AliMUONGeometryModule(Int_t moduleId)
57 /// Standard constructor
59 // Arrays of volumes Ids
60 fSVVolumeIds = new TArrayI(20);
62 // Sensitive volumes map
63 fSVMap = new AliMUONStringIntMap();
65 // Geometry parametrisation
66 fTransformer = new AliMUONGeometryModuleTransformer(moduleId);
69 fEnvelopes = new AliMUONGeometryEnvelopeStore(
70 fTransformer->GetDetElementStore());
74 //______________________________________________________________________________
75 AliMUONGeometryModule::AliMUONGeometryModule()
84 /// Default constructor
87 //______________________________________________________________________________
88 AliMUONGeometryModule::~AliMUONGeometryModule()
102 //______________________________________________________________________________
103 Int_t AliMUONGeometryModule::GetSVIndex(Int_t svVolId) const
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).
109 for (Int_t i=0; i<fNofSVs; i++) {
110 if (fSVVolumeIds->At(i) == svVolId) return i;
119 //______________________________________________________________________________
120 void AliMUONGeometryModule::SetTransformation(const TGeoCombiTrans& transform)
122 /// Set the module position wrt world.
124 fTransformer->SetTransformation(transform);
127 //______________________________________________________________________________
128 void AliMUONGeometryModule::SetVolumePath(const TString& volumePath)
130 /// Set the volume path to transformer
132 fTransformer->SetVolumePath(volumePath);
135 //______________________________________________________________________________
136 void AliMUONGeometryModule::SetSensitiveVolume(Int_t svVolId)
138 /// Add the volume specified by volId to the list of sensitive
141 // Resize TArrayI if needed
142 if (fSVVolumeIds->GetSize() == fNofSVs) fSVVolumeIds->Set(2*fNofSVs);
144 fSVVolumeIds->AddAt(svVolId, fNofSVs++);
147 //______________________________________________________________________________
148 void AliMUONGeometryModule::SetSensitiveVolume(const TString& volName)
150 /// Add the volume specified by volName to the list of sensitive
153 SetSensitiveVolume(gMC->VolId(volName));
156 //______________________________________________________________________________
157 void AliMUONGeometryModule::SetAlign(Bool_t align)
159 /// Set alignement option to envelope store.
161 fEnvelopes->SetAlign(align);
164 //______________________________________________________________________________
165 AliMUONGeometryDetElement*
166 AliMUONGeometryModule::FindBySensitiveVolume(const TString& sensVolume) const
168 /// Find detection element which the sensitive volume specified by name belongs to
170 Int_t detElemId = fSVMap->Get(sensVolume);
172 if (!detElemId) return 0;
173 // The specified sensitive volume is not in the map
175 return fTransformer->GetDetElement(detElemId);
178 //______________________________________________________________________________
179 Bool_t AliMUONGeometryModule::IsSensitiveVolume(Int_t volId) const
181 /// Check if the volume specified by volId is present in the list
182 /// of sensitive volumes.
184 for (Int_t i=0; i<fNofSVs; i++) {
185 if (fSVVolumeIds->At(i) == volId) return kTRUE;
190 //______________________________________________________________________________
191 Bool_t AliMUONGeometryModule::IsSensitiveVolume(const TString& volName) const
193 /// Check if the volume specified by volName is present in the list
194 /// of sensitive volumes.
196 return IsSensitiveVolume(gMC->VolId(volName));