~c-e-pidcott/maus/devel

« back to all changes in this revision

Viewing changes to src/legacy/FILES/Models/Modules/MakeEMR.py

  • Committer: Chris Rogers
  • Date: 2011-12-22 17:56:36 UTC
  • mfrom: (659.1.5 release-candidate)
  • Revision ID: chris.rogers@stfc.ac.uk-20111222175636-rw9uujiup42a7gnt
Tags: MAUS-v0.1.1
ReleaseĀ 0.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
WithBars = 1
8
8
 
9
9
class G4MiceGeoBase:
10
 
  def __init__( self, Name ):
11
 
    self.Name = Name
12
 
    self.Height = 0.0
13
 
    self.Length = 0.0
14
 
    self.Width = 0.0
15
 
    self.X = 0.0
16
 
    self.Y = 0.0
17
 
    self.Z = 0.0
18
 
    self.Phi = 0.0
19
 
    self.Theta = 0.0
20
 
    self.Psi = 0.0
21
 
  
22
 
  def SetDimensions( self, Length, Width, Height ):
23
 
    self.Length = Length
24
 
    self.Width = Width
25
 
    self.Height = Height
26
 
    
27
 
  def SetPosition( self, X, Y, Z ):
28
 
    self.X = X
29
 
    self.Y = Y
30
 
    self.Z = Z
31
 
    
32
 
  def SetRotation( self, Phi, Theta, Psi ):
33
 
    self.Phi = Phi
34
 
    self.Theta = Theta
35
 
    self.Psi = Psi
36
 
    
37
 
  def __str__( self  ):
38
 
    message = """Name: %s 
39
 
      Dimensions: %d %d %d
40
 
      Position: %d %d %d
41
 
      Rotation:
42
 
    """% ( self.Name, self.Width, self.Height, self.Length, self.X, self.Y, self.Z )
43
 
    return message
44
 
    
 
10
    def __init__( self, Name ):
 
11
        self.Name = Name
 
12
        self.Height = 0.0
 
13
        self.Length = 0.0
 
14
        self.Width = 0.0
 
15
        self.X = 0.0
 
16
        self.Y = 0.0
 
17
        self.Z = 0.0
 
18
        self.Phi = 0.0
 
19
        self.Theta = 0.0
 
20
        self.Psi = 0.0
 
21
 
 
22
    def SetDimensions( self, Length, Width, Height ):
 
23
        self.Length = Length
 
24
        self.Width = Width
 
25
        self.Height = Height
 
26
 
 
27
    def SetPosition( self, X, Y, Z ):
 
28
        self.X = X
 
29
        self.Y = Y
 
30
        self.Z = Z
 
31
 
 
32
    def SetRotation( self, Phi, Theta, Psi ):
 
33
        self.Phi = Phi
 
34
        self.Theta = Theta
 
35
        self.Psi = Psi
 
36
 
 
37
    def __str__( self  ):
 
38
        message = """Name: %s
 
39
          Dimensions: %d %d %d
 
40
          Position: %d %d %d
 
41
          Rotation:
 
42
        """% ( self.Name, self.Width, self.Height, self.Length, self.X, self.Y, self.Z )
 
43
        return message
 
44
 
45
45
class EMRBar( G4MiceGeoBase ):
46
 
  def __init__( self, LayerId, BarId, BarLength, BarHeight, BarWidth ):
47
 
    self.Name = "EMRLayer%dBar%d" % ( LayerId, BarId )
48
 
    self.BarId = BarId
49
 
    self.LayerId = LayerId
50
 
    self.Length = BarLength
51
 
    self.Width = BarWidth
52
 
    self.Height = BarHeight
53
 
    self.X = 0.0
54
 
    self.Y = 0.0
55
 
    self.Z = 0.0
56
 
    self.Phi = 0.0
57
 
    self.Theta = 0.0
58
 
    self.Psi = 0.0
59
 
 
60
 
  
61
 
  def Export( self ):
62
 
  
63
 
  #  if( self.BarId % 2 ):
64
 
  #    Y1HalfLength = 0
65
 
  #    Y2HalfLength = ( self.Width / 2 )
66
 
  #  else:
67
 
  #    Y1HalfLength = ( self.Width / 2 )
68
 
  #    Y2HalfLength = 0
69
 
                
70
 
  #  XHalfLength = ( self.Length / 2 )
71
 
  #  ZHalfLength = ( self.Height / 2 )
