source: trunk/Documentation/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch04s08.html @ 902

Last change on this file since 902 was 901, checked in by garnier, 16 years ago

Add Geant4 Documentation at 8.12.2008

File size: 9.1 KB
Line 
1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>4.8.  Command-based scoring</title><link rel="stylesheet" href="../xml/XSLCustomizationLayer/G4HTMLStylesheet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.71.1"><link rel="start" href="index.html" title="Geant4 User's Guide for Application Developers"><link rel="up" href="ch04.html" title="Chapter 4.  Detector Definition and Response"><link rel="prev" href="ch04s07.html" title="4.7.  Parallel Geometries"><link rel="next" href="ch05.html" title="Chapter 5.  Tracking and Physics"><script language="JavaScript">
2function remote_win(fName)
3{
4   var url = "AllResources/Detector/geometry.src/" + fName;
5   RemoteWin=window.open(url,"","resizable=no,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,copyhistory=0,width=520,height=520")
6   RemoteWin.creator=self
7}
8</script></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">4.8. 
9Command-based scoring
10</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s07.html"><img src="AllResources/IconsGIF/prev.gif" alt="Prev"></a> </td><th width="60%" align="center">Chapter 4. 
11Detector Definition and Response
12</th><td width="20%" align="right"> <a accesskey="n" href="ch05.html"><img src="AllResources/IconsGIF/next.gif" alt="Next"></a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sect.CommandScore"></a>4.8. 
13Command-based scoring
14</h2></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">
15  Notice
16</h3><p>
17As of Geant4 release 9.1, this functionality of command-based scoring
18is still in <span class="emphasis"><em>alpha</em></span> release and functionality offered
19is preliminary. We do not guarantee the correctness of the code. Also,
20we may change any of the commands / methods in the near future release.
21We appreciate your feedback.
22</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.CommandScore.Intro"></a>4.8.1. 
23Command-based scoring
24</h3></div></div></div><p>
25This new command-based scoring utilizes the parallel world described
26in the previous section. With UI interactive commands, the user can define :
27
28</p><div class="itemizedlist"><ul type="disc" compact><li><p>
29 A parallel world for scoring and three-dimensional mesh in it
30  </p></li><li><p>
31 Arbitrary number of physics quantities to be scored and filters
32  </p></li></ul></div><p>
33
34After scoring (i.e. a run), the user can visualize the score and dump
35scores into a file. All available UI commands are listed in
36<a href="./AllResources/Control/UIcommands/_score_.html" target="_top">
37List of built-in commands</a>.
38</p><p>
39For the time being of the alpha release, this command-based scoring
40is an optional functionality and the user has to explicity define
41its use in his/her <code class="literal">main()</code>. To do this, the
42method <code class="literal">G4ScoringManager::GetScoringManager()</code>
43must be invoked <span class="color_red">right after</span>
44the instantiation of <code class="literal">G4RunManager</code>.
45
46</p><div class="example"><a name="id434047"></a><p class="title"><b>Example 4.21. 
47A user <code class="literal">main()</code> to use the command-based scoring
48</b></p><div class="example-contents"><pre class="programlisting">
49
50#include "G4RunManager.hh"
51<span class="color_red">#include "G4ScoringManager.hh"</span>
52
53int main(int argc,char** argv)
54{
55 // Construct the run manager
56 G4RunManager * runManager = new G4RunManager;
57
58 // Activate command-based scorer
59 <span class="color_red">G4ScoringManager::GetScoringManager();</span>
60
61 ...
62
63}
64</pre></div></div><p><br class="example-break">
65</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.CommandScore.Mesh"></a>4.8.2. 
66Defining a scoring mesh
67</h3></div></div></div><p>
68To define a scoring mesh, the user has to specify the followings.
69</p><div class="itemizedlist"><ul type="disc" compact><li><p>
70 Shape and name of the 3D scoring mesh. Currently, box is the only available shape.
71  </p></li><li><p>
72 Size of the scoring mesh. Mesh size must be specified as "half width" similar to the
73 arguments of <code class="literal">G4Box</code>.
74  </p></li><li><p>
75 Number of bins for each axes. Note that too hugh number causes immense memory consumption.
76  </p></li><li><p>
77 Optionally, position and rotation of the mesh. If not specified, the mesh is positioned
78 at the center of the world volume without rotation.
79  </p></li></ul></div><p>
80</p><p>
81For a scoring mesh the user can have arbitrary number of quantities to be scored for each cell of the mesh.
82For each scoring quantity, the use can set one filter. Please note that <code class="literal">/score/filter</code>
83affects on the preceding scorer. Names of scorers and filters must be unique for the mesh.
84The user can define more than one scorers of same kind with different names (and most likely with different
85filters).
86</p><p>
87Defining a scoring mesh and scores in thiat mesh should terminate with <code class="literal">/score/close</code>
88command. The following sample UI commands define a scoring mesh named <code class="literal">boxMesh_1</code>,
89size of which is 2 m * 2 m * 2 m, and sliced into 30 cells along each axes. For each cell energy deposition,
90number of steps of gamma, number of steps of electron and number of steps of positron are scored.
91</p><div class="example"><a name="id434160"></a><p class="title"><b>Example 4.22. 
92UI commands to define a scoring mesh and scorers
93</b></p><div class="example-contents"><pre class="programlisting">
94
95#
96# define scoring mesh
97#
98/score/create/boxMesh boxMesh_1
99/score/mesh/boxSize 100. 100. 100. cm
100/score/mesh/nBin 30 30 30
101#
102# define scorers and filters
103#
104/score/quantity/energyDeposit eDep
105/score/quantity/nOfStep nOfStepGamma
106/score/filter/particle gammaFilter gamma
107/score/quantity/nOfStep nOfStepEMinus
108/score/filter/particle eMinusFilter e-
109/score/quantity/nOfStep nOfStepEPlus
110/score/filter/particle ePlusFilter e+
111#
112<span class="color_red">/score/close</span>
113#
114
115</pre></div></div><p><br class="example-break">
116</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.CommandScore.Draw"></a>4.8.3. 
117Drawing scores
118</h3></div></div></div><p>
119Once scores are filled, the user can visualize the scores. The score is
120drawn on top of the mass geometry with the current visualization settings.
121
122</p><div class="figure"><a name="fig.CommandScore_1"></a><div class="figure-contents"><div class="mediaobject" align="center"><img src="./AllResources/Detector/hit.src/scoreCombinedPicture.jpg" align="middle" width="566.929133858268" alt="Drawing scores in slices (left) and projection (right)"></div></div><p class="title"><b>Figure 4.10. 
123Drawing scores in slices (left) and projection (right)
124</b></p></div><p><br class="figure-break">
125</p><p>
126By default, entries are linearly mapped to colors (gray - blue - green - red).
127This color mapping is implemented in <code class="literal">G4DefaultLinearColorMap</code>
128class, and registered to <code class="literal">G4ScoringManager</code> with the color map
129name <code class="literal">"defaultLinearColorMap"</code>. The user may alternate color map
130by implementing his/her own color map class derived from <code class="literal">G4VScoreColorMap</code>
131and register it to <code class="literal">G4ScoringManager</code>. Then, for each <code class="literal">draw</code>
132command, the user can specify the color map of his/her own.
133</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.CommandScore.Dump"></a>4.8.4. 
134Writing scores to a file
135</h3></div></div></div><p>
136The user may dump a score in a mesh (<code class="literal">/score/dumpQuantityToFile</code> command)
137or all scores in a mesh (<code class="literal">/score/dumpAllQuantitiesToFile</code> command) to a file.
138The default file format is the simple CSV. To alternate the file format, the user should
139overwrite <code class="literal">G4VScoreWriter</code> class and register it to <code class="literal">G4ScoringManager</code>.
140Please refer to <code class="literal">/examples/extended/runAndEvent/RE03</code> for the detail.
141</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04s07.html"><img src="AllResources/IconsGIF/prev.gif" alt="Prev"></a> </td><td width="20%" align="center"><a accesskey="u" href="ch04.html"><img src="AllResources/IconsGIF/up.gif" alt="Up"></a></td><td width="40%" align="right"> <a accesskey="n" href="ch05.html"><img src="AllResources/IconsGIF/next.gif" alt="Next"></a></td></tr><tr><td width="40%" align="left" valign="top">4.7. 
142Parallel Geometries
143 </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="AllResources/IconsGIF/home.gif" alt="Home"></a></td><td width="40%" align="right" valign="top"> Chapter 5. 
144Tracking and Physics
145</td></tr></table></div></body></html>
Note: See TracBrowser for help on using the repository browser.