source: trunk/documents/UserDoc/DocBookUsersGuides/ForApplicationDeveloper/xml/Detector/parallelWorld.xml @ 905

Last change on this file since 905 was 904, checked in by garnier, 16 years ago

ajout de la doc

File size: 8.8 KB
Line 
1<!-- ******************************************************** -->
2<!--                                                          -->
3<!--  [History]                                               -->
4<!--    Created by: Makoto Asai,   24-Nov-2006                -->
5<!--    Converted to DocBook: Katsuya Amako, Dec-2006         -->
6<!--                                                          -->
7<!-- ******************************************************** -->
8
9
10<!-- ******************* Section (Level#1) ****************** -->
11<sect1 id="sect.ParaGeom">
12<title>
13Parallel Geometries
14</title>
15
16<!-- ******************* Section (Level#2) ****************** -->
17<sect2 id="sect.ParaGeom.ParaWrld">
18<title>
19A parallel world
20</title>
21
22<para>
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 parallel navigation functionality
27introduced since release 8.2 of Geant4, allows the user to define
28more than one worlds simultaneously.
29The <literal>G4Transportation</literal> process will see all worlds
30simultaneously; steps will be limited by both boundaries of the
31mass and parallel geometries.
32</para>
33
34<para>
35In a parallel world, the user can define volumes in arbitrary
36manner with sensitivity, regions, shower parameterization setups,
37and/or importance weight for biasing. Volumes in different worlds
38can overlap.
39</para>
40
41<para>
42Here are restrictions to be considered for the parallel
43geometry:
44
45<itemizedlist spacing="compact">
46  <listitem><para>
47    Materials, production thresholds and EM field are used only
48    from the mass geometry. Even if such <emphasis>physical</emphasis> 
49    quantities are defined in a parallel world, they do not affect to the
50    simulation.
51  </para></listitem>
52  <listitem><para>
53    Although all worlds will be comprehensively taken care by the
54    <literal>G4Transportation</literal> process for the navigation,
55    each parallel world must have its own process assigned to achieve
56    its purpose.
57    For example: in case the user defines a sensitive detector to a
58    parallel world, a process dedicated to the parallel world is
59    responsible to invoke this detector.
60    The <literal>G4SteppingManager</literal>
61    treats only the detectors in the mass geometry. For this case of
62    detector sensitivity defined in a parallel world, a
63    <literal>G4ParallelWorldScoringProcess</literal> process must be defined
64    in the physics list (see
65    <xref linkend="sect.ParaGeom.SenstivParaWrld" />).
66  </para></listitem>
67</itemizedlist>
68</para>
69
70</sect2>
71
72
73<!-- ******************* Section (Level#2) ****************** -->
74<sect2 id="sect.ParaGeom.DefParaWrld">
75<title>
76Defining a parallel world
77</title>
78
79<para>
80A parallel world should be defined in the <literal>Construct()</literal>
81virtual method of the user's class derived from the abstract base
82class <emphasis>G4VUserParallelWorld</emphasis>.
83
84<example>
85<title>
86An example header file of a concrete user parallel world class.
87</title>
88<programlisting>
89#ifndef MyParallelWorld_h
90#define MyParallelWorld_h 1
91
92#include "globals.hh"
93#include "G4VUserParallelWorld.hh"
94
95class MyParallelWorld : <emphasis role="color_red">public G4VUserParallelWorld</emphasis>
96{
97  public:
98    MyParallelWorld(G4String worldName);
99    virtual ~MyParallelWorld();
100
101  public:
102    <emphasis role="color_red">virtual void Construct();</emphasis>
103};
104
105#endif
106</programlisting>
107</example>
108</para>   
109
110<para>
111A parallel world must have its unique name, which should be set
112to the <literal>G4VUserParallelWorld</literal> base class as an argument of
113the base class constructor.
114</para>
115
116<para>
117The world physical volume of the parallel world is provided by
118the <literal>G4RunManager</literal> as a clone of the mass geometry. In the
119<literal>Construct()</literal> virtual method of the user's class, the
120pointer to this cloned world physical volume is available through
121the <literal>GetWorld()</literal> method defined in the base class. The user
122should fill the volumes in the parallel world by using this
123provided world volume. For a logical volume in a parallel world,
124the material pointer can be <literal>0</literal>. Even if specified a
125valid material pointer, it will not be taken into account by any
126physics process.
127
128
129<example>
130<title>
131An example source code of a concrete user parallel world class.
132</title>
133<programlisting>
134#include "MyParallelWorld.hh"
135#include "G4LogicalVolume.hh"
136#include "G4VPhysicalVolume.hh"
137#include "G4Box.hh"
138#include "G4PVPlacement.hh"
139
140MyParallelWorld::MyParallelWorld(G4String worldName)
141<emphasis role="color_red">:G4VUserParallelWorld(worldName)</emphasis>
142{;}
143
144MyParallelWorld::~MyParallelWorld()
145{;}
146
147void MyParallelWorld::Construct()
148{
149  G4VPhysicalVolume* ghostWorld = <emphasis role="color_red">GetWorld();</emphasis>
150  G4LogicalVolume* worldLogical = ghostWorld-&gt;GetLogicalVolume();
151
152  // place volumes in the parallel world here. For example ...
153  //
154  G4Box * ghostSolid = new G4Box("GhostdBox", 60.*cm, 60.*cm, 60.*cm);
155  G4LogicalVolume * ghostLogical
156        = new G4LogicalVolume(ghostSolid, 0, "GhostLogical", 0, 0, 0);
157  new G4PVPlacement(0, G4ThreeVector(), ghostLogical,
158                    "GhostPhysical", worldLogical, 0, 0);
159}
160</programlisting>
161</example>
162</para>   
163
164<para>
165In case the user needs to define more than one parallel worlds,
166each of them must be implemented through its dedicated class. Each
167parallel world should be registered to the mass geometry class
168using the method <literal>RegisterParallelWorld()</literal> available through
169the class <literal>G4VUserDetectorConstruction</literal>. The registration
170must be done -before- the mass world is registed to the
171<literal>G4RunManager</literal>.
172
173<example>
174<title>
175Typical implementation in the <literal>main()</literal> to define a parallel
176world.
177</title>
178<programlisting>
179  // RunManager construction
180  //
181  G4RunManager* runManager = new G4RunManager;
182
183  // mass world
184  //
185  MyDetectorConstruction* massWorld = new MyDetectorConstruction;
186
187  // parallel world
188  //
189  massWorld-&gt;<emphasis role="color_red">RegisterParallelWorld</emphasis>(new MyParallelWorld("ParallelScoringWorld"));
190
191  // set mass world to run manager
192  //
193  runManager-&gt;SetUserInitialization(massWorld);
194</programlisting>
195</example>
196</para>   
197
198</sect2>
199
200<!-- ******************* Section (Level#2) ****************** -->
201<sect2 id="sect.ParaGeom.SenstivParaWrld">
202<title>
203Detector sensitivity in a parallel world
204</title>
205
206<para>
207Any kind of <literal>G4VSensitiveDetector</literal> object can be defined
208in volumes in a parallel world, exactly at the same manner for the
209mass geometry. Once the user defines the sensitive detector in a
210parallel world, he/she must define a process which takes care of
211these detectors.
212</para>
213
214<para>
215The <literal>G4ParallelWorldScoringProcess</literal> is the class provided
216for this purpose. This process must be defined to all kinds of
217particles which need to be "detected". This process must be ordered
218<emphasis role="color_red">
219just after <literal>G4Transporation</literal> and prior
220to any other physics processes</emphasis>. The name of the parallel
221world where the <literal>G4ParallelWorldScoringProcess</literal> is
222responsible for, must be defined through the method
223<literal>SetParallelWorld()</literal> available from the class
224<literal>G4ParallelWorldScoringProcess</literal>. If the user has more than
225one parallel worlds with detectors, for each of the parallel
226worlds, dedicated <literal>G4ParallelWorldScoringProcess</literal> objects
227must be instantiated with the name of each parallel world
228respectively and registered to the particles.
229
230<example>
231<title>
232Define <literal>G4ParallelWorldScoringProcess</literal>.
233</title>
234<programlisting>
235  // Add parallel world scoring process
236  //
237  G4ParallelWorldScoringProcess* theParallelWorldScoringProcess
238      = new <emphasis role="color_red">G4ParallelWorldScoringProcess</emphasis>("ParaWorldScoringProc");
239  theParallelWorldScoringProcess-&gt;<emphasis role="color_red">SetParallelWorld</emphasis>("ParallelScoringWorld");
240
241  theParticleIterator-&gt;reset();
242  while( (*theParticleIterator)() )
243  {
244    G4ParticleDefinition* particle = theParticleIterator-&gt;value();
245    if (!particle-&gt;IsShortLived())
246    {
247      G4ProcessManager* pmanager = particle-&gt;GetProcessManager();
248      pmanager-&gt;AddProcess(theParallelWorldScoringProcess);
249      pmanager-&gt;SetProcessOrderingToLast(theParallelWorldScoringProcess, idxAtRest);
250      pmanager-&gt;SetProcessOrdering(theParallelWorldScoringProcess, idxAlongStep, 1);
251      pmanager-&gt;SetProcessOrderingToLast(theParallelWorldScoringProcess, idxPostStep);
252    }
253  }
254</programlisting>
255</example>
256</para>   
257
258<para>
259At the end of processing an event, all hits collections made for
260the parallel world are stored in <literal>G4HCofThisEvent</literal> as well
261as those for the mass geometry.
262</para>
263
264
265</sect2>
266</sect1>
Note: See TracBrowser for help on using the repository browser.