source: trunk/documents/UserDoc/DocBookUsersGuides/ForApplicationDeveloper/xml/Detector/commandScore.xml @ 905

Last change on this file since 905 was 904, checked in by garnier, 16 years ago

ajout de la doc

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