--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+// $Id$
+//
+// Class AliMUONGeometryModuleTransformer
+// -------------------------------------
+// Class for definition of the detector module transformations
+//
+// Author: Ivana Hrivnacova, IPN Orsay
+
+#include <TVirtualMC.h>
+#include <TGeoMatrix.h>
+#include <TObjArray.h>
+#include <TArrayI.h>
+#include <Riostream.h>
+
+#include "AliLog.h"
+
+#include "AliMUONGeometryModuleTransformer.h"
+#include "AliMUONGeometryDetElement.h"
+#include "AliMUONGeometryStore.h"
+
+ClassImp(AliMUONGeometryModuleTransformer)
+
+//______________________________________________________________________________
+AliMUONGeometryModuleTransformer::AliMUONGeometryModuleTransformer(Int_t moduleId)
+ : TObject(),
+ fModuleId(moduleId),
+ fTransformation(0),
+ fDetElements(0)
+{
+/// Standard constructor
+
+ // Chamber transformation
+ fTransformation = new TGeoCombiTrans("");
+
+ // Det elements transformation stores
+ fDetElements = new AliMUONGeometryStore(true);
+}
+
+
+//______________________________________________________________________________
+AliMUONGeometryModuleTransformer::AliMUONGeometryModuleTransformer()
+ : TObject(),
+ fModuleId(0),
+ fTransformation(0),
+ fDetElements(0)
+{
+/// Default constructor
+}
+
+
+//______________________________________________________________________________
+AliMUONGeometryModuleTransformer::AliMUONGeometryModuleTransformer(
+ const AliMUONGeometryModuleTransformer& rhs)
+ : TObject(rhs)
+{
+/// Protected copy constructor
+
+ AliFatal("Copy constructor is not implemented.");
+}
+
+//______________________________________________________________________________
+AliMUONGeometryModuleTransformer::~AliMUONGeometryModuleTransformer()
+{
+/// Destructor
+
+ delete fTransformation;
+ delete fDetElements;
+}
+
+//______________________________________________________________________________
+AliMUONGeometryModuleTransformer&
+AliMUONGeometryModuleTransformer::operator = (
+ const AliMUONGeometryModuleTransformer& rhs)
+{
+/// Protected assignement operator
+
+ // check assignement to self
+ if (this == &rhs) return *this;
+
+ AliFatal("Assignment operator is not implemented.");
+
+ return *this;
+}
+
+//
+// public methods
+//
+
+//______________________________________________________________________________
+void AliMUONGeometryModuleTransformer::Global2Local(Int_t detElemId,
+ Float_t xg, Float_t yg, Float_t zg,
+ Float_t& xl, Float_t& yl, Float_t& zl) const
+{
+/// Transform point from the global reference frame (ALIC)
+/// to the local reference frame of the detection element specified
+/// by detElemId.
+
+ // Get detection element
+ AliMUONGeometryDetElement* detElement = GetDetElement(detElemId);
+ if (!detElement) return;
+
+ // Transform point
+ detElement->Global2Local(xg, yg, zg, xl, yl, zl);
+}
+
+//______________________________________________________________________________
+void AliMUONGeometryModuleTransformer::Global2Local(Int_t detElemId,
+ Double_t xg, Double_t yg, Double_t zg,
+ Double_t& xl, Double_t& yl, Double_t& zl) const
+{
+/// Transform point from the global reference frame (ALIC)
+/// to the local reference frame of the detection element specified
+/// by detElemId.
+
+ // Get detection element
+ AliMUONGeometryDetElement* detElement = GetDetElement(detElemId);
+ if (!detElement) return;
+
+ // Transform point
+ detElement->Global2Local(xg, yg, zg, xl, yl, zl);
+}
+
+//______________________________________________________________________________
+void AliMUONGeometryModuleTransformer::Local2Global(Int_t detElemId,
+ Float_t xl, Float_t yl, Float_t zl,
+ Float_t& xg, Float_t& yg, Float_t& zg) const
+{
+/// Transform point from the local reference frame of the detection element
+/// specified by detElemId to the global reference frame (ALIC).
+
+ // Get detection element
+ AliMUONGeometryDetElement* detElement = GetDetElement(detElemId);
+ if (!detElement) return;
+
+ // Transform point
+ detElement->Local2Global(xl, yl, zl, xg, yg, zg);
+}
+
+//______________________________________________________________________________
+void AliMUONGeometryModuleTransformer::Local2Global(Int_t detElemId,
+ Double_t xl, Double_t yl, Double_t zl,
+ Double_t& xg, Double_t& yg, Double_t& zg) const
+{
+/// Transform point from the local reference frame of the detection element
+/// specified by detElemId to the global reference frame (ALIC).
+
+ // Get detection element
+ AliMUONGeometryDetElement* detElement = GetDetElement(detElemId);
+ if (!detElement) return;
+
+ // Transform point
+ detElement->Local2Global(xl, yl, zl, xg, yg, zg);
+}
+
+//______________________________________________________________________________
+void AliMUONGeometryModuleTransformer::SetTransformation(
+ const TGeoCombiTrans& transform)
+{
+/// Set the module position wrt world.
+
+ *fTransformation = transform;
+}
+
+//______________________________________________________________________________
+AliMUONGeometryDetElement*
+AliMUONGeometryModuleTransformer::GetDetElement(Int_t detElemId) const
+{
+/// Return the detection element specified by detElemId.
+/// Give error if detection element is not defined.
+
+ // Get detection element
+ AliMUONGeometryDetElement* detElement
+ = (AliMUONGeometryDetElement*) fDetElements->Get(detElemId);
+
+ if (!detElement) {
+ AliErrorStream()
+ << "Detection element " << detElemId
+ << " not found in module " << fModuleId << endl;
+ return 0;
+ }
+
+ return detElement;
+}
--- /dev/null
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id$ */
+// Revision of includes 07/05/2004
+
+/// \ingroup geometry
+/// \class AliMUONGeometryModuleTransformer
+/// \brief Geometry transformationer for detector module
+///
+/// Class for definition of the detector module parameters
+/// (the transformations of detection elements, mapping between
+/// sensitive volumes and detection elements).
+///
+/// Author: Ivana Hrivnacova, IPN Orsay
+
+#ifndef ALI_MUON_GEOMETRY_MODULE_TRANSFORMS_H
+#define ALI_MUON_GEOMETRY_MODULE_TRANSFORMS_H
+
+#include <TObject.h>
+#include <TString.h>
+
+class TGeoTranslation;
+class TGeoRotation;
+class TGeoCombiTrans;
+class TObjArray;
+class TArrayI;
+
+class AliMUONGeometryDetElement;
+class AliMUONGeometryStore;
+
+class AliMUONGeometryModuleTransformer : public TObject
+{
+ public:
+ AliMUONGeometryModuleTransformer(Int_t moduleId);
+ AliMUONGeometryModuleTransformer();
+ virtual ~AliMUONGeometryModuleTransformer();
+
+ // methods
+ void Global2Local(Int_t detElemId,
+ Float_t xg, Float_t yg, Float_t zg,
+ Float_t& xl, Float_t& yl, Float_t& zl) const;
+ void Global2Local(Int_t detElemId,
+ Double_t xg, Double_t yg, Double_t zg,
+ Double_t& xl, Double_t& yl, Double_t& zl) const;
+
+ void Local2Global(Int_t detElemId,
+ Float_t xl, Float_t yl, Float_t zl,
+ Float_t& xg, Float_t& yg, Float_t& zg) const;
+ void Local2Global(Int_t detElemId,
+ Double_t xl, Double_t yl, Double_t zl,
+ Double_t& xg, Double_t& yg, Double_t& zg) const;
+
+ // set methods
+ void SetTransformation(const TGeoCombiTrans& transform);
+
+ // get methods
+ Int_t GetModuleId() const;
+ const TGeoCombiTrans* GetTransformation() const;
+
+ AliMUONGeometryStore* GetDetElementStore() const;
+ AliMUONGeometryDetElement* GetDetElement(Int_t detElemId) const;
+
+ protected:
+ AliMUONGeometryModuleTransformer(const AliMUONGeometryModuleTransformer& rhs);
+ // operators
+ AliMUONGeometryModuleTransformer& operator = (const AliMUONGeometryModuleTransformer& rhs);
+
+ private:
+ // data members
+ Int_t fModuleId; // the module Id
+ TGeoCombiTrans* fTransformation;// the module transformation wrt to top
+ // volume
+ AliMUONGeometryStore* fDetElements; // detection elements
+
+ ClassDef(AliMUONGeometryModuleTransformer,2) // MUON geometry module class
+};
+
+// inline functions
+
+inline Int_t AliMUONGeometryModuleTransformer::GetModuleId() const
+{ return fModuleId; }
+
+inline const TGeoCombiTrans* AliMUONGeometryModuleTransformer::GetTransformation() const
+{ return fTransformation; }
+
+inline AliMUONGeometryStore* AliMUONGeometryModuleTransformer::GetDetElementStore() const
+{ return fDetElements; }
+
+#endif //ALI_MUON_GEOMETRY_MODULE_PARAM_H