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 AliMUONGeometryModuleTransformer
19 // -------------------------------------
20 // Class for definition of the detector module transformations
22 // Author: Ivana Hrivnacova, IPN Orsay
24 #include <TVirtualMC.h>
25 #include <TGeoMatrix.h>
26 #include <TObjArray.h>
28 #include <Riostream.h>
32 #include "AliMUONGeometryModuleTransformer.h"
33 #include "AliMUONGeometryDetElement.h"
34 #include "AliMUONGeometryStore.h"
36 ClassImp(AliMUONGeometryModuleTransformer)
38 //______________________________________________________________________________
39 AliMUONGeometryModuleTransformer::AliMUONGeometryModuleTransformer(Int_t moduleId)
45 /// Standard constructor
47 // Chamber transformation
48 fTransformation = new TGeoCombiTrans("");
50 // Det elements transformation stores
51 fDetElements = new AliMUONGeometryStore(true);
55 //______________________________________________________________________________
56 AliMUONGeometryModuleTransformer::AliMUONGeometryModuleTransformer()
62 /// Default constructor
66 //______________________________________________________________________________
67 AliMUONGeometryModuleTransformer::AliMUONGeometryModuleTransformer(
68 const AliMUONGeometryModuleTransformer& rhs)
71 /// Protected copy constructor
73 AliFatal("Copy constructor is not implemented.");
76 //______________________________________________________________________________
77 AliMUONGeometryModuleTransformer::~AliMUONGeometryModuleTransformer()
81 delete fTransformation;
85 //______________________________________________________________________________
86 AliMUONGeometryModuleTransformer&
87 AliMUONGeometryModuleTransformer::operator = (
88 const AliMUONGeometryModuleTransformer& rhs)
90 /// Protected assignement operator
92 // check assignement to self
93 if (this == &rhs) return *this;
95 AliFatal("Assignment operator is not implemented.");
104 //______________________________________________________________________________
105 void 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
109 /// Transform point from the global reference frame (ALIC)
110 /// to the local reference frame of the detection element specified
113 // Get detection element
114 AliMUONGeometryDetElement* detElement = GetDetElement(detElemId);
115 if (!detElement) return;
118 detElement->Global2Local(xg, yg, zg, xl, yl, zl);
121 //______________________________________________________________________________
122 void 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
126 /// Transform point from the global reference frame (ALIC)
127 /// to the local reference frame of the detection element specified
130 // Get detection element
131 AliMUONGeometryDetElement* detElement = GetDetElement(detElemId);
132 if (!detElement) return;
135 detElement->Global2Local(xg, yg, zg, xl, yl, zl);
138 //______________________________________________________________________________
139 void 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
143 /// Transform point from the local reference frame of the detection element
144 /// specified by detElemId to the global reference frame (ALIC).
146 // Get detection element
147 AliMUONGeometryDetElement* detElement = GetDetElement(detElemId);
148 if (!detElement) return;
151 detElement->Local2Global(xl, yl, zl, xg, yg, zg);
154 //______________________________________________________________________________
155 void 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
159 /// Transform point from the local reference frame of the detection element
160 /// specified by detElemId to the global reference frame (ALIC).
162 // Get detection element
163 AliMUONGeometryDetElement* detElement = GetDetElement(detElemId);
164 if (!detElement) return;
167 detElement->Local2Global(xl, yl, zl, xg, yg, zg);
170 //______________________________________________________________________________
171 void AliMUONGeometryModuleTransformer::SetTransformation(
172 const TGeoCombiTrans& transform)
174 /// Set the module position wrt world.
176 *fTransformation = transform;
179 //______________________________________________________________________________
180 AliMUONGeometryDetElement*
181 AliMUONGeometryModuleTransformer::GetDetElement(Int_t detElemId, Bool_t warn) const
183 /// Return the detection element specified by detElemId.
184 /// Give error if detection element is not defined.
186 // Get detection element
187 AliMUONGeometryDetElement* detElement
188 = (AliMUONGeometryDetElement*) fDetElements->Get(detElemId, warn);
193 << "Detection element " << detElemId
194 << " not found in module " << fModuleId << endl;