Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Par03DetectorConstruction Class Reference

Detector construction. More...

#include <Doxymodules_parameterisations.h>

Inheritance diagram for Par03DetectorConstruction:
G4VUserDetectorConstruction

Public Member Functions

 Par03DetectorConstruction ()
 
virtual ~Par03DetectorConstruction ()
 
virtual G4VPhysicalVolumeConstruct () final
 
virtual void ConstructSDandField () final
 
void SetRadius (G4double aRadius)
 
G4double GetRadius () const
 
void SetLength (G4double aLength)
 
G4double GetLength () const
 
void SetMaterial (const G4String &aMaterial)
 
G4String GetMaterial () const
 
void SetNbOfLayers (G4int aNumber)
 
G4int GetNbOfLayers () const
 
void SetNbOfRhoCells (G4int aNumber)
 
G4int GetNbOfRhoCells () const
 
void SetNbOfPhiCells (G4int aNumber)
 
G4int GetNbOfPhiCells () const
 
void Print () const
 

Private Attributes

Par03DetectorMessengerfDetectorMessenger
 Messenger that allows to modify geometry.
 
G4LogicalVolumefLogicCell = nullptr
 Logical volume of replicated cell.
 
G4double fWorldSize = 10 * m
 World size (in each X, Y, Z dimension)
 
G4double fDetectorRadius = 10 * cm
 Radius of the cylindrical detector.
 
G4double fDetectorLength = 30 * cm
 Length of the cylindrical detector (along z axis)
 
G4MaterialfDetectorMaterial = nullptr
 Material of the detector.
 
G4int fNbOfLayers = 10
 Number of layers = slices along z axis.
 
G4int fNbOfRhoCells = 10
 Number of cells along radius.
 
G4int fNbOfPhiCells = 10
 Number of cells in azimuthal angle.
 

Detailed Description

Detector construction.

Creates a cylindrical detector, with cylinder axis along Z-axis. It is placed in the world volume so that its bases are located at z=0 and z=Length. Dimensions of the detector (Radius and Length) and material can be set using the UI commands. Readout geometry of the detector is created, and can be set by UI commands. Cells are created along z-axis, azimuthal angle, and radius (cylindrical segmentation). Sensitive detector Par03SensitiveDetector is attached to the cell volume. Region for the detector is created as an envelope of the fast simulation.

Definition at line 60 of file Doxymodules_parameterisations.h.

Constructor & Destructor Documentation

◆ Par03DetectorConstruction()

Par03DetectorConstruction::Par03DetectorConstruction ( )

Definition at line 50 of file Par03DetectorConstruction.cc.

52{
54
55 G4NistManager* nistManager = G4NistManager::Instance();
56 fDetectorMaterial = nistManager->FindOrBuildMaterial("G4_Fe");
57}
G4Material * fDetectorMaterial
Material of the detector.
Par03DetectorMessenger * fDetectorMessenger
Messenger that allows to modify geometry.

◆ ~Par03DetectorConstruction()

Par03DetectorConstruction::~Par03DetectorConstruction ( )
virtualdefault

Member Function Documentation

◆ Construct()

G4VPhysicalVolume * Par03DetectorConstruction::Construct ( )
finalvirtual

Definition at line 65 of file Par03DetectorConstruction.cc.

