]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSInitGeometry.h
SDD macros to check OCDB quantities updated to manage the new files with correction...
[u/mrichter/AliRoot.git] / ITS / AliITSInitGeometry.h
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
10 /////////////////////////////////////////////////////////////////////
11 // Class to inilize AliITSgeom and the like for both simulation
12 //  and reconstruction.
13 /////////////////////////////////////////////////////////////////////
14
15 #include <TObject.h>
16 #include <TString.h>
17 #include "AliITSgeom.h"
18
19 typedef enum {
20     kvtest=-1,kvDefault=0,
21     kvSPD02=1,kvSDD03=2,kvSSD03=3,kvITS04=4,
22     kvPPRcourseasymm=6,kvPPRasymmFMD=10,
23     kv11=11,kv11Hybrid=110
24 } AliITSVersion_t;
25
26 class TArrayD;
27 class TGeoHMatrix;
28 class TDatime;
29
30 class AliITSInitGeometry : public TObject{
31  public:
32
33     AliITSInitGeometry();//Default Constructor
34     AliITSInitGeometry(AliITSVersion_t version,
35                        Int_t minorversion=2);//Standard Constructor
36     //virtual ~AliITSInitGeometry(); // Destructor
37     //
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
43     // Getters and Setters
44     void    SetVersion(AliITSVersion_t maj,Int_t min) {// Set Major and Minor versions
45         fMajorVersion=maj;fMinorVersion=min;}
46     TString GetGeometryName()const {return fName;}// Return geometry name
47     void    SetGeometryName(const Char_t *name){fName = name;}// Set Geometry name
48     Int_t   GetMajorVersion()const {return (Int_t)fMajorVersion;} // Return geometry major version
49     Int_t   GetMinorVersion()const{return fMinorVersion;}// Return geometry minor version
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
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;
74
75     static Bool_t SPDIsTGeoNative() {return !fgkOldSPDbarrel;}
76     static Bool_t SDDIsTGeoNative() {return !fgkOldSDDbarrel;}
77     static Bool_t SSDIsTGeoNative() {return !fgkOldSSDbarrel;}
78
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;}
86
87  private:
88     // Decode module number into old layer, ladder, and detector numbers
89     void DecodeDetectorLayersvtest2(Int_t mod,Int_t &lay,
90                                    Int_t &lad,Int_t &det) const {
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,
98                              Int_t &cpn2) const {
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,
102                                    Int_t &lad,Int_t &det) const;
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,
108                              Int_t &cpn2) const;
109     // Decode module number into old layer, ladder, and detector numbers
110     void DecodeDetectorLayersvSDD03(Int_t mod,Int_t &lay,
111                                    Int_t &lad,Int_t &det) const;
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,
117                              Int_t &cpn2) const;
118     // Decode module number into old layer, ladder, and detector numbers
119     void DecodeDetectorLayersvSSD03(Int_t mod,Int_t &lay,
120                                    Int_t &lad,Int_t &det) const;
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,
126                              Int_t &cpn2) const;
127     // Decode module number into old layer, ladder, and detector numbers
128     void DecodeDetectorLayersvITS04(Int_t mod,Int_t &lay,
129                                    Int_t &lad,Int_t &det) const;
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,
135                              Int_t &cpn2) const;
136     // Decode module number into old layer, ladder, and detector numbers
137     void DecodeDetectorLayersvPPRcourseasymm(Int_t mod,Int_t &lay,
138                                    Int_t &lad,Int_t &det) const {
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,
146                              Int_t &cpn2) const {
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                    
179     // Virtual MC code reproduction
180     Bool_t InitAliITSgeomSPD02(AliITSgeom *geom);
181     Bool_t InitAliITSgeomSDD03(AliITSgeom *geom);
182     Bool_t InitAliITSgeomSSD03(AliITSgeom *geom);
183     Bool_t InitAliITSgeomITS04(AliITSgeom *geom) const;
184     Bool_t InitAliITSgeomtest2(AliITSgeom *geom);
185     Bool_t InitAliITSgeomPPRasymmFMD(AliITSgeom *geom);
186     Bool_t InitAliITSgeomV11Hybrid(AliITSgeom *geom);
187     Bool_t InitAliITSgeomV11(AliITSgeom *geom);
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);
194     void TransposeTGeoHMatrix(TGeoHMatrix *m) const;
195
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
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 ?
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