72
 
    
73
 
    Content = """
74
 
    // FILES/Models/Modules/%s%s.dat
75
 
    //
76
 
    Module %s
77
 
    {
78
 
      Volume Trapezoid
79
 
      Dimensions %.2f %.2f %.2f %.2f %.2f cm
80
 
      PropertyInt Layer %d
81
 
      PropertyInt Cell %d
82
 
      PropertyInt numPMTs 2
83
 
      PropertyDouble BlueColour 1.0 
84
 
      Module EMR/%sSci.dat
85
 
      {
86
 
        Position 0.0 0.0 0.0 mm
87
 
        Rotation 0.0 0.0 0.0 degree
88
 
      }
89
 
    }
90
 
    """ % ( ExportFolder, self.Name, self.Name, self.Length / 2, self.Length / 2, 0., self.Width / 2, self.Height / 2, self.LayerId, self.BarId, self.Name )
91
 
     
92
 
    #% ( ExportFolder, self.Name, self.Name, XHalfLength, XHalfLength, Y1HalfLength, Y2HalfLength, ZHalfLength, self.LayerId, self.BarId, self.Name )
93
 
    
94
 
    BarFile = open( ExportFolder + self.Name + ".dat", 'w' )
95
 
    BarFile.write( Content )
96
 
    BarFile.close()
97
 
    Content = """
98
 
    // FILES/Models/Modules/%s%sSci.dat
99
 
    //
100
 
    
101
 
    Module %sSci
102
 
    {
103
 
      Volume Trapezoid
104
 
      Dimensions %.2f %.2f %.2f %.2f %.2f cm
105
 
      PropertyInt Layer %d
106
 
      PropertyInt Cell %d
107
 
      PropertyString SensitiveDetector EMR
108
 
      PropertyString Material POLYSTYRENE
109
 
      PropertyDouble GreenColour 1.0
110
 
      PropertyDouble RedColour 1.0
111
 
    }
112
 
    """ % ( ExportFolder, self.Name, self.Name, self.Length / 2, self.Length / 2, 0., self.Width / 2, self.Height / 2, self.LayerId, self.BarId ) 
113
 
    #% ( ExportFolder, self.Name, self.Name, XHalfLength, XHalfLength, Y1HalfLength, Y2HalfLength, ZHalfLength, self.LayerId, self.BarId )
114
 
    SciFile = open( ExportFolder + self.Name + "Sci.dat", 'w' )
115
 
    SciFile.write( Content )
116
 
    SciFile.close()
117
 
        
 
46
    def __init__( self, LayerId, BarId, BarLength, BarHeight, BarWidth ):
 
47
        self.Name = "EMRLayer%dBar%d" % ( LayerId, BarId )
 
48
        self.BarId = BarId
 
49
        self.LayerId = LayerId
 
50
        self.Length = BarLength
 
51
        self.Width = BarWidth
 
52
        self.Height = BarHeight
 
53
        self.X = 0.0
 
54
        self.Y = 0.0
 
55
        self.Z = 0.0
 
56
        self.Phi = 0.0
 
57
        self.Theta = 0.0
 
58
        self.Psi = 0.0
 
59
 
 
60
 
 
61
    def Export( self ):
 
62
 
 
63
    #  if( self.BarId % 2 ):
 
64
    #    Y1HalfLength = 0
 
65
    #    Y2HalfLength = ( self.Width / 2 )
 
66
    #  else:
 
67
    #    Y1HalfLength = ( self.Width / 2 )
 
68
    #    Y2HalfLength = 0
 
69
 
 
70
    #  XHalfLength = ( self.Length / 2 )
 
71
    #  ZHalfLength = ( self.Height / 2 )
 
72
 
 
73
        Content = """
 
74
        // FILES/Models/Modules/%s%s.dat
 
75
        //
 
76
        Module %s
 
77
        {
 
78
          Volume Trapezoid
 
79
          Dimensions %.2f %.2f %.2f %.2f %.2f cm
 
80
          PropertyInt Layer %d
 
81
          PropertyInt Cell %d
 
82
          PropertyInt numPMTs 2
 
83
          PropertyDouble BlueColour 1.0
 
84
          Module EMR/%sSci.dat
 
85
          {
 
86
            Position 0.0 0.0 0.0 mm
 
87
            Rotation 0.0 0.0 0.0 degree
 
88
          }
 
89
        }
 
90
        """ % ( ExportFolder, self.Name, self.Name, self.Length / 2, self.Length / 2, 0., self.Width / 2, self.Height / 2, self.LayerId, self.BarId, self.Name )
 
