]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSgeom.h
Major upgrade of AliRoot code
[u/mrichter/AliRoot.git] / ITS / AliITSgeom.h
index c75c0345b8bcf27be0b3b9255562eaadcfc9b714..6bb2495d05b5d16e768edd44521662db2743718c 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef ITSGEOM_H
-#define ITSGEOM_H
+#ifndef ALIITSGEOM_H
+#define ALIITSGEOM_H
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
 // a specialized structure for ease of implementation.
 /////////////////////////////////////////////////////////////////////////
 #include <fstream.h>
-#include "TObjArray.h"
+#include <TObjArray.h>
+#include <TVector.h>
+
 #include "AliITSgeomSPD.h"
 #include "AliITSgeomSDD.h"
 #include "AliITSgeomSSD.h"
+#include "AliITSgeomMatrix.h"
 
-////////////////////////////////////////////////////////////////////////
-// The structure ITS_geom:
-//     The structure ITS_geom has been defined to hold all of the
-// information necessary to do the coordinate transformations for one
-// detector between the ALICE Cartesian global and the detector local
-// coordinate systems. The rotations are implemented in the following
-// order, Rz*Ry*Rx*(Vglobal-Vtrans)=Vlocal (in matrix notation). 
-// In addition it contains an index to the TObjArray containing all of
-// the information about the shape of the active detector volume, and
-// any other useful detector parameters. See the definition of *fShape
-// below and the classes AliITSgeomSPD, AliITSgeomSDD, and AliITSgeomSSD
-// for a full description. This structure is not available outside of 
-// these routines.
-//
-// Int_t fShapeIndex
-//     The index to the array of detector shape information. In this way
-// only an index is needed to be stored and not all of the shape
-// information. This saves much space since most, if not all, of the
-// detectors of a give type have the same shape information and are only
-// placed in a different spot in the ALICE/ITS detector.
-//
-// Float_t fx0,fy0,fz0
-//     The Cartesian translation vector used to define part of the
-// coordinate transformation. The units of the translation are kept
-// in the Monte Carlo distance units, usually cm.
-//
-// Float_t frx,fry,frz
-//     The three rotation angles that define the rotation matrix. The
-// angles are, frx the rotation about the x axis. fry the rotation about
-// the "new" or "rotated" y axis. frz the rotation about the "new" or
-// "rotated" z axis. These angles, although redundant with the rotation
-// matrix fr, are kept for speed. This allows for their retrieval without
-// having to compute them each and every time. The angles are kept in
-// radians
-//
-// Float_t fr[9]
-//     The 3x3 rotation matrix defined by the angles frx, fry, and frz,
-// for the Global to Local transformation is
-//    |fr[0] fr[1] fr[2]| | cos(frz)  sin(frz) 0| | cos(fry) 0  sin(fry)|
-// fr=|fr[3] fr[4] fr[4]|=|-sin(frz)  cos(frz) 0|*|   0      1    0     |
-//    |fr[6] fr[7] fr[8]| |   0         0      1| |-sin(fry) 0  cos(fry)|
-//
-//    |1    0        0     |
-//   *|0  cos(frx) sin(frx)|
-//    |0 -sin(frx) cos(frx)|
-//
-// Even though this information is redundant with the three rotation
-// angles, because this transformation matrix can be used so much it is
-// kept to speed things up a lot. The coordinate system used is Cartesian.
-////////////////////////////////////////////////////////////////////////
-
-struct ITS_geom {
-    Int_t   fShapeIndex; // Shape index for this volume
-    Float_t fx0,fy0,fz0; // Translation vector
-    Float_t frx,fry,frz; // Rotation about axis, angle radians
-    Float_t fr[9];       // the rotation matrix
-};
+typedef enum {kSPD=0, kSDD=1, kSSD=2} AliITSDetector;
 
 //_______________________________________________________________________
 
 class AliITSgeom : public TObject {
-////////////////////////////////////////////////////////////////////////
-//
-// version: 0
-// Written by Bjorn S. Nilsen
-//
-// Data Members:
-//
-// Int_t fNlayers
-//     The number of ITS layers for this geometry. By default this
-//  is 6, but can be modified by the creator function if there are
-// more layers defined.
-//
-// Int_t *fNlad
-//     A pointer to an array fNlayers long containing the number of 
-// ladders for each layer. This array is typically created and filled 
-// by the AliITSgeom creator function.
-//
-// Int_t *fNdet
-//     A pointer to an array fNlayers long containing the number of
-// active detector volumes for each ladder. This array is typically
-// created and filled by the AliITSgeom creator function.
-//
-// ITS_geom **fg
-//     A pointer to an array of pointers pointing to the ITS_geom
-// structure containing the coordinate transformation information.
-// The ITS_geom structure corresponding to layer=lay, ladder=lad,
-// and detector=det is gotten by fg[lay-1][(fNlad[lay-1]*(lad-1)+det-1)].
-// In this way a lot of space is saved over trying to keep a three
-// dimensional array fNlayersXmax(fNlad)Xmax(fNdet), since the number
-// of detectors typically increases with layer number.
-//
-// TObjArray *fShape
-//     A pointer to an array of TObjects containing the detailed shape
-// information for each type of detector used in the ITS. For example
-// I have created AliITSgeomSPD, AliITSgeomSDD, and AliITSgeomSSD as
-// example structures, derived from TObjects, to hold the detector
-// information. I would recommend that one element in each of these
-// structures, that which describes the shape of the active volume,
-// be one of the ROOT classes derived from TShape. In this way it would
-// be easy to have the display program display the correct active
-// ITS volumes. See the example classes AliITSgeomSPD, AliITSgeomSDD,
-// and AliITSgeomSSD for a more detailed example.
-//
-// Member Functions:
-//
-// AliITSgeom()
-//     The default constructor for the AliITSgeom class. It, by default,
-// sets fNlayers to zero and zeros all pointers.
-//
-// AliITSgeom(const char *filename)
-//     The constructor for the AliITSgeom class. All of the data to fill
-// this structure is read in from the file given my the input filename.
-//
-// AliITSgeom(AliITSgeom &source)
-//     The copy constructor for the AliITSgeom class. It calls the
-// = operator function. See the = operator function for more details.
-//
-// void operator=(AliITSgeom &source)
-//     The = operator function for the AliITSgeom class. It makes an
-// independent copy of the class in such a way that any changes made
-// to the copied class will not affect the source class in any way.
-// This is required for many ITS alignment studies where the copied
-// class is then modified by introducing some misalignment.
-//
-// ~AliITSgeom()
-//     The destructor for the AliITSgeom class. If the arrays fNlad,
-// fNdet, or fg have had memory allocated to them, there pointer values
-// are non zero, then this memory space is freed and they are set
-// to zero. In addition, fNlayers is set to zero. The destruction of
-// TObjArray fShape is, by default, handled by the TObjArray destructor.
-//
-// Int_t GetNdetectors(Int_t layer)
-//     This function returns the number of detectors/ladder for a give 
-// layer. In particular it returns fNdet[layer-1].
-//
-// Int_t GetNladders(Int_t layer)
-//     This function returns the number of ladders for a give layer. In
-// particular it returns fNlad[layer-1].
-//
-// Int_t GetNlayers()
-//     This function returns the number of layers defined in the ITS
-// geometry. In particular it returns fNlayers.
-//
-// GetAngles(Int_t layer,Int_t ladder,Int_t detector,
-//           Float_t &rx, Float_t &ry, Float_t &rz)
-//     This function returns the rotation angles for a give detector on
-// a give ladder in a give layer in the three floating point variables
-// provided. rx = frx, fy = fry, rz = frz. The angles are in radians
-//
-// GetTrans(Int_t layer,Int_t ladder,Int_t detector,
-//          Float_t &x, Float_t &y, Float_t &z)
-//     This function returns the Cartesian translation for a give
-// detector on a give ladder in a give layer in the three floating
-// point variables provided. x = fx0, y = fy0, z = fz0. The units are
-// those of the Monte Carlo, generally cm.
-//
-// SetByAngles(Int_t layer,Int_t ladder,Int_t detector,
-//            Float_t &rx, Float_t &ry, Float_t &rz)
-//     This function computes a new rotation matrix based on the angles
-// rx, ry, and rz (in radians) for a give detector on the give ladder
-// in the give layer. A new
-// fg[layer-1][(fNlad[layer-1]*(ladder-1)+detector-1)].fr[] array is
-// computed.
-//
-// SetTrans(Int_t layer,Int_t ladder,Int_t detector,
-//          Float_t x, Float_t y, Float_t z)
-//     This function sets a new translation vector, given by the three
-// variables x, y, and z, for the Cartesian coordinate transformation
-// for the detector defined by layer, ladder and detector.
-//
-// GetRotMatrix(Int_t layer, Int_t ladder, Int_t detector, Float_t *mat)
-//     Returns, in the Float_t array pointed to by mat, the full rotation
-// matrix for the give detector defined by layer, ladder, and detector.
-// It returns all nine elements of fr in the ITS_geom structure. See the
-// description of the ITS_geom structure for further details of this
-// rotation matrix.
-//
-// GtoL(Int_t layer, Int_t ladder, Int_t detector,
-//       const Float_t *g, Float_t *l)
-//     The function that does the global ALICE Cartesian coordinate
-// to local active volume detector Cartesian coordinate transformation.
-// The local detector coordinate system is determined by the layer, 
-// ladder, and detector numbers. The global coordinates are entered by
-// the three element Float_t array g and the local coordinate values
-// are returned by the three element Float_t array l. The order of the 
-// three elements are g[0]=x, g[1]=y, and g[2]=z, similarly for l.
-//
-// GtoL(const Int_t *Id, const Float_t *g, Float_t *l)
-//     The function that does the global ALICE Cartesian coordinate
-// to local active volume detector Cartesian coordinate transformation.
-// The local detector coordinate system is determined by the three
-// element array Id containing as it's three elements Id[0]=layer, 
-// Id[1]=ladder, and Id[2]=detector numbers. The global coordinates
-// are entered by the three element Float_t array g and the local
-// coordinate values are returned by the three element Float_t array l.
-// The order of the three elements are g[0]=x, g[1]=y, and g[2]=z,
-// similarly for l.
-//
-//  LtoG(Int_t layer, Int_t ladder, Int_t detector,
-//       const Float_t *l, Float_t *g)
-//     The function that does the local active volume detector Cartesian
-// coordinate to global ALICE Cartesian coordinate transformation.
-// The local detector coordinate system is determined by the layer, 
-// ladder, and detector numbers. The local coordinates are entered by
-// the three element Float_t array l and the global coordinate values
-// are returned by the three element Float_t array g. The order of the 
-// three elements are l[0]=x, l[1]=y, and l[2]=z, similarly for g.
-//
-// LtoG(const Int_t *Id, const Float_t *l, Float_t *g)
-//     The function that does the local active volume detector Cartesian
-// coordinate to global ALICE Cartesian coordinate transformation.
-// The local detector coordinate system is determined by the three
-// element array Id containing as it's three elements Id[0]=layer, 
-// Id[1]=ladder, and Id[2]=detector numbers. The local coordinates
-// are entered by the three element Float_t array l and the global
-// coordinate values are returned by the three element Float_t array g.
-// The order of the three elements are l[0]=x, l[1]=y, and l[2]=z,
-// similarly for g.
-//
-// Int_t IsVersion()
-//     This function returns the version number of this AliITSgeom
-// class.
-//
-// AddShape(TObject *shape)
-//     This function adds one more shape element to the TObjArray
-// fShape. It is primarily used in the constructor functions of the
-// AliITSgeom class. The pointer *shape can be the pointer to any
-// class that is derived from TObject (this is true for nearly every
-// ROOT class). This does not appear to be working properly at this time.
-//
-// PrintComparison(FILE *fp, AliITSgeom *other)
-//     This function was primarily created for diagnostic reasons. It
-// print to a file pointed to by the file pointer fp the difference
-// between two AliITSgeom classes. The format of the file is basicly,
-// define d? to be the difference between the same element of the two
-// classes. For example dfrx = this->fg[i][j].frx - other->fg[i][j].frx.
-// if(at least one of dfx0, dfy0, dfz0,dfrx,dfry,dfrz are non zero) then print
-// layer ladder detector dfx0 dfy0 dfz0 dfrx dfry dfrz
-// if(at least one of the 9 elements of dfr[] are non zero) then print
-// layer ladder detector dfr[0] dfr[1] dfr[2]
-//                       dfr[3] dfr[4] dfr[5]
-//                       dfr[6] dfr[7] dfr[8]
-// Only non zero values are printed to save space. The differences are
-// typical written to a file because there are usually a lot of numbers
-// printed out and it is usually easier to read them in some nice editor
-// rather than zooming quickly past you on a screen. fprintf is used to
-// do the printing. The fShapeIndex difference is not printed at this time.
-//
-// PrintData(FILE *fp, Int_t layer, Int_t ladder, Int_t detector)
-//     This function prints out the coordinate transformations for
-// the particular detector defined by layer, ladder, and detector
-// to the file pointed to by the File pointer fp. fprinf statements
-// are used to print out the numbers. The format is
-// layer ladder detector Trans= fx0 fy0 fz0 rot= frx fry frz Shape=fShapeIndex
-//                         dfr= fr[0] fr[1] fr[2]
-//                         dfr= fr[3] fr[4] fr[5]
-//                         dfr= fr[6] fr[7] fr[8]
-// By indicating which detector, some control over the information 
-// is given to the user. The output it written to the file pointed
-// to by the file pointer fp. This can be set to stdout if you want.
-//
-// Streamer(TBuffer &R__b)
-//     The default Streamer function "written by ROOT" doesn't write out
-// the arrays referenced by pointers. Therefore, a specific Streamer function
-// has to be written. This function should not be modified but instead added
-// on to so that older versions can still be read. The proper handling of
-// the version dependent streamer function hasn't been written do to the lack
-// of finding an example at the time of writting.
-//
-//----------------------------------------------------------------------
-//
-//     The following member functions are defined to modify an existing
-// AliITSgeom data structure. They were developed for the use in doing
-// alignment studies of the ITS.
-//
-// GlobalChange(Float_t *dtranslation, Float_t *drotation)
-//     This function performs a Cartesian translation and rotation of
-// the full ITS from its default position by an amount determined by
-// the three element arrays dtranslation and drotation. If every element
-// of dtranslation and drotation are zero then there is no change made
-// the geometry. The change is global in that the exact same translation
-// and rotation is done to every detector element in the exact same way.
-// The units of the translation are those of the Monte Carlo, usually cm,
-// and those of the rotation are in radians. The elements of dtranslation
-// are dtranslation[0] = x, dtranslation[1] = y, and dtranslation[2] = z.
-// The elements of drotation are drotation[0] = rx, drotation[1] = ry, and
-// drotation[2] = rz. A change in x will move the hole ITS in the ALICE
-// global x direction, the same for a change in y. A change in z will
-// result in a translation of the ITS as a hole up or down the beam line.
-// A change in the angles will result in the inclination of the ITS with
-// respect to the beam line, except for an effective rotation about the
-// beam axis which will just rotate the ITS as a hole about the beam axis.
-//
-// GlobalCylindericalChange(Float_t *dtranslation, Float_t *drotation)
-//     This function performs a cylindrical translation and rotation of
-// each ITS element by a fixed about in radius, rphi, and z from its
-// default position by an amount determined by the three element arrays
-// dtranslation and drotation. If every element of dtranslation and
-// drotation are zero then there is no change made the geometry. The
-// change is global in that the exact same distance change in translation
-// and rotation is done to every detector element in the exact same way.
-// The units of the translation are those of the Monte Carlo, usually cm,
-// and those of the rotation are in radians. The elements of dtranslation
-// are dtranslation[0] = r, dtranslation[1] = rphi, and dtranslation[2] = z.
-// The elements of drotation are drotation[0] = rx, drotation[1] = ry, and
-// drotation[2] = rz. A change in r will results in the increase of the
-// radius of each layer by the same about. A change in rphi will results in
-// the rotation of each layer by a different angle but by the same
-// circumferential distance. A change in z will result in a translation
-// of the ITS as a hole up or down the beam line. A change in the angles
-// will result in the inclination of the ITS with respect to the beam
-// line, except for an effective rotation about the beam axis which will
-// just rotate the ITS as a hole about the beam axis.
-//
-// RandomChange(Float_t *stranslation, Float_t *srotation)
-//     This function performs a Gaussian random displacement and/or
-// rotation about the present global position of each active
-// volume/detector of the ITS. The sigma of the random displacement
-// is determined by the three element array stranslation, for the
-// x y and z translations, and the three element array srotation,
-// for the three rotation about the axis x y and z.
-//
-// RandomCylindericalChange(Float_t *stranslation, Float_t *srotation)
-//     This function performs a Gaussian random displacement and/or
-// rotation about the present global position of each active
-// volume/detector of the ITS. The sigma of the random displacement
-// is determined by the three element array stranslation, for the
-// r rphi and z translations, and the three element array srotation,
-// for the three rotation about the axis x y and z. This random change
-// in detector position allow for the simulation of a random uncertainty
-// in the detector positions of the ITS.
-////////////////////////////////////////////////////////////////////////
- private:
-    Int_t     fNlayers; // The number of layers.
-    Int_t     *fNlad;   // Array of the number of ladders/layer(layer)
-    Int_t     *fNdet;   // Array of the number of detectors/ladder(layer)
-    ITS_geom  **fg;     // Structure of translation and rotation.
-    TObjArray *fShape;  // Array of shapes and detector information.
 
  public:
     AliITSgeom();                      // Default constructor
     AliITSgeom(const char *filename);  // Constructor
+    void ReadNewFile(const char *filename); // Constructor for new format.
     AliITSgeom(AliITSgeom &source);    // Copy constructor
     void operator=(AliITSgeom &source);// = operator
     virtual ~AliITSgeom();             // Default destructor
-    // this is a dummy routine for now.
-    inline Int_t GetNdetectors(Int_t layer) {return fNdet[layer-1];}
-    inline Int_t GetNladders(Int_t layer)   {return fNlad[layer-1];}
-    inline Int_t GetNlayers()               {return fNlayers;}
-    inline void GetAngles(Int_t lay,Int_t lad,Int_t det,
-                         Float_t &rx,Float_t &ry,Float_t &rz){
-                          rx = fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].frx;
-                          ry = fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].fry;
-                          rz = fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].frz;}
-    inline void GetTrans(Int_t lay,Int_t lad,Int_t det,
-                        Float_t &x,Float_t &y,Float_t &z){
-                         x = fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].fx0;
-                         y = fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].fy0;
-                         z = fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].fz0;}
-    void SetByAngles(Int_t lay,Int_t lad,Int_t det,
-                    Float_t rx,Float_t ry,Float_t rz);
-    inline void SetTrans(Int_t lay,Int_t lad,Int_t det,
-                        Float_t x,Float_t y,Float_t z){
-                         fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].fx0 = x;
-                         fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].fy0 = y;
-                         fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].fz0 = z;}
-    void GetRotMatrix(Int_t lay,Int_t lad,Int_t det,Float_t *mat);
-    void GtoL(Int_t lay,Int_t lad,Int_t det,const Float_t *g,Float_t *l);
-    void GtoL(const Int_t *id,const Float_t *g,Float_t *l);
-    void GtoL(const Int_t index,const Float_t *g,Float_t *l);
-    void GtoLMomentum(Int_t lay,Int_t lad,Int_t det,const Float_t *g,Float_t *l);
-    void LtoG(Int_t lay,Int_t lad,Int_t det,const Float_t *l,Float_t *g);
-    void LtoG(const Int_t *id,const Float_t *l,Float_t *g);
-    void LtoG(const Int_t index,const Float_t *l,Float_t *g);
-    void LtoGMomentum(Int_t lay,Int_t lad,Int_t det,const Float_t *l,Float_t *g);
-    Int_t GetModuleIndex(Int_t lay,Int_t lad,Int_t det);
-    void  GetModuleId(Int_t index,Int_t &lay,Int_t &lad,Int_t &det);
-    void GlobalChange(Float_t  *tran,Float_t  *rot);
-    void GlobalCylindericalChange(Float_t *tran,Float_t *rot);
-    void RandomChange(Float_t *stran,Float_t *srot);
-    void RandomCylindericalChange(Float_t *stran,Float_t *srot);
+// Getters
+    Int_t GetTransformationType() const {return fTrans;}
+//
+    Bool_t IsGeantToGeant()     const {return (fTrans == 0);}
+    Bool_t IsGeantToTracking()  const {return ((fTrans&&0xfffe)!= 0);}
+    Bool_t IsGeantToDisplaced() const {return ((fTrans&&0xfffd)!= 0);}
+//
+    //     This function returns the number of detectors/ladder for a give 
+    // layer. In particular it returns fNdet[layer-1].
+    Int_t GetNdetectors(const Int_t lay) const {return fNdet[lay-1];}
+    //     This function returns the number of ladders for a give layer. In
+    // particular it returns fNlad[layer-1].
+    Int_t GetNladders(const Int_t lay)   const {return fNlad[lay-1];}
+    //     This function returns the number of layers defined in the ITS
+    // geometry. In particular it returns fNlayers.
+    Int_t GetNlayers()                   const {return fNlayers;}
+    Int_t GetModuleIndex(const Int_t lay,const Int_t lad,const Int_t det);
+    //     This function returns the module index number given the layer,
+    // ladder and detector numbers put into the array id[3].
+    Int_t GetModuleIndex(const Int_t *id){
+       return GetModuleIndex(id[0],id[1],id[2]);}
+    void  GetModuleId(const Int_t index,Int_t &lay,Int_t &lad,Int_t &det);
+//
+    Int_t GetStartDet(const Int_t dtype );
+    Int_t GetLastDet(const Int_t dtype);
+    //     Returns the starting module index number for SPD detector,
+    // assuming the modules are placed in the "standard" cylindrical
+    // ITS structure.
+    Int_t GetStartSPD() {return GetModuleIndex(1,1,1);}
+    //     Returns the ending module index number for SPD detector,
+    // assuming the modules are placed in the "standard" cylindrical
+    // ITS structure.
+    Int_t GetLastSPD()  {return GetModuleIndex(2,fNlad[1],fNdet[1]);}
+    //     Returns the starting module index number for SDD detector,
+    // assuming the modules are placed in the "standard" cylindrical
+    // ITS structure.
+    Int_t GetStartSDD() {return GetModuleIndex(3,1,1);}
+    //     Returns the ending module index number for SDD detector,
+    // assuming the modules are placed in the "standard" cylindrical
+    // ITS structure.
+    Int_t GetLastSDD()  {return GetModuleIndex(4,fNlad[3],fNdet[3]);}
+    //     Returns the starting module index number for SSD detector,
+    // assuming the modules are placed in the "standard" cylindrical
+    // ITS structure.
+    Int_t GetStartSSD() {return GetModuleIndex(5,1,1);}
+    //     Returns the ending module index number for SSD detector,
+    // assuming the modules are placed in the "standard" cylindrical
+    // ITS structure.
+    Int_t GetLastSSD()  {return GetModuleIndex(6,fNlad[5],fNdet[5]);}
+    //     Returns the last module index number.
+    Int_t GetIndexMax() {return fNmodules;}
+//
+    //     This function returns the rotation angles for a give module 
+    // in the Double point array ang[3]. The angles are in radians
+    void  GetAngles(const Int_t index,Double_t *ang) {
+                    fGm[index]->GetAngles(ang);}
+    //     This function returns the rotation angles for a give module
+    // in the three floating point variables provided. rx = frx,
+    // fy = fry, rz = frz. The angles are in radians
+    void  GetAngles(const Int_t index,Float_t &rx,Float_t &ry,Float_t &rz) {
+                    Double_t a[3];GetAngles(index,a);
+                    rx = a[0];ry = a[1];rz = a[2];}
+    //     This function returns the rotation angles for a give detector on
+    // a give ladder in a give layer in the three floating point variables
+    // provided. rx = frx, fy = fry, rz = frz. The angles are in radians
+    void  GetAngles(const Int_t lay,const Int_t lad,const Int_t det,
+                    Float_t &rx,Float_t &ry,Float_t &rz) {
+                    GetAngles(GetModuleIndex(lay,lad,det),rx,ry,rz);}
+//
+    //     This function returns the 6 GEANT rotation angles for a give 
+    // module in the double point array ang[3]. The angles are in degrees
+    void  GetGeantAngles(const Int_t index,Double_t *ang){
+                          fGm[index]->SixAnglesFromMatrix(ang);}
+//
+    //     This function returns the Cartesian translation for a give
+    // module in the Double array t[3]. The units are
+    // those of the Monte Carlo, generally cm.
+    void  GetTrans(const Int_t index,Double_t *t) {
+                   fGm[index]->GetTranslation(t);}
+    //     This function returns the Cartesian translation for a give
+    // module index in the three floating point variables provided.
+    // x = fx0, y = fy0, z = fz0. The units are those of the Mont
+    // Carlo, generally cm.
+    void  GetTrans(const Int_t index,Float_t &x,Float_t &y,Float_t &z) {
+                   Double_t t[3];GetTrans(index,t);
+                   x = t[0];y = t[1];z = t[2];}
+    //     This function returns the Cartesian translation for a give
+    // detector on a give ladder in a give layer in the three floating
+    // point variables provided. x = fx0, y = fy0, z = fz0. The units are
+    // those of the Monte Carlo, generally cm.
+    void  GetTrans(const Int_t lay,const Int_t lad,const Int_t det,
+                   Float_t &x,Float_t &y,Float_t &z) {
+                   GetTrans(GetModuleIndex(lay,lad,det),x,y,z);}
+//
+    //      This function returns the Cartesian translation [cm] and the
+    // 6 GEANT rotation angles [degrees]for a given layer ladder and
+    // detector number, in the TVector x (at least 9 elements large).
+    void  GetCenterThetaPhi(const Int_t lay,const Int_t lad,const Int_t det,
+                           TVector &x){Double_t t[3],ang[6];
+                           Int_t index=GetModuleIndex(lay,lad,det);
+                           GetTrans(index,t);GetGeantAngles(index,ang);
+                           x(0) =   t[0];x(1) =   t[1];x(2) =   t[2];
+                           x(3) = ang[0];x(4) = ang[1];x(5) = ang[2];
+                           x(6) = ang[3];x(7) = ang[4];x(8) = ang[5];}
+//
+    //     This function returns the rotation matrix in Double
+    // precision for a given module.
+    void  GetRotMatrix(const Int_t index,Double_t mat[3][3]){
+          fGm[index]->GetMatrix(mat);}
+    //     This function returns the rotation matrix in a Double
+    // precision pointer for a given module. mat[i][j] => mat[3*i+j].
+    void  GetRotMatrix(const Int_t index,Double_t *mat){
+          Double_t rot[3][3];GetRotMatrix(index,rot);
+          for(Int_t i=0;i<3;i++)for(Int_t j=0;j<3;j++) mat[3*i+j] = rot[i][j];}
+    //     This function returns the rotation matrix in a floating 
+    // precision pointer for a given layer ladder and detector module.
+    // mat[i][j] => mat[3*i+j].
+    void  GetRotMatrix(const Int_t lay,const Int_t lad,const Int_t det,
+                 Float_t *mat){GetRotMatrix(GetModuleIndex(lay,lad,det),mat);}
+    //     This function returns the rotation matrix in a Double
+    // precision pointer for a given layer ladder and detector module.
+    // mat[i][j] => mat[3*i+j].
+    void  GetRotMatrix(const Int_t lay,const Int_t lad,const Int_t det,
+                Double_t *mat){GetRotMatrix(GetModuleIndex(lay,lad,det),mat);}
+    //     This function returns the rotation matrix in a floating
+    // precision pointer for a given module. mat[i][j] => mat[3*i+j].
+    void  GetRotMatrix(const Int_t index,Float_t *mat){
+          Double_t rot[3][3];fGm[index]->GetMatrix(rot);
+          for(Int_t i=0;i<3;i++)for(Int_t j=0;j<3;j++) mat[3*i+j] = rot[i][j];}
+//
+    //     This function returns a pointer to the class describing the
+    // detector for a particular module index. This will return a pointer
+    // to one of the classes AliITSgeomSPD, AliITSgeomSDD, or AliITSgeomSSD,
+    // for example.
+    virtual TObject *GetShape(const Int_t index)
+                       {return fShape->At(fGm[index]->GetDetectorIndex());}
+    //     This function returns a pointer to the class describing the
+    // detector for a particular layer ladder and detector numbers. This
+    // will return a pointer to one of the classes AliITSgeomSPD,
+    // AliITSgeomSDD, or AliITSgeomSSD, for example.
+    virtual TObject *GetShape(const Int_t lay,const Int_t lad,const Int_t det)
+                            {return GetShape(GetModuleIndex(lay,lad,det));}
+//
+    //     This function returns a pointer to the particular AliITSgeomMatrix
+    // class for a specific module index.
+    AliITSgeomMatrix *GetGeomMatrix(Int_t index){return fGm[index];}
+//
+//  Setters
+    //     Sets the rotation angles and matrix for a give module index
+    // via the double precision array a[3] [radians].
+    void SetByAngles(const Int_t index,const Double_t a[]){
+       fGm[index]->SetAngles(a);}
+    //     Sets the rotation angles and matrix for a give module index
+    // via the 3 floating precision variables rx, ry, and rz [radians].
+    void SetByAngles(const Int_t index,
+                    const Float_t rx,const Float_t ry,const Float_t rz) {
+                     Double_t a[3];a[0] = rx;a[1] = ry;a[2] = rz;
+                     fGm[index]->SetAngles(a);}
+    //     Sets the rotation angles and matrix for a give layer, ladder,
+    // and detector numbers via the 3 floating precision variables rx,
+    // ry, and rz [radians].
+    void SetByAngles(const Int_t lay,const Int_t lad,const Int_t det,
+                     const Float_t rx,const Float_t ry,const Float_t rz) {
+                     SetByAngles(GetModuleIndex(lay,lad,det),rx,ry,rz);}
+//
+    //     Sets the rotation angles and matrix for a give module index
+    // via the Double precision array a[6] [degree]. The angles are those
+    // defined by GEANT 3.12.
+    void SetByGeantAngles(const Int_t index,const Double_t *ang){
+       fGm[index]->MatrixFromSixAngles(ang);}
+    //     Sets the rotation angles and matrix for a give layer, ladder
+    // and detector, in the array id[3] via the Double precision array
+    // a[6] [degree]. The angles are those defined by GEANT 3.12.
+    void SetByGeantAngles(const Int_t *id,const Double_t *ang){
+       SetByGeantAngles(GetModuleIndex(id),ang);}
+    //     Sets the rotation angles and matrix for a give layer, ladder
+    // and detector, via the Double precision array a[6] [degree]. The
+    // angles are those defined by GEANT 3.12.
+    void SetByGeantAngles(const Int_t lay,const Int_t lad,const Int_t det,
+                         const Double_t *ang){
+       SetByGeantAngles(GetModuleIndex(lay,lad,det),ang);}
+//
+    //     This function sets a new translation vector, given by the
+    // array x[3], for the Cartesian coordinate transformation
+    // for a give module index.
+    void SetTrans(const Int_t index,Double_t x[]){
+       fGm[index]->SetTranslation(x);}
+    //     This function sets a new translation vector, given by the three
+    // variables x, y, and z, for the Cartesian coordinate transformation
+    // for the detector defined by layer, ladder and detector.
+    void SetTrans(const Int_t lay,const Int_t lad,const Int_t det,
+                  Float_t x,Float_t y,Float_t z){Double_t t[3];
+                  t[0] = x;t[1] = y;t[2] = z;
+                  SetTrans(GetModuleIndex(lay,lad,det),t);}
+//
+    //     This function adds one more shape element to the TObjArray
+    // fShape. It is primarily used in the constructor functions of the
+    // AliITSgeom class. The pointer *shape can be the pointer to any
+    // class that is derived from TObject (this is true for nearly every
+    // ROOT class). This does not appear to be working properly at this time.
+    void AddShape(TObject *shp){fShape->AddLast(shp);}
+    //     This function deletes an existing shape element, of type TObject,
+    // and replaces it with the one specified. This is primarily used to
+    // changes the parameters to the segmentation class for a particular
+    // type of detector.
+    void ReSetShape(const Int_t dtype,TObject *shp){
+         fShape->RemoveAt(dtype);fShape->AddAt(shp,dtype);}
+//
+//  transformations
+    //     Transforms from the ALICE Global coordinate system
+    // to the detector local coordinate system for the detector
+    // defined by the layer, ladder, and detector numbers. The
+    // global and local coordinate are given in two floating point
+    // arrays g[3], and l[3].
+    void GtoL(const Int_t lay,const Int_t lad,const Int_t det,
+             const Float_t *g,Float_t *l){
+         GtoL(GetModuleIndex(lay,lad,det),g,l);}
+    //     Transforms from the ALICE Global coordinate system
+    // to the detector local coordinate system for the detector
+    // defined by the id[0], id[1], and id[2] numbers. The
+    // global and local coordinate are given in two floating point
+    // arrays g[3], and l[3].
+    void GtoL(const Int_t *id,const Float_t *g,Float_t *l){
+         GtoL(GetModuleIndex(id),g,l);}
+    //     Transforms from the ALICE Global coordinate system
+    // to the detector local coordinate system for the detector
+    // module index number. The global and local coordinate are
+    // given in two floating point arrays g[3], and l[3].
+    void GtoL(const Int_t index,const Float_t *g,Float_t *l){
+         Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dg[i] = g[i];
+         fGm[index]->GtoLPosition(dg,dl);
+         for(i=0;i<3;i++) l[i] =dl[i];}
+    //     Transforms from the ALICE Global coordinate system
+    // to the detector local coordinate system for the detector
+    // defined by the layer, ladder, and detector numbers. The
+    // global and local coordinate are given in two Double point
+    // arrays g[3], and l[3].
+    void GtoL(const Int_t lay,const Int_t lad,const Int_t det,
+             const Double_t *g,Double_t *l){
+         GtoL(GetModuleIndex(lay,lad,det),g,l);}
+    //     Transforms from the ALICE Global coordinate system
+    // to the detector local coordinate system for the detector
+    // defined by the id[0], id[1], and id[2] numbers. The
+    // global and local coordinate are given in two Double point
+    // arrays g[3], and l[3].
+    void GtoL(const Int_t *id,const Double_t *g,Double_t *l){
+         GtoL(GetModuleIndex(id),g,l);}
+    //     Transforms from the ALICE Global coordinate system
+    // to the detector local coordinate system for the detector
+    // module index number. The global and local coordinate are
+    // given in two Double point arrays g[3], and l[3].
+    void GtoL(const Int_t index,const Double_t *g,Double_t *l){
+         Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dg[i] = g[i];
+         fGm[index]->GtoLPosition(dg,dl);
+         for(i=0;i<3;i++) l[i] =dl[i];}
+//
+    //     Transforms from the ALICE Global coordinate system
+    // to the detector local coordinate system (used for ITS tracking)
+    // for the detector module index number. The global and local
+    // coordinate are given in two Double point arrays g[3], and l[3].
+    void GtoLtracking(const Int_t index,const Double_t *g,Double_t *l){
+        if(IsGeantToTracking()) GtoL(index,g,l);
+        else fGm[index]->GtoLPositionTracking(g,l);}
+    //     Transforms from the ALICE Global coordinate system
+    // to the detector local coordinate system (used for ITS tracking)
+    // for the detector id[3]. The global and local
+    // coordinate are given in two Double point arrays g[3], and l[3].
+    void GtoLtracking(const Int_t *id,const Double_t *g,Double_t *l){
+        GtoLtracking(GetModuleIndex(id),g,l);}
+    //     Transforms from the ALICE Global coordinate system
+    // to the detector local coordinate system (used for ITS tracking)
+    // for the detector layer ladder and detector numbers. The global
+    // and local coordinate are given in two Double point arrays g[3],
+    // and l[3].
+    void GtoLtracking(const Int_t lay,const Int_t lad,const Int_t det,
+                     const Double_t *g,Double_t *l){
+        GtoLtracking(GetModuleIndex(lay,lad,det),g,l);}
+//
+    //     Transforms of momentum types of quantities from the ALICE
+    // Global coordinate system to the detector local coordinate system
+    // for the detector layer ladder and detector numbers. The global
+    // and local coordinate are given in two float point arrays g[3],
+    // and l[3].
+    void GtoLMomentum(const Int_t lay,const Int_t lad,const Int_t det,
+                     const Float_t *g,Float_t *l){
+                         GtoLMomentum(GetModuleIndex(lay,lad,det),g,l);}
+    //     Transforms of momentum types of quantities from the ALICE
+    // Global coordinate system to the detector local coordinate system
+    // for the detector module index number. The global and local
+    // coordinate are given in two float point arrays g[3], and l[3].
+    void GtoLMomentum(const Int_t index,const Float_t *g,Float_t *l){
+         Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dg[i] = g[i];
+         fGm[index]->GtoLMomentum(dg,dl);
+         for(i=0;i<3;i++) l[i] =dl[i];}
+    //     Transforms of momentum types of quantities from the ALICE
+    // Global coordinate system to the detector local coordinate system
+    // for the detector layer ladder and detector numbers. The global
+    // and local coordinate are given in two Double point arrays g[3],
+    // and l[3].
+    void GtoLMomentum(const Int_t lay,const Int_t lad,const Int_t det,
+                     const Double_t *g,Double_t *l){
+         GtoLMomentum(GetModuleIndex(lay,lad,det),g,l);}
+    //     Transforms of momentum types of quantities from the ALICE
+    // Global coordinate system to the detector local coordinate system
+    // for the detector module index number. The global and local
+    // coordinate are given in two Double point arrays g[3], and l[3].
+    void GtoLMomentum(const Int_t index,const Double_t *g,Double_t *l){
+         Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dg[i] = g[i];
+         fGm[index]->GtoLMomentum(dg,dl);
+         for(i=0;i<3;i++) l[i] =dl[i];}
+//
+    //     Transforms of momentum types of quantities from the ALICE
+    // Global coordinate system to the detector local coordinate system
+    // (used for ITS tracking) for the detector module index number.
+    // The global and local coordinate are given in two Double point
+    // arrays g[3], and l[3].
+    void GtoLMomentumTracking(const Int_t index,const Double_t *g,Double_t *l){
+         if(IsGeantToTracking()) GtoLMomentum(index,g,l);
+         else fGm[index]->GtoLMomentumTracking(g,l);}
+    //     Transforms of momentum types of quantities from the ALICE
+    // Global coordinate system to the detector local coordinate system
+    // (used for ITS tracking) for the detector id[3].
+    // The global and local coordinate are given in two Double point
+    // arrays g[3], and l[3].
+    void GtoLMomentumTracking(const Int_t *id,const Double_t *g,Double_t *l){
+                 GtoLMomentumTracking(GetModuleIndex(id),g,l);}
+    //     Transforms of momentum types of quantities from the ALICE
+    // Global coordinate system to the detector local coordinate system
+    // (used for ITS tracking) for the detector layer ladder and detector
+    // numbers. The global and local coordinate are given in two Double point
+    // arrays g[3], and l[3].
+    void GtoLMomentumTracking(const Int_t lay,const Int_t lad,const Int_t det,
+                             const Double_t *g,Double_t *l){
+                        GtoLMomentumTracking(GetModuleIndex(lay,lad,det),g,l);}
+//
+    //     Transforms from the detector local coordinate system
+    // to the ALICE Global coordinate  system for the detector
+    // defined by the layer, ladder, and detector numbers. The
+    // global and local coordinate are given in two floating point
+    // arrays g[3], and l[3].
+    void LtoG(const Int_t lay,const Int_t lad,const Int_t det,
+             const Float_t *l,Float_t *g){
+                     LtoG(GetModuleIndex(lay,lad,det),l,g);}
+    //     Transforms from the detector local coordinate system
+    // to the ALICE Global coordinate system for the detector
+    // defined by the id[0], id[1], and id[2] numbers. The
+    // global and local coordinate are given in two floating point
+    // arrays g[3], and l[3].
+    void LtoG(const Int_t *id,const Float_t *l,Float_t *g){
+                     LtoG(GetModuleIndex(id),l,g);}
+    //     Transforms from the detector local coordinate system
+    // to the ALICE Global coordinate system for the detector
+    // module index number. The global and local coordinate are
+    // given in two floating point arrays g[3], and l[3].
+    void LtoG(const Int_t index,const Float_t *l,Float_t *g){
+         Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dl[i] = l[i];
+         fGm[index]->LtoGPosition(dl,dg);
+         for(i=0;i<3;i++) g[i] =dg[i];}
+    //     Transforms from the detector local coordinate system
+    // to the ALICE Global coordinate system for the detector
+    // defined by the layer, ladder, and detector numbers. The
+    // global and local coordinate are given in two Double point
+    // arrays g[3], and l[3].
+    void LtoG(const Int_t lay,const Int_t lad,const Int_t det,
+             const Double_t *l,Double_t *g){
+                      LtoG(GetModuleIndex(lay,lad,det),l,g);}
+    //     Transforms from the detector local coordinate system
+    // to the ALICE Global coordinate system for the detector
+    // defined by the id[0], id[1], and id[2] numbers. The
+    // global and local coordinate are given in two Double point
+    // arrays g[3], and l[3].
+    void LtoG(const Int_t *id,const Double_t *l,Double_t *g){
+                       LtoG(GetModuleIndex(id),l,g);}
+    //     Transforms from the detector local coordinate system
+    // to the ALICE Global coordinate system for the detector
+    // module index number. The global and local coordinate are
+    // given in two Double point arrays g[3], and l[3].
+    void LtoG(const Int_t index,const Double_t *l,Double_t *g){
+         Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dl[i] = l[i];
+         fGm[index]->LtoGPosition(dl,dg);
+         for(i=0;i<3;i++) g[i] =dg[i];}
+//
+    //     Transforms from the detector local coordinate system (used
+    // for ITS tracking) to the ALICE Global coordinate system 
+    // for the detector module index number. The global and local
+    // coordinate are given in two Double point arrays g[3], and l[3].
+    void LtoGtracking(const Int_t index,const Double_t *l,Double_t *g){
+        if(IsGeantToTracking()) LtoG(index,l,g);
+        else fGm[index]->LtoGPositionTracking(l,g);}
+    //     Transforms from the detector local coordinate system (used
+    // for ITS tracking) to the ALICE Global coordinate system 
+    // for the detector id[3]. The global and local
+    // coordinate are given in two Double point arrays g[3], and l[3].
+    void LtoGtracking(const Int_t *id,const Double_t *l,Double_t *g){
+        LtoGtracking(GetModuleIndex(id),l,g);}
+    //     Transforms from the detector local coordinate system (used
+    // for ITS tracking) to the detector local coordinate system
+    // for the detector layer ladder and detector numbers. The global
+    // and local coordinate are given in two Double point arrays g[3],
+    // and l[3].
+    void LtoGtracking(const Int_t lay,const Int_t lad,const Int_t det,
+                     const Double_t *l,Double_t *g){
+        LtoGtracking(GetModuleIndex(lay,lad,det),l,g);}
+//
+    //     Transforms of momentum types of quantities from the detector
+    // local coordinate system to the ALICE Global coordinate system
+    // for the detector layer ladder and detector numbers. The global
+    // and local coordinate are given in two float point arrays g[3],
+    // and l[3].
+    void LtoGMomentum(const Int_t lay,const Int_t lad,const Int_t det,
+                     const Float_t *l,Float_t *g){
+         LtoGMomentum(GetModuleIndex(lay,lad,det),l,g);}
+    //     Transforms of momentum types of quantities from the detector
+    // local coordinate system to the ALICE Global coordinate system
+    // for the detector module index number. The global and local
+    // coordinate are given in two float point arrays g[3], and l[3].
+    void LtoGMomentum(const Int_t index,const Float_t *l,Float_t *g){
+         Double_t dg[3],dl[3];Int_t i;for(i=0;i<3;i++) dl[i] = l[i];
+         fGm[index]->LtoGMomentum(dl,dg);
+         for(i=0;i<3;i++) g[i] =dg[i];}
+    //     Transforms of momentum types of quantities from the detector
+    // local coordinate system to the ALICE Global coordinate system
+    // for the detector layer ladder and detector numbers. The global
+    // and local coordinate are given in two Double point arrays g[3],
+    // and l[3].
+    void LtoGMomentum(const Int_t lay,const Int_t lad,const Int_t det,
+                          const Double_t *l,Double_t *g){
+                        LtoGMomentum(GetModuleIndex(lay,lad,det),l,g);}
+    //     Transforms of momentum types of quantities from the detector
+    // local coordinate system to the ALICE Global coordinate system
+    // for the detector module index number. The global and local
+    // coordinate are given in two Double point arrays g[3], and l[3].
+    void LtoGMomentum(const Int_t index,const Double_t *l,Double_t *g){
+         fGm[index]->LtoGMomentum(l,g);}
+//
+    //     Transforms of momentum types of quantities from the detector 
+    // local coordinate system (used for ITS tracking) to the detector
+    // system ALICE Global for the detector module index number.
+    // The global and local coordinate are given in two Double point
+    // arrays g[3], and l[3].
+    void LtoGMomentumTracking(const Int_t index,const Double_t *l,Double_t *g){
+         if(IsGeantToTracking()) LtoGMomentum(index,l,g);
+         else fGm[index]->LtoGMomentumTracking(l,g);}
+    //     Transforms of momentum types of quantities from the detector
+    // local coordinate system (used for ITS tracking) to the ALICE
+    // Global coordinate system for the detector id[3].
+    // The global and local coordinate are given in two Double point
+    // arrays g[3], and l[3].
+    void LtoGMomentumTracking(const Int_t *id,const Double_t *l,Double_t *g){
+                 LtoGMomentumTracking(GetModuleIndex(id),l,g);}
+    //     Transforms of momentum types of quantities from the detector
+    // local coordinate system (used for ITS tracking) to the ALICE
+    // Global coordinate system for the detector layer ladder and detector
+    // numbers. The global and local coordinate are given in two Double point
+    // arrays g[3], and l[3].
+    void LtoGMomentumTracking(const Int_t lay,const Int_t lad,const Int_t det,
+                             const Double_t *l,Double_t *g){
+                        LtoGMomentumTracking(GetModuleIndex(lay,lad,det),l,g);}
+//
+    //     Transforms from one detector local coordinate system
+    // to another detector local coordinate system for the detector
+    // module index1 number to the detector module index2 number. The
+    //  local coordinates are given in two Double point arrays l1[3],
+    // and l2[3].
+    void LtoL(const Int_t index1,const Int_t index2,Double_t *l1,Double_t *l2){
+         Double_t g[3]; LtoG(index1,l1,g);GtoL(index2,g,l2);}
+    //     Transforms from one detector local coordinate system
+    // to another detector local coordinate system for the detector
+    // id1[3] to the detector id2[3]. The local coordinates are given
+    // in two Double point arrays l1[3], and l2[3].
+    void LtoL(const Int_t *id1,const Int_t *id2,Double_t *l1,Double_t *l2){
+         LtoL(GetModuleIndex(id1[0],id1[1],id1[2]),
+              GetModuleIndex(id2[0],id2[1],id2[2]),l1,l2);}
+//
+    //     Transforms from one detector local coordinate system (used for
+    // ITS tracking) to another detector local coordinate system (used
+    // for ITS tracking) for the detector module index1 number to the
+    // detector module index2 number. The local coordinates are given
+    // in two Double point arrays l1[3], and l2[3].
+    void LtoLtracking(const Int_t index1,const Int_t index2,
+                          Double_t *l1,Double_t *l2){
+         Double_t g[3]; LtoGtracking(index1,l1,g);GtoLtracking(index2,g,l2);}
+    //     Transforms from one detector local coordinate system (used for
+    // ITS tracking) to another detector local coordinate system (used
+    // for ITS tracking) for the detector id1[3] to the detector id2[3].
+    // The local coordinates are given in two Double point arrays l1[3],
+    // and l2[3].
+    void LtoLtracking(const Int_t *id1,const Int_t *id2,
+                          Double_t *l1,Double_t *l2){
+         LtoLtracking(GetModuleIndex(id1[0],id1[1],id1[2]),
+              GetModuleIndex(id2[0],id2[1],id2[2]),l1,l2);}
+//
+    //     Transforms of momentum types of quantities from one detector
+    // local coordinate system to another detector local coordinate
+    // system for the detector module index1 number to the detector
+    // module index2 number. The local coordinates are given in two
+    // Double point arrays l1[3], and l2[3].
+    void LtoLMomentum(const Int_t index1,const Int_t index2,
+                     const Double_t *l1,Double_t *l2){
+         Double_t g[3]; LtoGMomentum(index1,l1,g);GtoLMomentum(index2,g,l2);}
+    //     Transforms of momentum types of quantities from one detector
+    // local coordinate system to another detector local coordinate
+    // system for the detector id1[3] to the detector id2[3]. The local
+    // coordinates are given in two Double point arrays l1[3], and l2[3].
+    void LtoLMomentum(const Int_t *id1,const Int_t *id2,
+                     const Double_t *l1,Double_t *l2){
+         LtoLMomentum(GetModuleIndex(id1[0],id1[1],id1[2]),
+                      GetModuleIndex(id2[0],id2[1],id2[2]),l1,l2);}
+//
+    //     Transforms of momentum types of quantities from one detector
+    // local coordinate system (used by ITS tracking) to another detector
+    // local coordinate system (used by ITS tracking) for the detector
+    // module index1 number to the detector module index2 number. The
+    // local coordinates are given in two Double point arrays l1[3],
+    // and l2[3].
+    void LtoLMomentumTracking(const Int_t index1,const Int_t index2,
+                          Double_t *l1,Double_t *l2){
+         Double_t g[3]; LtoGMomentumTracking(index1,l1,g);
+                        GtoLMomentumTracking(index2,g,l2);}
+    //     Transforms of momentum types of quantities from one detector
+    // local coordinate system (used by ITS tracking) to another detector
+    // local coordinate system (used by ITS tracking) for the detector
+    // id1[3] to the detector id2[3]. The local coordinates are given in
+    // two Double point arrays l1[3], and l2[3].
+    void LtoLMomentumTracking(const Int_t *id1,const Int_t *id2,
+                          Double_t *l1,Double_t *l2){
+         LtoLMomentumTracking(GetModuleIndex(id1[0],id1[1],id1[2]),
+                              GetModuleIndex(id2[0],id2[1],id2[2]),l1,l2);}
+//
+    //     Transforms a matrix, like an Uncertainty or Error matrix from
+    // the ALICE Global coordinate system to a detector local coordinate
+    // system. The specific detector is determined by the module index
+    // number.
+    void GtoLErrorMatrix(const Int_t index,const Double_t **g,Double_t **l){
+         fGm[index]->GtoLPositionError((Double_t (*)[3])g,(Double_t (*)[3])l);}
+//
+    //     Transforms a matrix, like an Uncertainty or Error matrix from
+    // the ALICE Global coordinate system to a detector local coordinate
+    // system (used by ITS tracking). The specific detector is determined
+    // by the module index number.
+    void GtoLErrorMatrixTracking(const Int_t index,const Double_t **g,
+                                Double_t **l){
+       if(IsGeantToTracking()) fGm[index]->GtoLPositionError((
+           Double_t (*)[3])g,(Double_t (*)[3])l);
+       else fGm[index]->GtoLPositionErrorTracking(
+            (Double_t (*)[3])g,(Double_t (*)[3])l);}
+//
+    //     Transforms a matrix, like an Uncertainty or Error matrix from
+    // the detector local coordinate system to a ALICE Global coordinate
+    // system. The specific detector is determined by the module index
+    // number.
+    void LtoGErrorMatrix(const Int_t index,const Double_t **l,Double_t **g){
+         fGm[index]->LtoGPositionError((Double_t (*)[3])l,(Double_t (*)[3])g);}
+//
+    //     Transforms a matrix, like an Uncertainty or Error matrix from
+    // the detector local coordinate system (used by ITS tracking) to a
+    // ALICE Global coordinate system. The specific detector is determined
+    // by the module index number.
+    void LtoGErrorMatrixTracking(const Int_t index,const Double_t **l,
+                                Double_t **g){
+         if(IsGeantToTracking()) fGm[index]->LtoGPositionError((
+           Double_t (*)[3])g,(Double_t (*)[3])l);
+       else fGm[index]->LtoGPositionErrorTracking((Double_t (*)[3])l,
+                                              (Double_t (*)[3])g);}
+//
+    //     Transforms a matrix, like an Uncertainty or Error matrix from
+    // one detector local coordinate system to another detector local
+    // coordinate system. The specific detector is determined by the
+    // two module index number index1 and index2.
+    void LtoLErrorMatrix(const Int_t index1,const Int_t index2,
+                        const Double_t **l1,Double_t **l2){
+       Double_t g[3][3];
+                  LtoGErrorMatrix(index1,l1,(Double_t **)g);
+                  GtoLErrorMatrix(index2,(const Double_t **)g,l2);}
+//
+    //     Transforms a matrix, like an Uncertainty or Error matrix from
+    // one detector local coordinate system (used by ITS tracking) to
+    // another detector local coordinate system (used by ITS tracking).
+    // The specific detector is determined by the two module index number
+    // index1 and index2.
+    void LtoLErrorMatrixTraking(const Int_t index1,const Int_t index2,
+                        const Double_t **l1,Double_t **l2){Double_t g[3][3];
+                  LtoGErrorMatrixTracking(index1,l1,(Double_t **)g);
+                  GtoLErrorMatrixTracking(index2,(const Double_t **)g,l2);}
+//  Find Specific Modules
+    Int_t    GetNearest(const Double_t g[3],const Int_t lay=0);
+    void     GetNearest27(const Double_t g[3],Int_t n[27],const Int_t lay=0);
+    // Returns the distance [cm] between the point g[3] and the center of
+    // the detector/module specified by the the module index number.
+    Double_t Distance(const Int_t index,const Double_t g[3]){
+         return  TMath::Sqrt(fGm[index]->Distance2(g));}
+//  Geometry manipulation
+    void GlobalChange(const Float_t  *tran,const Float_t  *rot);
+    void GlobalCylindericalChange(const Float_t *tran,const Float_t *rot);
+    void RandomChange(const Float_t *stran,const Float_t *srot);
+    void RandomCylindericalChange(const Float_t *stran,const Float_t *srot);
+    void GeantToTracking(AliITSgeom &source); // This converts the geometry
+//  Other routines.
     void PrintComparison(FILE *fp,AliITSgeom *other);
-    void PrintData(FILE *fp,Int_t lay,Int_t lad,Int_t det);
+    void PrintData(FILE *fp,const Int_t lay,const Int_t lad,const Int_t det);
     ofstream &PrintGeom(ofstream &out);
     ifstream &ReadGeom(ifstream &in);
-    virtual Int_t IsVersion() const {return 0;}
-    inline void AddShape(TObject *shp){fShape->AddLast(shp);}
 
-  ClassDef(AliITSgeom,1)
+ private:
+    Int_t            fTrans;   //Flag to keep track of which transformation 
+    Int_t            fNlayers; //The number of layers.
+    Int_t            fNmodules;//The total number of modules
+    Int_t            *fNlad;   //!Array of the number of ladders/layer(layer)
+    Int_t            *fNdet;   //!Array of the number of detectors/ladder(layer)
+    AliITSgeomMatrix **fGm;    //[fNmodules] Structure of trans. and rotation.
+    TObjArray        *fShape;  //Array of shapes and detector information.
+    
+    ClassDef(AliITSgeom,2) // ITS geometry class
 };
 
 #endif