66{
67 //--------- Material definition ---------
68 G4NistManager* nistManager = G4NistManager::Instance();
69 G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR");
70
71 //--------- Derived dimensions ---------
72 G4double full2Pi = 2. * CLHEP::pi * rad;
73 G4double layerThickness = fDetectorLength / fNbOfLayers;
74 G4double cellPhi = full2Pi / fNbOfPhiCells;
75 G4double cellDR = fDetectorRadius / fNbOfRhoCells;
76
77 //--------- World ---------
78 auto fSolidWorld = new G4Box("World", // name
79 fWorldSize / 2., // half-width in X
80 fWorldSize / 2., // half-width in Y
81 fWorldSize / 2.); // half-width in Z
82 auto fLogicWorld = new G4LogicalVolume(fSolidWorld, // solid
83 air, // material
84 "World"); // name
85 auto fPhysicWorld = new G4PVPlacement(0, // no rotation
86 G4ThreeVector(), // at (0,0,0)
87 fLogicWorld, // logical volume
88 "World", // name
89 0, // mother volume
90 false, // not used
91 999, // copy number
92 true); // copy number
93
94 //--------- Detector envelope ---------
95 auto fSolidDetector = new G4Tubs("Detector", // name
96 0, // inner radius
97 fDetectorRadius, // outer radius
98 fDetectorLength / 2., // half-width in Z
99 0, // start angle
100 full2Pi); // delta angle
101 auto fLogicDetector = new G4LogicalVolume(fSolidDetector, // solid
102 fDetectorMaterial, // material
103 "Detector"); // name
104 new G4PVPlacement(
105 0, // no rotation
106 G4ThreeVector(0, 0,
107 fDetectorLength / 2), // detector face starts at (0,0,0)
108 fLogicDetector, // logical volume
109 "Detector", // name
110 fLogicWorld, // mother volume
111 false, // not used
112 99, // copy number
113 true); // check overlaps
114
115 // Region for fast simulation
116 auto detectorRegion = new G4Region("DetectorRegion");
117 detectorRegion->AddRootLogicalVolume(fLogicDetector);
118
119 //--------- Readout geometry ---------
120 // Layers (along z)
121 auto fSolidLayer = new G4Tubs("Layer", // name
122 0, // inner radius
123 fDetectorRadius, // outer radius
124 layerThickness / 2., // half-width in Z
125 0, // start angle
126 full2Pi); // delta angle
127 auto fLogicLayer = new G4LogicalVolume(fSolidLayer, // solid
128 air, // material
129 "Layer"); // name
130 if(fNbOfLayers > 1)
131 new G4PVReplica("Layer", // name
132 fLogicLayer, // logical volume
133 fLogicDetector, // mother volume
134 kZAxis, // axis of replication
135 fNbOfLayers, // number of replicas
136 layerThickness); // width of single replica
137 else
138 new G4PVPlacement(0, // no rotation
139 G4ThreeVector(), // place at centre of mother volume
140 fLogicLayer, // logical volume
141 "Layer", // name
142 fLogicDetector, // mother volume
143 false, // not used
144 0, // copy number
145 true); // check overlaps
146
147 // Layer segment (division in phi)
148 auto fSolidRow = new G4Tubs("Row", // name
149 0, // inner radius
150 fDetectorRadius, // outer radius
151 layerThickness / 2., // half-width in Z
152 0, // start angle
153 cellPhi); // delta angle
154
155 auto fLogicRow = new G4LogicalVolume(fSolidRow, // solid
156 air, // material
157 "Segment"); // name
158 if(fNbOfPhiCells > 1)
159 new G4PVReplica("Segment", // name
160 fLogicRow, // logical volume
161 fLogicLayer, // mother volume
162 kPhi, // axis of replication
163 fNbOfPhiCells, // number of replicas
164 cellPhi); // width of single replica
165 else
166 new G4PVPlacement(0, // no rotation
167 G4ThreeVector(), // place at centre of mother volume
168 fLogicRow, // logical volume
169 "Row", // name
170 fLogicLayer, // mother volume
171 false, // not used
172 0, // copy number
173 true); // check overlaps
174
175 // Final cells (segment slices in radius)
176 // No volume can be placed inside a radial replication
177 auto fSolidCell = new G4Tubs("Cell", // name
178 0, // inner radius
179 cellDR, // outer radius
180 layerThickness / 2., // half-width in Z
181 0, // start angle
182 cellPhi); // delta angle
183
184 fLogicCell = new G4LogicalVolume(fSolidCell, // solid
185 fDetectorMaterial, // material
186 "Cell"); // name
187 if(fNbOfRhoCells > 1)
188 new G4PVReplica("Cell", // name
189 fLogicCell, // logical volume
190 fLogicRow, // mother volume
191 kRho, // axis of replication
192 fNbOfRhoCells, // number of replicas
193 cellDR); // width of single replica
194 else
195 new G4PVPlacement(0, // no rotation
196 G4ThreeVector(), // place at centre of mother volume
197 fLogicCell, // logical volume
198 "Cell", // name
199 fLogicRow, // mother volume
200 false, // not used
201 0, // copy number
202 true); // check overlaps
203
204 //--------- Visualisation settings ---------
205 fLogicWorld->SetVisAttributes(G4VisAttributes::GetInvisible());
206 fLogicLayer->SetVisAttributes(G4VisAttributes::GetInvisible());
207 fLogicRow->SetVisAttributes(G4VisAttributes::GetInvisible());
208 G4VisAttributes attribs;
209 attribs.SetColour(G4Colour(0, 0, 1, 0.3));
210 attribs.SetForceSolid(true);
211 fLogicCell->SetVisAttributes(attribs);
212
213 Print();
214 return fPhysicWorld;
215}
G4double fDetectorRadius
Radius of the cylindrical detector.
G4int fNbOfRhoCells
Number of cells along radius.
G4int fNbOfPhiCells
Number of cells in azimuthal angle.
G4int fNbOfLayers
Number of layers = slices along z axis.
G4double fDetectorLength
Length of the cylindrical detector (along z axis)
G4double fWorldSize
World size (in each X, Y, Z dimension)
G4LogicalVolume * fLogicCell
Logical volume of replicated cell.