91
 
 
92
        #% ( ExportFolder, self.Name, self.Name, XHalfLength, XHalfLength, Y1HalfLength, Y2HalfLength, ZHalfLength, self.LayerId, self.BarId, self.Name )
 
93
 
 
94
        BarFile = open( ExportFolder + self.Name + ".dat", 'w' )
 
95
        BarFile.write( Content )
 
96
        BarFile.close()
 
97
        Content = """
 
98
        // FILES/Models/Modules/%s%sSci.dat
 
99
        //
 
100
 
 
101
        Module %sSci
 
102
        {
 
103
          Volume Trapezoid
 
104
          Dimensions %.2f %.2f %.2f %.2f %.2f cm
 
105
          PropertyInt Layer %d
 
106
          PropertyInt Cell %d
 
107
          PropertyString SensitiveDetector EMR
 
108
          PropertyString Material POLYSTYRENE
 
109
          PropertyDouble GreenColour 1.0
 
110
          PropertyDouble RedColour 1.0
 
111
        }
 
112
        """ % ( ExportFolder, self.Name, self.Name, self.Length / 2, self.Length / 2, 0., self.Width / 2, self.Height / 2, self.LayerId, self.BarId )
 
113
        #% ( ExportFolder, self.Name, self.Name, XHalfLength, XHalfLength, Y1HalfLength, Y2HalfLength, ZHalfLength, self.LayerId, self.BarId )
 
114
        SciFile = open( ExportFolder + self.Name + "Sci.dat", 'w' )
 
115
        SciFile.write( Content )
 
116
        SciFile.close()
 
117
 
118
118
class EMRLayer( G4MiceGeoBase ):
119
 
  def __init__(self, LayerId, BarCount, BarLength, BarHeight, BarWidth ):
120
 
    self.Bars = []
121
 
    self.LayerId = LayerId
122
 
    self.BarCount = BarCount
123
 
    self.Name = "EMRLayer%d" % ( LayerId )
124
 
    self.BarHeight = BarHeight
125
 
    self.BarLength = BarLength
126
 
    self.BarWidth = BarWidth
127
 
    self.Length = self.BarLength
128
 
    self.Width = self.BarWidth * BarCount
129
 
    self.Height = self.BarHeight
130
 
    self.X = 0.0
131
 
    self.Y = 0.0
132
 
    self.Z = 0.0
133
 
    self.Phi = 0.0
134
 
    self.Theta = 0.0
135
 
    self.Psi = 0.0
136
 
    HalfLayerLength = ( ( self.BarWidth / 2 ) * (self.BarCount - 1) ) / 2
137
 
    if WithBars == 1 :
138
 
      for i in range( self.BarCount ):
139
 
        b = EMRBar( self.LayerId, i, self.BarLength, self.BarHeight, self.BarWidth )
140
 
        #if not( self.LayerId % 2 ):
141
 
        #  XPos = 0.0
142
 
        #  YPos = ( -HalfLayerLength + ( i * ( b.Width / 2 ) ) )
 
119
    def __init__(self, LayerId, BarCount, BarLength, BarHeight, BarWidth ):
 
120
        self.Bars = []
 
121
        self.LayerId = LayerId
 
122
        self.BarCount = BarCount
 
123
        self.Name = "EMRLayer%d" % ( LayerId )
 
124
        self.BarHeight = BarHeight
 
125
        self.BarLength = BarLength
 
126
        self.BarWidth = BarWidth
 
127
        self.Length = self.BarLength
 
128
        self.Width = self.BarWidth * BarCount
 
129
        self.Height = self.BarHeight
 
130
        self.X = 0.0
 
131
        self.Y = 0.0
 
132
        self.Z = 0.0
 
133
        self.Phi = 0.0
 
134
        self.Theta = 0.0
 
135
        self.Psi = 0.0
 
136
        HalfLayerLength = ( ( self.BarWidth / 2 ) * (self.BarCount - 1) ) / 2
 
137
        if WithBars == 1 :
 
138
            for i in range( self.BarCount ):
 
139
                b = EMRBar( self.LayerId, i, self.BarLength, self.BarHeight, self.BarWidth )
 
140
                #if not( self.LayerId % 2 ):
 
141
                #  XPos = 0.0
 
