source: trunk/documents/UserDoc/UsersGuides/ForApplicationDeveloper/html/Detector/geomDynamic.html @ 1358

Last change on this file since 1358 was 1208, checked in by garnier, 15 years ago

CVS update

File size: 4.0 KB
Line 
1<html>
2<head>
3<title>ADG: Geometry</title>
4</head>
5
6<!-- Changed by: Gabriele Cosmo, 18-Apr-2005 -->
7<!-- $Id: geomDynamic.html,v 1.2 2006/06/09 14:00:48 gcosmo Exp $ -->
8<!-- $Name:  $ -->
9<body>
10<table WIDTH="100%"><TR>
11<td>
12<a href="../../../../Overview/html/index.html">
13<IMG SRC="../../../../resources/html/IconsGIF/Overview.gif" ALT="Overview"></a>
14<a href="geometry.html">
15<IMG SRC="../../../../resources/html/IconsGIF/Contents.gif" ALT="Contents"></a>
16<a href="geomOverlap.html">
17<IMG SRC="../../../../resources/html/IconsGIF/Previous.gif" ALT="Previous"></a>
18<a href="geomXML.html">
19<IMG SRC="../../../../resources/html/IconsGIF/Next.gif" ALT="Next"></a>
20</td>
21<td ALIGN="Right">
22<font SIZE="-1" COLOR="#238E23">
23<b>Geant4 User's Guide</b>
24<br>
25<b>For Application Developers</b>
26<br>
27<b>Geometry</b>
28</font>
29</td>
30</tr></table>
31<br><br>
32
33<a name="4.1.12">
34<h2>4.1.12 Dynamic Geometry Setups</h2></a>
35
36<p>
37Geant4 can handle geometries which vary in time (e.g. a geometry varying
38between two runs in the same job).
39<br>
40It is considered a change to the geometry setup, whenever:
41 <UL>
42 <LI>the shape or dimension of an existing solid is modified;</LI>
43 <LI>the positioning (translation or rotation) of a volume is changed;</LI>
44 <LI>a volume (or a set of volumes, tree) is removed/replaced or added.</LI>
45 </UL>
46Whenever such a change happens, the geometry setup needs to be first "opened"
47for the change to be applied and afterwards "closed" for the optimisation to
48be reorganised.
49<br>
50In the general case, in order to notify the Geant4 system of the change in the
51geometry setup, the <TT>G4RunManager</TT> has to be messaged once the new
52geometry setup has been finalised:
53 
54 <PRE>
55     G4RunManager::GeometryHasBeenModified();
56 </PRE>
57 
58The above notification needs to be performed also if a material associated to
59a <i>positioned</i> volume is changed, in order to allow for the internal
60materials/cuts table to be updated.
61 
62However, for relatively complex geometries the re-optimisation step may be
63extremely inefficient, since it has the effect that the whole geometry setup
64will be re-optimised and re-initialised.  In cases where only a limited
65portion of the geometry has changed, it may be suitable to apply the
66re-optimisation only to the affected portion of the geometry (subtree).
67<br>
68Since release 7.1 of the Geant4 toolkit, it is possible to apply
69re-optimisation local to the subtree of the geometry which has changed. The
70user will have to explicitly "open/close" the geometry providing a pointer
71to the top physical volume concerned:
72</p>
73
74<p>
75<center>
76 <table BORDER=1 CELLPADDING=8>
77 <TR><TD>
78 <pre>
79 #include "G4GeometryManager.hh"
80 
81 // Open geometry for the physical volume to be modified ...
82 //
83 G4GeometryManager::OpenGeometry(physCalor);
84 
85 // Modify dimension of the solid ...
86 //
87 physCalor->GetLogicalVolume()->GetSolid()->SetXHalfLength(12.5*cm);
88 
89 // Close geometry for the portion modified ...
90 //
91 G4GeometryManager::CloseGeometry(physCalor);
92 </pre>
93 <TR>
94 <TD ALIGN=center>
95 Source listing 4.1.9<BR>
96 Opening and closing a portion of the geometry without notifying the
97 <TT>G4RunManager</TT>.
98 </table>
99</center>
100</p>
101
102<p>
103If the existing geometry setup is modified locally in more than one place, it
104may be convenient to apply such a technique only once, by specifying a
105physical volume on top of the hierarchy (subtree) containing all changed
106portions of the setup.
107</p>
108
109<p>
110An alternative solution for dealing with dynamic geometries is to specify NOT
111to apply optimisation for the subtree affected by the change and apply the
112general solution of invoking the <TT>G4RunManager</TT>. In this case, a
113performance penalty at run-time may be observed (depending on the complexity
114of the not-optimised subtree), considering that, without optimisation,
115intersections to all volumes in the subtree will be explicitely computed each
116time.
117</p>
118
119<hr><a href="../../../../Authors/html/subjectsToAuthors.html">
120<i>About the authors</a></i> </P>
121
122</body>
123</html>
Note: See TracBrowser for help on using the repository browser.