◆ ConstructSDandField()

void Par03DetectorConstruction::ConstructSDandField ( )
finalvirtual

Definition at line 219 of file Par03DetectorConstruction.cc.

220{
222 "sensitiveDetector", fNbOfLayers, fNbOfPhiCells, fNbOfRhoCells);
223 G4SDManager::GetSDMpointer()->AddNewDetector(caloSD);
224 SetSensitiveDetector(fLogicCell, caloSD);
225
226 auto detectorRegion =
227 G4RegionStore::GetInstance()->GetRegion("DetectorRegion");
228 new Par03EMShowerModel("model", detectorRegion);
229}
Example fast simulation model for EM showers.

◆ SetRadius()

void Par03DetectorConstruction::SetRadius ( G4double  aRadius)

Definition at line 261 of file Par03DetectorConstruction.cc.

262{
263 // check if fits within world volume
264 if(aRadius >= fWorldSize / 2.)
265 G4Exception("Par03DetectorConstruction::SetRadius()", "InvalidSetup",
266 FatalException,
267 ("Detector radius cannot be larger than the world size (" +
268 G4String(G4BestUnit(fWorldSize / 2., "Length")) + ")")
269 .c_str());
270 fDetectorRadius = aRadius;
271}

◆ GetRadius()

G4double Par03DetectorConstruction::GetRadius ( ) const
inline

Definition at line 64 of file Par03DetectorConstruction.hh.

64{ return fDetectorRadius; };

◆ SetLength()

void Par03DetectorConstruction::SetLength ( G4double  aLength)

Definition at line 274 of file Par03DetectorConstruction.cc.

275{
276 // check if fits within world volume
277 if(aLength >= fWorldSize / 2.)
278 G4Exception("Par03DetectorConstruction::SetLength()", "InvalidSetup",
279 FatalException,
280 ("Detector length cannot be larger than the world size (" +
281 G4String(G4BestUnit(fWorldSize / 2., "Length")) + ")")
282 .c_str());
283 fDetectorLength = aLength;
284}

◆ GetLength()

G4double Par03DetectorConstruction::GetLength ( ) const
inline

Definition at line 68 of file Par03DetectorConstruction.hh.

68{ return fDetectorLength; };

◆ SetMaterial()

void Par03DetectorConstruction::SetMaterial ( const G4String aMaterial)

Definition at line 247 of file Par03DetectorConstruction.cc.

248{
249 // search material by its name
250 G4Material* material = G4NistManager::Instance()->FindOrBuildMaterial(aName);
251 if(material)
252 fDetectorMaterial = material;
253 else
254 G4Exception("Par03DetectorConstruction::SetMaterial()", "InvalidSetup",
255 FatalException, ("Unknown material name: " + aName).c_str());
256 G4RunManager::GetRunManager()->PhysicsHasBeenModified();
257}

◆ GetMaterial()

G4String Par03DetectorConstruction::GetMaterial ( ) const
inline

Definition at line 72 of file Par03DetectorConstruction.hh.

72{ return fDetectorMaterial->GetName(); };

◆ SetNbOfLayers()

