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 | |
---|
9 | import CLHEP |
---|
10 | import G4Kernel |
---|
11 | import Tiara |
---|
12 | import tiaraApplication |
---|
13 | import tiaraGenerators |
---|
14 | import tiaraDetectors |
---|
15 | import tiaraSpecifications |
---|
16 | import myUtils |
---|
17 | import variableGeometry |
---|
18 | import slabGeometry |
---|
19 | import runSequence |
---|
20 | import os |
---|
21 | |
---|
22 | ########################################################################## |
---|
23 | # random number initialization |
---|
24 | ########################################################################## |
---|
25 | Tiara.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 | ########################################################################## |
---|
40 | particleCut = {"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 | |
---|
47 | beamEnergy = 43 |
---|
48 | shieldWidth = 150 * CLHEP.cm |
---|
49 | |
---|
50 | totalTime = 3 * myUtils.min |
---|
51 | timeForOneRun = 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() |
---|
57 | physList = Tiara.LHEP_LEAD() |
---|
58 | ##physList = Tiara.LHEP_PRECO_HP() |
---|
59 | |
---|
60 | # specify the detectors |
---|
61 | scoreDetectorCreator = tiaraDetectors.ThreeZylindricDetectors() |
---|
62 | #scoreDetectorCreator = tiaraDetectors.DetectorSlab() |
---|
63 | |
---|
64 | |
---|
65 | comment = "" |
---|
66 | |
---|
67 | |
---|
68 | |
---|
69 | ########################################################################## |
---|
70 | # Create a Specification object of the configuaration data |
---|
71 | ########################################################################## |
---|
72 | experiment = tiaraSpecifications.Experiment(beamEnergy, |
---|
73 | particleCut["neutron"], |
---|
74 | particleCut, |
---|
75 | shieldWidth, |
---|
76 | "concrete") |
---|
77 | |
---|
78 | tiaraSpecs = tiaraSpecifications.Specifications(Tiara.TiaraDimensions(), |
---|
79 | experiment, |
---|
80 | Tiara.TiaraMaterials()) |
---|
81 | |
---|
82 | |
---|
83 | |
---|
84 | ########################################################################## |
---|
85 | # definition of the importance geometry and a scorer |
---|
86 | ########################################################################## |
---|
87 | impGeo = variableGeometry.VariableImpSlabGeometry(tiaraSpecs) |
---|
88 | |
---|
89 | impGeo.addCellImportance(width=15.0 * CLHEP.cm, faktor=1) |
---|
90 | for i in range(9): |
---|
91 | impGeo.addCellImportance(width=15.0 * CLHEP.cm, faktor=2) |
---|
92 | |
---|
93 | impGeo.construct() |
---|
94 | |
---|
95 | # an alternative |
---|
96 | #impGeo = slabGeometry.SlabedImportanceGeometry(tiaraSpecs, |
---|
97 | # 10.0 * CLHEP.cm, |
---|
98 | # 1.5) |
---|
99 | |
---|
100 | |
---|
101 | impScorer = 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 | ########################################################################## |
---|
109 | tApp = tiaraApplication.TiaraApplet(tiaraSpecs = tiaraSpecs, |
---|
110 | tSim = Tiara.TiaraSim_GetTiaraSim(), |
---|
111 | usePI = False) |
---|
112 | |
---|
113 | |
---|
114 | #tApp.visMode() |
---|
115 | tApp.timedMode(timeForOneRun) |
---|
116 | |
---|
117 | |
---|
118 | tApp.specifyPhysicsList(physList, particleCut) |
---|
119 | |
---|
120 | # detectors |
---|
121 | tApp.setScoreDetectorCreator(scoreDetectorCreator) |
---|
122 | |
---|
123 | tApp.buildGeometry() |
---|
124 | |
---|
125 | tiara_dir = os.environ["TIARA_BASE"] |
---|
126 | |
---|
127 | tApp.setPhysics() |
---|
128 | |
---|
129 | #primGenBuilder = tiaraGenerators.\ |
---|
130 | # TiaraDPSEnergyGenerator(tiaraSpecs, |
---|
131 | # tiara_dir + |
---|
132 | # "/data/expDataConverted/dpsSource.xml") |
---|
133 | #primGenBuilder = tiaraGenerators.TiaraPrimaryGenerator(tiaraSpecs) |
---|
134 | |
---|
135 | primGenBuilder = tiaraGenerators.FixedEnergyPrimaryGenerator(tiaraSpecs) |
---|
136 | |
---|
137 | tApp.setPrimaryGenerator(primGenBuilder.primGen) |
---|
138 | |
---|
139 | |
---|
140 | tApp.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 | |
---|
150 | tApp.config() |
---|
151 | |
---|
152 | |
---|
153 | |
---|
154 | |
---|
155 | ########################################################################## |
---|
156 | # creating of the sampler |
---|
157 | ########################################################################## |
---|
158 | parallelSampler = myUtils.createParallelSampler(impGeo, |
---|
159 | impScorer) |
---|
160 | |
---|
161 | |
---|
162 | |
---|
163 | |
---|
164 | ########################################################################## |
---|
165 | # create a run config object, a run sequence and run the simulation |
---|
166 | ########################################################################## |
---|
167 | rc = runSequence.RunConfig() |
---|
168 | |
---|
169 | rc.basePath = "simData" |
---|
170 | rc.tApp = tApp |
---|
171 | rc.tiaraSpecs = tiaraSpecs |
---|
172 | rc.impGeo = impGeo |
---|
173 | rc.impScorer = impScorer |
---|
174 | rc.totalTime = totalTime |
---|
175 | rc.comment = comment |
---|
176 | |
---|
177 | rs = runSequence.RunSequence(runConfig=rc, usePI = False) |
---|
178 | rs.runNevents(100) |
---|
179 | rs.runLoop() |
---|
180 | |
---|
181 | |
---|
182 | ########################################################################## |
---|
183 | ########################################################################## |
---|