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 "AliMUONGeometryStore.h"
32 #include "AliMUONStringIntMap.h"
36 #include <TVirtualMC.h>
37 #include <TGeoMatrix.h>
38 #include <TObjArray.h>
40 #include <Riostream.h>
42 ClassImp(AliMUONGeometryModule)
44 //______________________________________________________________________________
45 AliMUONGeometryModule::AliMUONGeometryModule(Int_t moduleId)
54 /// Standard constructor
56 // Arrays of volumes Ids
57 fSVVolumeIds = new TArrayI(20);
59 // Sensitive volumes map
60 fSVMap = new AliMUONStringIntMap();
62 // Geometry parametrisation
63 fTransformer = new AliMUONGeometryModuleTransformer(moduleId);
66 fEnvelopes = new AliMUONGeometryEnvelopeStore(
67 fTransformer->GetDetElementStore());
71 //______________________________________________________________________________
72 AliMUONGeometryModule::AliMUONGeometryModule()
81 /// Default constructor
85 //______________________________________________________________________________
86 AliMUONGeometryModule::AliMUONGeometryModule(const AliMUONGeometryModule& rhs)
89 /// Protected copy constructor
91 AliFatal("Copy constructor is not implemented.");
94 //______________________________________________________________________________
95 AliMUONGeometryModule::~AliMUONGeometryModule()
105 //______________________________________________________________________________
106 AliMUONGeometryModule&
107 AliMUONGeometryModule::operator = (const AliMUONGeometryModule& rhs)
109 /// Protected assignement operator
111 // check assignement to self
112 if (this == &rhs) return *this;
114 AliFatal("Assignment operator is not implemented.");
123 //______________________________________________________________________________
124 Int_t AliMUONGeometryModule::GetSVIndex(Int_t svVolId) const
126 /// Return the index of the volume specified by volId
127 /// if it is present in the list of sensitive volumes
128 /// (or -1 if not present).
130 for (Int_t i=0; i<fNofSVs; i++) {
131 if (fSVVolumeIds->At(i) == svVolId) return i;
140 //______________________________________________________________________________
141 void AliMUONGeometryModule::SetTransformation(const TGeoCombiTrans& transform)
143 /// Set the module position wrt world.
145 fTransformer->SetTransformation(transform);
148 //______________________________________________________________________________
149 void AliMUONGeometryModule::SetVolumePath(const TString& volumePath)
151 /// Set the volume path to transformer
153 fTransformer->SetVolumePath(volumePath);
156 //______________________________________________________________________________
157 void AliMUONGeometryModule::SetSensitiveVolume(Int_t svVolId)
159 /// Add the volume specified by volId to the list of sensitive
162 // Resize TArrayI if needed
163 if (fSVVolumeIds->GetSize() == fNofSVs) fSVVolumeIds->Set(2*fNofSVs);
165 fSVVolumeIds->AddAt(svVolId, fNofSVs++);
168 //______________________________________________________________________________
169 void AliMUONGeometryModule::SetSensitiveVolume(const TString& volName)
171 /// Add the volume specified by volName to the list of sensitive
174 SetSensitiveVolume(gMC->VolId(volName));
177 //______________________________________________________________________________
178 void AliMUONGeometryModule::SetAlign(Bool_t align)
180 /// Set alignement option to envelope store.
182 fEnvelopes->SetAlign(align);
185 //______________________________________________________________________________
186 AliMUONGeometryDetElement*
187 AliMUONGeometryModule::FindBySensitiveVolume(const TString& sensVolume) const
189 /// Find TGeoCombiTrans for the detector element Id specified by aligned volume
191 Int_t detElemId = fSVMap->Get(sensVolume);
193 if (!detElemId) return 0;
194 // The specified sensitive volume is not in the map
196 return fTransformer->GetDetElement(detElemId);
199 //______________________________________________________________________________
200 Bool_t AliMUONGeometryModule::IsSensitiveVolume(Int_t volId) const
202 /// Check if the volume specified by volId is present in the list
203 /// of sensitive volumes.
205 for (Int_t i=0; i<fNofSVs; i++) {
206 if (fSVVolumeIds->At(i) == volId) return kTRUE;
211 //______________________________________________________________________________
212 Bool_t AliMUONGeometryModule::IsSensitiveVolume(const TString& volName) const
214 /// Check if the volume specified by volName is present in the list
215 /// of sensitive volumes.
217 return IsSensitiveVolume(gMC->VolId(volName));