void Par03DetectorConstruction::SetNbOfLayers ( G4int  aNumber)
inline

Definition at line 75 of file Par03DetectorConstruction.hh.

75{ fNbOfLayers = aNumber; };

◆ GetNbOfLayers()

G4int Par03DetectorConstruction::GetNbOfLayers ( ) const
inline

Definition at line 77 of file Par03DetectorConstruction.hh.

77{ return fNbOfLayers; };

◆ SetNbOfRhoCells()

void Par03DetectorConstruction::SetNbOfRhoCells ( G4int  aNumber)
inline

Definition at line 79 of file Par03DetectorConstruction.hh.

79{ fNbOfRhoCells = aNumber; };

◆ GetNbOfRhoCells()

G4int Par03DetectorConstruction::GetNbOfRhoCells ( ) const
inline

Definition at line 81 of file Par03DetectorConstruction.hh.

81{ return fNbOfRhoCells; };

◆ SetNbOfPhiCells()

void Par03DetectorConstruction::SetNbOfPhiCells ( G4int  aNumber)
inline

Definition at line 83 of file Par03DetectorConstruction.hh.

83{ fNbOfPhiCells = aNumber; };

◆ GetNbOfPhiCells()

G4int Par03DetectorConstruction::GetNbOfPhiCells ( ) const
inline

Definition at line 85 of file Par03DetectorConstruction.hh.

85{ return fNbOfPhiCells; };

◆ Print()

void Par03DetectorConstruction::Print ( ) const

Definition at line 233 of file Par03DetectorConstruction.cc.

234{
235 G4cout << "\n------------------------------------------------------"
236 << "\n--- Detector material:\t" << fDetectorMaterial->GetName()
237 << "\n--- Detector length:\t" << G4BestUnit(fDetectorLength, "Length")
238 << "\n--- Detector radius:\t" << G4BestUnit(fDetectorRadius, "Length")
239 << "\n--- Number of layers:\t" << fNbOfLayers
240 << "\n--- Number of R-cells:\t" << fNbOfRhoCells
241 << "\n--- Number of phi-cells:\t" << fNbOfPhiCells << G4endl;
242 G4cout << "-----------------------------------------------------" << G4endl;
243}

Member Data Documentation

◆ fDetectorMessenger

Par03DetectorMessenger* Par03DetectorConstruction::fDetectorMessenger
private

Messenger that allows to modify geometry.

Definition at line 92 of file Par03DetectorConstruction.hh.

◆ fLogicCell

G4LogicalVolume* Par03DetectorConstruction::fLogicCell = nullptr
private

Logical volume of replicated cell.

Definition at line 94 of file Par03DetectorConstruction.hh.

◆ fWorldSize

G4double Par03DetectorConstruction::fWorldSize = 10 * m
private

World size (in each X, Y, Z dimension)

Definition at line 96 of file Par03DetectorConstruction.hh.

◆ fDetectorRadius

G4double Par03DetectorConstruction::fDetectorRadius = 10 * cm
private

Radius of the cylindrical detector.

Definition at line 98 of file Par03DetectorConstruction.hh.

◆ fDetectorLength

G4double Par03DetectorConstruction::fDetectorLength = 30 * cm
private

Length of the cylindrical detector (along z axis)

Definition at line 100 of file Par03DetectorConstruction.hh.

◆ fDetectorMaterial

G4Material* Par03DetectorConstruction::fDetectorMaterial = nullptr
private

Material of the detector.

Definition at line 102 of file Par03DetectorConstruction.hh.

◆ fNbOfLayers

G4int Par03DetectorConstruction::fNbOfLayers = 10
private

Number of layers = slices along z axis.

Definition at line 104 of file Par03DetectorConstruction.hh.

◆ fNbOfRhoCells

G4int Par03DetectorConstruction::fNbOfRhoCells = 10
private

Number of cells along radius.

Definition at line 106 of file Par03DetectorConstruction.hh.

◆ fNbOfPhiCells

G4int Par03DetectorConstruction::fNbOfPhiCells = 10
private

Number of cells in azimuthal angle.

Definition at line 108 of file Par03DetectorConstruction.hh.


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

Applications | User Support | Publications | Collaboration