Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
B3::DetectorConstruction Class Reference
basic » B3 » B3a

Detector construction class to define materials and geometry. More...

#include <Doxymodules_basic.h>

Inheritance diagram for B3::DetectorConstruction:
G4VUserDetectorConstruction

Public Member Functions

 DetectorConstruction ()
 
 ~DetectorConstruction () override=default
 
G4VPhysicalVolumeConstruct () override
 
void ConstructSDandField () override
 

Private Member Functions

void DefineMaterials ()
 

Private Attributes

G4bool fCheckOverlaps = true
 

Detailed Description

Detector construction class to define materials and geometry.

Crystals are positioned in Ring, with an appropriate rotation matrix. Several copies of Ring are placed in the full detector.

Definition at line 84 of file Doxymodules_basic.h.

Constructor & Destructor Documentation

◆ DetectorConstruction()

B3::DetectorConstruction::DetectorConstruction ( )

Definition at line 53 of file DetectorConstruction.cc.

◆ ~DetectorConstruction()

B3::DetectorConstruction::~DetectorConstruction ( )
overridedefault

Member Function Documentation

◆ Construct()

G4VPhysicalVolume * B3::DetectorConstruction::Construct ( )
override

Definition at line 78 of file DetectorConstruction.cc.

79{
80 // Gamma detector Parameters
81 //
82 G4double cryst_dX = 6*cm, cryst_dY = 6*cm, cryst_dZ = 3*cm;
83 G4int nb_cryst = 32;
84 G4int nb_rings = 9;
85 //
86 G4double dPhi = twopi/nb_cryst, half_dPhi = 0.5*dPhi;
87 G4double cosdPhi = std::cos(half_dPhi);
88 G4double tandPhi = std::tan(half_dPhi);
89 //
90 G4double ring_R1 = 0.5*cryst_dY/tandPhi;
91 G4double ring_R2 = (ring_R1+cryst_dZ)/cosdPhi;
92 //
93 G4double detector_dZ = nb_rings*cryst_dX;
94 //
95 G4NistManager* nist = G4NistManager::Instance();
96 G4Material* default_mat = nist->FindOrBuildMaterial("G4_AIR");
97 G4Material* cryst_mat = nist->FindOrBuildMaterial("Lu2SiO5");
98
99 //
100 // World
101 //
102 G4double world_sizeXY = 2.4*ring_R2;
103 G4double world_sizeZ = 1.2*detector_dZ;
104
105 auto solidWorld = new G4Box("World", // its name
106 0.5 * world_sizeXY, 0.5 * world_sizeXY, 0.5 * world_sizeZ); // its size
107
108 auto logicWorld = new G4LogicalVolume(solidWorld, // its solid
109 default_mat, // its material
110 "World"); // its name
111
112 auto physWorld = new G4PVPlacement(nullptr, // no rotation
113 G4ThreeVector(), // at (0,0,0)
114 logicWorld, // its logical volume
115 "World", // its name
116 nullptr, // its mother volume
117 false, // no boolean operation
118 0, // copy number
119 fCheckOverlaps); // checking overlaps
120
121 //
122 // ring
123 //
124 auto solidRing = new G4Tubs("Ring", ring_R1, ring_R2, 0.5 * cryst_dX, 0., twopi);
125
126 auto logicRing = new G4LogicalVolume(solidRing, // its solid
127 default_mat, // its material
128 "Ring"); // its name
129
130 //
131 // define crystal
132 //
133 G4double gap = 0.5*mm; //a gap for wrapping
134 G4double dX = cryst_dX - gap, dY = cryst_dY - gap;
135 auto solidCryst = new G4Box("crystal", dX / 2, dY / 2, cryst_dZ / 2);
136
137 auto logicCryst = new G4LogicalVolume(solidCryst, // its solid
138 cryst_mat, // its material
139 "CrystalLV"); // its name
140
141 // place crystals within a ring
142 //
143 for (G4int icrys = 0; icrys < nb_cryst ; icrys++) {
144 G4double phi = icrys*dPhi;
145 G4RotationMatrix rotm = G4RotationMatrix();
146 rotm.rotateY(90*deg);
147 rotm.rotateZ(phi);
148 G4ThreeVector uz = G4ThreeVector(std::cos(phi), std::sin(phi),0.);
149 G4ThreeVector position = (ring_R1+0.5*cryst_dZ)*uz;
150 G4Transform3D transform = G4Transform3D(rotm,position);
151
152 new G4PVPlacement(transform, //rotation,position
153 logicCryst, //its logical volume
154 "crystal", //its name
155 logicRing, //its mother volume
156 false, //no boolean operation
157 icrys, //copy number
158 fCheckOverlaps); // checking overlaps
159 }
160
161 //
162 // full detector
163 //
164 auto solidDetector = new G4Tubs("Detector", ring_R1, ring_R2, 0.5 * detector_dZ, 0., twopi);
165
166 auto logicDetector = new G4LogicalVolume(solidDetector, // its solid
167 default_mat, // its material
168 "Detector"); // its name
169
170 //
171 // place rings within detector
172 //
173 G4double OG = -0.5*(detector_dZ + cryst_dX);
174 for (G4int iring = 0; iring < nb_rings ; iring++) {
175 OG += cryst_dX;
176 new G4PVPlacement(nullptr, // no rotation
177 G4ThreeVector(0, 0, OG), // position
178 logicRing, // its logical volume
179 "ring", // its name
180 logicDetector, // its mother volume
181 false, // no boolean operation
182 iring, // copy number
183 fCheckOverlaps); // checking overlaps
184 }
185
186 //
187 // place detector in world
188 //
189 new G4PVPlacement(nullptr, // no rotation
190 G4ThreeVector(), // at (0,0,0)
191 logicDetector, // its logical volume
192 "Detector", // its name
193 logicWorld, // its mother volume
194 false, // no boolean operation
195 0, // copy number
196 fCheckOverlaps); // checking overlaps
197
198 //
199 // patient
200 //
201 G4double patient_radius = 8*cm;
202 G4double patient_dZ = 10*cm;
203 G4Material* patient_mat = nist->FindOrBuildMaterial("G4_BRAIN_ICRP");
204
205 auto solidPatient = new G4Tubs("Patient", 0., patient_radius, 0.5 * patient_dZ, 0., twopi);
206
207 auto logicPatient = new G4LogicalVolume(solidPatient, // its solid
208 patient_mat, // its material
209 "PatientLV"); // its name
210
211 //
212 // place patient in world
213 //
214 new G4PVPlacement(nullptr, // no rotation
215 G4ThreeVector(), // at (0,0,0)
216 logicPatient, // its logical volume
217 "Patient", // its name
218 logicWorld, // its mother volume
219 false, // no boolean operation
220 0, // copy number
221 fCheckOverlaps); // checking overlaps
222
223 // Visualization attributes
224 //
225 logicRing->SetVisAttributes (G4VisAttributes::GetInvisible());
226 logicDetector->SetVisAttributes (G4VisAttributes::GetInvisible());
227
228 // Print materials
229 G4cout << *(G4Material::GetMaterialTable()) << G4endl;
230
231 //always return the physical World
232 //
233 return physWorld;
234}

