]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONVGeometryBuilder.h
Correcting MUONGenerateGeometryData.C macro description
[u/mrichter/AliRoot.git] / MUON / AliMUONVGeometryBuilder.h
CommitLineData
30178c30 1/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
2 * See cxx source for full Copyright notice */
3
d1cd2474 4// $Id$
30178c30 5// Revision of includes 07/05/2004
692de412 6
7/// \ingroup geometry
8/// \class AliMUONVGeometryBuilder
9/// \brief Abstract base class for geometry construction per module(s)
10///
11/// Author: Ivana Hrivnacova, IPN Orsay
d1cd2474 12
13#ifndef ALI_MUON_V_GEOMETRY_BUILDER_H
14#define ALI_MUON_V_GEOMETRY_BUILDER_H
15
2811276d 16#include <fstream>
17
d1cd2474 18#include <TObject.h>
e118b27e 19#include <TObjArray.h>
067866a3 20#include <TGeoMatrix.h>
d1cd2474 21
22class TGeoTranslation;
23class TGeoRotation;
24class TGeoCombiTrans;
d1cd2474 25
e118b27e 26class AliMUONGeometryModule;
2811276d 27class AliMUONGeometryEnvelopeStore;
e118b27e 28class AliMUONGeometryStore;
2811276d 29class AliMUONGeometrySVMap;
d1cd2474 30
31class AliMUONVGeometryBuilder : public TObject
32{
33 public:
2811276d 34 AliMUONVGeometryBuilder(const TString& fileName,
e118b27e 35 AliMUONGeometryModule* mg1,
36 AliMUONGeometryModule* mg2 = 0,
37 AliMUONGeometryModule* mg3 = 0,
38 AliMUONGeometryModule* mg4 = 0,
39 AliMUONGeometryModule* mg5 = 0,
40 AliMUONGeometryModule* mg6 = 0);
d1cd2474 41 AliMUONVGeometryBuilder();
42 virtual ~AliMUONVGeometryBuilder();
d1cd2474 43
44 // methods
067866a3 45 void SetReferenceFrame(const TGeoCombiTrans& referenceFrame);
2811276d 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;
067866a3 52
d1cd2474 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
64 // geometries
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
69 // geometry class.
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
74 // geometry class.
75 // The sensitive volumes Ids for each chamber
76 // should be defined and set to its geometry class.
067866a3 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
81 // coordinate frame
2811276d 82
e118b27e 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
88 // via moduleId
89
90
d1cd2474 91 protected:
30178c30 92 AliMUONVGeometryBuilder(const AliMUONVGeometryBuilder& rhs);
93
94 // operators
95 AliMUONVGeometryBuilder& operator = (const AliMUONVGeometryBuilder& rhs);
96
d1cd2474 97 // methods
e118b27e 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;
d1cd2474 102
103 private:
2811276d 104 //methods
105 TString ComposePath(const TString& volName, Int_t copyNo) const;
106 void MapSV(const TString&path, const TString& volName,
107 Int_t detElemId) const;
108
067866a3 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;
e118b27e 113 void FillData(Int_t moduleId, Int_t nofDetElements,
2811276d 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;
122
123 TString ReadData1(ifstream& in) const;
124 TString ReadData2(ifstream& in) const;
125 TString ReadData3(ifstream& in) const;
126
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;
131
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
138 // generated files
139
d1cd2474 140 // data members
2811276d 141 TString fTransformFileName; // the name file with transformations
142 TString fSVMapFileName; // the name file with sensitive volume map
e118b27e 143 TObjArray* fModuleGeometries; // the modules geometries that will be built
067866a3 144 // by this builder
145 TGeoCombiTrans fReferenceFrame; // the transformation from the builder
146 // reference frame to that of the transform
147 // data files
148
149 ClassDef(AliMUONVGeometryBuilder,4) // MUON chamber geometry base class
d1cd2474 150};
151
e118b27e 152// inline functions
153
154inline Int_t AliMUONVGeometryBuilder::NofGeometries() const
155{ return fModuleGeometries->GetEntriesFast(); }
156
157inline AliMUONGeometryModule* AliMUONVGeometryBuilder::Geometry(Int_t i) const
158{ return (AliMUONGeometryModule*)fModuleGeometries->At(i); }
159
067866a3 160inline void
161AliMUONVGeometryBuilder::SetReferenceFrame(const TGeoCombiTrans& referenceFrame)
162{ fReferenceFrame = referenceFrame;
163 //fReferenceFrame = new TGeoCombiTrans(referenceFrame);
164}
165
d1cd2474 166#endif //ALI_MUON_V_GEOMETRY_BUILDER_H