Geant4  10.02.p03
test Namespace Reference

Classes

class  MyDetectorConstruction
 
class  MyEventAction
 
class  MyField
 
class  MyPrimaryGeneratorAction
 
class  MyRunAction
 
class  MySteppingAction
 
class  MyX
 
class  MyXClass
 
class  MyZClass1
 
class  MyZClass2
 

Functions

def Setup0 ()
 
def Setup1 ()
 
def Setup3 ()
 
def Configure ()
 
def ConstructGeom ()
 
def DumpTree (atree)
 

Variables

string fname = "%s.wrl" % (s)
 
 cmdstr
 
 a
 
 b
 
 c
 
 z
 
 myz1
 
 myz2
 
 myx
 
 x
 
 acolor
 
 ival
 
 v
 
 alist
 

Function Documentation

◆ Configure()

def test.Configure ( )

Definition at line 18 of file tests/gtest03/python3/test.py.

18 def Configure():
19  # ------------------------------------------------------------------
20  # setup for materials
21  # ------------------------------------------------------------------
22  # simple materials for Qgeom
23  g4py.NISTmaterials.Construct()
24 
25  # ------------------------------------------------------------------
26  # setup for geometry
27  # ------------------------------------------------------------------
28  #g4py.Qgeom.Construct()
29  g4py.ezgeom.Construct() # initialize
30 
31  # ------------------------------------------------------------------
32  # setup for physics list
33  # ------------------------------------------------------------------
34  g4py.EMSTDpl.Construct()
35 
36  # ------------------------------------------------------------------
37  # setup for primary generator action
38  # ------------------------------------------------------------------
39  g4py.ParticleGun.Construct()
40  gControlExecute("gun.mac")
41 
42 # ==================================================================
43 # constructing geometry
44 # ==================================================================
Here is the caller graph for this function:

◆ ConstructGeom()

def test.ConstructGeom ( )

Definition at line 45 of file tests/gtest03/python3/test.py.

45 def ConstructGeom():
46  print("* Constructing geometry...")
47  # reset world material
48  air= G4Material.GetMaterial("G4_AIR")
49  g4py.ezgeom.SetWorldMaterial(air)
50 
51  # target
52  global target
53  target= G4EzVolume("Target")
54  au= G4Material.GetMaterial("G4_Au")
55  target.CreateTubeVolume(au, 0., 1.*cm, 1.*mm)
56  target.PlaceIt(G4ThreeVector(0.,0.,-10.*cm))
57 
58  # dummy box
59  global detector_box, detector_box_pv
60  detector_box= G4EzVolume("DetectorBox")
61  detector_box.CreateBoxVolume(air, 20.*cm, 20.*cm, 40.*cm)
62  detector_box_pv= detector_box.PlaceIt(G4ThreeVector(0.,0.,20.*cm))
63 
64  # calorimeter
65  global cal
66  cal= G4EzVolume("Calorimeter")
67  nai= G4Material.GetMaterial("G4_SODIUM_IODIDE")
68  cal.CreateBoxVolume(nai, 5.*cm, 5.*cm, 30.*cm)
69  dd= 5.*cm
70  for ical in range(-1, 2):
71  calPos= G4ThreeVector(dd*ical, 0., 0.)
72  print(calPos)
73  cal.PlaceIt(calPos, ical+1, detector_box)
74 
75 
76 # ==================================================================
77 # main
78 # ==================================================================
79 # ------------------------------------------------------------------
80 # randum number
81 # ------------------------------------------------------------------
82 rand_engine= Ranlux64Engine()
83 HepRandom.setTheEngine(rand_engine)
84 HepRandom.setTheSeed(20050830)
85 
86 # setup...
87 Configure()
89 
90 # ------------------------------------------------------------------
91 # go...
92 # ------------------------------------------------------------------
93 gRunManager.Initialize()
94 
95 # visualization
96 gControlExecute("vis.mac")
97 
98 # beamOn
99 #gRunManager.BeamOn(3)
100 
101 
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:604
void print(G4double elem)
Here is the call graph for this function:

◆ DumpTree()

def test.DumpTree (   atree)

Definition at line 10 of file tests/gtest04/python3/test.py.

10 def DumpTree(atree):
11  print("@@", atree.GetPathName(), "::", atree.GetTitle())
12  ntree= atree.GetTreeEntry()
13  ncommand= atree.GetCommandEntry()
14 
15  for i in range(1, ncommand+1):
16  icommand= atree.GetCommand(i)
17  print(" **", icommand.GetCommandPath())
18  print(" ", icommand.GetTitle())
19  x= icommand.GetStateList()
20 
21  nparameter= icommand.GetParameterEntries()
22  for j in range(0, nparameter):
23  iparam= icommand.GetParameter(j)
24  print(" +", iparam.GetParameterName(), iparam.GetParameterType())
25 
26  for i in range(1, ntree+1):
27  itree= atree.GetTree(i)
28  DumpTree(itree)
29 
30 # ==================================================================
31 # main
32 # ==================================================================
33 root_tree= gUImanager.GetTree()
34 
35 DumpTree(root_tree)
36 
37 
def DumpTree(atree)
void print(G4double elem)
Here is the call graph for this function:

◆ Setup0()

def test.Setup0 ( )

Definition at line 21 of file tests/gtest02/python3/test.py.