142
                #  YPos = ( -HalfLayerLength + ( i * ( b.Width / 2 ) ) )
 
143
                #else:
 
144
                #  XPos = ( -HalfLayerLength + ( i * ( b.Width / 2 ) ) )
 
145
                #  YPos = 0.0
 
146
                #b.SetPosition( XPos, YPos, 0.0 )
 
147
                b.SetPosition( 0.0, ( -HalfLayerLength + ( i * ( b.Width / 2 ) ) ), 0.0 )
 
148
                if i % 2 == 0:
 
149
                    b.SetRotation( 0.0, 0.0, 0.0 )
 
150
                else:
 
151
                    b.SetRotation( 0.0, 180.0, 0.0 )
 
152
                self.Bars.insert( i, b )
 
153
 
 
154
    def IsVertical( self ):
 
155
        return self.LayerId % 2
 
156
 
 
157
    def Export( self ):
 
158
        #Calculating trapezoid halflengths
 
159
        #ZHL = ( self.BarHeight / 2 )
 
160
        #if not self.IsVertical():
 
161
        #  X1HL = self.BarLength / 2
 
162
        #  X2HL = self.BarLength / 2
 
163
        #  Y1HL = ( self.BarWidth * ( self.BarCount / 2 ) ) / 2
 
164
        #  Y2HL = ( self.BarWidth * ( ( self.BarCount / 2 ) + ( self.BarCount % 2 ) ) ) / 2
143
165
        #else:
144
 
        #  XPos = ( -HalfLayerLength + ( i * ( b.Width / 2 ) ) )
145
 
        #  YPos = 0.0
146
 
        #b.SetPosition( XPos, YPos, 0.0 )
147
 
        b.SetPosition( 0.0, ( -HalfLayerLength + ( i * ( b.Width / 2 ) ) ), 0.0 )
148
 
        if i % 2 == 0: 
149
 
                b.SetRotation( 0.0, 0.0, 0.0 )
150
 
        else:
151
 
                b.SetRotation( 0.0, 180.0, 0.0 )
152
 
        self.Bars.insert( i, b )
153
 
 
154
 
  def IsVertical( self ):
155
 
    return self.LayerId % 2
156
 
  
157
 
  def Export( self ):
158
 
    #Calculating trapezoid halflengths
159
 
    #ZHL = ( self.BarHeight / 2 )
160
 
    #if not self.IsVertical():
161
 
    #  X1HL = self.BarLength / 2
162
 
    #  X2HL = self.BarLength / 2
163
 
    #  Y1HL = ( self.BarWidth * ( self.BarCount / 2 ) ) / 2
164
 
    #  Y2HL = ( self.BarWidth * ( ( self.BarCount / 2 ) + ( self.BarCount % 2 ) ) ) / 2
165
 
    #else:
166
 
    #  X1HL = ( self.BarWidth * ( self.BarCount / 2 ) ) / 2;
167
 
    #  X2HL = ( self.BarWidth * ( ( self.BarCount / 2 ) + ( self.BarCount % 2 ) ) ) / 2
168
 
    #  Y1HL = self.BarLength / 2
169
 
    #  Y2HL = self.BarLength / 2
170
 
      
171
 
    Content = """// FILES/Models/Modules/%s%s.dat
172
 
    //
173
 
    
174
 
      Module %s
175
 
      {
176
 
        Volume Trapezoid
177
 
        Dimensions  %.2f %.2f %.2f %.2f %.2f cm
178
 
 
179
 
        PropertyString Material Galactic
180
 
 
181
 
        PropertyInt Layer %d
182
 
        //  PropertyInt numSlabs %d
183
 
        PropertyInt numBars %d
184
 
        PropertyBool Invisible 1
185
 
      """% ( ExportFolder, self.Name, self.Name, self.Length / 2, self.Length / 2, ( self.BarWidth * ( self.BarCount / 2 ) ) / 2, 
186
 
          ( self.BarWidth * ( ( self.BarCount / 2 ) + ( self.BarCount % 2 ) ) ) / 2, self.Height / 2, self.LayerId, self.BarCount, self.BarCount ) 
187
 
      #% ( ExportFolder, self.Name, self.Name, X1HL, X2HL, Y1HL, Y2HL, ZHL,     self.LayerId, self.BarCount, self.BarCount )
188
 
    if WithBars == 1:
189
 
      for bar in self.Bars:
