| 1 | # $Id: parallelHall.py,v 1.4 2003/06/20 12:41:06 dressel Exp $
|
|---|
| 2 | # -------------------------------------------------------------------
|
|---|
| 3 | # GEANT4 tag $Name: $
|
|---|
| 4 | # -------------------------------------------------------------------
|
|---|
| 5 | #
|
|---|
| 6 | import G4Kernel
|
|---|
| 7 | import CLHEP
|
|---|
| 8 | import string
|
|---|
| 9 |
|
|---|
| 10 | class ParallelHall(object):
|
|---|
| 11 | def __init__(self, tiaraSpecs):
|
|---|
| 12 | self.halfWidth = tiaraSpecs.dimensions.worldHalfWidth + \
|
|---|
| 13 | 10*CLHEP.cm
|
|---|
| 14 | self.halfLength = tiaraSpecs.dimensions.worldHalfLength + \
|
|---|
| 15 | 10*CLHEP.cm
|
|---|
| 16 | self.hallSolid = G4Kernel.G4Box("parallelBox",
|
|---|
| 17 | self.halfWidth,
|
|---|
| 18 | self.halfWidth,
|
|---|
| 19 | self.halfLength)
|
|---|
| 20 | vacuum = tiaraSpecs.materials.GetMaterial("vacuum")
|
|---|
| 21 | self.logHall = G4Kernel.G4LogicalVolume(self.hallSolid,
|
|---|
| 22 | vacuum,
|
|---|
| 23 | "paralleleLog")
|
|---|
| 24 | rot = G4Kernel.G4RotationMatrix()
|
|---|
| 25 | self.worldVolume = G4Kernel.\
|
|---|
| 26 | G4PVPlacement(rot,
|
|---|
| 27 | CLHEP.Hep3Vector(0, 0, 0),
|
|---|
| 28 | self.logHall,
|
|---|
| 29 | "ParallelHall");
|
|---|
| 30 | self.geoCells = []
|
|---|
| 31 |
|
|---|
| 32 | def getWorldVolume(self):
|
|---|
| 33 | return self.worldVolume
|
|---|
| 34 |
|
|---|
| 35 | def placeCells(self, arrPosLogVol):
|
|---|
| 36 | for ele in arrPosLogVol:
|
|---|
| 37 | phys = self.placeOneCell(ele)
|
|---|
| 38 | self.geoCells.append(G4Kernel.G4GeometryCell(phys, 0))
|
|---|
| 39 |
|
|---|
| 40 | def placeOneCell(self, pLog, name = ""):
|
|---|
| 41 | rot = G4Kernel.G4RotationMatrix()
|
|---|
| 42 | z = int(pLog.pos)
|
|---|
| 43 | zstr = "%(z)d" % vars()
|
|---|
| 44 | zstr = string.rjust(zstr, 5)
|
|---|
| 45 | zstr = string.replace(zstr,' ','0')
|
|---|
| 46 |
|
|---|
| 47 | if not name:
|
|---|
| 48 | name = "cell_z_" + zstr
|
|---|
| 49 | vPhys = G4Kernel.\
|
|---|
| 50 | G4PVPlacement(rot,
|
|---|
| 51 | CLHEP.Hep3Vector(0, 0, pLog.pos),
|
|---|
| 52 | pLog.log,
|
|---|
| 53 | name,
|
|---|
| 54 | self.logHall);
|
|---|
| 55 | return vPhys
|
|---|
| 56 |
|
|---|
| 57 | def getGeometryCells(self):
|
|---|
| 58 | return self.geoCells
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|