Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ML2ReadOutGeometry.cc
Go to the documentation of this file.
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 // The code was written by :
27 // ^Claudio Andenna claudio.andenna@ispesl.it, claudio.andenna@iss.infn.it
28 // *Barbara Caccia barbara.caccia@iss.it
29 // with the support of Pablo Cirrone (LNS, INFN Catania Italy)
30 // with the contribute of Alessandro Occhigrossi*
31 //
32 // ^INAIL DIPIA - ex ISPESL and INFN Roma, gruppo collegato Sanità, Italy
33 // *Istituto Superiore di Sanità and INFN Roma, gruppo collegato Sanità, Italy
34 // Viale Regina Elena 299, 00161 Roma (Italy)
35 // tel (39) 06 49902246
36 // fax (39) 06 49387075
37 //
38 // more information:
39 // http://g4advancedexamples.lngs.infn.it/Examples/medical-linac
40 //
41 //*******************************************************//
42 
43 #include "ML2ReadOutGeometry.hh"
44 
45 #include "G4SystemOfUnits.hh"
46 #include "G4VPhysicalVolume.hh"
47 #include "G4LogicalVolume.hh"
48 #include "G4Box.hh"
49 #include "G4PVPlacement.hh"
50 #include "G4NistManager.hh"
51 #include "ML2DummySD.hh"
52 #include "G4PVReplica.hh"
53 
55 {
56  // Build the world volume
57  G4Material *Vacuum=G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic");
58  G4ThreeVector halfSizeWorld, ctr;
59  ctr.set(0.*mm, 0.*mm, 0.*mm);
60  halfSizeWorld.set(3000.*mm, 3000*mm, 3000*mm);
61  G4Box *ROphmWorldB = new G4Box("ROphmWorldG", halfSizeWorld.getX(), halfSizeWorld.getY(), halfSizeWorld.getZ());
62  G4LogicalVolume *ROphmWorldLV = new G4LogicalVolume(ROphmWorldB, Vacuum, "ROphmWorldL", 0, 0, 0);
63  ROPhyVol= new G4PVPlacement(0, ctr, "ROphmWorldPV", ROphmWorldLV, 0, false, 0);
64 }
65 
67 {
68  delete ROPhyVol;
69 }
70 
72 {
73  centre=ctr;
74  halfSize=hSiz;
75  NumberOfVoxelsAlongX=NVX;
76  NumberOfVoxelsAlongY=NVY;
77  NumberOfVoxelsAlongZ=NVZ;
78 }
79 
81 {
82  // Build RO Zone
83  G4Material *Vacuum=G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic");
84  G4Box *ROBox = new G4Box("ROBox", halfSize.getX(), halfSize.getY(), halfSize.getZ());
85  G4LogicalVolume *ROLV = new G4LogicalVolume(ROBox, Vacuum, "ROLV", 0, 0, 0);
86  G4VPhysicalVolume *ROPV;
87  ROPV = new G4PVPlacement(0, centre, "ROPV", ROLV, ROPhyVol, false, 0);
88 
89  // ROGeomtry: Voxel division
90 
91  G4double halfXVoxelDimensionX, halfXVoxelDimensionY, halfXVoxelDimensionZ;
92 
93  halfXVoxelDimensionX=halfSize.getX()/NumberOfVoxelsAlongX;
94  halfXVoxelDimensionY=halfSize.getY()/NumberOfVoxelsAlongY;
95  halfXVoxelDimensionZ=halfSize.getZ()/NumberOfVoxelsAlongZ;
96 
97  G4double voxelXThicknessX = 2*halfXVoxelDimensionX;
98  G4double voxelXThicknessY = 2*halfXVoxelDimensionY;
99  G4double voxelXThicknessZ = 2*halfXVoxelDimensionZ;
100 
101 
102  // X division first... slice along X axis
103  G4Box *ROPhantomXDivision = new G4Box("ROPhantomXDivision",
104  halfXVoxelDimensionX,
105  halfSize.getY(),
106  halfSize.getZ());
107 
108  G4LogicalVolume *ROPhantomXDivisionLog = new G4LogicalVolume(ROPhantomXDivision,
109  Vacuum,
110  "ROPhantomXDivisionLog",
111  0,0,0);
112  G4VPhysicalVolume *ROPhantomXDivisionPhys;
113  ROPhantomXDivisionPhys = new G4PVReplica("ROPhantomXDivisionPhys",
114  ROPhantomXDivisionLog,
115  ROPV,
116  kXAxis,
117  NumberOfVoxelsAlongX,
118  voxelXThicknessX,
119  -halfSize.getX());
120  // ...then Z division
121 
122  G4Box *ROPhantomZDivision = new G4Box("ROPhantomZDivision",
123  halfXVoxelDimensionX,
124  halfSize.getY(),
125  halfXVoxelDimensionZ);
126 
127  G4LogicalVolume *ROPhantomZDivisionLog = new G4LogicalVolume(ROPhantomZDivision,
128  Vacuum,
129  "ROPhantomZDivisionLog",
130  0,0,0);
131  G4VPhysicalVolume *ROPhantomZDivisionPhys;
132  ROPhantomZDivisionPhys = new G4PVReplica("ROPhantomZDivisionPhys",
133  ROPhantomZDivisionLog,
134  ROPhantomXDivisionPhys,
135  kZAxis,
136  NumberOfVoxelsAlongZ,
137  voxelXThicknessZ,
138  -halfSize.getZ());
139  // ...then Y division
140 
141  G4Box *ROPhantomYDivision = new G4Box("ROPhantomYDivision",
142  halfXVoxelDimensionX,
143  halfXVoxelDimensionY,
144  halfXVoxelDimensionZ);
145 
146  G4LogicalVolume *ROPhantomYDivisionLog = new G4LogicalVolume(ROPhantomYDivision,
147  Vacuum,
148  "ROPhantomYDivisionLog",
149  0,0,0);
150  ROPhantomYDivisionPhys = new G4PVReplica("ROPhantomYDivisionPhys",
151  ROPhantomYDivisionLog,
152  ROPhantomZDivisionPhys,
153  kYAxis,
154  NumberOfVoxelsAlongY,
155  voxelXThicknessY,
156  -halfSize.getY());
157 
158  // Sensitive detector doesn't matter which logical volume is used
159  G4VSensitiveDetector *sensDet=new CML2DummySD("Dummy ROG phantom");
160  ROPhantomYDivisionLog->SetSensitiveDetector(sensDet);
161 
162  return ROPhyVol;
163 }
void set(double x, double y, double z)
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
Definition: G4Box.hh:63
double getY() const
int G4int
Definition: G4Types.hh:78
static G4NistManager * Instance()
double getX() const
G4VPhysicalVolume * Build()
double getZ() const
void setBuildData(G4ThreeVector centre, G4ThreeVector halfSize, G4int NumberOfVoxelsAlongX, G4int NumberOfVoxelsAlongY, G4int NumberOfVoxelsAlongZ)
double G4double
Definition: G4Types.hh:76
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)