| 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">
|
|---|
| 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.7.
|
|---|
| 9 | Parallel 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.
|
|---|
| 11 | Detector 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.
|
|---|
| 13 | Parallel 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>
|
|---|
| 17 | As of Geant4 release 8.2, this functionality for defining parallel
|
|---|
| 18 | geometries is still in <span class="emphasis"><em>beta</em></span> release. We appreciate your
|
|---|
| 19 | feedback.
|
|---|
| 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.
|
|---|
| 21 | A parallel world
|
|---|
| 22 | </h3></div></div></div><p>
|
|---|
| 23 | Occasionally, it is not straightforward to define geometries for
|
|---|
| 24 | sensitive detectors, importance geometries or envelopes for shower
|
|---|
| 25 | parameterization to be coherently assigned to volumes in the
|
|---|
| 26 | tracking (mass) geometry. The new parallel navigation functionality
|
|---|
| 27 | allows the user to define more than one worlds simultaneously. The
|
|---|
| 28 | new <code class="literal">G4Transportation</code> process will see all worlds
|
|---|
| 29 | simultaneously; steps will be limited by both boundaries of the
|
|---|
| 30 | mass geometry and parallel geometries.
|
|---|
| 31 | </p><p>
|
|---|
| 32 | In a parallel world, the user can define volumes in arbitrary
|
|---|
| 33 | manner with sensitivity, regions, shower parameterization setups,
|
|---|
| 34 | and/or importance weight for biasing. Volumes in different worlds
|
|---|
| 35 | can overlap.
|
|---|
| 36 | </p><p>
|
|---|
| 37 | Here are restrictions to be considered for the parallel
|
|---|
| 38 | geometry:
|
|---|
| 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.
|
|---|
| 59 | Detector 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.
|
|---|
| 63 | Defining a parallel world
|
|---|
| 64 | </h3></div></div></div><p>
|
|---|
| 65 | A parallel world should be defined in the <code class="literal">Construct()</code>
|
|---|
| 66 | virtual method of the user's class derived from the abstract base
|
|---|
| 67 | class <span class="emphasis"><em>G4VUserParallelWorld</em></span>.
|
|---|
| 68 |
|
|---|
| 69 | </p><div class="example"><a name="id433212"></a><p class="title"><b>Example 4.17.
|
|---|
| 70 | An 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 |
|
|---|
| 78 | class 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>
|
|---|
| 91 | A parallel world must have its unique name, which should be set
|
|---|
| 92 | to the <code class="literal">G4VUserParallelWorld</code> base class as an argument of
|
|---|
| 93 | the base class constructor.
|
|---|
| 94 | </p><p>
|
|---|
| 95 | The world physical volume of the parallel world is provided by
|
|---|
| 96 | the <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
|
|---|
| 98 | pointer to this cloned world physical volume is available through
|
|---|
| 99 | the <code class="literal">GetWorld()</code> method defined in the base class. The user
|
|---|
| 100 | should fill the volumes in the parallel world by using this
|
|---|
| 101 | provided world volume. For a logical volume in a parallel world,
|
|---|
| 102 | the material pointer can be <code class="literal">NULL</code>. Even if specified a
|
|---|
| 103 | valid material pointer, it will not be taken into account by any
|
|---|
| 104 | physics process.
|
|---|
| 105 |
|
|---|
| 106 |
|
|---|
| 107 | </p><div class="example"><a name="id433280"></a><p class="title"><b>Example 4.18.
|
|---|
| 108 | An 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 |
|
|---|
| 116 | MyParallelWorld::MyParallelWorld(G4String worldName)
|
|---|
| 117 | <span class="color_red">:G4VUserParallelWorld(worldName)</span>
|
|---|
| 118 | {;}
|
|---|
| 119 |
|
|---|
| 120 | MyParallelWorld::~MyParallelWorld()
|
|---|
| 121 | {;}
|
|---|
| 122 |
|
|---|
| 123 | void MyParallelWorld::Construct()
|
|---|
| 124 | {
|
|---|
| 125 | G4VPhysicalVolume* ghostWorld = <span class="color_red">GetWorld();</span>
|
|---|
| 126 | G4LogicalVolume* worldLogical = ghostWorld->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>
|
|---|
| 138 | In case the user needs to define more than one parallel worlds,
|
|---|
| 139 | each of them must be implemented through its dedicated class. Each
|
|---|
| 140 | parallel world should be registered to the mass geometry class
|
|---|
| 141 | using the method <code class="literal">RegisterParallelWorld()</code> available through
|
|---|
| 142 | the class <code class="literal">G4VUserDetectorConstruction</code>. The registration
|
|---|
| 143 | must 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.
|
|---|
| 147 | Typical implementation in the <code class="literal">main()</code> to define a parallel
|
|---|
| 148 | world.
|
|---|
| 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-><span class="color_red">RegisterParallelWorld</span>(new MyParallelWorld("ParallelScoringWorld"));
|
|---|
| 161 |
|
|---|
| 162 | // set mass world to run manager
|
|---|
| 163 | //
|
|---|
| 164 | runManager->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.
|
|---|
| 167 | Detector sensitivity in a parallel world
|
|---|
| 168 | </h3></div></div></div><p>
|
|---|
| 169 | Any kind of <code class="literal">G4VSensitiveDetector</code> object can be defined
|
|---|
| 170 | in volumes in a parallel world, exactly at the same manner for the
|
|---|
| 171 | mass geometry. Once the user defines the sensitive detector in a
|
|---|
| 172 | parallel world, he/she must define a process which takes care of
|
|---|
| 173 | these detectors.
|
|---|
| 174 | </p><p>
|
|---|
| 175 | The <code class="literal">G4ParallelWorldScoringProcess</code> is the class provided
|
|---|
| 176 | for this purpose. This process must be defined to all kinds of
|
|---|
| 177 | particles which need to be "detected". This process must be ordered
|
|---|
| 178 | <span class="color_red">
|
|---|
| 179 | just after <code class="literal">G4Transporation</code> and prior
|
|---|
| 180 | to any other physics processes</span>. The name of the parallel
|
|---|
| 181 | world where the <code class="literal">G4ParallelWorldScoringProcess</code> is
|
|---|
| 182 | responsible 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
|
|---|
| 185 | one parallel worlds with detectors, for each of the parallel
|
|---|
| 186 | worlds, dedicated <code class="literal">G4ParallelWorldScoringProcess</code> objects
|
|---|
| 187 | must be instantiated with the name of each parallel world
|
|---|
| 188 | respectively and registered to the particles.
|
|---|
| 189 |
|
|---|
| 190 | </p><div class="example"><a name="id433442"></a><p class="title"><b>Example 4.20.
|
|---|
| 191 | Define <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-><span class="color_red">SetParallelWorld</span>("ParallelScoringWorld");
|
|---|
| 198 |
|
|---|
| 199 | theParticleIterator->reset();
|
|---|
| 200 | while( (*theParticleIterator)() )
|
|---|
| 201 | {
|
|---|
| 202 | G4ParticleDefinition* particle = theParticleIterator->value();
|
|---|
| 203 | if (!particle->IsShortLived())
|
|---|
| 204 | {
|
|---|
| 205 | G4ProcessManager* pmanager = particle->GetProcessManager();
|
|---|
| 206 | pmanager->AddProcess(theParallelWorldScoringProcess);
|
|---|
| 207 | pmanager->SetProcessOrderingToLast(theParallelWorldScoringProcess, idxAtRest);
|
|---|
| 208 | pmanager->SetProcessOrdering(theParallelWorldScoringProcess, idxAlongStep, 1);
|
|---|
| 209 | pmanager->SetProcessOrderingToLast(theParallelWorldScoringProcess, idxPostStep);
|
|---|
| 210 | }
|
|---|
| 211 | }
|
|---|
| 212 | </pre></div></div><p><br class="example-break">
|
|---|
| 213 | </p><p>
|
|---|
| 214 | At the end of processing an event, all hits collections made for
|
|---|
| 215 | the parallel world are stored in <code class="literal">G4HCofThisEvent</code> as well
|
|---|
| 216 | as 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.
|
|---|
| 218 | Object 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.
|
|---|
| 220 | Command-based scoring
|
|---|
| 221 | </td></tr></table></div></body></html>
|
|---|