Loading...
Searching...
No Matches
Par04DetectorConstruction.hh
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#ifndef PAR04DETECTORCONSTRUCTION_H
27#define PAR04DETECTORCONSTRUCTION_H
28
29#include <CLHEP/Units/SystemOfUnits.h> // for cm, mm, pi, rad
30#include <G4String.hh> // for G4String
31#include <G4Types.hh> // for G4double, G4bool, G4int
32#include <array> // for array
33#include <cstddef> // for size_t
34#include <vector> // for vector
35#include "G4Material.hh" // for G4Material
36#include "G4SystemOfUnits.hh" // for cm, mm, rad
37#include "G4ThreeVector.hh" // for G4ThreeVector
38#include "G4VUserDetectorConstruction.hh" // for G4VUserDetectorConstruction
39class G4LogicalVolume;
42
43/**
44 * @brief Detector construction.
45 *
46 * Creates a cylindrical detector, with cylinder axis along Z-axis. It is placed
47 * in the centre of the world volume.
48 * Dimensions of the detector (inner radius and its length) as well as composition (number of
49 * radial layers, number of absorbers, its thicknesses and materials) can be set using the UI
50 * commands. There may be up to two absorbers used to build the layers.
51 *
52 * TODO Extend to allow use of more than two different absorbers.
53 *
54 * Each absorber may have differnt thickness (along radial direction), material, and may be
55 * either sensitive to particle passage (will register deposited energy) or not (passive).
56 * Readout geometry of the detector is dynamic, and its size can be set by UI commands.
57 * Cells are created along z-axis, azimuthal angle, and radius (cylindrical
58 * segmentation). The z axis is parallel to the direction of the particle entering the
59 * detector volume. The mesh also starts at the entrance to the detector volume.
60 * In order to define this enrance position and direction, a fast simulation model is used.
61 * For the detector volume, if particle has entered, sets the particle direction and position
62 * in the event information. Those vectors define the readout mesh for the event.
63 *
64 * TODO In order to speed up the simulation, fast simulation that checks for the entrance
65 * properites should be defined in a very thin region instead of a whole region of the detector.
66 *
67 * Sensitive detector Par04SensitiveDetector is attached to the detector volume
68 * Region for the detector is created as an envelope of the fast simulation.
69 *
70 */
71
73{
74 public:
77
78 virtual G4VPhysicalVolume* Construct() final;
79 virtual void ConstructSDandField() final;
80
81 /// Set inner radius of the cylindrical detector
82 void SetInnerRadius(G4double aInnerRadius);
83 /// Get inner radius of the cylindrical detector
84 inline G4double GetInnerRadius() const { return fDetectorInnerRadius; };
85 /// Set length radius of the cylindrical detector
86 void SetLength(G4double aLength);
87 /// Get length of the cylindrical detector (along z-axis)
88 inline G4double GetLength() const { return fDetectorLength; };
89 /// Set number of layers
90 inline void SetNbOfLayers(G4int aNumber) { fNbOfLayers = aNumber; };
91 /// Get number of layers
92 inline G4int GetNbOfLayers() const { return fNbOfLayers; };
93
94 /// Set material of the layer (from NIST materials)
95 void SetAbsorberMaterial(const std::size_t aLayer, const G4String& aMaterial);
96 /// Get name of the material of the layer
97 inline G4String GetAbsorberMaterial(const std::size_t aLayer) const
98 {
99 return fAbsorberMaterial[aLayer]->GetName();
100 };
101 /// Set thickness of the layer
102 void SetAbsorberThickness(const std::size_t aLayer, const G4double aThickness);
103 /// Get thickness of the layer
104 inline G4double GetAbsorberThickness(const std::size_t aLayer) const
105 {
106 return fAbsorberThickness[aLayer];
107 };
108 /// Set sensitivity of the layer
109 void SetAbsorberSensitivity(const std::size_t aLayer, const G4bool aSensitivity);
110 /// Get sensitivity of the layer
111 inline G4bool GetAbsorberSensitivity(const std::size_t aLayer) const
112 {
113 return fAbsorberSensitivity[aLayer];
114 };
115
116 /// Set number of Mesh cells in cylindrical coordinates (r, phi, z)
117 inline void SetMeshNbOfCells(G4ThreeVector aNb) { fMeshNbOfCells = aNb; };
118 /// Set number of Mesh cells in cylindrical coordinates along one of the axis
119 /// @param[in] aIndex index of cylindrical axis (0,1,2) = (r, phi, z)
120 inline void SetMeshNbOfCells(std::size_t aIndex, G4double aNb) { fMeshNbOfCells[aIndex] = aNb; };
121 /// Get number of Mesh cells in cylindrical coordinates (r, phi, z)
122 inline G4ThreeVector GetMeshNbOfCells() const { return fMeshNbOfCells; };
123 /// Set size of Mesh cells in cylindrical coordinates (r, phi, z)
124 inline void SetMeshSizeOfCells(G4ThreeVector aNb) { fMeshSizeOfCells = aNb; };
125 /// Set size of Mesh cells in cylindrical coordinates along one of the axis
126 /// @param[in] aIndex index of cylindrical axis (0,1,2) = (r, phi, z)
127 inline void SetMeshSizeOfCells(std::size_t aIndex, G4double aNb)
128 { fMeshSizeOfCells[aIndex] = aNb; };
129 /// Get size of Mesh cells in cylindrical coordinates (r, phi, z)
130 inline G4ThreeVector GetMeshSizeOfCells() const { return fMeshSizeOfCells; };
131
132 /// Print detector information
133 void Print() const;
134
135 private:
136 /// Messenger that allows to modify geometry
138 /// Inner radius of the cylindrical detector
139 G4double fDetectorInnerRadius = 80 * cm;
140 /// Length of the cylindrical detector (along z axis)
141 G4double fDetectorLength = 24 * cm;
142 /// Logical volume(s) of the sensitive absorbers
143 std::vector<G4LogicalVolume*> fLayerLogical;
144 /// Material(s) of the layers
145 std::array<G4Material*, 2> fAbsorberMaterial = { nullptr, nullptr };
146 /// Thickness(es) of the layers
147 std::array<G4double, 2> fAbsorberThickness = { 1 * cm, 0 };
148 /// Sensitivity of the layers
149 std::array<G4bool, 2> fAbsorberSensitivity = { true, 0 };
150 /// Number of layers = slices along z axis
151 G4int fNbOfLayers = 24;
152 /// Mesh number of cells (Nr, Nphi, Nz)
153 G4ThreeVector fMeshNbOfCells = { 40, 50, 48 };
154 /// Mesh size of cells (dr, dphi, dz).
155 G4ThreeVector fMeshSizeOfCells = { 5 * mm, 2 * CLHEP::pi / 50 * CLHEP::rad, 5 * mm };
156};
157
158#endif /* PAR04DETECTORCONSTRUCTION_H */
void SetMeshSizeOfCells(G4ThreeVector aNb)
Set size of Mesh cells in cylindrical coordinates (r, phi, z)
G4double GetLength() const
Get length of the cylindrical detector (along z-axis)
void SetAbsorberSensitivity(const std::size_t aLayer, const G4bool aSensitivity)
Set sensitivity of the layer.
void SetLength(G4double aLength)
Set length radius of the cylindrical detector.
Par04DetectorMessenger * fDetectorMessenger
Messenger that allows to modify geometry.
virtual G4VPhysicalVolume * Construct() final
G4double fDetectorInnerRadius
Inner radius of the cylindrical detector.
G4ThreeVector GetMeshSizeOfCells() const
Get size of Mesh cells in cylindrical coordinates (r, phi, z)
void SetMeshSizeOfCells(std::size_t aIndex, G4double aNb)
Set size of Mesh cells in cylindrical coordinates along one of the axis.
G4ThreeVector GetMeshNbOfCells() const
Get number of Mesh cells in cylindrical coordinates (r, phi, z)
void SetMeshNbOfCells(G4ThreeVector aNb)
Set number of Mesh cells in cylindrical coordinates (r, phi, z)
G4String GetAbsorberMaterial(const std::size_t aLayer) const
Get name of the material of the layer.
G4double GetAbsorberThickness(const std::size_t aLayer) const
Get thickness of the layer.
virtual ~Par04DetectorConstruction()
G4ThreeVector fMeshSizeOfCells
Mesh size of cells (dr, dphi, dz).
std::array< G4bool, 2 > fAbsorberSensitivity
Sensitivity of the layers.
std::vector< G4LogicalVolume * > fLayerLogical
Logical volume(s) of the sensitive absorbers.
void SetAbsorberMaterial(const std::size_t aLayer, const G4String &aMaterial)
Set material of the layer (from NIST materials)
std::array< G4double, 2 > fAbsorberThickness
Thickness(es) of the layers.
void Print() const
Print detector information.
std::array< G4Material *, 2 > fAbsorberMaterial
Material(s) of the layers.
void SetInnerRadius(G4double aInnerRadius)
Set inner radius of the cylindrical detector.
G4int GetNbOfLayers() const
Get number of layers.
G4int fNbOfLayers
Number of layers = slices along z axis.
void SetNbOfLayers(G4int aNumber)
Set number of layers.
G4double GetInnerRadius() const
Get inner radius of the cylindrical detector.
G4ThreeVector fMeshNbOfCells
Mesh number of cells (Nr, Nphi, Nz)
G4double fDetectorLength
Length of the cylindrical detector (along z axis)
void SetAbsorberThickness(const std::size_t aLayer, const G4double aThickness)
Set thickness of the layer.
G4bool GetAbsorberSensitivity(const std::size_t aLayer) const
Get sensitivity of the layer.
void SetMeshNbOfCells(std::size_t aIndex, G4double aNb)
Set number of Mesh cells in cylindrical coordinates along one of the axis.

Applications | User Support | Publications | Collaboration