| 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">
|
|---|
| 2 | function 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.
|
|---|
| 9 | Command-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.
|
|---|
| 11 | Detector 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.
|
|---|
| 13 | Command-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>
|
|---|
| 17 | As of Geant4 release 9.1, this functionality of command-based scoring
|
|---|
| 18 | is still in <span class="emphasis"><em>alpha</em></span> release and functionality offered
|
|---|
| 19 | is preliminary. We do not guarantee the correctness of the code. Also,
|
|---|
| 20 | we may change any of the commands / methods in the near future release.
|
|---|
| 21 | We 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.
|
|---|
| 23 | Command-based scoring
|
|---|
| 24 | </h3></div></div></div><p>
|
|---|
| 25 | This new command-based scoring utilizes the parallel world described
|
|---|
| 26 | in 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 |
|
|---|
| 34 | After scoring (i.e. a run), the user can visualize the score and dump
|
|---|
| 35 | scores into a file. All available UI commands are listed in
|
|---|
| 36 | <a href="./AllResources/Control/UIcommands/_score_.html" target="_top">
|
|---|
| 37 | List of built-in commands</a>.
|
|---|
| 38 | </p><p>
|
|---|
| 39 | For the time being of the alpha release, this command-based scoring
|
|---|
| 40 | is an optional functionality and the user has to explicity define
|
|---|
| 41 | its use in his/her <code class="literal">main()</code>. To do this, the
|
|---|
| 42 | method <code class="literal">G4ScoringManager::GetScoringManager()</code>
|
|---|
| 43 | must be invoked <span class="color_red">right after</span>
|
|---|
| 44 | the instantiation of <code class="literal">G4RunManager</code>.
|
|---|
| 45 |
|
|---|
| 46 | </p><div class="example"><a name="id434047"></a><p class="title"><b>Example 4.21.
|
|---|
| 47 | A 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 |
|
|---|
| 53 | int 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.
|
|---|
| 66 | Defining a scoring mesh
|
|---|
| 67 | </h3></div></div></div><p>
|
|---|
| 68 | To 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>
|
|---|
| 81 | For a scoring mesh the user can have arbitrary number of quantities to be scored for each cell of the mesh.
|
|---|
| 82 | For each scoring quantity, the use can set one filter. Please note that <code class="literal">/score/filter</code>
|
|---|
| 83 | affects on the preceding scorer. Names of scorers and filters must be unique for the mesh.
|
|---|
| 84 | The user can define more than one scorers of same kind with different names (and most likely with different
|
|---|
| 85 | filters).
|
|---|
| 86 | </p><p>
|
|---|
| 87 | Defining a scoring mesh and scores in thiat mesh should terminate with <code class="literal">/score/close</code>
|
|---|
| 88 | command. The following sample UI commands define a scoring mesh named <code class="literal">boxMesh_1</code>,
|
|---|
| 89 | size of which is 2 m * 2 m * 2 m, and sliced into 30 cells along each axes. For each cell energy deposition,
|
|---|
| 90 | number 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.
|
|---|
| 92 | UI 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.
|
|---|
| 117 | Drawing scores
|
|---|
| 118 | </h3></div></div></div><p>
|
|---|
| 119 | Once scores are filled, the user can visualize the scores. The score is
|
|---|
| 120 | drawn 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.
|
|---|
| 123 | Drawing scores in slices (left) and projection (right)
|
|---|
| 124 | </b></p></div><p><br class="figure-break">
|
|---|
| 125 | </p><p>
|
|---|
| 126 | By default, entries are linearly mapped to colors (gray - blue - green - red).
|
|---|
| 127 | This color mapping is implemented in <code class="literal">G4DefaultLinearColorMap</code>
|
|---|
| 128 | class, and registered to <code class="literal">G4ScoringManager</code> with the color map
|
|---|
| 129 | name <code class="literal">"defaultLinearColorMap"</code>. The user may alternate color map
|
|---|
| 130 | by implementing his/her own color map class derived from <code class="literal">G4VScoreColorMap</code>
|
|---|
| 131 | and register it to <code class="literal">G4ScoringManager</code>. Then, for each <code class="literal">draw</code>
|
|---|
| 132 | command, 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.
|
|---|
| 134 | Writing scores to a file
|
|---|
| 135 | </h3></div></div></div><p>
|
|---|
| 136 | The user may dump a score in a mesh (<code class="literal">/score/dumpQuantityToFile</code> command)
|
|---|
| 137 | or all scores in a mesh (<code class="literal">/score/dumpAllQuantitiesToFile</code> command) to a file.
|
|---|
| 138 | The default file format is the simple CSV. To alternate the file format, the user should
|
|---|
| 139 | overwrite <code class="literal">G4VScoreWriter</code> class and register it to <code class="literal">G4ScoringManager</code>.
|
|---|
| 140 | Please 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.
|
|---|
| 142 | Parallel 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.
|
|---|
| 144 | Tracking and Physics
|
|---|
| 145 | </td></tr></table></div></body></html>
|
|---|