New SSD geometry class
[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"
22#include "AliITSgeomSPD.h"
23#include "AliITSgeomSDD.h"
24#include "AliITSgeomSSD.h"
25
58005f18 26
27struct ITS_geom {
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 private:
39 Int_t fNlayers; // The number of layers.
40 Int_t *fNlad; // Array of the number of ladders/layer(layer)
41 Int_t *fNdet; // Array of the number of detectors/ladder(layer)
42 ITS_geom **fg; // Structure of translation and rotation.
43 TObjArray *fShape; // Array of shapes and detector information.
44
45 public:
46 AliITSgeom(); // Default constructor
47 AliITSgeom(const char *filename); // Constructor
48 AliITSgeom(AliITSgeom &source); // Copy constructor
49 void operator=(AliITSgeom &source);// = operator
50 virtual ~AliITSgeom(); // Default destructor
51 // this is a dummy routine for now.
593d2ea1 52 Int_t GetNdetectors(Int_t layer) const {return fNdet[layer-1];}
53 Int_t GetNladders(Int_t layer) const {return fNlad[layer-1];}
54 Int_t GetNlayers() const {return fNlayers;}
55 void GetAngles(Int_t lay,Int_t lad,Int_t det,
56 Float_t &rx,Float_t &ry,Float_t &rz)const {
58005f18 57 rx = fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].frx;
58 ry = fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].fry;
59 rz = fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].frz;}
593d2ea1 60 void GetTrans(Int_t lay,Int_t lad,Int_t det,
61 Float_t &x,Float_t &y,Float_t &z)const {
58005f18 62 x = fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].fx0;
63 y = fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].fy0;
64 z = fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].fz0;}
65 void SetByAngles(Int_t lay,Int_t lad,Int_t det,
66 Float_t rx,Float_t ry,Float_t rz);
b79e4bc3 67 void SetByAngles(Int_t index,Double_t angl[]);
593d2ea1 68 void SetTrans(Int_t lay,Int_t lad,Int_t det,
58005f18 69 Float_t x,Float_t y,Float_t z){
70 fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].fx0 = x;
71 fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].fy0 = y;
72 fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].fz0 = z;}
b79e4bc3 73 void SetTrans(Int_t index,Double_t x[]);
58005f18 74 void GetRotMatrix(Int_t lay,Int_t lad,Int_t det,Float_t *mat);
b79e4bc3 75 void GetRotMatrix(Int_t lay,Int_t lad,Int_t det,Double_t *mat);
76 void GetRotMatrix(Int_t index,Float_t *mat);
77 void GetRotMatrix(Int_t index,Double_t *mat);
78 Int_t GetStartSPD() {return GetModuleIndex(1,1,1);}
79 Int_t GetLastSPD() {return GetModuleIndex(2,fNlad[1],fNdet[1]);}
80 Int_t GetStartSDD() {return GetModuleIndex(3,1,1);}
81 Int_t GetLastSDD() {return GetModuleIndex(4,fNlad[3],fNdet[3]);}
82 Int_t GetStartSSD() {return GetModuleIndex(5,1,1);}
83 Int_t GetLastSSD() {return GetModuleIndex(6,fNlad[5],fNdet[5]);}
84 Int_t GetIndexMax() {return GetModuleIndex(fNlayers,fNlad[fNlayers-1],
85 fNdet[fNlayers-1])+1;}
58005f18 86 void GtoL(Int_t lay,Int_t lad,Int_t det,const Float_t *g,Float_t *l);
87 void GtoL(const Int_t *id,const Float_t *g,Float_t *l);
88 void GtoL(const Int_t index,const Float_t *g,Float_t *l);
b79e4bc3 89 void GtoL(Int_t lay,Int_t lad,Int_t det,const Double_t *g,Double_t *l);
90 void GtoL(const Int_t *id,const Double_t *g,Double_t *l);
91 void GtoL(const Int_t index,const Double_t *g,Double_t *l);
92 void GtoLMomentum(Int_t lay,Int_t lad,Int_t det,
93 const Float_t *g,Float_t *l);
94 void GtoLMomentum(Int_t lay,Int_t lad,Int_t det,
95 const Double_t *g,Double_t *l);
58005f18 96 void LtoG(Int_t lay,Int_t lad,Int_t det,const Float_t *l,Float_t *g);
97 void LtoG(const Int_t *id,const Float_t *l,Float_t *g);
98 void LtoG(const Int_t index,const Float_t *l,Float_t *g);
b79e4bc3 99 void LtoG(Int_t lay,Int_t lad,Int_t det,const Double_t *l,Double_t *g);
100 void LtoG(const Int_t *id,const Double_t *l,Double_t *g);
101 void LtoG(const Int_t index,const Double_t *l,Double_t *g);
102 void LtoGMomentum(Int_t lay,Int_t lad,Int_t det,
103 const Float_t *l,Float_t *g);
104 void LtoGMomentum(Int_t lay,Int_t lad,Int_t det,
105 const Double_t *l,Double_t *g);
106 void LtoL(const Int_t *id1,const Int_t *id2,Double_t *l1,Double_t *l2);
107 void LtoL(const Int_t index1,const Int_t index2,Double_t *l1,Double_t *l2);
108 void LtoLMomentum(const Int_t *id1,const Int_t *id2,
109 const Double_t *l1,Double_t *l2);
110 void GtoLErrorMatrix(const Int_t index,Double_t **g,Double_t **l);
111 void LtoGErrorMatrix(const Int_t index,Double_t **l,Double_t **g);
112 void LtoLErrorMatrix(const Int_t index1,const Int_t index2,
113 Double_t **l1,Double_t **l2);
58005f18 114 Int_t GetModuleIndex(Int_t lay,Int_t lad,Int_t det);
593d2ea1 115 void GetModuleId(Int_t index,Int_t &lay,Int_t &lad,Int_t &det);
58005f18 116 void GlobalChange(Float_t *tran,Float_t *rot);
117 void GlobalCylindericalChange(Float_t *tran,Float_t *rot);
118 void RandomChange(Float_t *stran,Float_t *srot);
119 void RandomCylindericalChange(Float_t *stran,Float_t *srot);
120 void PrintComparison(FILE *fp,AliITSgeom *other);
121 void PrintData(FILE *fp,Int_t lay,Int_t lad,Int_t det);
122 ofstream &PrintGeom(ofstream &out);
123 ifstream &ReadGeom(ifstream &in);
b79e4bc3 124 virtual Int_t IsVersion() const {return 1;}
593d2ea1 125 void AddShape(TObject *shp){fShape->AddLast(shp);}
126 virtual TObject *GetShape(Int_t lay,Int_t lad,Int_t det)
b79e4bc3 127 const {return fShape->At(fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].
128 fShapeIndex);}
58005f18 129
b79e4bc3 130 void GeantToTracking(AliITSgeom &source); // This converts the geometry
131 // transformations from that used by the ITS and it's Monte Carlo to that
132 // used by the track finding code.
133 // Usage:
134 // AliITSgeom *gm,*gt;
135 // gm = ((AliITS *) ITS)->GetITSgeom();
136 // gt->GeantToTracking(*gm);
137 // This allocates and fills gt with the geometry transforms between the
138 // global coordinate system to the local coordinate system used to do
139 // tracking.
140
141 ClassDef(AliITSgeom,1) // ITS geometry class
58005f18 142};
143
144#endif