Correction of the inheritance scheme
[u/mrichter/AliRoot.git] / ITS / AliITSgeom.h
CommitLineData
b79e4bc3 1#ifndef ALIITSGEOM_H
2#define ALIITSGEOM_H
3da30618 3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id$ */
7
58005f18 8/////////////////////////////////////////////////////////////////////////
9// ITS geometry manipulation routines.
10// Created April 15 1999.
11// version: 0.0.0
12// By: Bjorn S. Nilsen
13//
14// A package of geometry routines to do transformations between
15// local, detector active area, and ALICE global coordinate system in such
16// a way as to allow for detector alignment studies and the like. All of
17// the information needed to do the coordinate transformation are kept in
18// a specialized structure for ease of implementation.
19/////////////////////////////////////////////////////////////////////////
20#include <fstream.h>
21#include "TObjArray.h"
cd44574c 22#include "AliITSgeomSPD.h"
23#include "AliITSgeomSDD.h"
24#include "AliITSgeomSSD.h"
58005f18 25
58005f18 26
085bb6ed 27struct AliITSgeomS {
58005f18 28 Int_t fShapeIndex; // Shape index for this volume
29 Float_t fx0,fy0,fz0; // Translation vector
30 Float_t frx,fry,frz; // Rotation about axis, angle radians
31 Float_t fr[9]; // the rotation matrix
32};
33
34//_______________________________________________________________________
35
36class AliITSgeom : public TObject {
b79e4bc3 37
58005f18 38 public:
085bb6ed 39 AliITSgeom(); // Default constructor
40 AliITSgeom(const char *filename); // Constructor
41 AliITSgeom(const AliITSgeom &source); // Copy constructor
42 // void operator=(const AliITSgeom &source);// = operator
43 AliITSgeom& operator=(const AliITSgeom &source);// = operator
44
45 virtual ~AliITSgeom(); // Default destructor
46
47 Int_t GetNdetectors(Int_t layer) const {return fNdet[layer-1];}// return number of detector a ladder has
48 Int_t GetNladders(Int_t layer) const {return fNlad[layer-1];}// return number of laders a layer has
49 Int_t GetNlayers() const {return fNlayers;} // return number of layer the ITS has
593d2ea1 50 void GetAngles(Int_t lay,Int_t lad,Int_t det,
51 Float_t &rx,Float_t &ry,Float_t &rz)const {
085bb6ed 52 rx = fGm[lay-1][fNdet[lay-1]*(lad-1)+det-1].frx;
53 ry = fGm[lay-1][fNdet[lay-1]*(lad-1)+det-1].fry;
54 rz = fGm[lay-1][fNdet[lay-1]*(lad-1)+det-1].frz;} // Get agnles of roations for a give module
593d2ea1 55 void GetTrans(Int_t lay,Int_t lad,Int_t det,
56 Float_t &x,Float_t &y,Float_t &z)const {
085bb6ed 57 x = fGm[lay-1][fNdet[lay-1]*(lad-1)+det-1].fx0;
58 y = fGm[lay-1][fNdet[lay-1]*(lad-1)+det-1].fy0;
59 z = fGm[lay-1][fNdet[lay-1]*(lad-1)+det-1].fz0;} // get translation for a given module
58005f18 60 void SetByAngles(Int_t lay,Int_t lad,Int_t det,
61 Float_t rx,Float_t ry,Float_t rz);
b79e4bc3 62 void SetByAngles(Int_t index,Double_t angl[]);
593d2ea1 63 void SetTrans(Int_t lay,Int_t lad,Int_t det,
58005f18 64 Float_t x,Float_t y,Float_t z){
085bb6ed 65 fGm[lay-1][fNdet[lay-1]*(lad-1)+det-1].fx0 = x;
66 fGm[lay-1][fNdet[lay-1]*(lad-1)+det-1].fy0 = y;
67 fGm[lay-1][fNdet[lay-1]*(lad-1)+det-1].fz0 = z;}// Set translation vector for a give module
b79e4bc3 68 void SetTrans(Int_t index,Double_t x[]);
58005f18 69 void GetRotMatrix(Int_t lay,Int_t lad,Int_t det,Float_t *mat);
b79e4bc3 70 void GetRotMatrix(Int_t lay,Int_t lad,Int_t det,Double_t *mat);
71 void GetRotMatrix(Int_t index,Float_t *mat);
72 void GetRotMatrix(Int_t index,Double_t *mat);
085bb6ed 73 Int_t GetStartDet(Int_t dtype );
74 Int_t GetLastDet(Int_t dtype);
75 Int_t GetStartSPD() {return GetModuleIndex(1,1,1);} // return starting index for SPD
76 Int_t GetLastSPD() {return GetModuleIndex(2,fNlad[1],fNdet[1]);}// return Ending index for SPD
77 Int_t GetStartSDD() {return GetModuleIndex(3,1,1);} // return starting index for SDD
78 Int_t GetLastSDD() {return GetModuleIndex(4,fNlad[3],fNdet[3]);}// return Ending index for SDD
79 Int_t GetStartSSD() {return GetModuleIndex(5,1,1);} // return starting index for SSD
80 Int_t GetLastSSD() {return GetModuleIndex(6,fNlad[5],fNdet[5]);}// return Ending index for SSD
b79e4bc3 81 Int_t GetIndexMax() {return GetModuleIndex(fNlayers,fNlad[fNlayers-1],
085bb6ed 82 fNdet[fNlayers-1])+1;}// return Ending index for all ITS
58005f18 83 void GtoL(Int_t lay,Int_t lad,Int_t det,const Float_t *g,Float_t *l);
84 void GtoL(const Int_t *id,const Float_t *g,Float_t *l);
85 void GtoL(const Int_t index,const Float_t *g,Float_t *l);
b79e4bc3 86 void GtoL(Int_t lay,Int_t lad,Int_t det,const Double_t *g,Double_t *l);
87 void GtoL(const Int_t *id,const Double_t *g,Double_t *l);
88 void GtoL(const Int_t index,const Double_t *g,Double_t *l);
89 void GtoLMomentum(Int_t lay,Int_t lad,Int_t det,
90 const Float_t *g,Float_t *l);
91 void GtoLMomentum(Int_t lay,Int_t lad,Int_t det,
92 const Double_t *g,Double_t *l);
58005f18 93 void LtoG(Int_t lay,Int_t lad,Int_t det,const Float_t *l,Float_t *g);
94 void LtoG(const Int_t *id,const Float_t *l,Float_t *g);
95 void LtoG(const Int_t index,const Float_t *l,Float_t *g);
b79e4bc3 96 void LtoG(Int_t lay,Int_t lad,Int_t det,const Double_t *l,Double_t *g);
97 void LtoG(const Int_t *id,const Double_t *l,Double_t *g);
98 void LtoG(const Int_t index,const Double_t *l,Double_t *g);
99 void LtoGMomentum(Int_t lay,Int_t lad,Int_t det,
100 const Float_t *l,Float_t *g);
101 void LtoGMomentum(Int_t lay,Int_t lad,Int_t det,
102 const Double_t *l,Double_t *g);
103 void LtoL(const Int_t *id1,const Int_t *id2,Double_t *l1,Double_t *l2);
104 void LtoL(const Int_t index1,const Int_t index2,Double_t *l1,Double_t *l2);
105 void LtoLMomentum(const Int_t *id1,const Int_t *id2,
106 const Double_t *l1,Double_t *l2);
107 void GtoLErrorMatrix(const Int_t index,Double_t **g,Double_t **l);
108 void LtoGErrorMatrix(const Int_t index,Double_t **l,Double_t **g);
109 void LtoLErrorMatrix(const Int_t index1,const Int_t index2,
110 Double_t **l1,Double_t **l2);
58005f18 111 Int_t GetModuleIndex(Int_t lay,Int_t lad,Int_t det);
593d2ea1 112 void GetModuleId(Int_t index,Int_t &lay,Int_t &lad,Int_t &det);
58005f18 113 void GlobalChange(Float_t *tran,Float_t *rot);
114 void GlobalCylindericalChange(Float_t *tran,Float_t *rot);
115 void RandomChange(Float_t *stran,Float_t *srot);
116 void RandomCylindericalChange(Float_t *stran,Float_t *srot);
117 void PrintComparison(FILE *fp,AliITSgeom *other);
118 void PrintData(FILE *fp,Int_t lay,Int_t lad,Int_t det);
119 ofstream &PrintGeom(ofstream &out);
120 ifstream &ReadGeom(ifstream &in);
085bb6ed 121 virtual Int_t IsVersion() const {return 1;} // return version number
122 void AddShape(TObject *shp){fShape->AddLast(shp);} // Add Shapes
593d2ea1 123 virtual TObject *GetShape(Int_t lay,Int_t lad,Int_t det)
085bb6ed 124 const {return fShape->At(fGm[lay-1][fNdet[lay-1]*(lad-1)+det-1].
125 fShapeIndex);} // return specific TShape
126
127 TObjArray *Shape() {return fShape;} // return Shapes array
58005f18 128
b79e4bc3 129 void GeantToTracking(AliITSgeom &source); // This converts the geometry
130 // transformations from that used by the ITS and it's Monte Carlo to that
131 // used by the track finding code.
132 // Usage:
133 // AliITSgeom *gm,*gt;
134 // gm = ((AliITS *) ITS)->GetITSgeom();
135 // gt->GeantToTracking(*gm);
136 // This allocates and fills gt with the geometry transforms between the
137 // global coordinate system to the local coordinate system used to do
138 // tracking.
085bb6ed 139
140 private:
141 Int_t fNlayers; // The number of layers.
142 Int_t *fNlad; // Array of the number of ladders/layer(layer)
143 Int_t *fNdet; // Array of the number of detectors/ladder(layer)
144 AliITSgeomS **fGm; // Structure of translation and rotation.
145 TObjArray *fShape; // Array of shapes and detector information.
b79e4bc3 146
147 ClassDef(AliITSgeom,1) // ITS geometry class
58005f18 148};
149
150#endif