1 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
2 * See cxx source for full Copyright notice */
5 // Revision of includes 07/05/2004
7 // Class AliMUONVGeometryBuilder
8 // -----------------------------
9 // Abstract base class for geometry construction per chamber(s).
11 // Author: Ivana Hrivnacova, IPN Orsay
13 #ifndef ALI_MUON_V_GEOMETRY_BUILDER_H
14 #define ALI_MUON_V_GEOMETRY_BUILDER_H
19 #include <TObjArray.h>
21 class TGeoTranslation;
25 class AliMUONGeometryModule;
26 class AliMUONGeometryEnvelopeStore;
27 class AliMUONGeometryStore;
28 class AliMUONGeometrySVMap;
30 class AliMUONVGeometryBuilder : public TObject
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();
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;
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
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
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
73 // The sensitive volumes Ids for each chamber
74 // should be defined and set to its geometry class.
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
85 AliMUONVGeometryBuilder(const AliMUONVGeometryBuilder& rhs);
88 AliMUONVGeometryBuilder& operator = (const AliMUONVGeometryBuilder& rhs);
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;
98 TString ComposePath(const TString& volName, Int_t copyNo) const;
99 void MapSV(const TString&path, const TString& volName,
100 Int_t detElemId) const;
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;
112 TString ReadData1(ifstream& in) const;
113 TString ReadData2(ifstream& in) const;
114 TString ReadData3(ifstream& in) const;
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;
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
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
135 ClassDef(AliMUONVGeometryBuilder,3) // MUON chamber geometry base class
140 inline Int_t AliMUONVGeometryBuilder::NofGeometries() const
141 { return fModuleGeometries->GetEntriesFast(); }
143 inline AliMUONGeometryModule* AliMUONVGeometryBuilder::Geometry(Int_t i) const
144 { return (AliMUONGeometryModule*)fModuleGeometries->At(i); }
146 #endif //ALI_MUON_V_GEOMETRY_BUILDER_H