ROOT logo
#ifndef ALIITSGEOMTGEO_H
#define ALIITSGEOMTGEO_H
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               */

/////////////////////////////////////////////////////////////////////////
//  AliITSgeomTGeo is a simple interface class to TGeoManager          //
//  It is used in the simulation and reconstruction in order to        //
//  query the TGeo ITS geometry                                        //
//                                                                     //
//  author - cvetan.cheshkov@cern.ch                                   //
//  15/02/2007                                                         //
/////////////////////////////////////////////////////////////////////////

#include <TObject.h>
#include <TGeoMatrix.h>

class TGeoPNEntry;

class AliITSgeomTGeo : public TObject {

 public:

  AliITSgeomTGeo() { } // Default constructor
  virtual ~AliITSgeomTGeo() { } // Destructor

  // This function returns the total number of ITS modules 
  static Int_t GetNModules() {return fgkNModules;}
  // This function returns the number of detectors/ladder for a given layer 
  static Int_t GetNDetectors(Int_t lay) {return fgkNDetectors[lay-1];}
  // This function returns the number of ladders for a given layer
  static Int_t GetNLadders(Int_t lay)   {return fgkNLadders[lay-1];}
  // This function returns the number of layers
  static Int_t GetNLayers()             {return kNLayers;}

  // Two methods to map module index to layer,ladder,detector indeces
  static Int_t  GetModuleIndex(Int_t lay,Int_t lad,Int_t det);
  static Bool_t GetModuleId(Int_t index,Int_t &lay,Int_t &lad,Int_t &det);

  static const char *GetSymName(Int_t index); // Get TGeoPNEntry symbolic name
  static const char *GetSymName(Int_t lay,Int_t lad,Int_t det)
    { return GetSymName(GetModuleIndex(lay,lad,det)); }
 
  // This function returns a pointer to the TGeoHMatrix (local->global)
  // of a given module index
  static TGeoHMatrix* GetMatrix(Int_t index);
  static TGeoHMatrix* GetMatrix(Int_t lay,Int_t lad,Int_t det)
    { return GetMatrix(GetModuleIndex(lay,lad,det)); }

  static Bool_t GetTranslation(Int_t index, Double_t t[3]);
  static Bool_t GetTranslation(Int_t lay,Int_t lad,Int_t det, Double_t t[3])
    { return GetTranslation(GetModuleIndex(lay,lad,det),t); }

  static Bool_t GetRotation(Int_t index, Double_t r[9]);
  static Bool_t GetRotation(Int_t lay,Int_t lad,Int_t det, Double_t r[9])
    { return GetRotation(GetModuleIndex(lay,lad,det),r); }

  // This function returns a pointer to the original TGeoHMatrix (local->global)
  // for a specific module index
  static Bool_t GetOrigMatrix(Int_t index, TGeoHMatrix &m);
  static Bool_t GetOrigMatrix(Int_t lay,Int_t lad,Int_t det, TGeoHMatrix &m)
    { return GetOrigMatrix(GetModuleIndex(lay,lad,det),m); }

  static Bool_t GetOrigTranslation(Int_t index, Double_t t[3]);
  static Bool_t GetOrigTranslation(Int_t lay,Int_t lad,Int_t det, Double_t t[3])
    { return GetOrigTranslation(GetModuleIndex(lay,lad,det),t); }

  static Bool_t GetOrigRotation(Int_t index, Double_t r[9]);
  static Bool_t GetOrigRotation(Int_t lay,Int_t lad,Int_t det, Double_t r[9])
    { return GetOrigRotation(GetModuleIndex(lay,lad,det),r); }

  static const TGeoHMatrix* GetTracking2LocalMatrix(Int_t index);
  static const TGeoHMatrix* GetTracking2LocalMatrix(Int_t lay,Int_t lad,Int_t det)
    { return GetTracking2LocalMatrix(GetModuleIndex(lay,lad,det)); }

  static Bool_t GetTrackingMatrix(Int_t index, TGeoHMatrix &m);
  static Bool_t GetTrackingMatrix(Int_t lay,Int_t lad,Int_t det, TGeoHMatrix &m)
    { return GetTrackingMatrix(GetModuleIndex(lay,lad,det),m); }

  static Bool_t LocalToGlobal(Int_t index, const Double_t *loc, Double_t *glob);
  static Bool_t LocalToGlobal(Int_t lay, Int_t lad, Int_t det,
			      const Double_t *loc, Double_t *glob)
    { return LocalToGlobal(GetModuleIndex(lay,lad,det), loc, glob);}

  static Bool_t GlobalToLocal(Int_t index, const Double_t *glob, Double_t *loc);
  static Bool_t GlobalToLocal(Int_t lay, Int_t lad, Int_t det,
			      const Double_t *glob, Double_t *loc)
    { return GlobalToLocal(GetModuleIndex(lay,lad,det), glob, loc);}

  static Bool_t LocalToGlobalVect(Int_t index, const Double_t *loc, Double_t *glob);
  static Bool_t GlobalToLocalVect(Int_t index, const Double_t *glob, Double_t *loc);

  enum {kNLayers = 6}; // The number of layers.

 private:

  static Bool_t       GetLayer(Int_t index,Int_t &lay,Int_t &index2);
  static TGeoPNEntry* GetPNEntry(Int_t index);

