1 | // |
---|
2 | // ******************************************************************** |
---|
3 | // * License and Disclaimer * |
---|
4 | // * * |
---|
5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
7 | // * conditions of the Geant4 Software License, included in the file * |
---|
8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
9 | // * include a list of copyright holders. * |
---|
10 | // * * |
---|
11 | // * Neither the authors of this software system, nor their employing * |
---|
12 | // * institutes,nor the agencies providing financial support for this * |
---|
13 | // * work make any representation or warranty, express or implied, * |
---|
14 | // * regarding this software system or assume any liability for its * |
---|
15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
16 | // * for the full disclaimer and the limitation of liability. * |
---|
17 | // * * |
---|
18 | // * This code implementation is the result of the scientific and * |
---|
19 | // * technical work of the GEANT4 collaboration. * |
---|
20 | // * By using, copying, modifying or distributing the software (or * |
---|
21 | // * any work based on the software) you agree to acknowledge its * |
---|
22 | // * use in resulting scientific publications, and indicate your * |
---|
23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
24 | // ******************************************************************** |
---|
25 | // |
---|
26 | // |
---|
27 | // $Id: Test2ParallelWorld.cc,v 1.4 2010/11/03 08:48:57 taso Exp $ |
---|
28 | // GEANT4 tag $Name: $ |
---|
29 | // |
---|
30 | // |
---|
31 | |
---|
32 | #include "Test2ParallelWorld.hh" |
---|
33 | #include "Test2GeometryConstruction.hh" |
---|
34 | |
---|
35 | #include "G4Material.hh" |
---|
36 | #include "G4Box.hh" |
---|
37 | #include "G4LogicalVolume.hh" |
---|
38 | #include "G4PVPlacement.hh" |
---|
39 | #include "G4PVReplica.hh" |
---|
40 | #include "G4PVDivision.hh" |
---|
41 | #include "G4VisAttributes.hh" |
---|
42 | #include "G4Colour.hh" |
---|
43 | #include "G4ios.hh" |
---|
44 | |
---|
45 | |
---|
46 | Test2ParallelWorld::Test2ParallelWorld(G4String worldName) |
---|
47 | :G4VUserParallelWorld(worldName), fbConstructed(false), |
---|
48 | SDC(0),PSC(0),fSensitivityType(0) |
---|
49 | {;} |
---|
50 | |
---|
51 | Test2ParallelWorld::~Test2ParallelWorld() |
---|
52 | { |
---|
53 | if(SDC) delete SDC; |
---|
54 | if(PSC) delete PSC; |
---|
55 | } |
---|
56 | |
---|
57 | void Test2ParallelWorld::Construct() { |
---|
58 | |
---|
59 | if(!fbConstructed) |
---|
60 | { |
---|
61 | fbConstructed = true; |
---|
62 | SetupGeometry(); |
---|
63 | switch ( fSensitivityType ){ |
---|
64 | case 0: |
---|
65 | break; |
---|
66 | case 1: |
---|
67 | SetupPSDetectors(); |
---|
68 | break; |
---|
69 | case 2: |
---|
70 | SetupSDDetectors(); |
---|
71 | break; |
---|
72 | default: |
---|
73 | break; |
---|
74 | } |
---|
75 | } |
---|
76 | } |
---|
77 | |
---|
78 | void Test2ParallelWorld::SetupGeometry() |
---|
79 | { |
---|
80 | // |
---|
81 | // World |
---|
82 | // |
---|
83 | G4VPhysicalVolume * ghostWorld = GetWorld(); |
---|
84 | |
---|
85 | G4cout << "Test2ParallelWorld::SetupGeometry"<<G4endl; |
---|
86 | // |
---|
87 | // 3D nested phantom |
---|
88 | // |
---|
89 | // parameters |
---|
90 | phantomSize[0] = 1.*m; |
---|
91 | phantomSize[1] = 1.*m; |
---|
92 | phantomSize[2] = 1.*m; |
---|
93 | nSegment[0] = 10; |
---|
94 | nSegment[1] = 10; |
---|
95 | nSegment[2] = 10; |
---|
96 | |
---|
97 | GEOM = |
---|
98 | new Test2GeometryConstruction(phantomSize,NULL,nSegment); |
---|
99 | fWorldPhys = GEOM->ConstructGeometry(ghostWorld); |
---|
100 | |
---|
101 | } |
---|
102 | |
---|
103 | |
---|
104 | #include "G4SDManager.hh" |
---|
105 | #include "Test2SDConstruction.hh" |
---|
106 | |
---|
107 | void Test2ParallelWorld::SetupSDDetectors() { |
---|
108 | G4LogicalVolume* phantomLogical = GEOM->GetSensitiveLogical(); |
---|
109 | |
---|
110 | SDC = new Test2SDConstruction("ParallelWorldSD",nSegment); |
---|
111 | SDC->SetupSensitivity(phantomLogical); |
---|
112 | } |
---|
113 | |
---|
114 | #include "Test2PSConstruction.hh" |
---|
115 | |
---|
116 | void Test2ParallelWorld::SetupPSDetectors() { |
---|
117 | G4LogicalVolume* phantomLogical = GEOM->GetSensitiveLogical(); |
---|
118 | |
---|
119 | PSC = new Test2PSConstruction("ParallelWorldPS",nSegment); |
---|
120 | PSC->SetupSensitivity(phantomLogical); |
---|
121 | } |
---|
122 | |
---|