source: trunk/Documentation/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch04s07.html@ 901

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

Add Geant4 Documentation at 8.12.2008

File size: 11.6 KB
Line 
1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>4.7.  Parallel Geometries</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="ch04s06.html" title="4.6.  Object Persistency"><link rel="next" href="ch04s08.html" title="4.8.  Command-based scoring"><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.7. 
9Parallel Geometries
10</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s06.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="ch04s08.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.ParaGeom"></a>4.7. 
13Parallel Geometries
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 8.2, this functionality for defining parallel
18geometries is still in <span class="emphasis"><em>beta</em></span> release. We appreciate your
19feedback.
20</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.ParaGeom.ParaWrld"></a>4.7.1. 
21A parallel world
22</h3></div></div></div><p>
23Occasionally, it is not straightforward to define geometries for
24sensitive detectors, importance geometries or envelopes for shower
25parameterization to be coherently assigned to volumes in the
26tracking (mass) geometry. The new parallel navigation functionality
27allows the user to define more than one worlds simultaneously. The
28new <code class="literal">G4Transportation</code> process will see all worlds
29simultaneously; steps will be limited by both boundaries of the
30mass geometry and parallel geometries.
31</p><p>
32In a parallel world, the user can define volumes in arbitrary
33manner with sensitivity, regions, shower parameterization setups,
34and/or importance weight for biasing. Volumes in different worlds
35can overlap.
36</p><p>
37Here are restrictions to be considered for the parallel
38geometry:
39
40</p><div class="itemizedlist"><ul type="disc" compact><li><p>
41 Materials, production thresholds and EM field are used only
42 from the mass geometry. Even if such <span class="emphasis"><em>physical</em></span>
43 quantities are defined in a parallel world, they do not affect to the
44 simulation.
45 </p></li><li><p>
46 Although all worlds will be comprehensively taken care by the
47 <code class="literal">G4Transportation</code> process for the navigation,
48 each parallel world must have its own process assigned to achieve
49 its purpose.
50 For example: in case the user defines a sensitive detector to a
51 parallel world, a process dedicated to the parallel world is
52 responsible to invoke this detector.
53 The <code class="literal">G4SteppingManager</code>
54 treats only the detectors in the mass geometry. For this case of
55 detector sensitivity defined in a parallel world, a
56 <code class="literal">G4ParallelWorldScoringProcess</code> process must be defined
57 in the physics list (see
58 <a href="ch04s07.html#sect.ParaGeom.SenstivParaWrld" title="4.7.3. 
59Detector sensitivity in a parallel world
60">Section 4.7.3</a>).
61 </p></li></ul></div><p>
62</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.ParaGeom.DefParaWrld"></a>4.7.2. 
63Defining a parallel world
64</h3></div></div></div><p>
65A parallel world should be defined in the <code class="literal">Construct()</code>
66virtual method of the user's class derived from the abstract base
67class <span class="emphasis"><em>G4VUserParallelWorld</em></span>.
68
69</p><div class="example"><a name="id433212"></a><p class="title"><b>Example 4.17. 
70An example header file of a concrete user parallel world class.
71</b></p><div class="example-contents"><pre class="programlisting">
72#ifndef MyParallelWorld_h
73#define MyParallelWorld_h 1
74
75#include "globals.hh"
76#include "G4VUserParallelWorld.hh"
77
78class MyParallelWorld : <span class="color_red">public G4VUserParallelWorld</span>
79{
80 public:
81 MyParallelWorld(G4String worldName);
82 virtual ~MyParallelWorld();
83
84 public:
85 <span class="color_red">virtual void Construct();</span>
86};
87
88#endif
89</pre></div></div><p><br class="example-break">
90</p><p>
91A parallel world must have its unique name, which should be set
92to the <code class="literal">G4VUserParallelWorld</code> base class as an argument of
93the base class constructor.
94</p><p>
95The world physical volume of the parallel world is provided by
96the <code class="literal">G4RunManager</code> as a clone of the mass geometry. In the
97<code class="literal">Construct()</code> virtual method of the user's class, the
98pointer to this cloned world physical volume is available through
99the <code class="literal">GetWorld()</code> method defined in the base class. The user
100should fill the volumes in the parallel world by using this
101provided world volume. For a logical volume in a parallel world,
102the material pointer can be <code class="literal">NULL</code>. Even if specified a
103valid material pointer, it will not be taken into account by any
104physics process.
105
106
107</p><div class="example"><a name="id433280"></a><p class="title"><b>Example 4.18. 
108An example source code of a concrete user parallel world class.
109</b></p><div class="example-contents"><pre class="programlisting">
110#include "MyParallelWorld.hh"
111#include "G4LogicalVolume.hh"
112#include "G4VPhysicalVolume.hh"
113#include "G4Box.hh"
114#include "G4PVPlacement.hh"
115
116MyParallelWorld::MyParallelWorld(G4String worldName)
117<span class="color_red">:G4VUserParallelWorld(worldName)</span>
118{;}
119
120MyParallelWorld::~MyParallelWorld()
121{;}
122
123void MyParallelWorld::Construct()
124{
125 G4VPhysicalVolume* ghostWorld = <span class="color_red">GetWorld();</span>
126 G4LogicalVolume* worldLogical = ghostWorld-&gt;GetLogicalVolume();
127
128 // place volumes in the parallel world here. For example ...
129 //
130 G4Box * ghostSolid = new G4Box("GhostdBox", 60.*cm, 60.*cm, 60.*cm);
131 G4LogicalVolume * ghostLogical
132 = new G4LogicalVolume(ghostSolid, 0, "GhostLogical", 0, 0, 0);
133 new G4PVPlacement(0, G4ThreeVector(), ghostLogical,
134 "GhostPhysical", worldLogical, 0, 0);
135}
136</pre></div></div><p><br class="example-break">
137</p><p>
138In case the user needs to define more than one parallel worlds,
139each of them must be implemented through its dedicated class. Each
140parallel world should be registered to the mass geometry class
141using the method <code class="literal">RegisterParallelWorld()</code> available through
142the class <code class="literal">G4VUserDetectorConstruction</code>. The registration
143must be done -before- the mass world is registed to the
144<code class="literal">G4RunManager</code>.
145
146</p><div class="example"><a name="id433338"></a><p class="title"><b>Example 4.19. 
147Typical implementation in the <code class="literal">main()</code> to define a parallel
148world.
149</b></p><div class="example-contents"><pre class="programlisting">
150 // RunManager construction
151 //
152 G4RunManager* runManager = new G4RunManager;
153
154 // mass world
155 //
156 MyDetectorConstruction* massWorld = new MyDetectorConstruction;
157
158 // parallel world
159 //
160 massWorld-&gt;<span class="color_red">RegisterParallelWorld</span>(new MyParallelWorld("ParallelScoringWorld"));
161
162 // set mass world to run manager
163 //
164 runManager-&gt;SetUserInitialization(massWorld);
165</pre></div></div><p><br class="example-break">
166</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.ParaGeom.SenstivParaWrld"></a>4.7.3. 
167Detector sensitivity in a parallel world
168</h3></div></div></div><p>
169Any kind of <code class="literal">G4VSensitiveDetector</code> object can be defined
170in volumes in a parallel world, exactly at the same manner for the
171mass geometry. Once the user defines the sensitive detector in a
172parallel world, he/she must define a process which takes care of
173these detectors.
174</p><p>
175The <code class="literal">G4ParallelWorldScoringProcess</code> is the class provided
176for this purpose. This process must be defined to all kinds of
177particles which need to be "detected". This process must be ordered
178<span class="color_red">
179just after <code class="literal">G4Transporation</code> and prior
180to any other physics processes</span>. The name of the parallel
181world where the <code class="literal">G4ParallelWorldScoringProcess</code> is
182responsible for, must be defined through the method
183<code class="literal">SetParallelWorld()</code> available from the class
184<code class="literal">G4ParallelWorldScoringProcess</code>. If the user has more than
185one parallel worlds with detectors, for each of the parallel
186worlds, dedicated <code class="literal">G4ParallelWorldScoringProcess</code> objects
187must be instantiated with the name of each parallel world
188respectively and registered to the particles.
189
190</p><div class="example"><a name="id433442"></a><p class="title"><b>Example 4.20. 
191Define <code class="literal">G4ParallelWorldScoringProcess</code>.
192</b></p><div class="example-contents"><pre class="programlisting">
193 // Add parallel world scoring process
194 //
195 G4ParallelWorldScoringProcess* theParallelWorldScoringProcess
196 = new <span class="color_red">G4ParallelWorldScoringProcess</span>("ParaWorldScoringProc");
197 theParallelWorldScoringProcess-&gt;<span class="color_red">SetParallelWorld</span>("ParallelScoringWorld");
198
199 theParticleIterator-&gt;reset();
200 while( (*theParticleIterator)() )
201 {
202 G4ParticleDefinition* particle = theParticleIterator-&gt;value();
203 if (!particle-&gt;IsShortLived())
204 {
205 G4ProcessManager* pmanager = particle-&gt;GetProcessManager();
206 pmanager-&gt;AddProcess(theParallelWorldScoringProcess);
207 pmanager-&gt;SetProcessOrderingToLast(theParallelWorldScoringProcess, idxAtRest);
208 pmanager-&gt;SetProcessOrdering(theParallelWorldScoringProcess, idxAlongStep, 1);
209 pmanager-&gt;SetProcessOrderingToLast(theParallelWorldScoringProcess, idxPostStep);
210 }
211 }
212</pre></div></div><p><br class="example-break">
213</p><p>
214At the end of processing an event, all hits collections made for
215the parallel world are stored in <code class="literal">G4HCofThisEvent</code> as well
216as those for the mass geometry.
217</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04s06.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="ch04s08.html"><img src="AllResources/IconsGIF/next.gif" alt="Next"></a></td></tr><tr><td width="40%" align="left" valign="top">4.6. 
218Object Persistency
219 </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"> 4.8. 
220Command-based scoring
221</td></tr></table></div></body></html>
Note: See TracBrowser for help on using the repository browser.