]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONGeometryModule.cxx
Adding MuonSim.SetMakeTrigger(MUON); now required by the new CTP framework (Christian)
[u/mrichter/AliRoot.git] / MUON / AliMUONGeometryModule.cxx
CommitLineData
e118b27e 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// 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).
23//
24// Author: Ivana Hrivnacova, IPN Orsay
25
e118b27e 26#include "AliMUONGeometryModule.h"
6cfb12b4 27#include "AliMUONGeometryModuleTransformer.h"
e118b27e 28#include "AliMUONGeometryEnvelope.h"
29#include "AliMUONGeometryEnvelopeStore.h"
30#include "AliMUONGeometryDetElement.h"
31#include "AliMUONGeometryStore.h"
fbdfcd24 32#include "AliMUONStringIntMap.h"
33
34#include "AliLog.h"
35
36#include <TVirtualMC.h>
37#include <TGeoMatrix.h>
38#include <TObjArray.h>
39#include <TArrayI.h>
40#include <Riostream.h>
e118b27e 41
42ClassImp(AliMUONGeometryModule)
43
44//______________________________________________________________________________
45AliMUONGeometryModule::AliMUONGeometryModule(Int_t moduleId)
46 : TObject(),
cfbf2f7d 47 fIsVirtual(true),
e118b27e 48 fNofSVs(0),
49 fSVVolumeIds(0),
e118b27e 50 fEnvelopes(0),
6cfb12b4 51 fSVMap(0),
52 fTransformer(0)
e118b27e 53{
692de412 54/// Standard constructor
e118b27e 55
e118b27e 56 // Arrays of volumes Ids
57 fSVVolumeIds = new TArrayI(20);
58
59 // Sensitive volumes map
fbdfcd24 60 fSVMap = new AliMUONStringIntMap();
e118b27e 61
6cfb12b4 62 // Geometry parametrisation
63 fTransformer = new AliMUONGeometryModuleTransformer(moduleId);
e118b27e 64
65 // Envelope store
6cfb12b4 66 fEnvelopes = new AliMUONGeometryEnvelopeStore(
67 fTransformer->GetDetElementStore());
e118b27e 68}
69
70
71//______________________________________________________________________________
72AliMUONGeometryModule::AliMUONGeometryModule()
73 : TObject(),
cfbf2f7d 74 fIsVirtual(true),
e118b27e 75 fNofSVs(0),
76 fSVVolumeIds(0),
e118b27e 77 fEnvelopes(0),
6cfb12b4 78 fSVMap(0),
79 fTransformer(0)
e118b27e 80{
692de412 81/// Default constructor
e118b27e 82}
83
84
85//______________________________________________________________________________
86AliMUONGeometryModule::AliMUONGeometryModule(const AliMUONGeometryModule& rhs)
87 : TObject(rhs)
88{
692de412 89/// Protected copy constructor
90
e118b27e 91 AliFatal("Copy constructor is not implemented.");
92}
93
94//______________________________________________________________________________
692de412 95AliMUONGeometryModule::~AliMUONGeometryModule()
96{
97/// Destructor
e118b27e 98
e118b27e 99 delete fSVVolumeIds;
100 delete fEnvelopes;
e118b27e 101 delete fSVMap;
6cfb12b4 102 delete fTransformer;
e118b27e 103}
104
105//______________________________________________________________________________
106AliMUONGeometryModule&
107AliMUONGeometryModule::operator = (const AliMUONGeometryModule& rhs)
108{
692de412 109/// Protected assignement operator
110
e118b27e 111 // check assignement to self
112 if (this == &rhs) return *this;
113
114 AliFatal("Assignment operator is not implemented.");
115
116 return *this;
117}
118
119//
120// private methods
121//
122
123//______________________________________________________________________________
124Int_t AliMUONGeometryModule::GetSVIndex(Int_t svVolId) const
125{
692de412 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).
e118b27e 129
130 for (Int_t i=0; i<fNofSVs; i++) {
131 if (fSVVolumeIds->At(i) == svVolId) return i;
132 }
133 return -1;
134}
135
136//
137// public methods
138//
139
e118b27e 140//______________________________________________________________________________
6cfb12b4 141void AliMUONGeometryModule::SetTransformation(const TGeoCombiTrans& transform)
e118b27e 142{
692de412 143/// Set the module position wrt world.
e118b27e 144
6cfb12b4 145 fTransformer->SetTransformation(transform);
e118b27e 146}
147
fbdfcd24 148//______________________________________________________________________________
149void AliMUONGeometryModule::SetVolumePath(const TString& volumePath)
150{
151/// Set the volume path to transformer
152
153 fTransformer->SetVolumePath(volumePath);
154}
155
e118b27e 156//______________________________________________________________________________
157void AliMUONGeometryModule::SetSensitiveVolume(Int_t svVolId)
158{
692de412 159/// Add the volume specified by volId to the list of sensitive
160/// volumes
e118b27e 161
162 // Resize TArrayI if needed
163 if (fSVVolumeIds->GetSize() == fNofSVs) fSVVolumeIds->Set(2*fNofSVs);
164
165 fSVVolumeIds->AddAt(svVolId, fNofSVs++);
166}
167
168//______________________________________________________________________________
169void AliMUONGeometryModule::SetSensitiveVolume(const TString& volName)
170{
692de412 171/// Add the volume specified by volName to the list of sensitive
172/// volumes
e118b27e 173
174 SetSensitiveVolume(gMC->VolId(volName));
175}
176
177//______________________________________________________________________________
178void AliMUONGeometryModule::SetAlign(Bool_t align)
179{
6cfb12b4 180/// Set alignement option to envelope store.
e118b27e 181
182 fEnvelopes->SetAlign(align);
183}
184
185//______________________________________________________________________________
186AliMUONGeometryDetElement*
187AliMUONGeometryModule::FindBySensitiveVolume(const TString& sensVolume) const
188{
692de412 189/// Find TGeoCombiTrans for the detector element Id specified by aligned volume
e118b27e 190
fbdfcd24 191 Int_t detElemId = fSVMap->Get(sensVolume);
e118b27e 192
193 if (!detElemId) return 0;
194 // The specified sensitive volume is not in the map
195
6cfb12b4 196 return fTransformer->GetDetElement(detElemId);
e118b27e 197}
198
199//______________________________________________________________________________
200Bool_t AliMUONGeometryModule::IsSensitiveVolume(Int_t volId) const
201{
692de412 202/// Check if the volume specified by volId is present in the list
203/// of sensitive volumes.
e118b27e 204
205 for (Int_t i=0; i<fNofSVs; i++) {
206 if (fSVVolumeIds->At(i) == volId) return kTRUE;
207 }
208 return kFALSE;
209}
210
211//______________________________________________________________________________
212Bool_t AliMUONGeometryModule::IsSensitiveVolume(const TString& volName) const
213{
692de412 214/// Check if the volume specified by volName is present in the list
215/// of sensitive volumes.
e118b27e 216
217 return IsSensitiveVolume(gMC->VolId(volName));
218}