◆ ConstructSDandField()

void B3::DetectorConstruction::ConstructSDandField ( )
override

Definition at line 238 of file DetectorConstruction.cc.

239{
240 G4SDManager::GetSDMpointer()->SetVerboseLevel(1);
241
242 // declare crystal as a MultiFunctionalDetector scorer
243 //
244 auto cryst = new G4MultiFunctionalDetector("crystal");
245 G4SDManager::GetSDMpointer()->AddNewDetector(cryst);
246 G4VPrimitiveScorer* primitiv1 = new G4PSEnergyDeposit("edep");
247 cryst->RegisterPrimitive(primitiv1);
248 SetSensitiveDetector("CrystalLV",cryst);
249
250 // declare patient as a MultiFunctionalDetector scorer
251 //
252 auto patient = new G4MultiFunctionalDetector("patient");
253 G4SDManager::GetSDMpointer()->AddNewDetector(patient);
254 G4VPrimitiveScorer* primitiv2 = new G4PSDoseDeposit("dose");
255 patient->RegisterPrimitive(primitiv2);
256 SetSensitiveDetector("PatientLV",patient);
257}

◆ DefineMaterials()

void B3::DetectorConstruction::DefineMaterials ( )
private

Definition at line 60 of file DetectorConstruction.cc.

61{
62 G4NistManager* man = G4NistManager::Instance();
63
64 G4bool isotopes = false;
65
66 G4Element* O = man->FindOrBuildElement("O" , isotopes);
67 G4Element* Si = man->FindOrBuildElement("Si", isotopes);
68 G4Element* Lu = man->FindOrBuildElement("Lu", isotopes);
69
70 auto LSO = new G4Material("Lu2SiO5", 7.4 * g / cm3, 3);
71 LSO->AddElement(Lu, 2);
72 LSO->AddElement(Si, 1);
73 LSO->AddElement(O , 5);
74}

Member Data Documentation

◆ fCheckOverlaps

G4bool B3::DetectorConstruction::fCheckOverlaps = true
private

Definition at line 60 of file DetectorConstruction.hh.


The documentation for this class was generated from the following files:

Applications | User Support | Publications | Collaboration