source: trunk/examples/advanced/Tiara/run/runSimNoAnalysis.py @ 1313

Last change on this file since 1313 was 807, checked in by garnier, 16 years ago

update

  • Property svn:executable set to *
File size: 5.3 KB
Line 
1#!/usr/bin/env python
2#
3# $Id: runSimNoAnalysis.py,v 1.7 2005/12/15 16:23:06 ahoward Exp $
4# -------------------------------------------------------------------
5# GEANT4 tag $Name:  $
6# -------------------------------------------------------------------
7
8
9import CLHEP
10import G4Kernel
11import Tiara
12import tiaraApplication
13import tiaraGenerators
14import tiaraDetectors
15import tiaraSpecifications
16import myUtils
17import variableGeometry
18import slabGeometry
19import runSequence
20import os
21
22##########################################################################
23# random number initialization
24##########################################################################
25Tiara.setRandomSeed(891011);
26#Tiara.setRandomStatus("dTest/tiara-2003_5_27_20_5_39_pcgeant2/randomNumberFile_run00003");   
27
28
29
30
31
32
33
34
35
36
37##########################################################################
38# experiment and simulation specific data
39##########################################################################
40particleCut = {"neutron" : 3 * CLHEP.MeV,
41               "gamma"   : 1 * CLHEP.MeV,
42               "proton"  : 1 * CLHEP.MeV,
43               "deuteron": 1 * CLHEP.MeV,
44               "triton"  : 1 * CLHEP.MeV,
45               "alpha"   : 1 * CLHEP.MeV}
46
47beamEnergy = 43
48shieldWidth = 150 * CLHEP.cm
49
50totalTime = 3 * myUtils.min
51timeForOneRun = 1 * myUtils.min
52
53# available physics lists: LHEP_LEAD, LHEP_PRECO_HP
54# LHEP_PRECO, LHEP
55##physList = Tiara.LHEP()
56##physList = Tiara.LHEP_PRECO()
57physList = Tiara.LHEP_LEAD()
58##physList = Tiara.LHEP_PRECO_HP()
59
60# specify the detectors
61scoreDetectorCreator = tiaraDetectors.ThreeZylindricDetectors()
62#scoreDetectorCreator = tiaraDetectors.DetectorSlab()
63
64
65comment = ""
66
67
68
69##########################################################################
70# Create a Specification object of the configuaration data
71##########################################################################
72experiment = tiaraSpecifications.Experiment(beamEnergy,     
73                                           particleCut["neutron"],
74                                           particleCut,
75                                           shieldWidth,
76                                           "concrete")
77
78tiaraSpecs = tiaraSpecifications.Specifications(Tiara.TiaraDimensions(),
79                                                experiment,
80                                                Tiara.TiaraMaterials())
81
82
83
84##########################################################################
85# definition of the importance geometry and a scorer
86##########################################################################
87impGeo = variableGeometry.VariableImpSlabGeometry(tiaraSpecs)
88
89impGeo.addCellImportance(width=15.0 * CLHEP.cm, faktor=1)
90for i in range(9):
91    impGeo.addCellImportance(width=15.0 * CLHEP.cm, faktor=2)
92
93impGeo.construct()
94
95# an alternative
96#impGeo = slabGeometry.SlabedImportanceGeometry(tiaraSpecs,
97#                                               10.0 * CLHEP.cm,
98#                                               1.5)
99
100
101impScorer = G4Kernel.G4Scorer()
102
103
104
105##########################################################################
106# Creation of a TiaraApplet to define the run mode, physics list,
107# detector type and the primary generator
108##########################################################################
109tApp = tiaraApplication.TiaraApplet(tiaraSpecs = tiaraSpecs,
110                                    tSim = Tiara.TiaraSim_GetTiaraSim(),
111                                    usePI = False)
112
113
114#tApp.visMode()
115tApp.timedMode(timeForOneRun)
116
117
118tApp.specifyPhysicsList(physList, particleCut)
119
120# detectors
121tApp.setScoreDetectorCreator(scoreDetectorCreator)
122
123tApp.buildGeometry()
124
125tiara_dir = os.environ["TIARA_BASE"]
126
127tApp.setPhysics()
128
129#primGenBuilder = tiaraGenerators.\
130#                 TiaraDPSEnergyGenerator(tiaraSpecs,
131#                                         tiara_dir +
132#                                         "/data/expDataConverted/dpsSource.xml")
133#primGenBuilder = tiaraGenerators.TiaraPrimaryGenerator(tiaraSpecs)
134
135primGenBuilder = tiaraGenerators.FixedEnergyPrimaryGenerator(tiaraSpecs)
136
137tApp.setPrimaryGenerator(primGenBuilder.primGen)
138
139
140tApp.noComponents = 0
141
142## The following lines should be probably moved here after release Geant4-7.0
143##physList = Tiara.LHEP()
144##physList = Tiara.LHEP_PRECO()
145##physList = Tiara.LHEP_PRECO_HP()
146##physList = Tiara.LHEP_LEAD()
147##tApp.specifyPhysicsList(physList, particleCut)
148##tApp.setPrimaryGenerator(primGenBuilder.primGen)
149
150tApp.config()
151
152
153
154
155##########################################################################
156# creating of the sampler
157##########################################################################
158parallelSampler = myUtils.createParallelSampler(impGeo,
159                                                impScorer)
160
161
162
163
164##########################################################################
165# create a run config object, a run sequence and run the simulation
166##########################################################################
167rc = runSequence.RunConfig()
168
169rc.basePath = "simData"
170rc.tApp = tApp
171rc.tiaraSpecs = tiaraSpecs
172rc.impGeo = impGeo
173rc.impScorer = impScorer
174rc.totalTime = totalTime
175rc.comment = comment
176
177rs = runSequence.RunSequence(runConfig=rc, usePI = False)
178rs.runNevents(100)
179rs.runLoop()
180
181
182##########################################################################
183##########################################################################
Note: See TracBrowser for help on using the repository browser.