source: trunk/examples/advanced/Tiara/run/runVisNoAnalysis.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: 6.1 KB
Line 
1#!/usr/bin/env python
2#
3# $Id: runVisNoAnalysis.py,v 1.5 2006/06/26 10:12:05 ahoward Exp $
4# -------------------------------------------------------------------
5# GEANT4 tag $Name:  $
6# -------------------------------------------------------------------
7
8
9# importing python libraries
10import os
11
12# importing wrapper modules (see the source/*Wrapper directories)
13# created by swig (from the source/*Wrapper/*.i files).
14import CLHEP
15import Tiara
16import G4Kernel
17
18# importing python modules specific to this example
19# (see source/py_modules)
20import tiaraApplication
21import tiaraGenerators
22import tiaraDetectors
23import tiaraSpecifications
24import myUtils
25import variableGeometry
26import slabGeometry
27import runSequence
28
29##########################################################################
30# random number initialization
31##########################################################################
32Tiara.setRandomSeed(891011);
33#Tiara.setRandomStatus("dTest/tiara-2003_5_27_20_5_39_pcgeant2/randomNumberFile_run00003");   
34
35
36
37
38
39
40
41
42
43
44##########################################################################
45# experiment and simulation specific data
46##########################################################################
47# create a list of particles and give a lower energy cut
48particleCut = {"neutron" : 3 * CLHEP.MeV,
49               "gamma"   : 1 * CLHEP.MeV,
50               "proton"  : 1 * CLHEP.MeV,
51               "deuteron": 1 * CLHEP.MeV,
52               "triton"  : 1 * CLHEP.MeV,
53               "alpha"   : 1 * CLHEP.MeV}
54
55# specify if the source neutrons shoul be form the 43 or 68 MeV protons
56beamEnergy = 68 * CLHEP.MeV
57# specify the shieldwidth [25, 50, 100, 150, (200 for 68 MeV case only)]
58shieldWidth = 100 * CLHEP.cm
59
60# available physics lists: TiaraPhysicsList, LHEP_LEAD_HP, LHEP_PRECO_HP
61# CASCADE_HP LHEP_BIC  LHEP_BIC_BIC
62physList = Tiara.LHEP_BIC_HP()
63
64# specify the detectors
65scoreDetectorCreator = tiaraDetectors.ThreeZylindricDetectors()
66#scoreDetectorCreator = tiaraDetectors.DetectorSlab()
67
68
69comment = ""
70
71
72
73
74
75
76
77
78
79
80
81
82##########################################################################
83# Create a Specification object of the configuaration data
84##########################################################################
85
86experiment = tiaraSpecifications.Experiment(beamEnergy,     
87                                           particleCut["neutron"],
88                                           particleCut,
89                                           shieldWidth,
90                                           "concrete")
91
92tiaraSpecs = tiaraSpecifications.Specifications(Tiara.TiaraDimensions(),
93                                                experiment,
94                                                Tiara.TiaraMaterials())
95
96
97
98
99
100
101
102
103
104##########################################################################
105# definition of the importance geometry importance values and a scorer
106##########################################################################
107# create a parallel geometry.
108impGeo = variableGeometry.VariableImpSlabGeometry(tiaraSpecs)
109
110
111# introduce "importance cells" into the shielding region
112# In this case the width of all the shields in the shielding region
113# are equal and the importance staring from one doubles
114# from cell to cell in the beam direction.
115impGeo.addCellImportance(width=15.0 * CLHEP.cm, faktor=1)
116for i in range(9):
117    # to run unbiased set: faktor=1     in the next line
118    impGeo.addCellImportance(width=15.0 * CLHEP.cm, faktor=2)
119
120impGeo.construct()
121
122# Make sure the widths given in the above way add up to the
123# shield widths e.g. 25, 50, ... cm.
124# The importance geometries take care to give the importance value 1
125# to the volume before the shield and to assign the same importance
126# as the last cell in the shield region to the volume behind the shield.
127
128# an alternative
129#impGeo = slabGeometry.SlabedImportanceGeometry(tiaraSpecs,
130#                                               10.0 * CLHEP.cm,
131#                                               1.5)
132
133
134impScorer = G4Kernel.G4Scorer()
135
136
137
138
139
140
141
142##########################################################################
143# Creation of a TiaraApplet to define the run mode, physics list,
144# detector type and the primary generator
145##########################################################################
146tApp = tiaraApplication.TiaraApplet(tiaraSpecs,
147                                    Tiara.TiaraSim_GetTiaraSim(), False)
148
149
150# chise if you want to run in a timed mode (for a given time) or in
151# the visualization mode to see the detector.
152tApp.visMode()
153##timeForOneRun = 1 * myUtils.min
154##tApp.timedMode(timeForOneRun)
155
156tApp.specifyPhysicsList(physList, particleCut)
157
158# detectors
159tApp.setScoreDetectorCreator(scoreDetectorCreator)
160
161tApp.buildGeometry()
162
163tiara_dir = os.environ["TIARA_BASE"]
164
165tApp.setPhysics()
166
167tApp.visAdd()
168
169##primGenBuilder = tiaraGenerators.\
170##                 TiaraDPSEnergyGenerator(tiaraSpecs,
171##                                         tiara_dir +
172##                                         "/data/expDataConverted/dpsSource.xml")
173#primGenBuilder = tiaraGenerators.TiaraPrimaryGenerator(tiaraSpecs)
174primGenBuilder = tiaraGenerators.FixedEnergyPrimaryGenerator(tiaraSpecs)
175
176tApp.setPrimaryGenerator(primGenBuilder.primGen)
177
178
179tApp.noComponents = 0
180tApp.config()
181
182
183
184
185
186
187
188
189
190##########################################################################
191# creating of the sampler
192##########################################################################
193parallelSampler = myUtils.createParallelSampler(impGeo,
194                                                impScorer)
195
196
197
198
199
200
201
202
203
204
205
206##########################################################################
207# create a run config object, a run sequence and run the simulation
208##########################################################################
209rc = runSequence.RunConfig()
210
211rc.basePath = "simData"
212rc.tApp = tApp
213rc.tiaraSpecs = tiaraSpecs
214rc.impGeo = impGeo
215rc.impScorer = impScorer
216rc.totalTime = totalTime
217rc.comment = comment
218
219rs = runSequence.RunSequence(rc)
220rs.runNevents(100)
221rs.runLoop()
222
223
224##########################################################################
225##########################################################################
Note: See TracBrowser for help on using the repository browser.