21 def Setup0():
22  # simple materials for Qgeom
23  g4py.Qmaterials.Construct()
24 
25  # NIST materials
26  #g4py.NISTmaterials.Construct()
27 
28  # normal way for constructing user geometry
29  #qDC= g4py.Qgeom.QDetectorConstruction()
30  #gRunManager.SetUserInitialization(qDC)
31 
32  # 2nd way, short-cut way
33  g4py.Qgeom.Construct()
34 
35  # primary
36  global primary_position, primary_direction
37  primary_position= G4ThreeVector(0.,0., -14.9*cm)
38  primary_direction= G4ThreeVector(0.2, 0., 1.)
39 
40 
41 # ------------------------------------------------------------------
42 # Setup-1 (ExampleN01)
43 # ------------------------------------------------------------------
Here is the caller graph for this function:

◆ Setup1()

def test.Setup1 ( )

Definition at line 44 of file tests/gtest02/python3/test.py.

44 def Setup1():
45  g4py.ExN01geom.Construct()
46 
47  global primary_position, primary_direction
48  primary_position= G4ThreeVector(-2.5*m, 0., 0.)
49  primary_direction= G4ThreeVector(1., 0., 0.)
50 
51 
52 # ------------------------------------------------------------------
53 # Setup-3 (ExampleN03)
54 # ------------------------------------------------------------------

◆ Setup3()

def test.Setup3 ( )

Definition at line 55 of file tests/gtest02/python3/test.py.

55 def Setup3():
56  #exN03geom= g4py.ExN03geom.ExN03DetectorConstruction()
57  #gRunManager.SetUserInitialization(exN03geom)
58 
59  g4py.ExN03geom.Construct()
60 
61  global primary_position, primary_direction
62  primary_position= G4ThreeVector(-1.*m, 0., 0.)
63  primary_direction= G4ThreeVector(1., 0., 0.)
64 
65 
66 # ==================================================================
67 # main
68 # ==================================================================
69 # ------------------------------------------------------------------
70 # randum number
71 # ------------------------------------------------------------------
72 rand_engine= Ranlux64Engine()
73 HepRandom.setTheEngine(rand_engine)
74 HepRandom.setTheSeed(20050830)
75 
76 # ------------------------------------------------------------------
77 # user setup
78 # ------------------------------------------------------------------
79 Setup0()
80 #Setup1()
81 #Setup3()
82 
83 
84 # ------------------------------------------------------------------
85 # setup for physics list
86 # ------------------------------------------------------------------
87 # normal way for constructing user physics list
88 #exN01PL= ExN01PhysicsList.ExN01PhysicsList()
89 #gRunManager.SetUserInitialization(exN01PL)
90 
91 # 2nd way, short-cut way
92 # geantino + transportation
93 #g4py.ExN01pl.Construct()
94 
95 # electron/gamma standard EM
96 g4py.EMSTDpl.Construct()
97 
98 # ------------------------------------------------------------------
99 # setup for primary generator action
100 # ------------------------------------------------------------------
101 # ------------
102 # Particle Gun
103 # ------------
104 # normal way for constructing user physics list
105 #pgPGA= g4py.ParticleGun.ParticleGunAction()
106 #gRunManager.SetUserAction(pgPGA)
107 #pg= pgPGA.GetParticleGun()
108 
109 # 2nd way, short-cut way
110 pg= g4py.ParticleGun.Construct()
111 
112 # set parameters of particle gun
113 pg.SetParticleByName("e-")
114 pg.SetParticleEnergy(300.*MeV)
115 pg.SetParticlePosition(primary_position)
116 pg.SetParticleMomentumDirection(primary_direction)
117 
118 # ------------
119 # Medical Beam
120 # ------------
121 #beam= g4py.MedicalBeam.Construct()
122 
123 # ------------------------------------------------------------------
124 # go...
125 # ------------------------------------------------------------------
126 gRunManager.Initialize()
127 
128 # visualization
129 gApplyUICommand("/control/execute vis.mac")
130 
131 # beamOn
132 #gRunManager.BeamOn(3)
133 
Here is the call graph for this function:

Variable Documentation

◆ a

test.a

Definition at line 11 of file tests/test01/test.py.

◆ acolor

test.acolor

Definition at line 9 of file tests/test07/test.py.

◆ alist

test.alist

Definition at line 9 of file tests/test13/test.py.

◆ b

test.b

Definition at line 12 of file tests/test01/test.py.

◆ c

test.c

Definition at line 13 of file tests/test01/test.py.

◆ cmdstr

test.cmdstr

Definition at line 123 of file tests/gtest06/python3/test.py.

◆ fname

test.fname = "%s.wrl" % (s)

Definition at line 308 of file tests/gtest05/python3/test.py.

◆ ival

test.ival

Definition at line 10 of file tests/test12/test.py.

◆ myx

test.myx

Definition at line 45 of file tests/test06/test.py.

◆ myz1

test.myz1

Definition at line 34 of file tests/test06/test.py.

◆ myz2

test.myz2

Definition at line 39 of file tests/test06/test.py.

◆ v

test.v

Definition at line 18 of file tests/test12/test.py.

◆ x

test.x

Definition at line 50 of file tests/test06/test.py.

◆ z

test.z

Definition at line 28 of file tests/test06/test.py.