12.07.2015 Views

Geant4 User's Guide for Application Developers - Geant4 - CERN

Geant4 User's Guide for Application Developers - Geant4 - CERN

Geant4 User's Guide for Application Developers - Geant4 - CERN

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Detector Definition and Responsein the parallel world by using this provided world volume. For a logical volume in a parallel world, the materialpointer can be 0. Even if specified a valid material pointer, it will not be taken into account by any physics process.Example 4.18. An example source code of a concrete user parallel world class.#include "MyParallelWorld.hh"#include "G4LogicalVolume.hh"#include "G4VPhysicalVolume.hh"#include "G4Box.hh"#include "G4PVPlacement.hh"MyParallelWorld::MyParallelWorld(G4String worldName):G4VUserParallelWorld(worldName){;}MyParallelWorld::~MyParallelWorld(){;}void MyParallelWorld::Construct(){G4VPhysicalVolume* ghostWorld = GetWorld();G4LogicalVolume* worldLogical = ghostWorld->GetLogicalVolume();// place volumes in the parallel world here. For example ...//G4Box * ghostSolid = new G4Box("GhostdBox", 60.*cm, 60.*cm, 60.*cm);G4LogicalVolume * ghostLogical= new G4LogicalVolume(ghostSolid, 0, "GhostLogical", 0, 0, 0);new G4PVPlacement(0, G4ThreeVector(), ghostLogical,"GhostPhysical", worldLogical, 0, 0);}In case the user needs to define more than one parallel worlds, each of them must be implemented through itsdedicated class. Each parallel world should be registered to the mass geometry class using the method RegisterParallelWorld()available through the class G4VUserDetectorConstruction. The registrationmust be done -be<strong>for</strong>e- the mass world is registed to the G4RunManager.Example 4.19. Typical implementation in the main() to define a parallel world.// RunManager construction//G4RunManager* runManager = new G4RunManager;// mass world//MyDetectorConstruction* massWorld = new MyDetectorConstruction;// parallel world//massWorld->RegisterParallelWorld(new MyParallelWorld("ParallelScoringWorld"));// set mass world to run manager//runManager->SetUserInitialization(massWorld);4.7.3. Detector sensitivity in a parallel worldAny kind of G4VSensitiveDetector object can be defined in volumes in a parallel world, exactly at thesame manner <strong>for</strong> the mass geometry. Once the user defines the sensitive detector in a parallel world, he/she mustdefine a process which takes care of these detectors.The G4ParallelWorldScoringProcess is the class provided <strong>for</strong> this purpose. This process mustbe defined to all kinds of particles which need to be "detected". This process must be ordered justafter G4Transporation and prior to any other physics processes. The name of the parallel worldwhere the G4ParallelWorldScoringProcess is responsible <strong>for</strong>, must be defined through themethod SetParallelWorld() available from the class G4ParallelWorldScoringProcess. Ifthe user has more than one parallel worlds with detectors, <strong>for</strong> each of the parallel worlds, dedicated139

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!