1 | <!-- ******************************************************** --> |
---|
2 | <!-- --> |
---|
3 | <!-- [History] --> |
---|
4 | <!-- Created by: Makoto Asai, 25-Nov-2007 --> |
---|
5 | <!-- --> |
---|
6 | <!-- ******************************************************** --> |
---|
7 | |
---|
8 | |
---|
9 | <!-- ******************* Section (Level#1) ****************** --> |
---|
10 | <sect1 id="sect.CommandScore"> |
---|
11 | <title> |
---|
12 | Command-based scoring |
---|
13 | </title> |
---|
14 | |
---|
15 | <!-- ******************* Section (Level#2) ****************** --> |
---|
16 | <sect2 id="sect.CommandScore.Intro"> |
---|
17 | |
---|
18 | <para> |
---|
19 | Command-based scoring in Geant4 utilizes parallel navigation in a parallel |
---|
20 | world volume as descibed in the previous sections. Through interactive commands, |
---|
21 | the user can define : |
---|
22 | |
---|
23 | <itemizedlist spacing="compact"> |
---|
24 | <listitem><para> |
---|
25 | A parallel world for scoring and three-dimensional mesh in it |
---|
26 | </para></listitem> |
---|
27 | <listitem><para> |
---|
28 | Arbitrary number of physics quantities to be scored and filters |
---|
29 | </para></listitem> |
---|
30 | </itemizedlist> |
---|
31 | |
---|
32 | After scoring (i.e. a run), the user can visualize the score and dump |
---|
33 | scores into a file. All available UI commands are listed in |
---|
34 | <ulink url="./AllResources/Control/UIcommands/_score_.html"> |
---|
35 | List of built-in commands</ulink>. |
---|
36 | </para> |
---|
37 | |
---|
38 | <para> |
---|
39 | Command-based scoring is an optional functionality and the user has |
---|
40 | to explicity define its use in the <literal>main()</literal>. |
---|
41 | To do this, the method <literal>G4ScoringManager::GetScoringManager()</literal> |
---|
42 | must be invoked <emphasis role="color_red">right after</emphasis> |
---|
43 | the instantiation of <literal>G4RunManager</literal>. |
---|
44 | |
---|
45 | <example> |
---|
46 | <title> |
---|
47 | A user <literal>main()</literal> to use the command-based scoring |
---|
48 | </title> |
---|
49 | <programlisting> |
---|
50 | |
---|
51 | #include "G4RunManager.hh" |
---|
52 | <emphasis role="color_red">#include "G4ScoringManager.hh"</emphasis> |
---|
53 | |
---|
54 | int main(int argc,char** argv) |
---|
55 | { |
---|
56 | // Construct the run manager |
---|
57 | G4RunManager * runManager = new G4RunManager; |
---|
58 | |
---|
59 | // Activate command-based scorer |
---|
60 | <emphasis role="color_red">G4ScoringManager::GetScoringManager();</emphasis> |
---|
61 | |
---|
62 | ... |
---|
63 | |
---|
64 | } |
---|
65 | </programlisting> |
---|
66 | </example> |
---|
67 | </para> |
---|
68 | |
---|
69 | </sect2> |
---|
70 | |
---|
71 | <!-- ******************* Section (Level#2) ****************** --> |
---|
72 | <sect2 id="sect.CommandScore.Mesh"> |
---|
73 | <title> |
---|
74 | Defining a scoring mesh |
---|
75 | </title> |
---|
76 | |
---|
77 | <para> |
---|
78 | To define a scoring mesh, the user has to specify the followings. |
---|
79 | <itemizedlist spacing="compact"> |
---|
80 | <listitem><para> |
---|
81 | Shape and name of the 3D scoring mesh. Currently, box is the only available shape. |
---|
82 | </para></listitem> |
---|
83 | <listitem><para> |
---|
84 | Size of the scoring mesh. Mesh size must be specified as "half width" similar to the |
---|
85 | arguments of <literal>G4Box</literal>. |
---|
86 | </para></listitem> |
---|
87 | <listitem><para> |
---|
88 | Number of bins for each axes. Note that too hugh number causes immense memory consumption. |
---|
89 | </para></listitem> |
---|
90 | <listitem><para> |
---|
91 | Optionally, position and rotation of the mesh. If not specified, the mesh is positioned |
---|
92 | at the center of the world volume without rotation. |
---|
93 | </para></listitem> |
---|
94 | </itemizedlist> |
---|
95 | </para> |
---|
96 | |
---|
97 | <para> |
---|
98 | For a scoring mesh the user can have arbitrary number of quantities to be scored for |
---|
99 | each cell of the mesh. |
---|
100 | For each scoring quantity, the use can set one filter. |
---|
101 | Please note that <literal>/score/filter</literal> affects on the preceding scorer. |
---|
102 | Names of scorers and filters must be unique for the mesh. |
---|
103 | It is possible to define more than one scorer of same kind with different names |
---|
104 | and, likely, with different filters. |
---|
105 | </para> |
---|
106 | |
---|
107 | <para> |
---|
108 | Defining a scoring mesh and scores in the mesh should terminate with the |
---|
109 | <literal>/score/close</literal> command. The following sample UI commands |
---|
110 | define a scoring mesh named <literal>boxMesh_1</literal>, size of which is |
---|
111 | 2 m * 2 m * 2 m, and sliced into 30 cells along each axes. |
---|
112 | For each cell energy deposition, number of steps of gamma, number of steps |
---|
113 | of electron and number of steps of positron are scored. |
---|
114 | <example> |
---|
115 | <title> |
---|
116 | UI commands to define a scoring mesh and scorers |
---|
117 | </title> |
---|
118 | <programlisting> |
---|
119 | |
---|
120 | # |
---|
121 | # define scoring mesh |
---|
122 | # |
---|
123 | /score/create/boxMesh boxMesh_1 |
---|
124 | /score/mesh/boxSize 100. 100. 100. cm |
---|
125 | /score/mesh/nBin 30 30 30 |
---|
126 | # |
---|
127 | # define scorers and filters |
---|
128 | # |
---|
129 | /score/quantity/energyDeposit eDep |
---|
130 | /score/quantity/nOfStep nOfStepGamma |
---|
131 | /score/filter/particle gammaFilter gamma |
---|
132 | /score/quantity/nOfStep nOfStepEMinus |
---|
133 | /score/filter/particle eMinusFilter e- |
---|
134 | /score/quantity/nOfStep nOfStepEPlus |
---|
135 | /score/filter/particle ePlusFilter e+ |
---|
136 | # |
---|
137 | <emphasis role="color_red">/score/close</emphasis> |
---|
138 | # |
---|
139 | |
---|
140 | </programlisting> |
---|
141 | </example> |
---|
142 | </para> |
---|
143 | |
---|
144 | </sect2> |
---|
145 | |
---|
146 | <!-- ******************* Section (Level#2) ****************** --> |
---|
147 | <sect2 id="sect.CommandScore.Draw"> |
---|
148 | <title> |
---|
149 | Drawing scores |
---|
150 | </title> |
---|
151 | |
---|
152 | <para> |
---|
153 | Once scores are filled, it is possible to visualize the scores. The score is |
---|
154 | drawn on top of the mass geometry with the current visualization settings. |
---|
155 | |
---|
156 | <figure id="fig.CommandScore_1"> |
---|
157 | <title> |
---|
158 | Drawing scores in slices (left) and projection (right) |
---|
159 | </title> |
---|
160 | <mediaobject> |
---|
161 | <imageobject role="fo"> |
---|
162 | <imagedata fileref="./AllResources/Detector/hit.src/scoreCombinedPicture.jpg" |
---|
163 | format="JPG" contentwidth="12.0cm" align="center" /> |
---|
164 | </imageobject> |
---|
165 | <imageobject role="html"> |
---|
166 | <imagedata fileref="./AllResources/Detector/hit.src/scoreCombinedPicture.jpg" |
---|
167 | format="JPG" contentwidth="16.0cm" align="center" /> |
---|
168 | </imageobject> |
---|
169 | </mediaobject> |
---|
170 | </figure> |
---|
171 | </para> |
---|
172 | |
---|
173 | <para> |
---|
174 | By default, entries are linearly mapped to colors (gray - blue - green - red). |
---|
175 | This color mapping is implemented in <literal>G4DefaultLinearColorMap</literal> |
---|
176 | class, and registered to <literal>G4ScoringManager</literal> with the color map |
---|
177 | name <literal>"defaultLinearColorMap"</literal>. The user may alternate color map |
---|
178 | by implementing a customised color map class derived from |
---|
179 | <literal>G4VScoreColorMap</literal> and register it to |
---|
180 | <literal>G4ScoringManager</literal>. Then, for each <literal>draw</literal> |
---|
181 | command, one can specify the preferred color map. |
---|
182 | </para> |
---|
183 | |
---|
184 | </sect2> |
---|
185 | |
---|
186 | <!-- ******************* Section (Level#2) ****************** --> |
---|
187 | <sect2 id="sect.CommandScore.Dump"> |
---|
188 | <title> |
---|
189 | Writing scores to a file |
---|
190 | </title> |
---|
191 | |
---|
192 | <para> |
---|
193 | It is possible to dump a score in a mesh (<literal>/score/dumpQuantityToFile</literal> |
---|
194 | command) or all scores in a mesh (<literal>/score/dumpAllQuantitiesToFile</literal> |
---|
195 | command) to a file. |
---|
196 | The default file format is the simple CSV. To alternate the file format, one should |
---|
197 | overwrite <literal>G4VScoreWriter</literal> class and register it to |
---|
198 | <literal>G4ScoringManager</literal>. |
---|
199 | Please refer to <literal>/examples/extended/runAndEvent/RE03</literal> for details. |
---|
200 | </para> |
---|
201 | |
---|
202 | </sect2> |
---|
203 | </sect1> |
---|
204 | |
---|