Logo ROOT   6.12/07
Reference Guide
ROOTwriter.py
Go to the documentation of this file.
1 # @(#)root/gdml:$Id$
2 # Author: Witold Pokorski 05/06/2006
3 
4 from math import *
5 
6 import libPyROOT
7 import ROOT
8 import math
9 import re
10 
11 # This class provides ROOT binding for the 'writer' class. It implements specific
12 # methods for all the supported TGeo classes which call the appropriate 'add-element'
13 # methods from the 'writer' class.
14 
15 # The list of presently supported classes is the following:
16 
17 # Materials:
18 # TGeoElement
19 # TGeoMaterial
20 # GeoMixture
21 
22 # Solids:
23 # TGeoBBox
24 # TGeoArb8
25 # TGeoTubeSeg
26 # TGeoConeSeg
27 # TGeoCtub
28 # TGeoPcon
29 # TGeoTrap
30 # TGeoGtra
31 # TGeoTrd2
32 # TGeoSphere
33 # TGeoPara
34 # TGeoTorus
35 # TGeoHype
36 # TGeoPgon
37 # TGeoXtru
38 # TGeoEltu
39 # TGeoParaboloid
40 # TGeoCompositeShape (subtraction, union, intersection)
41 
42 # Geometry:
43 # TGeoVolume
44 
45 # In addition the class contains three methods 'dumpMaterials', 'dumpSolids' and 'examineVol'
46 # which retrieve from the memory the materials, the solids and the geometry tree
47 # respectively. The user should instanciate this class passing and instance of 'writer'
48 # class as argument. In order to export the geometry in the form of a GDML file,
49 # the three methods (dumpMaterials, dumpSolids and examineVol) should be called.
50 # The argument of 'dumpMaterials' method should be the list of materials,
51 # the argument of the 'dumpSolids' method should be the list of solids and
52 # the argument of the 'examineVol' method should be the top volume of
53 # the geometry tree.
54 
55 # For any question or remarks concerning this code, please send an email to
56 # Witold.Pokorski@cern.ch.
57 
58 class ROOTwriter(object):
59 
60  def __init__(self, writer):
61  self.writer = writer
62  self.elements = []
63  self.volumeCount = 0
64  self.nodeCount = 0
65  self.shapesCount = 0
66  self.bvols = []
67  self.vols = []
68  self.volsUseCount = {}
69  self.sortedVols = []
70  self.nodes = []
71  self.bnodes = []
72  self.solList = []
73  self.geomgr = ROOT.gGeoManager
74  self.geomgr.SetAllIndex()
75  pass
76 
77 
78 
79  def genName(self, name):
80 
81  re.sub('$', '', name)
82 
83  return name
84 
85 
86  def rotXYZ(self, r):
87 
88  rad = 180/acos(-1)
89 
90  cosb = math.sqrt( r[0]*r[0] + r[1]*r[1] )
91  if cosb > 0.00001 : #I didn't find a proper constant to use here, so I just put a value that works with all the examples on a linux machine (P4)
92  a = atan2( r[5], r[8] ) * rad
93  b = atan2( -r[2], cosb ) * rad
94  c = atan2( r[1], r[0] ) * rad
95  else:
96  a = atan2( -r[7], r[4] ) * rad
97  b = atan2( -r[2], cosb ) * rad
98  c = 0.
99  return (a, b, c)
100 
101  def TGeoBBox(self, solid):
102  self.writer.addBox(self.genName(solid.GetName())+'_'+str(libPyROOT.AddressOf(solid)[0]), 2*solid.GetDX(), 2*solid.GetDY(), 2*solid.GetDZ())
103 
104  def TGeoParaboloid(self, solid):
105  self.writer.addParaboloid(self.genName(solid.GetName())+'_'+str(libPyROOT.AddressOf(solid)[0]), solid.GetRlo(), solid.GetRhi(), solid.GetDz())
106 
107  def TGeoSphere(self, solid):
108  self.writer.addSphere(self.genName(solid.GetName())+'_'+str(libPyROOT.AddressOf(solid)[0]), solid.GetRmin(), solid.GetRmax(),
109  solid.GetPhi1(), solid.GetPhi2() - solid.GetPhi1(),
110  solid.GetTheta1(), solid.GetTheta2() - solid.GetTheta1())
111 
112  def TGeoArb8(self, solid):
113  self.writer.addArb8(self.genName(solid.GetName())+'_'+str(libPyROOT.AddressOf(solid)[0]),
114  solid.GetVertices()[0],
115  solid.GetVertices()[1],
116  solid.GetVertices()[2],
117  solid.GetVertices()[3],
118  solid.GetVertices()[4],
119  solid.GetVertices()[5],
120  solid.GetVertices()[6],
121  solid.GetVertices()[7],
122  solid.GetVertices()[8],
123  solid.GetVertices()[9],
124  solid.GetVertices()[10],
125  solid.GetVertices()[11],
126  solid.GetVertices()[12],
127  solid.GetVertices()[13],
128  solid.GetVertices()[14],
129  solid.GetVertices()[15],
130  solid.GetDz())
131 
132  def TGeoConeSeg(self, solid):
133  self.writer.addCone(self.genName(solid.GetName())+'_'+str(libPyROOT.AddressOf(solid)[0]), 2*solid.GetDz(), solid.GetRmin1(), solid.GetRmin2(),
134  solid.GetRmax1(), solid.GetRmax2(), solid.GetPhi1(), solid.GetPhi2() - solid.GetPhi1())
135 
136  def TGeoCone(self, solid):
137  self.writer.addCone(self.genName(solid.GetName())+'_'+str(libPyROOT.AddressOf(solid)[0]), 2*solid.GetDz(), solid.GetRmin1(), solid.GetRmin2(),
138  solid.GetRmax1(), solid.GetRmax2(), 0, 360)
139 
140  def TGeoPara(self, solid):
141  self.writer.addPara(self.genName(solid.GetName())+'_'+str(libPyROOT.AddressOf(solid)[0]), solid.GetX(), solid.GetY(), solid.GetZ(),
142  solid.GetAlpha(), solid.GetTheta(), solid.GetPhi())
143 
144  def TGeoTrap(self, solid):
145  self.writer.addTrap(self.genName(solid.GetName())+'_'+str(libPyROOT.AddressOf(solid)[0]), 2*solid.GetDz(), solid.GetTheta(), solid.GetPhi(),
146  2*solid.GetH1(), 2*solid.GetBl1(), 2*solid.GetTl1(), solid.GetAlpha1(),
147  2*solid.GetH2(), 2*solid.GetBl2(), 2*solid.GetTl2(), solid.GetAlpha2())
148 
149  def TGeoGtra(self, solid):
150  self.writer.addTwistedTrap(self.genName(solid.GetName())+'_'+str(libPyROOT.AddressOf(solid)[0]), 2*solid.GetDz(), solid.GetTheta(), solid.GetPhi(),
151  2*solid.GetH1(), 2*solid.GetBl1(), 2*solid.GetTl1(), solid.GetAlpha1(),
152  2*solid.GetH2(), 2*solid.GetBl2(), 2*solid.GetTl2(), solid.GetAlpha2(), solid.GetTwistAngle())
153 
154  def TGeoTrd1(self, solid):
155  self.writer.addTrd(self.genName(solid.GetName())+'_'+str(libPyROOT.AddressOf(solid)[0]), 2*solid.GetDx1(), 2*solid.GetDx2(), 2*solid.GetDy(),
156  2*solid.GetDy(), 2*solid.GetDz())
157 
158  def TGeoTrd2(self, solid):
159  self.writer.addTrd(self.genName(solid.GetName())+'_'+str(libPyROOT.AddressOf(solid)[0]), 2*solid.GetDx1(), 2*solid.GetDx2(), 2*solid.GetDy1(),
160  2*solid.GetDy2(), 2*solid.GetDz())
161 
162  def TGeoTubeSeg(self, solid):
163  self.writer.addTube(self.genName(solid.GetName())+'_'+str(libPyROOT.AddressOf(solid)[0]), solid.GetRmin(), solid.GetRmax(),
164  2*solid.GetDz(), solid.GetPhi1(), solid.GetPhi2()-solid.GetPhi1())
165 
166  def TGeoCtub(self, solid):
167  self.writer.addCutTube(self.genName(solid.GetName())+'_'+str(libPyROOT.AddressOf(solid)[0]), solid.GetRmin(), solid.GetRmax(),
168  2*solid.GetDz(), solid.GetPhi1(), solid.GetPhi2()-solid.GetPhi1(),
169  solid.GetNlow()[0],
170  solid.GetNlow()[1],
171  solid.GetNlow()[2],
172  solid.GetNhigh()[0],
173  solid.GetNhigh()[1],
174  solid.GetNhigh()[2])
175 
176  def TGeoTube(self, solid):
177  self.writer.addTube(self.genName(solid.GetName())+'_'+str(libPyROOT.AddressOf(solid)[0]), solid.GetRmin(), solid.GetRmax(),
178  2*solid.GetDz(), 0, 360)
179 
180  def TGeoPcon(self, solid):
181  zplanes = []
182  for i in range(solid.GetNz()):
183  zplanes.append( (solid.GetZ(i), solid.GetRmin(i), solid.GetRmax(i)) )
184  self.writer.addPolycone(self.genName(solid.GetName())+'_'+str(libPyROOT.AddressOf(solid)[0]), solid.GetPhi1(), solid.GetDphi(), zplanes)
185 
186  def TGeoTorus(self, solid):
187  self.writer.addTorus(self.genName(solid.GetName())+'_'+str(libPyROOT.AddressOf(solid)[0]), solid.GetR(), solid.GetRmin(), solid.GetRmax(),
188  solid.GetPhi1(), solid.GetDphi())
189 
190  def TGeoPgon(self, solid):
191  zplanes = []
192  for i in range(solid.GetNz()):
193  zplanes.append( (solid.GetZ(i), solid.GetRmin(i), solid.GetRmax(i)) )
194  self.writer.addPolyhedra(self.genName(solid.GetName())+'_'+str(libPyROOT.AddressOf(solid)[0]), solid.GetPhi1(), solid.GetDphi(),
195  solid.GetNedges(), zplanes)
196 
197  def TGeoXtru(self, solid):
198  vertices = []
199  sections = []
200  for i in range(solid.GetNvert()):
201  vertices.append( (solid.GetX(i), solid.GetY(i)) )
202  for i in range(solid.GetNz()):
203  sections.append( (i, solid.GetZ(i), solid.GetXOffset(i), solid.GetYOffset(i), solid.GetScale(i)) )
204  self.writer.addXtrusion(self.genName(solid.GetName())+'_'+str(libPyROOT.AddressOf(solid)[0]), vertices, sections)
205 
206  def TGeoEltu(self, solid):
207  self.writer.addEltube(self.genName(solid.GetName())+'_'+str(libPyROOT.AddressOf(solid)[0]), solid.GetA(), solid.GetB(), solid.GetDz())
208 
209  def TGeoHype(self, solid):
210  self.writer.addHype(self.genName(solid.GetName())+'_'+str(libPyROOT.AddressOf(solid)[0]), solid.GetRmin(), solid.GetRmax(),
211  solid.GetStIn(), solid.GetStOut(), 2*solid.GetDz())
212 
213  def TGeoUnion(self, solid):
214  lrot = self.rotXYZ(solid.GetBoolNode().GetLeftMatrix().Inverse().GetRotationMatrix())
215  rrot = self.rotXYZ(solid.GetBoolNode().GetRightMatrix().Inverse().GetRotationMatrix())
216 
217  if ([solid.GetBoolNode().GetLeftShape(), 0]) in self.solList:
218  self.solList[self.solList.index([solid.GetBoolNode().GetLeftShape(), 0])][1] = 1
219  eval('self.'+solid.GetBoolNode().GetLeftShape().__class__.__name__)(solid.GetBoolNode().GetLeftShape())
220  self.shapesCount = self.shapesCount + 1
221  if ([solid.GetBoolNode().GetRightShape(), 0]) in self.solList:
222  self.solList[self.solList.index([solid.GetBoolNode().GetRightShape(), 0])][1] = 1
223  eval('self.'+solid.GetBoolNode().GetRightShape().__class__.__name__)(solid.GetBoolNode().GetRightShape())
224  self.shapesCount = self.shapesCount + 1
225 
226  self.writer.addUnion(self.genName(solid.GetName())+'_'+str(libPyROOT.AddressOf(solid)[0]),
227  solid.GetBoolNode().GetLeftShape().GetName()+'_'+str(libPyROOT.AddressOf(solid.GetBoolNode().GetLeftShape())[0]),
228  solid.GetBoolNode().GetLeftMatrix().GetTranslation(),
229  lrot,
230  solid.GetBoolNode().GetRightShape().GetName()+'_'+str(libPyROOT.AddressOf(solid.GetBoolNode().GetRightShape())[0]),
231  solid.GetBoolNode().GetRightMatrix().GetTranslation(),
232  rrot)
233 
234  def TGeoIntersection(self, solid):
235  lrot = self.rotXYZ(solid.GetBoolNode().GetLeftMatrix().Inverse().GetRotationMatrix())
236  rrot = self.rotXYZ(solid.GetBoolNode().GetRightMatrix().Inverse().GetRotationMatrix())
237 
238  if ([solid.GetBoolNode().GetLeftShape(), 0]) in self.solList:
239  self.solList[self.solList.index([solid.GetBoolNode().GetLeftShape(), 0])][1] = 1
240  eval('self.'+solid.GetBoolNode().GetLeftShape().__class__.__name__)(solid.GetBoolNode().GetLeftShape())
241  self.shapesCount = self.shapesCount + 1
242  if ([solid.GetBoolNode().GetRightShape(), 0]) in self.solList:
243  self.solList[self.solList.index([solid.GetBoolNode().GetRightShape(), 0])][1] = 1
244  eval('self.'+solid.GetBoolNode().GetRightShape().__class__.__name__)(solid.GetBoolNode().GetRightShape())
245  self.shapesCount = self.shapesCount + 1
246 
247  self.writer.addIntersection(self.genName(solid.GetName())+'_'+str(libPyROOT.AddressOf(solid)[0]),
248  solid.GetBoolNode().GetLeftShape().GetName()+'_'+str(libPyROOT.AddressOf(solid.GetBoolNode().GetLeftShape())[0]),
249  solid.GetBoolNode().GetLeftMatrix().GetTranslation(),
250  lrot,
251  solid.GetBoolNode().GetRightShape().GetName()+'_'+str(libPyROOT.AddressOf(solid.GetBoolNode().GetRightShape())[0]),
252  solid.GetBoolNode().GetRightMatrix().GetTranslation(),
253  rrot)
254 
255  def TGeoSubtraction(self, solid):
256  lrot = self.rotXYZ(solid.GetBoolNode().GetLeftMatrix().Inverse().GetRotationMatrix())
257  rrot = self.rotXYZ(solid.GetBoolNode().GetRightMatrix().Inverse().GetRotationMatrix())
258 
259  if ([solid.GetBoolNode().GetLeftShape(), 0]) in self.solList:
260  self.solList[self.solList.index([solid.GetBoolNode().GetLeftShape(), 0])][1] = 1
261  eval('self.'+solid.GetBoolNode().GetLeftShape().__class__.__name__)(solid.GetBoolNode().GetLeftShape())
262  self.shapesCount = self.shapesCount + 1
263  if ([solid.GetBoolNode().GetRightShape(), 0]) in self.solList:
264  self.solList[self.solList.index([solid.GetBoolNode().GetRightShape(), 0])][1] = 1
265  eval('self.'+solid.GetBoolNode().GetRightShape().__class__.__name__)(solid.GetBoolNode().GetRightShape())
266  self.shapesCount = self.shapesCount + 1
267 
268  self.writer.addSubtraction(self.genName(solid.GetName())+'_'+str(libPyROOT.AddressOf(solid)[0]),
269  solid.GetBoolNode().GetLeftShape().GetName()+'_'+str(libPyROOT.AddressOf(solid.GetBoolNode().GetLeftShape())[0]),
270  solid.GetBoolNode().GetLeftMatrix().GetTranslation(),
271  lrot,
272  solid.GetBoolNode().GetRightShape().GetName()+'_'+str(libPyROOT.AddressOf(solid.GetBoolNode().GetRightShape())[0]),
273  solid.GetBoolNode().GetRightMatrix().GetTranslation(),
274  rrot)
275 
276  def TGeoCompositeShape(self, solid):
277  eval('self.'+solid.GetBoolNode().__class__.__name__)(solid)
278 
279  def dumpMaterials(self, matlist):
280  print 'Info in <TPython::Exec>: Found ', matlist.GetSize(),' materials'
281  for mat in matlist:
282  if not mat.IsMixture():
283  self.writer.addMaterial(self.genName(mat.GetName()), mat.GetA(), mat.GetZ(), mat.GetDensity())
284  else:
285  elems = {}
286  for index in range(mat.GetNelements()):
287  elems[mat.GetElement(index).GetName()] = mat.GetWmixt()[index]
288  el = mat.GetElement(index)
289  if el not in self.elements:
290  self.elements.append(el)
291  self.writer.addElement(mat.GetElement(index).GetTitle(), mat.GetElement(index).GetName(), mat.GetZmixt()[index], mat.GetAmixt()[index])
292 
293  self.writer.addMixture(self.genName(mat.GetName()), mat.GetDensity(), elems)
294 
295  def dumpSolids(self, shapelist):
296  print 'Info in <TPython::Exec>: Found ', shapelist.GetEntries(), ' shapes'
297  for shape in shapelist:
298  self.solList.append([shape, 0])
299  for sol in self.solList:
300  if sol[1] == 0:
301  sol[1] = 1
302  #print eval('self.'+sol[0].__class__.__name__)(sol[0])
303  eval('self.'+sol[0].__class__.__name__)(sol[0])
304  self.shapesCount = self.shapesCount + 1
305  print 'Info in <TPython::Exec>: Dumped ', self.shapesCount, ' shapes'
306 
307 
308  def orderVolumes(self, volume):
309  index = str(volume.GetNumber())+"_"+str(libPyROOT.AddressOf(volume)[0])
310  daughters = volume.GetNodes()
311  if len(self.sortedVols)<len(self.vols) and self.volsUseCount[index]>0:
312  self.volsUseCount[index] = self.volsUseCount[index]-1
313  if self.volsUseCount[index]==0:
314  self.sortedVols.append(volume)
315  if daughters:
316  for node in daughters:
317  self.orderVolumes(node.GetVolume())
318  self.nodeCount = self.nodeCount+1
319  if self.nodeCount%10000==0:
320  print '[FIRST STAGE] Node count: ', self.nodeCount
321  elif len(self.sortedVols)<len(self.volsUseCount) and self.volsUseCount[index]==0:
322  self.sortedVols.append(volume)
323  if daughters:
324  for node in daughters:
325  self.orderVolumes(node.GetVolume())
326  self.nodeCount = self.nodeCount+1
327  if self.nodeCount%10000==0:
328  print '[FIRST STAGE] Node count: ', self.nodeCount
329 
330  def getNodes(self, volume):
331  nd = volume.GetNdaughters()
332  if nd:
333  for i in range(nd):
334  currentNode = volume.GetNode(i)
335  nextVol = currentNode.GetVolume()
336  index = str(nextVol.GetNumber())+"_"+str(libPyROOT.AddressOf(nextVol)[0])
337  self.volsUseCount[index] = self.volsUseCount[index]+1
338  self.nodes.append(currentNode)
339  self.getNodes(nextVol)
340  self.nodeCount = self.nodeCount+1
341  if self.nodeCount%10000==0:
342  print '[ZEROTH STAGE] Analysing node: ', self.nodeCount
343 
344  def examineVol2(self, volume): #use with geometries containing many volumes
345  print ''
346  print '[RETRIEVING VOLUME LIST]'
347 
348  self.bvols = geomgr.GetListOfVolumes()
349  print ''
350  print '[INITIALISING VOLUME USE COUNT]'
351  for vol in self.bvols:
352  self.vols.append(vol)
353  self.volsUseCount[str(vol.GetNumber())+"_"+str(libPyROOT.AddressOf(vol)[0])]=0
354  print ''
355  print '[CALCULATING VOLUME USE COUNT]'
356  self.nodeCount = 0
357  self.getNodes(volume)
358  print ''
359  print '[ORDERING VOLUMES]'
360  self.nodeCount = 0
361  self.orderVolumes(volume)
362  print ''
363  print '[DUMPING GEOMETRY TREE]'
364  self.sortedVols.reverse()
365  self.nodeCount = 0
366  self.dumpGeoTree()
367  print ''
368  print '[FINISHED!]'
369  print ''
370 
371  def examineVol(self, volume): #use with geometries containing very few volumes and many nodes
372  daughters = []
373  if volume.GetNodes():
374  for node in volume.GetNodes():
375  subvol = node.GetVolume()
376 
377  #if bit not set, set and save primitive
378  if not subvol.TestAttBit(524288): #value referring to TGeoAtt::kSavePrimitiveAtt (1 << 19)
379  subvol.SetAttBit(524288)
380  self.vols.append(subvol)
381  self.examineVol(subvol)
382  name = node.GetName()+str(libPyROOT.AddressOf(subvol)[0])+'in'+volume.GetName()+str(libPyROOT.AddressOf(volume)[0])
383  pos = node.GetMatrix().GetTranslation()
384  self.writer.addPosition(name+'pos', pos[0], pos[1], pos[2])
385  r = self.rotXYZ(node.GetMatrix().GetRotationMatrix())
386  rotname = ''
387  if r[0]!=0.0 or r[1]!=0.0 or r[2]!=0.0:
388  self.writer.addRotation(name+'rot', r[0], r[1], r[2])
389  rotname = name+'rot'
390 
391  reflection = node.GetMatrix().IsReflection()#check if this daughter has a reflection matrix
392 
393  if reflection:
394  rotmat = node.GetMatrix().GetRotationMatrix()
395 
396  #add new 'reflectedSolid' shape to solids
397  self.writer.addReflSolid('refl_'+node.GetVolume().GetShape().GetName()+'_'+str(libPyROOT.AddressOf(node.GetVolume().GetShape())[0]), node.GetVolume().GetShape().GetName()+'_'+str(libPyROOT.AddressOf(node.GetVolume().GetShape())[0]), 0, 0, 0, rotmat[0], rotmat[4], rotmat[8], 0, 0, 0)
398 
399  #add new volume with correct solidref to the new reflectedSolid
400  emptyd = []
401  self.writer.addVolume('refl_'+node.GetVolume().GetName()+'_'+str(libPyROOT.AddressOf(node.GetVolume())[0]), 'refl_'+node.GetVolume().GetShape().GetName()+'_'+str(libPyROOT.AddressOf(node.GetVolume().GetShape())[0]), self.genName(node.GetVolume().GetMaterial().GetName()), emptyd)
402 
403  #add new volume as volumeref to this physvol
404  daughters.append( ('refl_'+node.GetVolume().GetName()+'_'+str(libPyROOT.AddressOf(node.GetVolume())[0]), name+'pos', rotname) )
405 
406  else:
407  daughters.append( (node.GetVolume().GetName()+'_'+str(libPyROOT.AddressOf(node.GetVolume())[0]), name+'pos', rotname) )
408 
409  if volume.IsTopVolume():
410  if not volume.IsAssembly():
411  self.writer.addVolume(volume.GetName(), volume.GetShape().GetName()+'_'+str(libPyROOT.AddressOf(volume.GetShape())[0]), self.genName(volume.GetMaterial().GetName()), daughters)
412  else:
413  self.writer.addAssembly(volume.GetName(), daughters)
414  else:
415  if not volume.IsAssembly():
416  self.writer.addVolume(volume.GetName()+'_'+str(libPyROOT.AddressOf(volume)[0]), volume.GetShape().GetName()+'_'+str(libPyROOT.AddressOf(volume.GetShape())[0]), self.genName(volume.GetMaterial().GetName()), daughters)
417  else:
418  self.writer.addAssembly(volume.GetName()+'_'+str(libPyROOT.AddressOf(volume)[0]), daughters)
419 
420  def dumpGeoTree(self):
421  for volume in self.sortedVols:
422  nd = volume.GetNdaughters()
423  daughters = []
424  if nd:
425  for i in range(nd):
426  node = volume.GetNode(i)
427  name = node.GetName()+'in'+volume.GetName()
428  pos = node.GetMatrix().GetTranslation()
429  self.writer.addPosition(name+'pos', pos[0], pos[1], pos[2])
430  r = self.rotXYZ(node.GetMatrix().GetRotationMatrix())
431  rotname = ''
432  if r[0]!=0.0 or r[1]!=0.0 or r[2]!=0.0:
433  self.writer.addRotation(name+'rot', r[0], r[1], r[2])
434  rotname = name+'rot'
435  daughters.append( (node.GetVolume().GetName()+'_'+str(libPyROOT.AddressOf(node.GetVolume())[0]), name+'pos', rotname) )
436  self.nodeCount = self.nodeCount+1
437  if self.nodeCount%100==0:
438  print '[SECOND STAGE] Volume Count: ', self.nodeCount, node.GetVolume().GetName()+'_'+str(libPyROOT.AddressOf(node.GetVolume())[0])
439 
440  if volume.IsTopVolume():
441  if not volume.IsAssembly():
442  self.writer.addVolume(volume.GetName(), volume.GetShape().GetName()+'_'+str(libPyROOT.AddressOf(volume.GetShape())[0]), self.genName(volume.GetMaterial().GetName()), daughters)
443  else:
444  self.writer.addAssembly(volume.GetName(), daughters)
445  else:
446  if not volume.IsAssembly():
447  self.writer.addVolume(volume.GetName()+'_'+str(libPyROOT.AddressOf(volume)[0]), volume.GetShape().GetName()+'_'+str(libPyROOT.AddressOf(volume.GetShape())[0]), self.genName(volume.GetMaterial().GetName()), daughters)
448  else:
449  self.writer.addAssembly(volume.GetName()+'_'+str(libPyROOT.AddressOf(volume)[0]), daughters)
450 
std::string GetName(const std::string &scope_name)
Definition: Cppyy.cxx:145
def TGeoUnion(self, solid)
Definition: ROOTwriter.py:213
def TGeoPcon(self, solid)
Definition: ROOTwriter.py:180
def TGeoSphere(self, solid)
Definition: ROOTwriter.py:107
def rotXYZ(self, r)
Definition: ROOTwriter.py:86
def TGeoArb8(self, solid)
Definition: ROOTwriter.py:112
def TGeoCompositeShape(self, solid)
Definition: ROOTwriter.py:276
def TGeoGtra(self, solid)
Definition: ROOTwriter.py:149
def TGeoConeSeg(self, solid)
Definition: ROOTwriter.py:132
def TGeoTorus(self, solid)
Definition: ROOTwriter.py:186
def __init__(self, writer)
Definition: ROOTwriter.py:60
def TGeoPara(self, solid)
Definition: ROOTwriter.py:140
def examineVol2(self, volume)
Definition: ROOTwriter.py:344
def TGeoXtru(self, solid)
Definition: ROOTwriter.py:197
def dumpMaterials(self, matlist)
Definition: ROOTwriter.py:279
def TGeoParaboloid(self, solid)
Definition: ROOTwriter.py:104
def TGeoCtub(self, solid)
Definition: ROOTwriter.py:166
ABObj< sym, MatrixInverse< sym, ABObj< sym, LASymMatrix, double >, double >, double > Inverse(const ABObj< sym, LASymMatrix, double > &obj)
LAPACK Algebra functions specialize the Invert function for LASymMatrix.
Definition: LaInverse.h:27
def TGeoBBox(self, solid)
Definition: ROOTwriter.py:101
double acos(double)
def getNodes(self, volume)
Definition: ROOTwriter.py:330
def dumpSolids(self, shapelist)
Definition: ROOTwriter.py:295
def TGeoHype(self, solid)
Definition: ROOTwriter.py:209
def TGeoEltu(self, solid)
Definition: ROOTwriter.py:206
def TGeoIntersection(self, solid)
Definition: ROOTwriter.py:234
def TGeoTube(self, solid)
Definition: ROOTwriter.py:176
def TGeoTrd2(self, solid)
Definition: ROOTwriter.py:158
def genName(self, name)
Definition: ROOTwriter.py:79
def TGeoTubeSeg(self, solid)
Definition: ROOTwriter.py:162
def orderVolumes(self, volume)
Definition: ROOTwriter.py:308
def TGeoCone(self, solid)
Definition: ROOTwriter.py:136
def TGeoPgon(self, solid)
Definition: ROOTwriter.py:190
double atan2(double, double)
def TGeoSubtraction(self, solid)
Definition: ROOTwriter.py:255
def TGeoTrap(self, solid)
Definition: ROOTwriter.py:144
def examineVol(self, volume)
Definition: ROOTwriter.py:371
def TGeoTrd1(self, solid)
Definition: ROOTwriter.py:154