  AliITSgeomTGeo(const AliITSgeomTGeo &geom);     // Copy constructor
  AliITSgeomTGeo& operator=(const AliITSgeomTGeo &geom);// Assignment operator

  static const Int_t  fgkNModules;            // The total number of modules
  static const Int_t  fgkNLadders[kNLayers];  // Array of the number of ladders/layer(layer)
  static const Int_t  fgkNDetectors[kNLayers];// Array of the number of detector/ladder(layer)

  ClassDef(AliITSgeomTGeo, 0) // ITS geometry based on TGeo
};

#endif
 AliITSgeomTGeo.h:1
 AliITSgeomTGeo.h:2
 AliITSgeomTGeo.h:3
 AliITSgeomTGeo.h:4
 AliITSgeomTGeo.h:5
 AliITSgeomTGeo.h:6
 AliITSgeomTGeo.h:7
 AliITSgeomTGeo.h:8
 AliITSgeomTGeo.h:9
 AliITSgeomTGeo.h:10
 AliITSgeomTGeo.h:11
 AliITSgeomTGeo.h:12
 AliITSgeomTGeo.h:13
 AliITSgeomTGeo.h:14
 AliITSgeomTGeo.h:15
 AliITSgeomTGeo.h:16
 AliITSgeomTGeo.h:17
 AliITSgeomTGeo.h:18
 AliITSgeomTGeo.h:19
 AliITSgeomTGeo.h:20
 AliITSgeomTGeo.h:21
 AliITSgeomTGeo.h:22
 AliITSgeomTGeo.h:23
 AliITSgeomTGeo.h:24
 AliITSgeomTGeo.h:25
 AliITSgeomTGeo.h:26
 AliITSgeomTGeo.h:27
 AliITSgeomTGeo.h:28
 AliITSgeomTGeo.h:29
 AliITSgeomTGeo.h:30
 AliITSgeomTGeo.h:31
 AliITSgeomTGeo.h:32
 AliITSgeomTGeo.h:33
 AliITSgeomTGeo.h:34
 AliITSgeomTGeo.h:35
 AliITSgeomTGeo.h:36
 AliITSgeomTGeo.h:37
 AliITSgeomTGeo.h:38
 AliITSgeomTGeo.h:39
 AliITSgeomTGeo.h:40
 AliITSgeomTGeo.h:41
 AliITSgeomTGeo.h:42
 AliITSgeomTGeo.h:43
 AliITSgeomTGeo.h:44
 AliITSgeomTGeo.h:45
 AliITSgeomTGeo.h:46
 AliITSgeomTGeo.h:47
 AliITSgeomTGeo.h:48
 AliITSgeomTGeo.h:49
 AliITSgeomTGeo.h:50
 AliITSgeomTGeo.h:51
 AliITSgeomTGeo.h:52
 AliITSgeomTGeo.h:53
 AliITSgeomTGeo.h:54
 AliITSgeomTGeo.h:55
 AliITSgeomTGeo.h:56
 AliITSgeomTGeo.h:57
 AliITSgeomTGeo.h:58
 AliITSgeomTGeo.h:59
 AliITSgeomTGeo.h:60
 AliITSgeomTGeo.h:61
 AliITSgeomTGeo.h:62
 AliITSgeomTGeo.h:63
 AliITSgeomTGeo.h:64
 AliITSgeomTGeo.h:65
 AliITSgeomTGeo.h:66
 AliITSgeomTGeo.h:67
 AliITSgeomTGeo.h:68
 AliITSgeomTGeo.h:69
 AliITSgeomTGeo.h:70
 AliITSgeomTGeo.h:71
 AliITSgeomTGeo.h:72
 AliITSgeomTGeo.h:73
 AliITSgeomTGeo.h:74
 AliITSgeomTGeo.h:75
 AliITSgeomTGeo.h:76
 AliITSgeomTGeo.h:77
 AliITSgeomTGeo.h:78
 AliITSgeomTGeo.h:79
 AliITSgeomTGeo.h:80
 AliITSgeomTGeo.h:81
 AliITSgeomTGeo.h:82
 AliITSgeomTGeo.h:83
 AliITSgeomTGeo.h:84
 AliITSgeomTGeo.h:85
 AliITSgeomTGeo.h:86
 AliITSgeomTGeo.h:87
 AliITSgeomTGeo.h:88
 AliITSgeomTGeo.h:89
 AliITSgeomTGeo.h:90
 AliITSgeomTGeo.h:91
 AliITSgeomTGeo.h:92
 AliITSgeomTGeo.h:93
 AliITSgeomTGeo.h:94
 AliITSgeomTGeo.h:95
 AliITSgeomTGeo.h:96
 AliITSgeomTGeo.h:97
 AliITSgeomTGeo.h:98
 AliITSgeomTGeo.h:99
 AliITSgeomTGeo.h:100
 AliITSgeomTGeo.h:101
 AliITSgeomTGeo.h:102
 AliITSgeomTGeo.h:103
 AliITSgeomTGeo.h:104
 AliITSgeomTGeo.h:105
 AliITSgeomTGeo.h:106
 AliITSgeomTGeo.h:107
 AliITSgeomTGeo.h:108
 AliITSgeomTGeo.h:109
 AliITSgeomTGeo.h:110