]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/UPGRADE/AliITSInitGeometryUpg.h
Set the detector version to 0 for upgrade. Tmp.hack to make the simulation chain...
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITSInitGeometryUpg.h
1 #ifndef ALIITSINITGEOMETRYUPG_H
2 #define ALIITSINITGEOMETRYUPG_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: AliITSInitGeometryUpg.h $
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   kvDefault=0,kv11=11,kvUpgrade=20
21 } AliITSVersion_t;
22
23 class TArrayD;
24 class TGeoHMatrix;
25 class TDatime;
26
27 class AliITSInitGeometryUpg : public TObject{
28  public:
29
30     AliITSInitGeometryUpg();//Default Constructor
31     AliITSInitGeometryUpg(AliITSVersion_t version,
32                        Int_t minorversion=2);//Standard Constructor
33     //virtual ~AliITSInitGeometryUpg(); // Destructor
34     //
35     // Create and initialize geometry from TGeo
36     AliITSgeom* CreateAliITSgeom();
37     AliITSgeom* CreateAliITSgeom(Int_t major,Int_t minor); 
38     Bool_t InitAliITSgeom(AliITSgeom *geom);//Initilize geometry from gGeoManager
39     // Getters and Setters
40     // Getters and Setters
41     void    SetVersion(AliITSVersion_t maj,Int_t min) {// Set Major and Minor versions
42         fMajorVersion=maj;fMinorVersion=min;}
43     TString GetGeometryName()const {return fName;}// Return geometry name
44     void    SetGeometryName(const Char_t *name){fName = name;}// Set Geometry name
45     Int_t   GetMajorVersion()const {return (Int_t)fMajorVersion;} // Return geometry major version
46     Int_t   GetMinorVersion()const{return fMinorVersion;}// Return geometry minor version
47     Bool_t  GetTiming()const{return fTiming;} // return routine timing flag
48     void    SetTiming(Bool_t time=kTRUE){fTiming=time;}// Set routine timing (on)
49     Bool_t  GetSegGeom()const{return fSegGeom;} // return flag indecating the use of AliITSsegmentation or AliITSgeomS?D class in fShape.
50     void    SetSegGeom(Bool_t seg=kTRUE){fSegGeom = seg;}// Set the use of AliITSsegmentation class' instead of AliITSgeomS?D class in fShape
51     Bool_t  GetDecoding()const{return fDecode;}// Return flag indecating wether to use new/old decoding
52     void    SetDecoding(Bool_t newdec=kFALSE){fDecode = newdec;}// Set flag to use new/old decoding
53      // Set debug level. debug=0 no debug info outputted.
54     void    SetDebug(Int_t debug=0){fDebug=debug;};
55     // Retrun debug value
56     Int_t   GetDebug()const{return fDebug;};
57     // Decode module number into old layer, ladder, and detector numbers
58     void DecodeDetectorLayers(Int_t mod,Int_t &lay,Int_t &lad,Int_t &det);
59     // find module number by layer, and copy numbers
60     void DecodeDetector(Int_t &mod,Int_t lay,Int_t cpn0,
61                         Int_t cpn1,Int_t cpn2) const;
62     // Given module number, find copy numbers.
63     void RecodeDetector(Int_t mod,Int_t &cpn0,Int_t &cpn1,Int_t &cpn2);
64    // fills the string str with the major and minor version number
65     Bool_t WriteVersionString(Char_t *str,Int_t length,
66                               AliITSVersion_t maj,Int_t min,
67                               const Char_t *cvsDate,const Char_t *cvsRev)const;
68     // decodes the string str with the major and minor version number
69     Bool_t ReadVersionString(const Char_t *str,Int_t length,
70                              AliITSVersion_t &maj,Int_t &min,TDatime &dt)const;
71
72     Int_t GetNumberOfLayers();
73     Int_t GetNumberOfLadders(const Int_t lay)const;
74     Int_t GetNumberOfModules(const Int_t lay)const;
75
76  private:
77     // Decode module number into old layer, ladder, and detector numbers
78     void DecodeDetectorLayersv11(Int_t mod,Int_t &lay,
79                                  Int_t &lad,Int_t &det);
80     // find module number by layer, and copy numbers
81     void DecodeDetectorv11(Int_t &mod,Int_t lay,Int_t cpn0,Int_t cpn1,
82                            Int_t cpn2)const;
83     // Given module number, find copy numbers.
84     void RecodeDetectorv11(Int_t mod,Int_t &cpn0,Int_t &cpn1,
85                            Int_t &cpn2);
86     // Decode module number into old layer, ladder, and detector numbers
87     void DecodeDetectorvUpgrade(Int_t &mod,Int_t lay,Int_t cpn0,Int_t cpn1,
88                                     Int_t cpn2)const;
89     // find module number by layer, and copy numbers
90     void RecodeDetectorvUpgrade(Int_t mod,Int_t &cpn0,Int_t &cpn1,
91                                     Int_t &cpn2);
92     // Given module number, find copy numbers.
93     void DecodeDetectorLayersvUpgrade(Int_t mod,Int_t &lay,Int_t &lad,
94                                     Int_t &det);
95                    
96     // Virtual MC code 
97     Bool_t InitAliITSgeomV11(AliITSgeom *geom);
98     Bool_t InitAliITSgeomVUpgrade(AliITSgeom *geom);
99     Bool_t GetTransformation(const TString &volumePath,TGeoHMatrix &mat);
100     Bool_t GetShape(const TString &volumePath,TString &shapeType,TArrayD &par);
101     void TransposeTGeoHMatrix(TGeoHMatrix *m) const;
102
103     TString         fName;         // Geometry name
104     Int_t           fMinorVersion; // Geometry minor version
105     AliITSVersion_t fMajorVersion; // Geometry swich value
106     Bool_t          fTiming;       // Flag to start inilization timing
107     Bool_t          fSegGeom;      // Flag to switch between the old use of
108                                    // AliITSgeomS?D class, or AliITSsegmentation
109                                    // class in fShape of AliITSgeom class.
110     Bool_t          fDecode;       // Flag for new/old decoding
111     Int_t           fDebug;        // Debug flag
112
113     ClassDef(AliITSInitGeometryUpg,0) // create/Init AliITSgeom
114     // 0 in ClassDef indicates that this class will not be "saved" in a file.
115 };
116
117 #endif
118