Loading...
Searching...
No Matches
Par04ParallelFastWorld.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
27// User Classes
31
32// G4 Classes
33#include "G4NistManager.hh"
34#include "G4Material.hh"
35#include "G4ThreeVector.hh"
36#include "G4PVPlacement.hh"
37#include "G4PVReplica.hh"
38#include "G4VPhysicalVolume.hh"
39#include "G4LogicalVolume.hh"
40#include "G4Tubs.hh"
41#include "G4SDManager.hh"
42#include "G4VisAttributes.hh"
43#include "G4Colour.hh"
44#include "G4SystemOfUnits.hh"
45#include "G4AutoDelete.hh"
46#include "globals.hh"
47#include "G4UnitsTable.hh"
48
49
50//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51
53 const Par04DetectorConstruction* aMassDetector,
54 const Par04ParallelFullWorld* aParallelFull)
55 :G4VUserParallelWorld(aWorldName), fMassDetector(aMassDetector), fParallelFull(aParallelFull) {
57}
58
59//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
60
62
63//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
64
66{
67 // In parallel world material does not matter
68 G4Material* dummy = nullptr;
69
70 // Build parallel geometry:
71 auto parallelLogicalVolume = GetWorld()->GetLogicalVolume();
72
73 G4double detectorInnerRadius = fMassDetector->GetInnerRadius();
74 G4double detectorLength = fMassDetector->GetLength();
75 G4double fullLayerThickness = fMassDetector->GetAbsorberThickness(0)
77 fLayerThickness = fullLayerThickness;
78 // Get an updated value
82 G4double detectorRadius = fNbOfLayers * fullLayerThickness;
83 G4double detectorOuterRadius = detectorInnerRadius + detectorRadius;
84 G4double rowThickness = detectorLength / fNbOfRows;
85 G4double full2Pi = 2.* CLHEP::pi * rad;
86 Print();
87
88 // Insert cells to create a readout structure that contains both passive and active materials
89 // Mostly a copy from the detector construction
90 auto solidDetector = new G4Tubs("Detector", // name
91 detectorInnerRadius, // inner radius
92 detectorOuterRadius, // outer radius
93 detectorLength / 2., // half-width in Z
94 0, // start angle
95 full2Pi); // delta angle
96 auto logicDetector = new G4LogicalVolume(solidDetector, // solid
97 dummy, // material
98 "Detector"); // name
99 new G4PVPlacement(0, // no rotation
100 G4ThreeVector(0, 0, 0), // detector centre at (0,0,0)
101 logicDetector, // logical volume
102 "Detector", // name
103 parallelLogicalVolume, // mother volume
104 false, // not used
105 9999, // copy number
106 true); // check overlaps
107
108
109 //--------- Detector cylinder (division along z axis) ---------
110 auto solidRow = new G4Tubs("Row", detectorInnerRadius, detectorOuterRadius, rowThickness / 2.,
111 0, full2Pi);
112
113 auto logicRow = new G4LogicalVolume(solidRow, dummy, "Row");
114 if (fNbOfRows > 1)
115 new G4PVReplica("Row",
116 logicRow,
117 logicDetector,
118 kZAxis,
119 fNbOfRows,
120 rowThickness);
121 else
122 new G4PVPlacement(0,
123 G4ThreeVector(),
124 logicRow,
125 "Row",
126 logicDetector,
127 false,
128 0);
129
130 //--------- Detector slices (division in azimuthal angle) ---------
131 G4double cellPhi = full2Pi / fNbOfSlices;
132 auto solidSlice = new G4Tubs("Slice", detectorInnerRadius, detectorOuterRadius, rowThickness/2,
133 0, cellPhi);
134 auto logicSlice = new G4LogicalVolume(solidSlice,
135 dummy,
136 "Slice");
137 if(fNbOfSlices>1) {
138 new G4PVReplica("Slice",
139 logicSlice,
140 logicRow,
141 kPhi,
143 cellPhi,
144 -cellPhi);
145 } else {
146 new G4PVPlacement(0,
147 G4ThreeVector(),
148 logicSlice,
149 "Slice",
150 logicRow,
151 false,
152 0);
153 }
154
155 //--------- Detector cells (division along radial axis) ---------
156 G4VisAttributes attribs;
157 attribs.SetColour(G4Colour(0, 1, 0, 0.1));
158 attribs.SetForceSolid(true);
159 if(fNbOfLayers>1) {
160 auto solidCell = new G4Tubs("Cell", detectorInnerRadius,
161 detectorInnerRadius + fLayerThickness,
162 rowThickness/2, 0, cellPhi);
163 fLogicalCell.push_back(new G4LogicalVolume(solidCell, dummy, "Cell_0"));
164 new G4PVReplica("Cell",
165 fLogicalCell.back(),
166 logicSlice,
167 kRho,
170 detectorInnerRadius);
171 } else {
172 auto solidCell = new G4Tubs("Cell", detectorInnerRadius,
173 detectorInnerRadius + fLayerThickness,
174 rowThickness/2, 0, cellPhi);
175 fLogicalCell.push_back(new G4LogicalVolume(solidCell, dummy, "Cell"));
176 fLogicalCell.back()->SetVisAttributes(attribs);
177 new G4PVPlacement(0,
178 G4ThreeVector(),
179 fLogicalCell.back(),
180 "Cell",
181 logicSlice,
182 false,
183 0);
184 }
185 Print();
186}
187
188//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
189
191{
192 // -- sensitive detectors:
193 G4SDManager* SDman = G4SDManager::GetSDMpointer();
196 SDman->AddNewDetector(caloSD);
197 for(const auto& logicalCell: fLogicalCell)
198 logicalCell->SetSensitiveDetector(caloSD);
199}
200
201//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
202
204 G4cout << "\n------------------------------------------------------"
205 << "\n Readout geometry with physics layout is set in parallel geometry:\t"
206 << "\n Cylindrical detector is divided along radius (layers), phi (slices), and z (rows)."
207 << "\n Number of layers is determined by number of layers set in detector construction. "
208 << "\n- Number of layers: " << fNbOfLayers << "\n------- Number of slices: " << fNbOfSlices
209 << "\n- Number of rows: " << fNbOfRows;
210 G4cout << "\n Readout will collect energy from fast simulation.\n------- Thickness is "
211 << "a sum of all absorbers" << " = " << G4BestUnit(fLayerThickness, "Length")
212 << "\n-----------------------------------------------------" << G4endl;
213}
G4double GetLength() const
Get length of the cylindrical detector (along z-axis)
G4double GetAbsorberThickness(const std::size_t aLayer) const
Get thickness of the layer.
G4int GetNbOfLayers() const
Get number of layers.
G4double GetInnerRadius() const
Get inner radius of the cylindrical detector.
Par04ParallelFastWorld(G4String aWorldName, const Par04DetectorConstruction *aMassDetector, const Par04ParallelFullWorld *aParallelFull)
std::vector< G4LogicalVolume * > fLogicalCell
virtual void Construct() final
const Par04ParallelFullWorld * fParallelFull
virtual void ConstructSD() final
const Par04DetectorConstruction * fMassDetector
Messenger that allows to modify geometry.
G4int GetNbOfRows() const
Get number of rows.
G4int GetNbOfSlices() const
Get number of slices.

Applications | User Support | Publications | Collaboration