190
 
        Content += """Module %s%s.dat
191
 
        {
192
 
          Position %.2f %.2f %.2f cm
193
 
          Rotation %.2f %.2f %.2f degree
194
 
        }
195
 
        """ % ( ExportFolder, bar.Name, bar.X, bar.Y, bar.Z, bar.Phi, bar.Theta, bar.Psi )
196
 
        bar.Export()
197
 
    Content += "}"
198
 
    LayerFile = open( ExportFolder + self.Name + ".dat", 'w' )
199
 
    LayerFile.write( Content )
200
 
    LayerFile.close()
201
 
  
 
166
        #  X1HL = ( self.BarWidth * ( self.BarCount / 2 ) ) / 2;
 
167
        #  X2HL = ( self.BarWidth * ( ( self.BarCount / 2 ) + ( self.BarCount % 2 ) ) ) / 2
 
168
        #  Y1HL = self.BarLength / 2
 
169
        #  Y2HL = self.BarLength / 2
 
170
 
 
171
        Content = """// FILES/Models/Modules/%s%s.dat
 
172
        //
 
173
 
 
174
          Module %s
 
175
          {
 
176
            Volume Trapezoid
 
177
            Dimensions  %.2f %.2f %.2f %.2f %.2f cm
 
178
 
 
179
            PropertyString Material Galactic
 
180
 
 
181
            PropertyInt Layer %d
 
182
            //  PropertyInt numSlabs %d
 
183
            PropertyInt numBars %d
 
184
            PropertyBool Invisible 1
 
185
          """% ( ExportFolder, self.Name, self.Name, self.Length / 2, self.Length / 2, ( self.BarWidth * ( self.BarCount / 2 ) ) / 2,
 
186
              ( self.BarWidth * ( ( self.BarCount / 2 ) + ( self.BarCount % 2 ) ) ) / 2, self.Height / 2, self.LayerId, self.BarCount, self.BarCount )
 
187
            #% ( ExportFolder, self.Name, self.Name, X1HL, X2HL, Y1HL, Y2HL, ZHL,     self.LayerId, self.BarCount, self.BarCount )
 
188
        if WithBars == 1:
 
189
            for bar in self.Bars:
 
190
                Content += """Module %s%s.dat
 
191
                {
 
192
                  Position %.2f %.2f %.2f cm
 
193
                  Rotation %.2f %.2f %.2f degree
 
194
                }
 
195
                """ % ( ExportFolder, bar.Name, bar.X, bar.Y, bar.Z, bar.Phi, bar.Theta, bar.Psi )
 
196
                bar.Export()
 
197
        Content += "}"
 
198
        LayerFile = open( ExportFolder + self.Name + ".dat", 'w' )
 
199
        LayerFile.write( Content )
 
200
        LayerFile.close()
 
201
 
202
202
class EMRGeometry( G4MiceGeoBase ):
203
 
  def __init__(self, NumLayers, NumBars, BarLength, BarHeight, BarWidth ):
204
 
    self.Layers = []
205
 
    self.Name = "Calorimeter"
206
 
    
207
 
    self.LayersCount = NumLayers
208
 
    self.BarsCount = NumBars
209
 
    
210
 
    self.BarHeight = BarHeight
211
 
    self.BarLength = BarLength
212
 
    self.BarWidth = BarWidth
213
 
    
214
 
    self.Width = self.BarHeight * self.LayersCount
215
 
    self.Height = self.BarWidth * ( self.BarsCount / 2 )
216
 
    self.Length = self.BarLength
217
 
    
218
 
    self.X = 0.0
219
 
    self.Y = 0.0
220
 
    self.Z = 0.0
221
 
    
222
 
    self.Phi = 0.0
223
 
    self.Theta = 0.0
224
 
    self.Psi = 0.0
225
 
    
226
 
    HalfEMRLength = ( self.BarHeight * (self.LayersCount - 1 ) ) / 2
227
 
    for i in range( self.LayersCount ):
228
 
      l = EMRLayer( i, self.BarsCount, self.BarLength, self.BarHeight, self.BarWidth )
229
 
      l.SetPosition( 0.0, 0.0, - HalfEMRLength + ( i * self.BarHeight ) )
230
 
      if i % 2 == 0: 
231
 
                l.SetRotation( 0.0, 0.0, 0.0 )
232
 
      else:
233
 
                l.SetRotation( 0.0, 0.0, 90.0 )
234
 
      self.Layers.insert( i, l )
235
 
      
236
 
  def Export( self ):
