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
8 /// \class AliMUONVGeometryBuilder
9 /// \brief Abstract base class for geometry construction per module(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>
20 #include <TGeoMatrix.h>
22 class TGeoTranslation;
26 class AliMUONGeometryModule;
27 class AliMUONGeometryEnvelopeStore;
28 class AliMUONGeometryStore;
29 class AliMUONGeometrySVMap;
31 class AliMUONVGeometryBuilder : public TObject
34 AliMUONVGeometryBuilder(const TString& fileName,
35 AliMUONGeometryModule* mg1,
36 AliMUONGeometryModule* mg2 = 0,
37 AliMUONGeometryModule* mg3 = 0,
38 AliMUONGeometryModule* mg4 = 0,
39 AliMUONGeometryModule* mg5 = 0,
40 AliMUONGeometryModule* mg6 = 0);
41 AliMUONVGeometryBuilder();
42 virtual ~AliMUONVGeometryBuilder();
45 void SetReferenceFrame(const TGeoCombiTrans& referenceFrame);
46 virtual void FillTransformations() const;
47 virtual void RebuildSVMaps() const;
48 virtual Bool_t ReadTransformations() const;
49 virtual Bool_t ReadSVMap() const;
50 virtual Bool_t WriteTransformations() const;
51 virtual Bool_t WriteSVMap(Bool_t rebuild) const;
53 virtual void CreateMaterials() {} // make = 0; ?
54 // Function to be overriden in a concrete chamber/station
55 // geometry builder class.
56 // Only materials that are not defined in the common
57 // functions should be defined here.
58 virtual void CreateGeometry() = 0;
59 // Function to be overriden in a concrete chamber/station
60 // geometry builder class.
61 // The geometry built there should not be placed
62 // in ALIC; but all volumes going to ALIC
63 // have to be added as envelopes to the chamber
65 // (They will be then placed automatically
66 // usind the provided transformation.
67 virtual void SetTransformations() = 0;
68 // Function to be overriden in a concrete chamber/station
70 // The transformation of each chamber(s) wrt ALICE
71 // should be defined and set to its geometry class.
72 virtual void SetSensitiveVolumes() = 0;
73 // Function to be overriden in a concrete chamber/station
75 // The sensitive volumes Ids for each chamber
76 // should be defined and set to its geometry class.
77 virtual bool ApplyGlobalTransformation() { return true; }
78 // Function to be overriden (and return false)
79 // in the concrete geometry builder classes
80 // which are already defined in the new ALICE
83 // access to module geometries
84 Int_t NofGeometries() const;
85 AliMUONGeometryModule* Geometry(Int_t i) const;
86 // In difference from protected GetGeometry()
87 // this function access geometry via index and not
92 AliMUONVGeometryBuilder(const AliMUONVGeometryBuilder& rhs);
95 AliMUONVGeometryBuilder& operator = (const AliMUONVGeometryBuilder& rhs);
98 AliMUONGeometryModule* GetGeometry(Int_t moduleId) const;
99 AliMUONGeometryEnvelopeStore* GetEnvelopes(Int_t moduleId) const;
100 AliMUONGeometryStore* GetDetElements(Int_t moduleId) const;
101 AliMUONGeometrySVMap* GetSVMap(Int_t moduleId) const;
105 TString ComposePath(const TString& volName, Int_t copyNo) const;
106 void MapSV(const TString&path, const TString& volName,
107 Int_t detElemId) const;
109 TGeoHMatrix GetTransform(
110 Double_t x, Double_t y, Double_t z,
111 Double_t a1, Double_t a2, Double_t a3,
112 Double_t a4, Double_t a5, Double_t a6) const;
113 void FillData(Int_t moduleId, Int_t nofDetElements,
114 Double_t x, Double_t y, Double_t z,
115 Double_t a1, Double_t a2, Double_t a3,
116 Double_t a4, Double_t a5, Double_t a6) const;
117 void FillData(Int_t id, const TString& volName, Int_t copyNo,
118 Double_t x, Double_t y, Double_t z,
119 Double_t a1, Double_t a2, Double_t a3,
120 Double_t a4, Double_t a5, Double_t a6) const;
121 void FillData(const TString& sensVolumePath, Int_t detElemId) const;
123 TString ReadData1(ifstream& in) const;
124 TString ReadData2(ifstream& in) const;
125 TString ReadData3(ifstream& in) const;
127 void WriteTransform(ofstream& out, const TGeoCombiTrans* transform) const;
128 void WriteData1(ofstream& out) const;
129 void WriteData2(ofstream& out) const;
130 void WriteData3(ofstream& out) const;
132 // static data members
133 static const TString fgkTransformFileNamePrefix; // the prefix for the name
134 // of file with transformations
135 static const TString fgkSVMapFileNamePrefix; // the prefix for the name of file
136 // with sensitive volume map
137 static const TString fgkOutFileNameSuffix; // the suffix for the name of
141 TString fTransformFileName; // the name file with transformations
142 TString fSVMapFileName; // the name file with sensitive volume map
143 TObjArray* fModuleGeometries; // the modules geometries that will be built
145 TGeoCombiTrans fReferenceFrame; // the transformation from the builder
146 // reference frame to that of the transform
149 ClassDef(AliMUONVGeometryBuilder,4) // MUON chamber geometry base class
154 inline Int_t AliMUONVGeometryBuilder::NofGeometries() const
155 { return fModuleGeometries->GetEntriesFast(); }
157 inline AliMUONGeometryModule* AliMUONVGeometryBuilder::Geometry(Int_t i) const
158 { return (AliMUONGeometryModule*)fModuleGeometries->At(i); }
161 AliMUONVGeometryBuilder::SetReferenceFrame(const TGeoCombiTrans& referenceFrame)
162 { fReferenceFrame = referenceFrame;
163 //fReferenceFrame = new TGeoCombiTrans(referenceFrame);
166 #endif //ALI_MUON_V_GEOMETRY_BUILDER_H