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 <TVirtualMC.h>
27 #include <TGeoMatrix.h>
28 #include <TObjArray.h>
30 #include <Riostream.h>
34 #include "AliMUONGeometryModule.h"
35 #include "AliMUONGeometryModuleTransformer.h"
36 #include "AliMUONGeometryEnvelope.h"
37 #include "AliMUONGeometryEnvelopeStore.h"
38 #include "AliMUONGeometryDetElement.h"
39 #include "AliMUONGeometryStore.h"
40 #include "AliMUONGeometrySVMap.h"
42 ClassImp(AliMUONGeometryModule)
44 //______________________________________________________________________________
45 AliMUONGeometryModule::AliMUONGeometryModule(Int_t moduleId)
48 fMotherVolume("ALIC"),
56 /// Standard constructor
58 // Arrays of volumes Ids
59 fSVVolumeIds = new TArrayI(20);
61 // Sensitive volumes map
62 fSVMap = new AliMUONGeometrySVMap(100);
64 // Geometry parametrisation
65 fTransformer = new AliMUONGeometryModuleTransformer(moduleId);
68 fEnvelopes = new AliMUONGeometryEnvelopeStore(
69 fTransformer->GetDetElementStore());
73 //______________________________________________________________________________
74 AliMUONGeometryModule::AliMUONGeometryModule()
85 /// Default constructor
89 //______________________________________________________________________________
90 AliMUONGeometryModule::AliMUONGeometryModule(const AliMUONGeometryModule& rhs)
93 /// Protected copy constructor
95 AliFatal("Copy constructor is not implemented.");
98 //______________________________________________________________________________
99 AliMUONGeometryModule::~AliMUONGeometryModule()
109 //______________________________________________________________________________
110 AliMUONGeometryModule&
111 AliMUONGeometryModule::operator = (const AliMUONGeometryModule& rhs)
113 /// Protected assignement operator
115 // check assignement to self
116 if (this == &rhs) return *this;
118 AliFatal("Assignment operator is not implemented.");
127 //______________________________________________________________________________
128 Int_t AliMUONGeometryModule::GetSVIndex(Int_t svVolId) const
130 /// Return the index of the volume specified by volId
131 /// if it is present in the list of sensitive volumes
132 /// (or -1 if not present).
134 for (Int_t i=0; i<fNofSVs; i++) {
135 if (fSVVolumeIds->At(i) == svVolId) return i;
144 //______________________________________________________________________________
145 void AliMUONGeometryModule::SetVolume(const TString& volumeName)
147 /// Set the concrete volume associated with this module.
148 /// The module in not virtual in this case
150 fVolume = volumeName;
154 //______________________________________________________________________________
155 void AliMUONGeometryModule::SetTransformation(const TGeoCombiTrans& transform)
157 /// Set the module position wrt world.
159 fTransformer->SetTransformation(transform);
162 //______________________________________________________________________________
163 void AliMUONGeometryModule::SetSensitiveVolume(Int_t svVolId)
165 /// Add the volume specified by volId to the list of sensitive
168 // Resize TArrayI if needed
169 if (fSVVolumeIds->GetSize() == fNofSVs) fSVVolumeIds->Set(2*fNofSVs);
171 fSVVolumeIds->AddAt(svVolId, fNofSVs++);
174 //______________________________________________________________________________
175 void AliMUONGeometryModule::SetSensitiveVolume(const TString& volName)
177 /// Add the volume specified by volName to the list of sensitive
180 SetSensitiveVolume(gMC->VolId(volName));
183 //______________________________________________________________________________
184 void AliMUONGeometryModule::SetAlign(Bool_t align)
186 /// Set alignement option to envelope store.
188 fEnvelopes->SetAlign(align);
191 //______________________________________________________________________________
192 AliMUONGeometryDetElement*
193 AliMUONGeometryModule::FindBySensitiveVolume(const TString& sensVolume) const
195 /// Find TGeoCombiTrans for the detector element Id specified by aligned volume
197 Int_t detElemId = fSVMap->GetDetElemId(sensVolume);
199 if (!detElemId) return 0;
200 // The specified sensitive volume is not in the map
202 return fTransformer->GetDetElement(detElemId);
205 //______________________________________________________________________________
206 Bool_t AliMUONGeometryModule::IsSensitiveVolume(Int_t volId) const
208 /// Check if the volume specified by volId is present in the list
209 /// of sensitive volumes.
211 for (Int_t i=0; i<fNofSVs; i++) {
212 if (fSVVolumeIds->At(i) == volId) return kTRUE;
217 //______________________________________________________________________________
218 Bool_t AliMUONGeometryModule::IsSensitiveVolume(const TString& volName) const
220 /// Check if the volume specified by volName is present in the list
221 /// of sensitive volumes.
223 return IsSensitiveVolume(gMC->VolId(volName));