]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONVGeometryBuilder.h
First PHOS calibration object data (Y.K.)
[u/mrichter/AliRoot.git] / MUON / AliMUONVGeometryBuilder.h
1 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
2  * See cxx source for full Copyright notice                               */
3
4 // $Id$
5 // Revision of includes 07/05/2004
6 //
7 // Class AliMUONVGeometryBuilder
8 // -----------------------------
9 // Abstract base class for geometry construction per chamber(s).
10 //
11 // Author: Ivana Hrivnacova, IPN Orsay
12
13 #ifndef ALI_MUON_V_GEOMETRY_BUILDER_H
14 #define ALI_MUON_V_GEOMETRY_BUILDER_H
15
16 #include <fstream>
17
18 #include <TObject.h>
19 #include <TObjArray.h>
20
21 class TGeoTranslation;
22 class TGeoRotation;
23 class TGeoCombiTrans;
24
25 class AliMUONGeometryModule;
26 class AliMUONGeometryEnvelopeStore;
27 class AliMUONGeometryStore;
28 class AliMUONGeometrySVMap;
29
30 class AliMUONVGeometryBuilder : public TObject
31 {
32   public:
33     AliMUONVGeometryBuilder(const TString& fileName,
34                             AliMUONGeometryModule* mg1,
35                             AliMUONGeometryModule* mg2 = 0,
36                             AliMUONGeometryModule* mg3 = 0,
37                             AliMUONGeometryModule* mg4 = 0,
38                             AliMUONGeometryModule* mg5 = 0,
39                             AliMUONGeometryModule* mg6 = 0);
40     AliMUONVGeometryBuilder();
41     virtual ~AliMUONVGeometryBuilder();
42   
43     // methods
44     virtual void  FillTransformations() const;
45     virtual void  RebuildSVMaps() const;
46     virtual Bool_t  ReadTransformations() const;
47     virtual Bool_t  ReadSVMap() const;
48     virtual Bool_t  WriteTransformations() const;
49     virtual Bool_t  WriteSVMap(Bool_t rebuild) const;
50     
51     virtual void CreateMaterials() {}  // make = 0; ?
52                   // Function to be overriden in a concrete chamber/station
53                   // geometry builder class.
54                   // Only materials that are not defined in the common
55                   // functions should be defined here.
56     virtual void CreateGeometry() = 0;
57                   // Function to be overriden in a concrete chamber/station
58                   // geometry builder class.
59                   // The geometry built there should not be placed
60                   // in ALIC; but all volumes going to ALIC
61                   // have to be added as envelopes to the chamber
62                   // geometries
63                   // (They will be then placed automatically 
64                   // usind the provided transformation.
65     virtual void SetTransformations() = 0;
66                   // Function to be overriden in a concrete chamber/station
67                   // geometry class.
68                   // The transformation of each chamber(s) wrt ALICE
69                   // should be defined and set to its geometry class. 
70     virtual void SetSensitiveVolumes() = 0;
71                   // Function to be overriden in a concrete chamber/station
72                   // geometry class.
73                   // The sensitive volumes Ids for each chamber
74                   // should be defined and set to its geometry class. 
75
76     // access to module geometries
77     Int_t  NofGeometries() const;
78     AliMUONGeometryModule* Geometry(Int_t i) const;
79                   // In difference from protected GetGeometry()
80                   // this function access geometry via index and not
81                   // via moduleId
82
83
84   protected:
85     AliMUONVGeometryBuilder(const AliMUONVGeometryBuilder& rhs);
86
87     // operators  
88     AliMUONVGeometryBuilder& operator = (const AliMUONVGeometryBuilder& rhs);
89
90     // methods
91     AliMUONGeometryModule*         GetGeometry(Int_t moduleId) const;
92     AliMUONGeometryEnvelopeStore*  GetEnvelopes(Int_t moduleId) const;
93     AliMUONGeometryStore*          GetDetElements(Int_t moduleId) const;
94     AliMUONGeometrySVMap*          GetSVMap(Int_t moduleId) const;
95     
96   private:
97     //methods
98     TString  ComposePath(const TString& volName, Int_t copyNo) const; 
99     void     MapSV(const TString&path, const TString& volName, 
100                   Int_t detElemId) const;
101
102     void FillData(Int_t moduleId, Int_t nofDetElements, 
103                   Double_t x, Double_t y, Double_t z,
104                   Double_t a1, Double_t a2, Double_t a3, 
105                   Double_t a4, Double_t a5, Double_t a6) const; 
106     void FillData(Int_t id, const TString& volName, Int_t copyNo,
107                   Double_t x, Double_t y, Double_t z,
108                   Double_t a1, Double_t a2, Double_t a3, 
109                   Double_t a4, Double_t a5, Double_t a6) const;
110     void FillData(const TString& sensVolumePath, Int_t detElemId) const;                   
111
112     TString ReadData1(ifstream& in) const;
113     TString ReadData2(ifstream& in) const;
114     TString ReadData3(ifstream& in) const;
115
116     void WriteTransform(ofstream& out, const TGeoCombiTrans* transform) const;
117     void WriteData1(ofstream& out) const;
118     void WriteData2(ofstream& out) const;
119     void WriteData3(ofstream& out) const;
120
121     // static data members
122     static const TString fgkTransformFileNamePrefix; // the prefix for the name 
123                                                  // of file with transformations
124     static const TString fgkSVMapFileNamePrefix; // the prefix for the name of file 
125                                                  // with sensitive volume map
126     static const TString fgkOutFileNameSuffix;   // the suffix for the name of 
127                                                  // generated files
128     
129     // data members
130     TString     fTransformFileName; // the name file with transformations 
131     TString     fSVMapFileName;     // the name file with sensitive volume map 
132     TObjArray*  fModuleGeometries;  // the modules geometries that will be built
133                                     // by this builder
134     
135   ClassDef(AliMUONVGeometryBuilder,3) // MUON chamber geometry base class
136 };
137
138 // inline functions
139
140 inline Int_t  AliMUONVGeometryBuilder::NofGeometries() const
141 { return fModuleGeometries->GetEntriesFast(); }
142
143 inline AliMUONGeometryModule* AliMUONVGeometryBuilder::Geometry(Int_t i) const
144 { return (AliMUONGeometryModule*)fModuleGeometries->At(i); }
145
146 #endif //ALI_MUON_V_GEOMETRY_BUILDER_H