Added two missing includes to allow macro compilation (thanks to Laurent for remarkin...
[u/mrichter/AliRoot.git] / ITS / AliITSInitGeometry.h
CommitLineData
023ae34b 1#ifndef ALIITSINITGEOMETRY_H
2#define ALIITSINITGEOMETRY_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/*
7$Id$
8*/
9
108bd0fe 10/////////////////////////////////////////////////////////////////////
6b0f3880 11// Class to inilize AliITSgeom and the like for both simulation
108bd0fe 12// and reconstruction.
6b0f3880 13/////////////////////////////////////////////////////////////////////
14
023ae34b 15#include <TObject.h>
023ae34b 16#include <TString.h>
012f0f4c 17#include "AliITSgeom.h"
023ae34b 18
108bd0fe 19typedef enum {
012f0f4c 20 kvtest=-1,kvDefault=0,
21 kvSPD02=1,kvSDD03=2,kvSSD03=3,kvITS04=4,
22 kvPPRcourseasymm=6,kvPPRasymmFMD=10,
23 kv11=11,kv11Hybrid=110
108bd0fe 24} AliITSVersion_t;
25
6b0f3880 26class TArrayD;
27class TGeoHMatrix;
012f0f4c 28class TDatime;
023ae34b 29
30class AliITSInitGeometry : public TObject{
31 public:
012f0f4c 32
33 AliITSInitGeometry();//Default Constructor
34 AliITSInitGeometry(AliITSVersion_t version,
35 Int_t minorversion=2);//Standard Constructor
023ae34b 36 //virtual ~AliITSInitGeometry(); // Destructor
37 //
012f0f4c 38 // Create and initialize geometry from TGeo
39 AliITSgeom* CreateAliITSgeom();
40 AliITSgeom* CreateAliITSgeom(Int_t major,Int_t minor);
41 Bool_t InitAliITSgeom(AliITSgeom *geom);//Initilize geometry from gGeoManager
42 // Getters and Setters
023ae34b 43 // Getters and Setters
012f0f4c 44 void SetVersion(AliITSVersion_t maj,Int_t min) {// Set Major and Minor versions
45 fMajorVersion=maj;fMinorVersion=min;}
023ae34b 46 TString GetGeometryName()const {return fName;}// Return geometry name
47 void SetGeometryName(const Char_t *name){fName = name;}// Set Geometry name
108bd0fe 48 Int_t GetMajorVersion()const {return (Int_t)fMajorVersion;} // Return geometry major version
023ae34b 49 Int_t GetMinorVersion()const{return fMinorVersion;}// Return geometry minor version
023ae34b 50 Bool_t GetTiming()const{return fTiming;} // return routine timing flag
51 void SetTiming(Bool_t time=kTRUE){fTiming=time;}// Set routine timing (on)
52 Bool_t GetSegGeom()const{return fSegGeom;} // return flag indecating the use of AliITSsegmentation or AliITSgeomS?D class in fShape.
53 void SetSegGeom(Bool_t seg=kTRUE){fSegGeom = seg;}// Set the use of AliITSsegmentation class' instead of AliITSgeomS?D class in fShape
54 Bool_t GetDecoding()const{return fDecode;}// Return flag indecating wether to use new/old decoding
55 void SetDecoding(Bool_t newdec=kFALSE){fDecode = newdec;}// Set flag to use new/old decoding
012f0f4c 56 // Set debug level. debug=0 no debug info outputted.
57 void SetDebug(Int_t debug=0){fDebug=debug;};
58 // Retrun debug value
59 Int_t GetDebug()const{return fDebug;};
60 // Decode module number into old layer, ladder, and detector numbers
61 void DecodeDetectorLayers(Int_t mod,Int_t &lay,Int_t &lad,Int_t &det);
62 // find module number by layer, and copy numbers
63 void DecodeDetector(Int_t &mod,Int_t lay,Int_t cpn0,
64 Int_t cpn1,Int_t cpn2) const;
65 // Given module number, find copy numbers.
66 void RecodeDetector(Int_t mod,Int_t &cpn0,Int_t &cpn1,Int_t &cpn2);
67 // fills the string str with the major and minor version number
68 Bool_t WriteVersionString(Char_t *str,Int_t length,
69 AliITSVersion_t maj,Int_t min,
70 const Char_t *cvsDate,const Char_t *cvsRev)const;
71 // decodes the string str with the major and minor version number
72 Bool_t ReadVersionString(const Char_t *str,Int_t length,
73 AliITSVersion_t &maj,Int_t &min,TDatime &dt)const;
023ae34b 74
012f0f4c 75 static Bool_t SPDIsTGeoNative() {return !fgkOldSPDbarrel;}
76 static Bool_t SDDIsTGeoNative() {return !fgkOldSDDbarrel;}
77 static Bool_t SSDIsTGeoNative() {return !fgkOldSSDbarrel;}
108bd0fe 78
012f0f4c 79 static Bool_t SDDconeIsTGeoNative() {return ! fgkOldSDDcone;}
80 static Bool_t SSDconeIsTGeoNative() {return ! fgkOldSSDcone;}
81 static Bool_t SPDshieldIsTGeoNative() {return ! fgkOldSPDshield;}
82 static Bool_t SDDshieldIsTGeoNative() {return ! fgkOldSDDshield; }
83 static Bool_t SSDshieldIsTGeoNative() {return ! fgkOldSSDshield;}
84 static Bool_t ServicesAreTGeoNative() {return ! fgkOldServices;}
85 static Bool_t SupportIsTGeoNative() {return ! fgkOldSupports;}
108bd0fe 86
012f0f4c 87 private:
88 // Decode module number into old layer, ladder, and detector numbers
89 void DecodeDetectorLayersvtest2(Int_t mod,Int_t &lay,
f736d235 90 Int_t &lad,Int_t &det) const {
012f0f4c 91 lay=mod+1;lad=det=1;};
92 // find module number by layer, and copy numbers
93 void DecodeDetectorvtest2(Int_t &mod,Int_t lay,Int_t cpn0,
94 Int_t cpn1,Int_t cpn2) const{
95 mod=lay-1;cpn0=cpn1=cpn2=1;};
96 // Given module number, find copy numbers.
97 void RecodeDetectorvtest2(Int_t mod,Int_t &cpn0,Int_t &cpn1,
f736d235 98 Int_t &cpn2) const {
012f0f4c 99 mod=cpn0=cpn1=cpn2=1;};
100 // Decode module number into old layer, ladder, and detector numbers
101 void DecodeDetectorLayersvSPD02(Int_t mod,Int_t &lay,
f736d235 102 Int_t &lad,Int_t &det) const;
012f0f4c 103 // find module number by layer, and copy numbers
104 void DecodeDetectorvSPD02(Int_t &mod,Int_t lay,Int_t cpn0,
105 Int_t cpn1,Int_t cpn2) const;
106 // Given module number, find copy numbers.
107 void RecodeDetectorvSPD02(Int_t mod,Int_t &cpn0,Int_t &cpn1,
f736d235 108 Int_t &cpn2) const;
012f0f4c 109 // Decode module number into old layer, ladder, and detector numbers
110 void DecodeDetectorLayersvSDD03(Int_t mod,Int_t &lay,
f736d235 111 Int_t &lad,Int_t &det) const;
012f0f4c 112 // find module number by layer, and copy numbers
113 void DecodeDetectorvSDD03(Int_t &mod,Int_t lay,Int_t cpn0,
114 Int_t cpn1,Int_t cpn2) const;
115 // Given module number, find copy numbers.
116 void RecodeDetectorvSDD03(Int_t mod,Int_t &cpn0,Int_t &cpn1,
f736d235 117 Int_t &cpn2) const;
012f0f4c 118 // Decode module number into old layer, ladder, and detector numbers
119 void DecodeDetectorLayersvSSD03(Int_t mod,Int_t &lay,
f736d235 120 Int_t &lad,Int_t &det) const;
012f0f4c 121 // find module number by layer, and copy numbers
122 void DecodeDetectorvSSD03(Int_t &mod,Int_t lay,Int_t cpn0,
123 Int_t cpn1,Int_t cpn2) const;
124 // Given module number, find copy numbers.
125 void RecodeDetectorvSSD03(Int_t mod,Int_t &cpn0,Int_t &cpn1,
f736d235 126 Int_t &cpn2) const;
012f0f4c 127 // Decode module number into old layer, ladder, and detector numbers
128 void DecodeDetectorLayersvITS04(Int_t mod,Int_t &lay,
f736d235 129 Int_t &lad,Int_t &det) const;
012f0f4c 130 // find module number by layer, and copy numbers
131 void DecodeDetectorvITS04(Int_t &mod,Int_t lay,Int_t cpn0,
132 Int_t cpn1,Int_t cpn2) const;
133 // Given module number, find copy numbers.
134 void RecodeDetectorvITS04(Int_t mod,Int_t &cpn0,Int_t &cpn1,
f736d235 135 Int_t &cpn2) const;
012f0f4c 136 // Decode module number into old layer, ladder, and detector numbers
137 void DecodeDetectorLayersvPPRcourseasymm(Int_t mod,Int_t &lay,
f736d235 138 Int_t &lad,Int_t &det) const {
012f0f4c 139 lay=lad=det=mod;/*Dummy*/};
140 // find module number by layer, and copy numbers
141 void DecodeDetectorvPPRcourseasymm(Int_t &mod,Int_t lay,Int_t cpn0,
142 Int_t cpn1,Int_t cpn2) const{
143 mod=lay=cpn0=cpn1=cpn2;/*Dummy*/};
144 // Given module number, find copy numbers.
145 void RecodeDetectorvPPRcourseasymm(Int_t mod,Int_t &cpn0,Int_t &cpn1,
f736d235 146 Int_t &cpn2) const {
012f0f4c 147 cpn0=cpn1=cpn2=mod;/*Dummy*/};
148 // Decode module number into old layer, ladder, and detector numbers
149 void DecodeDetectorLayersvPPRasymmFMD(Int_t mod,Int_t &lay,
150 Int_t &lad,Int_t &det);
151 // find module number by layer, and copy numbers
152 void DecodeDetectorvPPRasymmFMD(Int_t &mod,Int_t lay,Int_t cpn0,
153 Int_t cpn1,Int_t cpn2) const;
154 // Given module number, find copy numbers.
155 void RecodeDetectorvPPRasymmFMD(Int_t mod,Int_t &cpn0,Int_t &cpn1,
156 Int_t &cpn2);
157 // Decode module number into old layer, ladder, and detector numbers
158 void DecodeDetectorLayersv11(Int_t mod,Int_t &lay,
159 Int_t &lad,Int_t &det)const{
160 lay=lad=det=mod;};
161 // find module number by layer, and copy numbers
162 void DecodeDetectorv11(Int_t &mod,Int_t lay,Int_t cpn0,
163 Int_t cpn1,Int_t cpn2) const{
164 mod=lay=cpn0=cpn1=cpn2;};
165 // Given module number, find copy numbers.
166 void RecodeDetectorv11(Int_t mod,Int_t &cpn0,Int_t &cpn1,
167 Int_t &cpn2)const{
168 cpn0=cpn1=cpn2=mod;};
169 // Decode module number into old layer, ladder, and detector numbers
170 void DecodeDetectorv11Hybrid(Int_t &mod,Int_t lay,Int_t cpn0,Int_t cpn1,
171 Int_t cpn2)const;
172 // find module number by layer, and copy numbers
173 void RecodeDetectorv11Hybrid(Int_t mod,Int_t &cpn0,Int_t &cpn1,
174 Int_t &cpn2);
175 // Given module number, find copy numbers.
176 void DecodeDetectorLayersv11Hybrid(Int_t mod,Int_t &lay,Int_t &lad,
177 Int_t &det);
178
023ae34b 179 // Virtual MC code reproduction
012f0f4c 180 Bool_t InitAliITSgeomSPD02(AliITSgeom *geom);
181 Bool_t InitAliITSgeomSDD03(AliITSgeom *geom);
182 Bool_t InitAliITSgeomSSD03(AliITSgeom *geom);
f736d235 183 Bool_t InitAliITSgeomITS04(AliITSgeom *geom) const;
012f0f4c 184 Bool_t InitAliITSgeomtest2(AliITSgeom *geom);
023ae34b 185 Bool_t InitAliITSgeomPPRasymmFMD(AliITSgeom *geom);
108bd0fe 186 Bool_t InitAliITSgeomV11Hybrid(AliITSgeom *geom);
187 Bool_t InitAliITSgeomV11(AliITSgeom *geom);
023ae34b 188 Bool_t InitGeomShapePPRasymmFMD(AliITSDetector idet,Bool_t *initSeg,
189 TArrayD &shapePar,AliITSgeom *geom);
190 Bool_t InitSegmentationPPRasymmFMD(AliITSDetector idet,Bool_t *initSeg,
191 TArrayD &shapePar,AliITSgeom *geom);
192 Bool_t GetTransformation(const TString &volumePath,TGeoHMatrix &mat);
193 Bool_t GetShape(const TString &volumePath,TString &shapeType,TArrayD &par);
012f0f4c 194 void TransposeTGeoHMatrix(TGeoHMatrix *m) const;
023ae34b 195
012f0f4c 196 TString fName; // Geometry name
197 Int_t fMinorVersion; // Geometry minor version
198 AliITSVersion_t fMajorVersion; // Geometry swich value
199 Bool_t fTiming; // Flag to start inilization timing
200 Bool_t fSegGeom; // Flag to switch between the old use of
201 // AliITSgeomS?D class, or AliITSsegmentation
202 // class in fShape of AliITSgeom class.
203 Bool_t fDecode; // Flag for new/old decoding
204 Int_t fDebug; // Debug flag
108bd0fe 205
206 static const Bool_t fgkOldSPDbarrel; // use old geo for SPD ?
207 static const Bool_t fgkOldSDDbarrel; // use old geo for SDD ?
208 static const Bool_t fgkOldSSDbarrel; // use old geo for SSD ?
209 static const Bool_t fgkOldSDDcone; // use old geo for SDD cone ?
210 static const Bool_t fgkOldSSDcone; // use old geo for SSD cone?
211 static const Bool_t fgkOldSPDshield; // use old geo for SPD shield ?
212 static const Bool_t fgkOldSDDshield; // use old geo for SDD shield ?
213 static const Bool_t fgkOldSSDshield; // use old geo for SDD shield ?
214 static const Bool_t fgkOldServices; // use old geo for services ?
215 static const Bool_t fgkOldSupports; // use old geo for supports ?
023ae34b 216
217 ClassDef(AliITSInitGeometry,0) // create/Init AliITSgeom
218 // 0 in ClassDef indicates that this class will not be "saved" in a file.
219};
220
221#endif
222