]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONGeometryModuleTransformer.cxx
Added new method DisIntegrate(AliMUONHit&, TList& digits) to replace the one in
[u/mrichter/AliRoot.git] / MUON / AliMUONGeometryModuleTransformer.cxx
CommitLineData
4f8b0abb 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 AliMUONGeometryModuleTransformer
19// -------------------------------------
20// Class for definition of the detector module transformations
21//
22// Author: Ivana Hrivnacova, IPN Orsay
23
24#include <TVirtualMC.h>
25#include <TGeoMatrix.h>
26#include <TObjArray.h>
27#include <TArrayI.h>
28#include <Riostream.h>
29
30#include "AliLog.h"
31
32#include "AliMUONGeometryModuleTransformer.h"
33#include "AliMUONGeometryDetElement.h"
34#include "AliMUONGeometryStore.h"
35
36ClassImp(AliMUONGeometryModuleTransformer)
37
38//______________________________________________________________________________
39AliMUONGeometryModuleTransformer::AliMUONGeometryModuleTransformer(Int_t moduleId)
40 : TObject(),
41 fModuleId(moduleId),
42 fTransformation(0),
43 fDetElements(0)
44{
45/// Standard constructor
46
47 // Chamber transformation
48 fTransformation = new TGeoCombiTrans("");
49
50 // Det elements transformation stores
51 fDetElements = new AliMUONGeometryStore(true);
52}
53
54
55//______________________________________________________________________________
56AliMUONGeometryModuleTransformer::AliMUONGeometryModuleTransformer()
57 : TObject(),
58 fModuleId(0),
59 fTransformation(0),
60 fDetElements(0)
61{
62/// Default constructor
63}
64
65
66//______________________________________________________________________________
67AliMUONGeometryModuleTransformer::AliMUONGeometryModuleTransformer(
68 const AliMUONGeometryModuleTransformer& rhs)
69 : TObject(rhs)
70{
71/// Protected copy constructor
72
73 AliFatal("Copy constructor is not implemented.");
74}
75
76//______________________________________________________________________________
77AliMUONGeometryModuleTransformer::~AliMUONGeometryModuleTransformer()
78{
79/// Destructor
80
81 delete fTransformation;
82 delete fDetElements;
83}
84
85//______________________________________________________________________________
86AliMUONGeometryModuleTransformer&
87AliMUONGeometryModuleTransformer::operator = (
88 const AliMUONGeometryModuleTransformer& rhs)
89{
90/// Protected assignement operator
91
92 // check assignement to self
93 if (this == &rhs) return *this;
94
95 AliFatal("Assignment operator is not implemented.");
96
97 return *this;
98}
99
100//
101// public methods
102//
103
104//______________________________________________________________________________
105void AliMUONGeometryModuleTransformer::Global2Local(Int_t detElemId,
106 Float_t xg, Float_t yg, Float_t zg,
107 Float_t& xl, Float_t& yl, Float_t& zl) const
108{
109/// Transform point from the global reference frame (ALIC)
110/// to the local reference frame of the detection element specified
111/// by detElemId.
112
113 // Get detection element
114 AliMUONGeometryDetElement* detElement = GetDetElement(detElemId);
115 if (!detElement) return;
116
117 // Transform point
118 detElement->Global2Local(xg, yg, zg, xl, yl, zl);
119}
120
121//______________________________________________________________________________
122void AliMUONGeometryModuleTransformer::Global2Local(Int_t detElemId,
123 Double_t xg, Double_t yg, Double_t zg,
124 Double_t& xl, Double_t& yl, Double_t& zl) const
125{
126/// Transform point from the global reference frame (ALIC)
127/// to the local reference frame of the detection element specified
128/// by detElemId.
129
130 // Get detection element
131 AliMUONGeometryDetElement* detElement = GetDetElement(detElemId);
132 if (!detElement) return;
133
134 // Transform point
135 detElement->Global2Local(xg, yg, zg, xl, yl, zl);
136}
137
138//______________________________________________________________________________
139void AliMUONGeometryModuleTransformer::Local2Global(Int_t detElemId,
140 Float_t xl, Float_t yl, Float_t zl,
141 Float_t& xg, Float_t& yg, Float_t& zg) const
142{
143/// Transform point from the local reference frame of the detection element
144/// specified by detElemId to the global reference frame (ALIC).
145
146 // Get detection element
147 AliMUONGeometryDetElement* detElement = GetDetElement(detElemId);
148 if (!detElement) return;
149
150 // Transform point
151 detElement->Local2Global(xl, yl, zl, xg, yg, zg);
152}
153
154//______________________________________________________________________________
155void AliMUONGeometryModuleTransformer::Local2Global(Int_t detElemId,
156 Double_t xl, Double_t yl, Double_t zl,
157 Double_t& xg, Double_t& yg, Double_t& zg) const
158{
159/// Transform point from the local reference frame of the detection element
160/// specified by detElemId to the global reference frame (ALIC).
161
162 // Get detection element
163 AliMUONGeometryDetElement* detElement = GetDetElement(detElemId);
164 if (!detElement) return;
165
166 // Transform point
167 detElement->Local2Global(xl, yl, zl, xg, yg, zg);
168}
169
170//______________________________________________________________________________
171void AliMUONGeometryModuleTransformer::SetTransformation(
172 const TGeoCombiTrans& transform)
173{
174/// Set the module position wrt world.
175
176 *fTransformation = transform;
177}
178
179//______________________________________________________________________________
180AliMUONGeometryDetElement*
b75f649b 181AliMUONGeometryModuleTransformer::GetDetElement(Int_t detElemId, Bool_t warn) const
4f8b0abb 182{
183/// Return the detection element specified by detElemId.
184/// Give error if detection element is not defined.
185
186 // Get detection element
187 AliMUONGeometryDetElement* detElement
b75f649b 188 = (AliMUONGeometryDetElement*) fDetElements->Get(detElemId, warn);
4f8b0abb 189
190 if (!detElement) {
b75f649b 191 if (warn)
192 AliErrorStream()
193 << "Detection element " << detElemId
194 << " not found in module " << fModuleId << endl;
4f8b0abb 195 return 0;
196 }
197
198 return detElement;
199}