237
 
    Content = """// FILES/Models/Modules/%s%s.dat
238
 
    //
239
 
    //
240
 
    
241
 
    Module %s
242
 
    {
243
 
      Volume Box
244
 
      Dimensions %.2f %.2f %.2f cm
245
 
      PropertyString Material Galactic
246
 
 
247
 
      PropertyBool Invisible 1
248
 
      // PropertyInt numPlanes %d
249
 
      PropertyInt numLayers %d
250
 
      PropertyDouble G4StepMax 1.0 mm
251
 
    """ % ( ExportFolder, self.Name, self.Name, self.Length, self.Width, self.Height, self.LayersCount, self.LayersCount )
252
 
    for layer in self.Layers:
253
 
      Content += """
254
 
        Module %s%s.dat
255
 
        {
256
 
          Position %.2f %.2f %.2f  cm
257
 
          Rotation %.2f %.2f %.2f degree
258
 
        }
259
 
      """ % ( ExportFolder, layer.Name, layer.X, layer.Y, layer.Z, layer.Phi, layer.Theta, layer.Psi )
260
 
      layer.Export()
261
 
    Content += "}"
262
 
    EMRFile = open( ExportFolder + self.Name + ".dat", 'w' )
263
 
    EMRFile.write( Content )
264
 
    EMRFile.close()
265
 
  
 
203
    def __init__(self, NumLayers, NumBars, BarLength, BarHeight, BarWidth ):
 
204
        self.Layers = []
 
205
        self.Name = "Calorimeter"
 
206
 
 
207
        self.LayersCount = NumLayers
 
208
        self.BarsCount = NumBars
 
209
 
 
210
        self.BarHeight = BarHeight
 
211
        self.BarLength = BarLength
 
212
        self.BarWidth = BarWidth
 
213
 
 
214
        self.Width = self.BarHeight * self.LayersCount
 
215
        self.Height = self.BarWidth * ( self.BarsCount / 2 )
 
216
        self.Length = self.BarLength
 
217
 
 
218
        self.X = 0.0
 
219
        self.Y = 0.0
 
220
        self.Z = 0.0
 
221
 
 
222
        self.Phi = 0.0
 
223
        self.Theta = 0.0
 
224
        self.Psi = 0.0
 
225
 
 
226
        HalfEMRLength = ( self.BarHeight * (self.LayersCount - 1 ) ) / 2
 
227
        for i in range( self.LayersCount ):
 
228
            l = EMRLayer( i, self.BarsCount, self.BarLength, self.BarHeight, self.BarWidth )
 
229
            l.SetPosition( 0.0, 0.0, - HalfEMRLength + ( i * self.BarHeight ) )
 
230
            if i % 2 == 0:
 
231
                l.SetRotation( 0.0, 0.0, 0.0 )
 
232
            else:
 
233
                l.SetRotation( 0.0, 0.0, 90.0 )
 
234
            self.Layers.insert( i, l )
 
235
 
 
236
    def Export( self ):
 
237
        Content = """// FILES/Models/Modules/%s%s.dat
 
238
        //
 
239
        //
 
240
 
 
241
        Module %s
 
242
        {
 
243
          Volume Box
 
244
          Dimensions %.2f %.2f %.2f cm
 
245
          PropertyString Material Galactic
 
246
 
 
247
          PropertyBool Invisible 1
 
248
          // PropertyInt numPlanes %d
 
249
          PropertyInt numLayers %d
 
250
          PropertyDouble G4StepMax 1.0 mm
 
251
        """ % ( ExportFolder, self.Name, self.Name, self.Length, self.Width, self.Height, self.LayersCount, self.LayersCount )
 
252
        for layer in self.Layers:
 
253
            Content += """
 
254
              Module %s%s.dat
 
255
              {
 
256
                Position %.2f %.2f %.2f  cm
 
257
                Rotation %.2f %.2f %.2f degree
 
258
              }
 
259
            """ % ( ExportFolder, layer.Name, layer.X, layer.Y, layer.Z, layer.Phi, layer.Theta, layer.Psi )
 
260
            layer.Export()
 
261
        Content += "}"
 
262
        EMRFile = open( ExportFolder + self.Name + ".dat", 'w' )
 
263
        EMRFile.write( Content )
 
264
        EMRFile.close()
 
265
 
266
266
#Geo = G4MiceGeoBase( "Test" )
267
267
#print Geo
268
268