[904] | 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> |
---|
| 13 | Parallel Geometries |
---|
| 14 | </title> |
---|
| 15 | |
---|
| 16 | <!-- ******************* Section (Level#2) ****************** --> |
---|
| 17 | <sect2 id="sect.ParaGeom.ParaWrld"> |
---|
| 18 | <title> |
---|
| 19 | A parallel world |
---|
| 20 | </title> |
---|
| 21 | |
---|
| 22 | <para> |
---|
| 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 parallel navigation functionality |
---|
| 27 | introduced since release 8.2 of Geant4, allows the user to define |
---|
| 28 | more than one worlds simultaneously. |
---|
| 29 | The <literal>G4Transportation</literal> process will see all worlds |
---|
| 30 | simultaneously; steps will be limited by both boundaries of the |
---|
| 31 | mass and parallel geometries. |
---|
| 32 | </para> |
---|
| 33 | |
---|
| 34 | <para> |
---|
| 35 | In a parallel world, the user can define volumes in arbitrary |
---|
| 36 | manner with sensitivity, regions, shower parameterization setups, |
---|
| 37 | and/or importance weight for biasing. Volumes in different worlds |
---|
| 38 | can overlap. |
---|
| 39 | </para> |
---|
| 40 | |
---|
| 41 | <para> |
---|
| 42 | Here are restrictions to be considered for the parallel |
---|
| 43 | geometry: |
---|
| 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> |
---|
| 76 | Defining a parallel world |
---|
| 77 | </title> |
---|
| 78 | |
---|
| 79 | <para> |
---|
| 80 | A parallel world should be defined in the <literal>Construct()</literal> |
---|
| 81 | virtual method of the user's class derived from the abstract base |
---|
| 82 | class <emphasis>G4VUserParallelWorld</emphasis>. |
---|
| 83 | |
---|
| 84 | <example> |
---|
| 85 | <title> |
---|
| 86 | An 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 | |
---|
| 95 | class 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> |
---|
| 111 | A parallel world must have its unique name, which should be set |
---|
| 112 | to the <literal>G4VUserParallelWorld</literal> base class as an argument of |
---|
| 113 | the base class constructor. |
---|
| 114 | </para> |
---|
| 115 | |
---|
| 116 | <para> |
---|
| 117 | The world physical volume of the parallel world is provided by |
---|
| 118 | the <literal>G4RunManager</literal> as a clone of the mass geometry. In the |
---|
| 119 | <literal>Construct()</literal> virtual method of the user's class, the |
---|
| 120 | pointer to this cloned world physical volume is available through |
---|
| 121 | the <literal>GetWorld()</literal> method defined in the base class. The user |
---|
| 122 | should fill the volumes in the parallel world by using this |
---|
| 123 | provided world volume. For a logical volume in a parallel world, |
---|
| 124 | the material pointer can be <literal>0</literal>. Even if specified a |
---|
| 125 | valid material pointer, it will not be taken into account by any |
---|
| 126 | physics process. |
---|
| 127 | |
---|
| 128 | |
---|
| 129 | <example> |
---|
| 130 | <title> |
---|
| 131 | An 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 | |
---|
| 140 | MyParallelWorld::MyParallelWorld(G4String worldName) |
---|
| 141 | <emphasis role="color_red">:G4VUserParallelWorld(worldName)</emphasis> |
---|
| 142 | {;} |
---|
| 143 | |
---|
| 144 | MyParallelWorld::~MyParallelWorld() |
---|
| 145 | {;} |
---|
| 146 | |
---|
| 147 | void MyParallelWorld::Construct() |
---|
| 148 | { |
---|
| 149 | G4VPhysicalVolume* ghostWorld = <emphasis role="color_red">GetWorld();</emphasis> |
---|
| 150 | G4LogicalVolume* worldLogical = ghostWorld->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> |
---|
| 165 | In case the user needs to define more than one parallel worlds, |
---|
| 166 | each of them must be implemented through its dedicated class. Each |
---|
| 167 | parallel world should be registered to the mass geometry class |
---|
| 168 | using the method <literal>RegisterParallelWorld()</literal> available through |
---|
| 169 | the class <literal>G4VUserDetectorConstruction</literal>. The registration |
---|
| 170 | must be done -before- the mass world is registed to the |
---|
| 171 | <literal>G4RunManager</literal>. |
---|
| 172 | |
---|
| 173 | <example> |
---|
| 174 | <title> |
---|
| 175 | Typical implementation in the <literal>main()</literal> to define a parallel |
---|
| 176 | world. |
---|
| 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-><emphasis role="color_red">RegisterParallelWorld</emphasis>(new MyParallelWorld("ParallelScoringWorld")); |
---|
| 190 | |
---|
| 191 | // set mass world to run manager |
---|
| 192 | // |
---|
| 193 | runManager->SetUserInitialization(massWorld); |
---|
| 194 | </programlisting> |
---|
| 195 | </example> |
---|
| 196 | </para> |
---|
| 197 | |
---|
| 198 | </sect2> |
---|
| 199 | |
---|
| 200 | <!-- ******************* Section (Level#2) ****************** --> |
---|
| 201 | <sect2 id="sect.ParaGeom.SenstivParaWrld"> |
---|
| 202 | <title> |
---|
| 203 | Detector sensitivity in a parallel world |
---|
| 204 | </title> |
---|
| 205 | |
---|
| 206 | <para> |
---|
| 207 | Any kind of <literal>G4VSensitiveDetector</literal> object can be defined |
---|
| 208 | in volumes in a parallel world, exactly at the same manner for the |
---|
| 209 | mass geometry. Once the user defines the sensitive detector in a |
---|
| 210 | parallel world, he/she must define a process which takes care of |
---|
| 211 | these detectors. |
---|
| 212 | </para> |
---|
| 213 | |
---|
| 214 | <para> |
---|
| 215 | The <literal>G4ParallelWorldScoringProcess</literal> is the class provided |
---|
| 216 | for this purpose. This process must be defined to all kinds of |
---|
| 217 | particles which need to be "detected". This process must be ordered |
---|
| 218 | <emphasis role="color_red"> |
---|
| 219 | just after <literal>G4Transporation</literal> and prior |
---|
| 220 | to any other physics processes</emphasis>. The name of the parallel |
---|
| 221 | world where the <literal>G4ParallelWorldScoringProcess</literal> is |
---|
| 222 | responsible 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 |
---|
| 225 | one parallel worlds with detectors, for each of the parallel |
---|
| 226 | worlds, dedicated <literal>G4ParallelWorldScoringProcess</literal> objects |
---|
| 227 | must be instantiated with the name of each parallel world |
---|
| 228 | respectively and registered to the particles. |
---|
| 229 | |
---|
| 230 | <example> |
---|
| 231 | <title> |
---|
| 232 | Define <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-><emphasis role="color_red">SetParallelWorld</emphasis>("ParallelScoringWorld"); |
---|
| 240 | |
---|
| 241 | theParticleIterator->reset(); |
---|
| 242 | while( (*theParticleIterator)() ) |
---|
| 243 | { |
---|
| 244 | G4ParticleDefinition* particle = theParticleIterator->value(); |
---|
| 245 | if (!particle->IsShortLived()) |
---|
| 246 | { |
---|
| 247 | G4ProcessManager* pmanager = particle->GetProcessManager(); |
---|
| 248 | pmanager->AddProcess(theParallelWorldScoringProcess); |
---|
| 249 | pmanager->SetProcessOrderingToLast(theParallelWorldScoringProcess, idxAtRest); |
---|
| 250 | pmanager->SetProcessOrdering(theParallelWorldScoringProcess, idxAlongStep, 1); |
---|
| 251 | pmanager->SetProcessOrderingToLast(theParallelWorldScoringProcess, idxPostStep); |
---|
| 252 | } |
---|
| 253 | } |
---|
| 254 | </programlisting> |
---|
| 255 | </example> |
---|
| 256 | </para> |
---|
| 257 | |
---|
| 258 | <para> |
---|
| 259 | At the end of processing an event, all hits collections made for |
---|
| 260 | the parallel world are stored in <literal>G4HCofThisEvent</literal> as well |
---|
| 261 | as those for the mass geometry. |
---|
| 262 | </para> |
---|
| 263 | |
---|
| 264 | |
---|
| 265 | </sect2> |
---|
| 266 | </sect1> |
---|