| [901] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|---|
| 2 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|---|
| 3 | <html>
|
|---|
| 4 |
|
|---|
| 5 | <head>
|
|---|
| 6 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|---|
| 7 | <title>FAQ</title>
|
|---|
| 8 | <link rel="stylesheet" type="text/css" href="../includes/geantstyle.css" />
|
|---|
| 9 | </head>
|
|---|
| 10 |
|
|---|
| 11 | <body>
|
|---|
| 12 |
|
|---|
| 13 | <!-- stop index -->
|
|---|
| 14 | <table id="top" cellpadding="0" cellspacing="0" width="100%">
|
|---|
| 15 | <tr>
|
|---|
| 16 | <td><a href="index.shtml">
|
|---|
| 17 | <img alt="Geant4 Home" src="http://cern.ch/geant4/images/geanttiny.gif" width="164" height="40" /></a></td>
|
|---|
| 18 | <td align="right" class="doNotPrint">
|
|---|
| 19 | <a href="http://cern.ch/geant4/support/download.shtml">Download</a>
|
|---|
| 20 | | <a href="http://hypernews.slac.stanford.edu/HyperNews/geant4/cindex">User
|
|---|
| 21 | Forum</a> | <a href="http://cern.ch/geant4/gallery/index.html">
|
|---|
| 22 | Gallery</a><br />
|
|---|
| 23 | <a href="http://cern.ch/geant4/collaboration/contacts.shtml">
|
|---|
| 24 | Contact Us</a><br />
|
|---|
| 25 | <form method="get" action="http://www.cern.ch/cgi-bin/directory-search.pl">
|
|---|
| 26 | <input type="hidden" value="No" name="SubSearch" />
|
|---|
| 27 | <input type="hidden" value="url:wwwinfo.cern.ch/asd/geant4/G4UsersDocuments/
|
|---|
| 28 | url:geant4.web.cern.ch/geant4/G4UsersDocuments/" name="AdditionalQuery" />
|
|---|
| 29 | <input type="hidden" value="searchbrowse.html" name="TemplateFile" />
|
|---|
| 30 | <input type="hidden" value="http://wwwinfo.cern.ch/asd/" name="Referer" />
|
|---|
| 31 | <input type="hidden" value="cern" name="qc" />
|
|---|
| 32 | <input type="hidden" value="cern" name="col" />
|
|---|
| 33 | <input size="35" name="qt" />
|
|---|
| 34 | <input type="submit" value="Search Geant4" />
|
|---|
| 35 | </form>
|
|---|
| 36 | </td>
|
|---|
| 37 | </tr>
|
|---|
| 38 | </table>
|
|---|
| 39 |
|
|---|
| 40 | <!-- start index -->
|
|---|
| 41 |
|
|---|
| 42 | <table border="0" cellpadding="4" cellspacing="0" width="100%">
|
|---|
| 43 | <tr>
|
|---|
| 44 | <td id="breadcrumb">
|
|---|
| 45 | <!-- start bread crumb --><a href="../index.shtml">Home</a> >
|
|---|
| 46 | <a href="index.shtml">User Support</a> >
|
|---|
| 47 | <a href="gettingstarted.shtml">Getting Started</a> >
|
|---|
| 48 | FAQ<!-- end bread crumb --></td>
|
|---|
| 49 | </tr>
|
|---|
| 50 | <tr>
|
|---|
| 51 | <td id="main">
|
|---|
| 52 | <h1>Frequently Asked Questions</h1>
|
|---|
| 53 | <H2>(See also
|
|---|
| 54 | <A TARGET="_top" HREF="http://geant4.slac.stanford.edu/Tips">Useful Tips</A> page
|
|---|
| 55 | at SLAC)</H2></DIV>
|
|---|
| 56 | <P></P>
|
|---|
| 57 |
|
|---|
| 58 | <UL>
|
|---|
| 59 | <LI> <B><A NAME="q-general"></A><A HREF="#a-general">General</A></B>
|
|---|
| 60 | <OL>
|
|---|
| 61 | <LI><A HREF="#gen-1">How do I add a FAQ to this page?</A></LI>
|
|---|
| 62 | </OL>
|
|---|
| 63 | </LI>
|
|---|
| 64 | <BLOCKQUOTE>
|
|---|
| 65 | <P> </P>
|
|---|
| 66 | </BLOCKQUOTE>
|
|---|
| 67 | <LI><B><A NAME="q-install"></A><A HREF="#a-install">Installation</A></B>
|
|---|
| 68 | <OL>
|
|---|
| 69 | <LI><A HREF="#install-1">When I download the source from the web, and unpack
|
|---|
| 70 | the tar file, some files unpack into the top level directory.</A> </LI>
|
|---|
| 71 | <LI><A HREF="#install-2">I cannot find CLHEP files or library and I have it
|
|---|
| 72 | installed in my system</A>. </LI>
|
|---|
| 73 | <LI><a href="#install-3">While installing the Geant4 libraries I get the
|
|---|
| 74 | following message printed:</a><br>
|
|---|
| 75 | <code> gmake[1]: cernlib:
|
|---|
| 76 | Command not found</code> <br>
|
|---|
| 77 | <a href="#install-3">Has Geant4 been installed properly ? What to do to
|
|---|
| 78 | solve this error ? </a> </LI>
|
|---|
| 79 | <LI><a href="#install-4">Trying building the Geant4 libraries I see several
|
|---|
| 80 | of these errors appearing and my installation fails:</a><br>
|
|---|
| 81 | <code> .....G4Exception.d:1:
|
|---|
| 82 | *** missing separator. Stop.<br>
|
|---|
| 83 | </code><code>...../G4DalitzDecayChannel.d:1:
|
|---|
| 84 | *** missing separator. Stop. <br>
|
|---|
| 85 | :<br>
|
|---|
| 86 | : </code>
|
|---|
| 87 | <br>
|
|---|
| 88 | <a href="#install-4">Has Geant4 been installed properly ? What to do to
|
|---|
| 89 | solve this error ? </a> </LI>
|
|---|
| 90 | </OL>
|
|---|
| 91 | </LI>
|
|---|
| 92 | <BLOCKQUOTE>
|
|---|
| 93 | <P> </P>
|
|---|
| 94 | </BLOCKQUOTE>
|
|---|
| 95 | <LI><B><A NAME="q-run"></A><A HREF="#a-run">Runtime Problems</A></B>
|
|---|
| 96 | <OL>
|
|---|
| 97 | <LI><A HREF="#runtime-1">On Linux, I get a segmentation fault
|
|---|
| 98 | as soon as I run one of the official examples.</A>
|
|---|
| 99 | </LI>
|
|---|
| 100 | <LI><a href="#runtime-2">I installed Geant4 libraries and built my application,
|
|---|
| 101 | when I try to run it I get:</a><br>
|
|---|
| 102 | <code>
|
|---|
| 103 |
|
|---|
| 104 | error in loading shared libraries:<br>
|
|---|
| 105 |
|
|---|
| 106 | libCLHEP.so: cannot open shared object file:<br>
|
|---|
| 107 |
|
|---|
| 108 | No such file or directory</code>.
|
|---|
| 109 | </LI>
|
|---|
| 110 | <LI><A HREF="#runtime-3">On my system I get a Floating Point Exception
|
|---|
| 111 | (FPE) since some physics processes sometimes return DBL_MAX as interaction
|
|---|
| 112 | length and this number is afterwards multiplied by a number greater than
|
|---|
| 113 | 1.</A>
|
|---|
| 114 | </LI>
|
|---|
| 115 | </OL>
|
|---|
| 116 | </LI>
|
|---|
| 117 | <BLOCKQUOTE>
|
|---|
| 118 | <P> </P>
|
|---|
| 119 | </BLOCKQUOTE>
|
|---|
| 120 | <LI><A NAME="q-geometry"></A><B><A HREF="#a-geometry">Geometry</A></B>
|
|---|
| 121 | <OL>
|
|---|
| 122 | <LI><A HREF="#a-geom-1">I have a generic point and I would like to know
|
|---|
| 123 | in which physical volume I'm located in my detector geometry.</A></LI>
|
|---|
| 124 | <LI><A HREF="#a-geom-2">How can I access the daughter volumes of a specific
|
|---|
| 125 | physical volume?</A></LI>
|
|---|
| 126 | <LI><A HREF="#a-geom-3">How can I identify the exact copy-number of a specific
|
|---|
| 127 | physical volume in my mass geometry? I tried with <code>GetCopyNo()</code>
|
|---|
| 128 | from my physical volume pointer, but it doesn't seem to work!</A></LI>
|
|---|
| 129 | <LI><A HREF="#a-geom-4">How can I determine the exact position in global coordinates
|
|---|
| 130 | in my mass geometry during tracking and how can I convert it to coordinates local to
|
|---|
| 131 | the current volume ?</A></LI>
|
|---|
| 132 | </OL>
|
|---|
| 133 | </LI>
|
|---|
| 134 | <BLOCKQUOTE>
|
|---|
| 135 | <P> </P>
|
|---|
| 136 | </BLOCKQUOTE>
|
|---|
| 137 | <LI><B><A NAME="q-track"></A><A HREF="#a-track">Tracks and steps</A></B>
|
|---|
| 138 | <OL>
|
|---|
| 139 | <LI><A HREF="#TRACK-1">How can I access the track information through
|
|---|
| 140 | the step object and what information am I allowed to access ?</A>
|
|---|
| 141 | </OL>
|
|---|
| 142 | </LI>
|
|---|
| 143 | <BLOCKQUOTE>
|
|---|
| 144 | <P> </P>
|
|---|
| 145 | </BLOCKQUOTE>
|
|---|
| 146 | <LI><B><A NAME="q-phys"></A><A HREF="#a-phys">Physics and cuts</A></B>
|
|---|
| 147 | <OL>
|
|---|
| 148 | <LI><A HREF="#PHYS-1">How do production cuts (in range) work in Geant4 ?
|
|---|
| 149 | Are they also used in tracking ? If a particle has an energy lower than the
|
|---|
| 150 | converted cut in energy for the given material and the distance to the next
|
|---|
| 151 | boundary is smaller than the cut in range, is the particle killed ?</A>
|
|---|
| 152 | </OL>
|
|---|
| 153 | </LI>
|
|---|
| 154 | <BLOCKQUOTE>
|
|---|
| 155 | <P> </P>
|
|---|
| 156 | </BLOCKQUOTE>
|
|---|
| 157 | <LI><B><A NAME="q-vis"></A><A HREF="#a-vis">Visualization</A></B>
|
|---|
| 158 | <OL>
|
|---|
| 159 | <LI><A HREF="#VIS-1">I have set G4VIS... environmental variables but visualization
|
|---|
| 160 | does not appear to be enabled.</A>
|
|---|
| 161 | </OL>
|
|---|
| 162 | </LI>
|
|---|
| 163 | </UL>
|
|---|
| 164 |
|
|---|
| 165 | <HR>
|
|---|
| 166 |
|
|---|
| 167 | <H3><A NAME="a-general"></A><A HREF="#q-general">General</A></H3>
|
|---|
| 168 | <OL>
|
|---|
| 169 | <LI><A NAME="gen-1"></A><I>How do I add a FAQ to this page?</I>
|
|---|
| 170 | <BR><BR>
|
|---|
| 171 | <I>Solution:</I><BR>
|
|---|
| 172 | This is done manually at the moment. Please send your FAQ with solution
|
|---|
| 173 | to the <A HREF="mailto:Gunter.Folger@cern.ch, Gabriele.Cosmo@cern.ch">editors</A>.
|
|---|
| 174 | </LI>
|
|---|
| 175 | </OL>
|
|---|
| 176 |
|
|---|
| 177 | <HR>
|
|---|
| 178 |
|
|---|
| 179 | <H3> <A NAME="a-install"></A><A HREF="#q-install">Installation</A> </H3>
|
|---|
| 180 | <OL>
|
|---|
| 181 | <LI><A NAME="install-1"></A><I>When I download the source from the web, and unpack
|
|---|
| 182 | the tar file, some files unpack into the top level directory.</I><BR>
|
|---|
| 183 | <BR>
|
|---|
| 184 | <I>Solution:</I><BR>
|
|---|
| 185 | The problem you describe usually is the result of using "UNIX" tar to
|
|---|
| 186 | unpack the gtar ("GNU-tar") file, or vice versa, or using zip on either the
|
|---|
| 187 | gtar or tar file. Please make certain that you download the correct file for
|
|---|
| 188 | your system, and that you use the correct unpacking tool. Note that for Linux
|
|---|
| 189 | you must download the gtar.gz file.<P>
|
|---|
| 190 | </LI>
|
|---|
| 191 | <LI><A NAME="install-2"></A><I>I cannot find CLHEP files or library and I have
|
|---|
| 192 | it installed in my system.</I><BR>
|
|---|
| 193 | <BR>
|
|---|
| 194 | <I>Solution:</I><BR>
|
|---|
| 195 | If the standard CLHEP installation procedure has been adopted, the variable
|
|---|
| 196 | <tt>CLHEP_BASE_DIR</tt> should point to the area where <tt>include/</tt> and
|
|---|
| 197 | <tt>lib/</tt> directories for CLHEP headers & library are installed in your
|
|---|
| 198 | system. In case the <B>library file name</B> is different than the one
|
|---|
| 199 | expected (<tt>libCLHEP.a</tt>), you should either create a symbolic
|
|---|
| 200 | link with the expected name, or define the variable <tt>CLHEP_LIB</tt> in
|
|---|
| 201 | your environment which explicitly sets the name of the CLHEP library.
|
|---|
| 202 | If a non-standard CLHEP installation has been adopted, define variables
|
|---|
| 203 | <tt>CLHEP_INCLUDE_DIR</tt>, <tt>CLHEP_LIB_DIR</tt> (and <tt>CLHEP_LIB</tt>)
|
|---|
| 204 | to refer explicitly to the place where headers, library (and library-name)
|
|---|
| 205 | respectively are placed in your system.<BR>
|
|---|
| 206 | On Windows systems, the full library file name (with extension) should be
|
|---|
| 207 | specified as <tt>CLHEP_LIB</tt>, while for UNIX-like systems, just the name
|
|---|
| 208 | is required (i.e. <tt>CLHEP</tt> for <tt>libCLHEP.a</tt>)<P>
|
|---|
| 209 | </LI>
|
|---|
| 210 | <li><a name="install-3"></a><i>While installing the Geant4 libraries I get
|
|---|
| 211 | the following message printed:</i><br>
|
|---|
| 212 |
|
|---|
| 213 | gmake[1]: cernlib: Command not found <br>
|
|---|
| 214 | <i>Has Geant4 been installed properly ? What to do to solve this error ?</i><br>
|
|---|
| 215 | <br>
|
|---|
| 216 | <i>Solution:</i><br>
|
|---|
| 217 | The message:<br>
|
|---|
| 218 | <code>
|
|---|
| 219 | gmake[1]: cernlib: Command not found
|
|---|
| 220 | </code> <br>
|
|---|
| 221 | shows that you don't have the 'cernlib' command installed in your system;
|
|---|
| 222 | 'cernlib' is a command from the CERN program library (cernlib) returning a
|
|---|
| 223 | list of libraries needed to link a cernlib application. This command is only
|
|---|
| 224 | used in the 'g3tog4' module, however, if you do not make use of the 'g3tog4'
|
|---|
| 225 | tool, it's harmless. The cernlib script (and the needed cernlib libraries)
|
|---|
| 226 | are available from: <a href="http://cern.ch/cernlib">http://cern.ch/cernlib</a>.<P>
|
|---|
| 227 | </li>
|
|---|
| 228 | <li><a name="install-4"></a> <i>Trying building the Geant4 libraries I see several
|
|---|
| 229 | of these errors appearing and my installation fails:</i><br>
|
|---|
| 230 | <code>
|
|---|
| 231 | .....G4Exception.d:1:
|
|---|
| 232 | *** missing separator. Stop.<br>
|
|---|
| 233 |
|
|---|
| 234 | ...../G4DalitzDecayChannel.d:1:
|
|---|
| 235 | *** missing separator. Stop. <br>
|
|---|
| 236 |
|
|---|
| 237 | :<br>
|
|---|
| 238 |
|
|---|
| 239 | :
|
|---|
| 240 | </code> <br>
|
|---|
| 241 | <i>Has Geant4 been installed properly ? What to do to solve this error ?</i><br>
|
|---|
| 242 | <br>
|
|---|
| 243 | <i>Solution:</i><br>
|
|---|
| 244 | It looks like some file dependencies (.d) are corrupted, possibly
|
|---|
| 245 | due to previous build attempts which failed for some reason.<br>
|
|---|
| 246 | You need to remove each of them. A quick recipe for doing this is to:
|
|---|
| 247 | <ul>
|
|---|
| 248 | <li>Configure the environment with the installation to be repaired</li>
|
|---|
| 249 | <li>Unset the <tt>G4WORKDIR</tt> environment variable (in case it is
|
|---|
| 250 | eventually set)</li>
|
|---|
| 251 | <li>Type:
|
|---|
| 252 | <pre>
|
|---|
| 253 | gmake clean dependencies=''
|
|---|
| 254 | </pre>
|
|---|
| 255 | from the affected module (i.e. for this case, from
|
|---|
| 256 | <tt>$G4INSTALL/source/global/management</tt> and
|
|---|
| 257 | <tt>$G4INSTALL/source/particles/management</tt>)
|
|---|
| 258 | and rebuild.
|
|---|
| 259 | <br>Alternatively, you may use:
|
|---|
| 260 | <pre>
|
|---|
| 261 | gmake clean dependencies=''
|
|---|
| 262 | </pre>
|
|---|
| 263 | from <tt>$G4INSTALL/source</tt> and rebuild.</li>
|
|---|
| 264 | </ul>
|
|---|
| 265 | </li>
|
|---|
| 266 | </ol>
|
|---|
| 267 |
|
|---|
| 268 | <HR>
|
|---|
| 269 |
|
|---|
| 270 | <H3><A NAME="a-run"></A><A HREF="#q-run">Run Time Problems</A> </H3>
|
|---|
| 271 | <OL>
|
|---|
| 272 | <LI><A NAME="runtime-1"></A><I>On Linux, I get a segmentation fault
|
|---|
| 273 | as soon as I run one of the official examples.</I><BR>
|
|---|
| 274 | <BR>
|
|---|
| 275 | <I>Solution:</I><BR>
|
|---|
| 276 | Check that the CLHEP library has been installed and compiled coherently with
|
|---|
| 277 | the same compiler you use for installing Geant4 and for the same version of Linux
|
|---|
| 278 | distribution.
|
|---|
| 279 | For example, a binary object produced with Red-Hat 7.X is not fully compatible with
|
|---|
| 280 | binaries running on RH 9.X or higher, due to different <tt>libc</tt> used in the two
|
|---|
| 281 | configurations.<P>
|
|---|
| 282 | </li>
|
|---|
| 283 | <li><a name="runtime-2"></a><i>I installed Geant4 libraries and built my application,
|
|---|
| 284 | when I try to run it I get:</i><br>
|
|---|
| 285 | <code>
|
|---|
| 286 |
|
|---|
| 287 | error in loading shared libraries:<br>
|
|---|
| 288 |
|
|---|
| 289 | libCLHEP.so: cannot open shared object file:<br>
|
|---|
| 290 |
|
|---|
| 291 | No such file or directory.
|
|---|
| 292 | </code><br>
|
|---|
| 293 | <br>
|
|---|
| 294 | <i>Solution:</i><br>
|
|---|
| 295 | Your installation of CLHEP includes shared libraries. You need to specify
|
|---|
| 296 | the path where <tt>libCLHEP.so</tt> is installed through your environment
|
|---|
| 297 | variable <tt>LD_LIBRARY_PATH</tt>. For example, in <tt>tcsh</tt> UNIX shell:
|
|---|
| 298 | <pre>
|
|---|
| 299 | setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:$CLHEP_BASE_DIR/lib
|
|---|
| 300 | </pre><P>
|
|---|
| 301 | </li>
|
|---|
| 302 | <LI><A NAME="runtime-3"></A><I>On my system I get a Floating Point Exception
|
|---|
| 303 | (FPE) since some physics processes sometimes return </I>DBL_MAX<I> as interaction
|
|---|
| 304 | length and this number is afterwards multiplied by a number greater than 1.</I><BR>
|
|---|
| 305 | <BR>
|
|---|
| 306 | <I>Solution:</I><BR>
|
|---|
| 307 | Geant4 coding conventions and installation setup explicitly follow the ANSI/IEEE-754
|
|---|
| 308 | Standard for the initialization of floating-point arithmetic hardware and
|
|---|
| 309 | portability. The Standard foresees floating-point arithmetic to be nonstop
|
|---|
| 310 | and underflows to be gradual. On DEC platforms, for example, the ANSI/IEEE-754
|
|---|
| 311 | Standard compliance needs to be explicitly set (since deactivated by default);
|
|---|
| 312 | in this case we use infact the option "-ieee" on the DEC/cxx native C++ compiler
|
|---|
| 313 | to achieve this. You should check if your compiler provides compilation options
|
|---|
| 314 | for activating Standard initialization of FP arithmetic (it may be platform
|
|---|
| 315 | specific).
|
|---|
| 316 | </LI>
|
|---|
| 317 | </OL>
|
|---|
| 318 |
|
|---|
| 319 | <HR>
|
|---|
| 320 |
|
|---|
| 321 | <H3><A NAME="a-geometry"></A><A HREF="#q-geometry">Geometry</A> </H3>
|
|---|
| 322 | <OL>
|
|---|
| 323 | <LI><A NAME="a-geom-1"></A><I>I have a generic point and I would like to know
|
|---|
| 324 | in which physical volume I'm located in my detector geometry.</I>
|
|---|
| 325 | <BR><BR>
|
|---|
| 326 | <I>Solution:</I><BR>
|
|---|
| 327 | The best way of doing this is by invoking the <code>G4Navigator</code>.
|
|---|
| 328 | First get a pointer of the navigator through the <code>G4TransportationManager</code>,
|
|---|
| 329 | and then locate the point.
|
|---|
| 330 | i.e.
|
|---|
| 331 | <pre>
|
|---|
| 332 | #include "G4TransportationManager.hh"
|
|---|
| 333 | #include "G4Navigator.hh"
|
|---|
| 334 | G4ThreeVector myPoint = ....;
|
|---|
| 335 | G4Navigator* theNavigator = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
|
|---|
| 336 | G4VPhysicalVolume* myVolume = theNavigator->LocateGlobalPointAndSetup(myPoint);
|
|---|
| 337 | </pre>
|
|---|
| 338 | NOTE 1: it is advisable to perform the call for locating the point when the
|
|---|
| 339 | geometry is "closed", i.e. after the geometry optimisation has been
|
|---|
| 340 | generated.<P></P>
|
|---|
| 341 | NOTE 2: by using the navigator for tracking as shown above, the actual particle
|
|---|
| 342 | gets also -relocated- in the specified position. Therefore, if this
|
|---|
| 343 | information is needed during tracking time, in order to avoid affecting
|
|---|
| 344 | tracking, you should either use an alternative <code>G4Navigator</code>
|
|---|
| 345 | object (which you then assign to your world-volume), or you access the
|
|---|
| 346 | information through the track or touchable as specified in the FAQ
|
|---|
| 347 | for <A HREF="#TRACK-1">tracking and steps</A>.<P></P>
|
|---|
| 348 | </LI>
|
|---|
| 349 | <LI><A NAME="a-geom-2"></A><I>How can I access the daughter volumes of a specific
|
|---|
| 350 | physical volume?</I>
|
|---|
| 351 | <BR><BR>
|
|---|
| 352 | <I>Solution:</I><BR>
|
|---|
| 353 | Through the associated logical volume.
|
|---|
| 354 | <pre>
|
|---|
| 355 | G4VPhysicalVolume* myPVolume = ....;
|
|---|
| 356 | G4LogicalVolume* myLVolume = myPVolume->GetLogicalVolume();
|
|---|
| 357 | for (G4int i=0; i < myLVolume->GetNoDaughters(); i++)
|
|---|
| 358 | myPVolume = myLVolume->GetDaughter(i);
|
|---|
| 359 | </pre>
|
|---|
| 360 | </LI>
|
|---|
| 361 | <LI><A NAME="a-geom-3"></A><I>How can I identify the exact copy-number of a specific
|
|---|
| 362 | physical volume in my mass geometry? I tried with <code>GetCopyNo()</code>
|
|---|
| 363 | from my physical volume pointer, but it doesn't seem to work!</I>
|
|---|
| 364 | <BR><BR>
|
|---|
| 365 | <I>Solution:</I><BR>
|
|---|
| 366 | The correct way to identify -uniquely- a physical volume in your
|
|---|
| 367 | mass geometry is by using the touchables (see also section 4.1.5 of the
|
|---|
| 368 | User's Guide for Application Developers), as follows:
|
|---|
| 369 | <pre>
|
|---|
| 370 | G4Step* aStep = ..;
|
|---|
| 371 | G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
|
|---|
| 372 | G4TouchableHandle theTouchable = preStepPoint->GetTouchableHandle();
|
|---|
| 373 | G4int copyNo = theTouchable->GetCopyNumber();
|
|---|
| 374 | G4int motherCopyNo = theTouchable->GetCopyNumber(1);
|
|---|
| 375 | </pre>
|
|---|
| 376 | where <code>Copy</code> here stays for any duplicated instance of a physical
|
|---|
| 377 | volume, either if it is a <code>G4PVPlacement</code> (multiple placements of the
|
|---|
| 378 | same logical volume) or a <code>G4PVReplica</code>/<code>G4PVParameterised</code>.<BR>
|
|---|
| 379 | The method <code>GetCopyNo()</code> is meant to return only the serial
|
|---|
| 380 | number of placements not duplicated in the geometry tree.<P>
|
|---|
| 381 | </LI>
|
|---|
| 382 | <LI><A NAME="a-geom-4"></A><I>How can I determine the exact position in global coordinates
|
|---|
| 383 | in my mass geometry during tracking and how can I convert it to coordinates local to
|
|---|
| 384 | the current volume ?</I>
|
|---|
| 385 | <BR><BR>
|
|---|
| 386 | <I>Solution:</I><BR>
|
|---|
| 387 | You need again to do it through the touchables (see also section 4.1.5 of the
|
|---|
| 388 | User's Guide for Application Developers), as follows:
|
|---|
| 389 | <pre>
|
|---|
| 390 | G4Step* aStep = ..;
|
|---|
| 391 | G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
|
|---|
| 392 | G4TouchableHandle theTouchable = preStepPoint->GetTouchableHandle();
|
|---|
| 393 | G4ThreeVector worldPosition = preStepPoint->GetPosition();
|
|---|
| 394 | G4ThreeVector localPosition = theTouchable->GetHistory()->
|
|---|
| 395 | GetTopTransform().TransformPoint(worldPosition);
|
|---|
| 396 | </pre>
|
|---|
| 397 | where <code>worldPosition</code> here stays for the position related to the world
|
|---|
| 398 | volume, while <code>localPosition</code> refers to the coordinates local to the
|
|---|
| 399 | volume where the particle is currently placed.
|
|---|
| 400 | </LI>
|
|---|
| 401 | </OL>
|
|---|
| 402 |
|
|---|
| 403 | <HR>
|
|---|
| 404 |
|
|---|
| 405 | <H3><A NAME="a-track"></A><A HREF="#q-track">Tracks and steps</A> </H3>
|
|---|
| 406 | <OL>
|
|---|
| 407 | <LI><I><A NAME="TRACK-1"></A>How can I access the track information through
|
|---|
| 408 | the step object and what information am I allowed to access ?</I>
|
|---|
| 409 | <BR><BR>
|
|---|
| 410 | <I>Answer:</I><BR>
|
|---|
| 411 | A <code>G4Step</code> object consists of two points:
|
|---|
| 412 | <pre>
|
|---|
| 413 | G4StepPoint* point1 = step->GetPreStepPoint();
|
|---|
| 414 | G4StepPoint* point2 = step->GetPostStepPoint();
|
|---|
| 415 | </pre>
|
|---|
| 416 | To get their positions in the global coordinate system:
|
|---|
| 417 | <pre>
|
|---|
| 418 | G4ThreeVector pos1 = point1->GetPosition();
|
|---|
| 419 | G4ThreeVector pos2 = point2->GetPosition();
|
|---|
| 420 | </pre>
|
|---|
| 421 | Hereafter we call <i>current volume</i> the volume where the step has just
|
|---|
| 422 | gone through. Geometrical informations are available from
|
|---|
| 423 | <code>preStepPoint</code>.<BR>
|
|---|
| 424 | <code>G4VTouchable</code> and its derivates keep these geometrical
|
|---|
| 425 | informations. We retrieve a <i>touchable</i> by creating a <i>handle</i>
|
|---|
| 426 | for it:
|
|---|
| 427 | <pre>
|
|---|
| 428 | G4TouchableHandle touch1 = point1->GetTouchableHandle();
|
|---|
| 429 | </pre>
|
|---|
| 430 | To get the current volume:
|
|---|
| 431 | <pre>
|
|---|
| 432 | G4VPhysicalVolume* volume = touch1->GetVolume();
|
|---|
| 433 | </pre>
|
|---|
| 434 | To get its name:
|
|---|
| 435 | <pre>
|
|---|
| 436 | G4String name = volume->GetName();
|
|---|
| 437 | </pre>
|
|---|
| 438 | To get the physical volume copy number:
|
|---|
| 439 | <pre>
|
|---|
| 440 | G4int copyNumber = touch1->GetCopyNumber();
|
|---|
| 441 | </pre>
|
|---|
| 442 | To get logical volume:
|
|---|
| 443 | <pre>
|
|---|
| 444 | G4LogicalVolume* lVolume = volume->GetLogicalVolume();
|
|---|
| 445 | </pre>
|
|---|
| 446 | To get the associated material: the following statements are equivalent:
|
|---|
| 447 | <pre>
|
|---|
| 448 | G4Material* material = point1 ->GetMaterial();
|
|---|
| 449 | G4Material* material = lVolume ->GetMaterial();
|
|---|
| 450 | </pre>
|
|---|
| 451 | To get the geometrical region:
|
|---|
| 452 | <pre>
|
|---|
| 453 | G4Region* region = lVolume->GetRegion();
|
|---|
| 454 | </pre>
|
|---|
| 455 | To get its mother volume:
|
|---|
| 456 | <pre>
|
|---|
| 457 | G4VPhysicalVolume* mother = touch1->GetVolume(depth=1);
|
|---|
| 458 | grandMother: depth=2 ...etc...
|
|---|
| 459 | </pre>
|
|---|
| 460 | To get the copy number of the mother volume:
|
|---|
| 461 | <pre>
|
|---|
| 462 | G4int copyNumber = touch1->GetCopyNumber(depth=1);
|
|---|
| 463 | grandMother: depth=2 ...etc...
|
|---|
| 464 | </pre>
|
|---|
| 465 | To get the process which has limited the current step:
|
|---|
| 466 | <pre>
|
|---|
| 467 | G4VProcess* aProcess = point2->GetProcessDefinedStep();
|
|---|
| 468 | </pre>
|
|---|
| 469 | To check that the particle has just entered in the current volume
|
|---|
| 470 | (i.e. it is at the first step in the volume; the <code>preStepPoint</code>
|
|---|
| 471 | is at the boundary):
|
|---|
| 472 | <pre>
|
|---|
| 473 | if (point1->GetStepStatus() == fGeomBoundary)
|
|---|
| 474 | </pre>
|
|---|
| 475 | To check that the particle is leaving the current volume
|
|---|
| 476 | (i.e. it is at the last step in the volume; the <code>postStepPoint</code>
|
|---|
| 477 | is at the boundary):
|
|---|
| 478 | <pre>
|
|---|
| 479 | if (point2->GetStepStatus() == fGeomBoundary)
|
|---|
| 480 | </pre>
|
|---|
| 481 | In the above situation, to get touchable of the next volume:
|
|---|
| 482 | <pre>
|
|---|
| 483 | G4TouchableHandle touch2 = point2->GetTouchableHandle();
|
|---|
| 484 | </pre>
|
|---|
| 485 | From <code>touch2</code>, all informations on the next volume can
|
|---|
| 486 | be retrieved as above.
|
|---|
| 487 | <p></p>
|
|---|
| 488 | Physics quantities are available from the step (<code>G4Step</code>) or
|
|---|
| 489 | from the track (<code>G4Track</code>).
|
|---|
| 490 | <p></p>
|
|---|
| 491 | To get the energy deposition, step length, displacement and time of flight
|
|---|
| 492 | spent by the current step:
|
|---|
| 493 | <pre>
|
|---|
| 494 | G4double eDeposit = step->GetTotalEnergyDeposit();
|
|---|
| 495 | G4double sLength = step->GetStepLength();
|
|---|
| 496 | G4ThreeVector displace = step->GetDeltaPosition();
|
|---|
| 497 | G4double tof = step->GetDeltaTime();
|
|---|
| 498 | </pre>
|
|---|
| 499 | To get momentum, kinetic energy and global time (time since the beginning
|
|---|
| 500 | of the event) of the track after the completion of the current step:
|
|---|
| 501 | <pre>
|
|---|
| 502 | G4Track* track = step->GetTrack();
|
|---|
| 503 | G4ThreeVector momentum = track->GetMomentum();
|
|---|
| 504 | G4double kinEnergy = track->GetKineticEnergy();
|
|---|
| 505 | G4double globalTime = track->GetGlobalTime();
|
|---|
| 506 | ...etc...
|
|---|
| 507 | </pre>
|
|---|
| 508 | <u>Remark</u> - To transform a position from the global coordinate
|
|---|
| 509 | system to the local system of the current volume, use the
|
|---|
| 510 | <code>preStepPoint</code> transformation, as described in the
|
|---|
| 511 | <a href="#a-geom-4">geometry section</a> above.
|
|---|
| 512 | </LI>
|
|---|
| 513 | </OL>
|
|---|
| 514 |
|
|---|
| 515 | <HR>
|
|---|
| 516 |
|
|---|
| 517 | <H3><A NAME="a-phys"></A><A HREF="#q-phys">Physics and cuts</A> </H3>
|
|---|
| 518 | <OL>
|
|---|
| 519 | <LI><I><A NAME="PHYS-1"></A>How do production cuts (in range) work in Geant4 ?
|
|---|
| 520 | Are they also used in tracking ? If a particle has an energy lower than the
|
|---|
| 521 | converted cut in energy for the given material and the distance to the next
|
|---|
| 522 | boundary is smaller than the cut in range, is the particle killed ?</I>
|
|---|
| 523 | <BR><BR>
|
|---|
| 524 | <I>Answer:</I><BR>
|
|---|
| 525 | Geant4 does NOT have a "tracking cut". The toolkit's default behaviour
|
|---|
| 526 | is to track particles down to zero range (i.e. zero energy).<BR>
|
|---|
| 527 | Of course, it is possible for the user to create and register a process
|
|---|
| 528 | that kills particles below a certain energy or range; this is however
|
|---|
| 529 | NOT provided by default in Geant4. So there's NO "tracking cut".<BR>
|
|---|
| 530 | For example, suppose a particle that is nearing zero energy will at some point
|
|---|
| 531 | be proposed by its Ionisation process to undergo one final step, from its current
|
|---|
| 532 | energy down to zero energy. This is still only a proposal. If during this step
|
|---|
| 533 | the particle crosses a boundary, then the transportation will limit the step at
|
|---|
| 534 | a length smaller than the Ionisation -- so the particle will still see and cross
|
|---|
| 535 | the relevant boundary, and another step will occur on the other side of that
|
|---|
| 536 | boundary.<BR>
|
|---|
| 537 | In summary the "production threshold" range and its equivalent in
|
|---|
| 538 | energy are not utilised as a "tracking cut". A particle is not abandoned
|
|---|
| 539 | by Geant4 below a certain range/energy unless the user registers a process
|
|---|
| 540 | to do this by him/her-self.
|
|---|
| 541 | </LI>
|
|---|
| 542 | </OL>
|
|---|
| 543 |
|
|---|
| 544 | <HR>
|
|---|
| 545 |
|
|---|
| 546 | <H3><A NAME="a-vis"></A><A HREF="#q-vis">Visualization</A> </H3>
|
|---|
| 547 | <OL>
|
|---|
| 548 | <LI><I><A NAME="VIS-1"></A>I have set G4VIS... environmental variables but
|
|---|
| 549 | visualization does not appear to be enabled.</I>
|
|---|
| 550 | <BR><BR>
|
|---|
| 551 | <I>Solution:</I><BR>
|
|---|
| 552 | This might be
|
|---|
| 553 | because you set the environment variables *after* already compiling. The environment
|
|---|
| 554 | variables control C-pre-processor macros of the same name and therefore influence
|
|---|
| 555 | what code gets compiled. It is suggested to proceed with the following manual procedure
|
|---|
| 556 | to correct the current installation:
|
|---|
| 557 | <UL>
|
|---|
| 558 | <LI>Configure the environment according to the installation making sure to -unset-
|
|---|
| 559 | the <tt>G4WORKDIR</tt> environment variable, if set.</LI>
|
|---|
| 560 | <LI>Verify and eventually set the environment variables of the visualization module
|
|---|
| 561 | [name] concerned (setenv or export both <TT>G4VIS_BUILD_[name]_DRIVER</TT> and
|
|---|
| 562 | <TT>G4VIS_USE_[name]</TT> variables according to the UNIX shell used), and then
|
|---|
| 563 | proceed as follows:
|
|---|
| 564 | <PRE>
|
|---|
| 565 | cd $G4INSTALL/source/visualization
|
|---|
| 566 | gmake clean
|
|---|
| 567 | gmake
|
|---|
| 568 | cd $G4INSTALL/source/interfaces
|
|---|
| 569 | gmake clean
|
|---|
| 570 | gmake
|
|---|
| 571 | cd $G4INSTALL/source
|
|---|
| 572 | gmake libmap
|
|---|
| 573 | setenv G4WORKDIR [your working directory] (or export)
|
|---|
| 574 | cd [your application directory]
|
|---|
| 575 | gmake clean
|
|---|
| 576 | gmake
|
|---|
| 577 | </PRE></LI>
|
|---|
| 578 | </UL>
|
|---|
| 579 | </LI>
|
|---|
| 580 | </OL>
|
|---|
| 581 | </td>
|
|---|
| 582 | </tr>
|
|---|
| 583 | </table>
|
|---|
| 584 |
|
|---|
| 585 | <!-- start footer -->
|
|---|
| 586 | <div id="bottom">
|
|---|
| 587 | <br/><br/>
|
|---|
| 588 | <a href="http://cern.ch/geant4/applications/index.shtml">Applications</a> |
|
|---|
| 589 | <a href="http://cern.ch/geant4/support/index.shtml">User Support</a> |
|
|---|
| 590 | <a href="http://cern.ch/geant4/results/index.shtml">Results & Publications</a> |
|
|---|
| 591 | <a href="http://cern.ch/geant4/collaboration/index.shtml">Collaboration</a> |
|
|---|
| 592 | <a href="http://cern.ch/geant4/sitemap.shtml">Site Map</a><br />
|
|---|
| 593 | <p></p>
|
|---|
| 594 | <script type="text/javascript">
|
|---|
| 595 | <!--//
|
|---|
| 596 | var zap_domain = "cern.ch"
|
|---|
| 597 | var zap_user = "Gunter.Folger"
|
|---|
| 598 | var zap_recipient = zap_user + "@" + zap_domain
|
|---|
| 599 | var zap_url = "mailto:" + zap_recipient +"?subject=Feedback&body=My feedback concerns the page at: " + " " + escape(top.parent.location.href)
|
|---|
| 600 | document.write('<a href="' + zap_url + '" target=>Contact Webmaster</a>')
|
|---|
| 601 | //-->
|
|---|
| 602 | </script>
|
|---|
| 603 |
|
|---|
| 604 |
|
|---|
| 605 | <div id="update">
|
|---|
| 606 | <p>Last updated:
|
|---|
| 607 |
|
|---|
| 608 | 09/27/2007
|
|---|
| 609 | </p>
|
|---|
| 610 | </div>
|
|---|
| 611 | </div>
|
|---|
| 612 | <!-- End footer -->
|
|---|
| 613 |
|
|---|
| 614 | </body>
|
|---|
| 615 |
|
|---|
| 616 | </html>
|
|---|
| 617 |
|
|---|