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

Detector construction. More...

#include <Doxymodules_parameterisations.h>

Inheritance diagram for Par04DetectorConstruction:
G4VUserDetectorConstruction

Public Member Functions

 Par04DetectorConstruction ()
 
virtual ~Par04DetectorConstruction ()
 
virtual G4VPhysicalVolumeConstruct () final
 
virtual void ConstructSDandField () final
 
void SetInnerRadius (G4double aInnerRadius)
 Set inner radius of the cylindrical detector.
 
G4double GetInnerRadius () const
 Get inner radius of the cylindrical detector.
 
void SetLength (G4double aLength)
 Set length radius of the cylindrical detector.
 
G4double GetLength () const
 Get length of the cylindrical detector (along z-axis)
 
void SetNbOfLayers (G4int aNumber)
 Set number of layers.
 
G4int GetNbOfLayers () const
 Get number of layers.
 
void SetAbsorberMaterial (const std::size_t aLayer, const G4String &aMaterial)
 Set material of the layer (from NIST materials)
 
G4String GetAbsorberMaterial (const std::size_t aLayer) const
 Get name of the material of the layer.
 
void SetAbsorberThickness (const std::size_t aLayer, const G4double aThickness)
 Set thickness of the layer.
 
G4double GetAbsorberThickness (const std::size_t aLayer) const
 Get thickness of the layer.
 
void SetAbsorberSensitivity (const std::size_t aLayer, const G4bool aSensitivity)
 Set sensitivity of the layer.
 
G4bool GetAbsorberSensitivity (const std::size_t aLayer) const
 Get sensitivity of the layer.
 
void SetMeshNbOfCells (G4ThreeVector aNb)
 Set number of Mesh cells in cylindrical coordinates (r, phi, z)
 
void SetMeshNbOfCells (std::size_t aIndex, G4double aNb)
 Set number 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 SetMeshSizeOfCells (G4ThreeVector aNb)
 Set 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 GetMeshSizeOfCells () const
 Get size of Mesh cells in cylindrical coordinates (r, phi, z)
 
void Print () const
 Print detector information.
 

Private Attributes

Par04DetectorMessengerfDetectorMessenger = nullptr
 Messenger that allows to modify geometry.
 
G4double fDetectorInnerRadius = 80 * cm
 Inner radius of the cylindrical detector.
 
G4double fDetectorLength = 24 * cm
 Length of the cylindrical detector (along z axis)
 
std::vector< G4LogicalVolume * > fLayerLogical
 Logical volume(s) of the sensitive absorbers.
 
std::array< G4Material *, 2 > fAbsorberMaterial = { nullptr, nullptr }
 Material(s) of the layers.
 
std::array< G4double, 2 > fAbsorberThickness = { 1 * cm, 0 }
 Thickness(es) of the layers.
 
std::array< G4bool, 2 > fAbsorberSensitivity = { true, 0 }
 Sensitivity of the layers.
 
G4int fNbOfLayers = 24
 Number of layers = slices along z axis.
 
G4ThreeVector fMeshNbOfCells = { 40, 50, 48 }
 Mesh number of cells (Nr, Nphi, Nz)
 
G4ThreeVector fMeshSizeOfCells = { 5 * mm, 2 * CLHEP::pi / 50 * CLHEP::rad, 5 * mm }
 Mesh size of cells (dr, dphi, dz).
 

Detailed Description

Detector construction.

Creates a cylindrical detector, with cylinder axis along Z-axis. It is placed in the centre of the world volume. Dimensions of the detector (inner radius and its length) as well as composition (number of radial layers, number of absorbers, its thicknesses and materials) can be set using the UI commands. There may be up to two absorbers used to build the layers.

TODO Extend to allow use of more than two different absorbers.

Each absorber may have differnt thickness (along radial direction), material, and may be either sensitive to particle passage (will register deposited energy) or not (passive). Readout geometry of the detector is dynamic, and its size can be set by UI commands. Cells are created along z-axis, azimuthal angle, and radius (cylindrical segmentation). The z axis is parallel to the direction of the particle entering the detector volume. The mesh also starts at the entrance to the detector volume. In order to define this enrance position and direction, a fast simulation model is used. For the detector volume, if particle has entered, sets the particle direction and position in the event information. Those vectors define the readout mesh for the event.

TODO In order to speed up the simulation, fast simulation that checks for the entrance properites should be defined in a very thin region instead of a whole region of the detector.

Sensitive detector Par04SensitiveDetector is attached to the detector volume Region for the detector is created as an envelope of the fast simulation.

Definition at line 79 of file Doxymodules_parameterisations.h.

Constructor & Destructor Documentation

◆ Par04DetectorConstruction()

Par04DetectorConstruction::Par04DetectorConstruction ( )

Definition at line 60 of file Par04DetectorConstruction.cc.

62{
64 G4NistManager* nistManager = G4NistManager::Instance();
65 fAbsorberMaterial[0] = nistManager->FindOrBuildMaterial("G4_PbWO4");
66}
Par04DetectorMessenger * fDetectorMessenger
Messenger that allows to modify geometry.
std::array< G4Material *, 2 > fAbsorberMaterial
Material(s) of the layers.

◆ ~Par04DetectorConstruction()

Par04DetectorConstruction::~Par04DetectorConstruction ( )
virtualdefault

Member Function Documentation

◆ Construct()

G4VPhysicalVolume * Par04DetectorConstruction::Construct ( )
finalvirtual

useful variable

Definition at line 74 of file Par04DetectorConstruction.cc.

75{
76 //--------- Material definition ---------
77 G4NistManager* nistManager = G4NistManager::Instance();
78 G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR");
79
80 //--------- Derived dimensions ---------
81 G4double full2Pi = 2. * CLHEP::pi * rad;
82 G4double layerThickness =
83 std::accumulate(fAbsorberThickness.begin(), fAbsorberThickness.end(), 0.);
84 G4double detectorOuterRadius = fDetectorInnerRadius + fNbOfLayers * layerThickness;
85 G4double worldSizeXY = detectorOuterRadius * 4.;
86 G4double worldSizeZ = fDetectorLength * 2;
87 // check number of materials: (1 = homogeneous calo, 2 = sampling calo)
88 G4int nbOfMaterials = 0;
89 for(const auto material : fAbsorberMaterial)
90 {
91 if(material != nullptr)
92 nbOfMaterials++;
93 }
94
95 //--------- World ---------
96 auto fSolidWorld = new G4Box("World", // name
97 worldSizeXY / 2., // half-width in X
98 worldSizeXY / 2., // half-width in Y
99 worldSizeZ / 2.); // half-width in Z
100 auto fLogicWorld = new G4LogicalVolume(fSolidWorld, // solid
101 air, // material
102 "World"); // name
103 auto fPhysicWorld = new G4PVPlacement(0, // no rotation
104 G4ThreeVector(), // at (0,0,0)
105 fLogicWorld, // logical volume
106 "World", // name
107 0, // mother volume
108 false, // not used
109 99999, // copy number
110 false); // check overlaps
111 fLogicWorld->SetVisAttributes(G4VisAttributes::GetInvisible());
112
113 //--------- Detector envelope ---------
114 auto fSolidDetector = new G4Tubs("Detector", // name
115 fDetectorInnerRadius, // inner radius
116 detectorOuterRadius, // outer radius
117 fDetectorLength / 2., // half-width in Z
118 0, // start angle
119 full2Pi); // delta angle
120 auto fLogicDetector = new G4LogicalVolume(fSolidDetector, // solid
121 air, // material
122 "Detector"); // name
123 new G4PVPlacement(0, // no rotation
124 G4ThreeVector(0, 0, 0), // detector centre at (0,0,0)
125 fLogicDetector, // logical volume
126 "Detector", // name
127 fLogicWorld, // mother volume
128 false, // not used
129 999, // copy number
130 false); // check overlaps
131
132 // Region for fast simulation
133 auto detectorRegion = new G4Region("DetectorRegion");
134 detectorRegion->AddRootLogicalVolume(fLogicDetector);
135
136 //--------- Detector layers: material ---------
137 std::array<G4VisAttributes, 2> attribs;
138 attribs[0].SetColour(G4Colour(0, 0, 1, 0.1));
139 attribs[0].SetForceSolid(true);
140 attribs[1].SetColour(G4Colour(1, 0, 0, 0.1));
141 attribs[1].SetForceSolid(true);
142 /// useful variable
143 G4double innerRadius = fDetectorInnerRadius;
144 for(G4int iLayer = 0; iLayer < fNbOfLayers; iLayer++)
145 {
146 for(G4int iMaterial = 0; iMaterial < nbOfMaterials; iMaterial++)
147 {
148 auto fSolidLayer = new G4Tubs("Layer", // name
149 innerRadius, // inner radius
150 innerRadius + fAbsorberThickness[iMaterial], // outer radius
151 fDetectorLength / 2., // half-width in Z
152 0, // start angle
153 full2Pi); // delta angle
154 G4LogicalVolume* logical = new G4LogicalVolume(fSolidLayer, // solid
155 fAbsorberMaterial[iMaterial], // material
156 "Layer"); // name
157 new G4PVPlacement(0, // no rotation
158 G4ThreeVector(), // place at centre of mother volume
159 logical, // logical volume
160 "Layer", // name
161 fLogicDetector, // mother volume
162 false, // not used
163 iLayer * nbOfMaterials + iMaterial, // copy number
164 false); // check overlaps
165 logical->SetVisAttributes(attribs[iMaterial]);
166 innerRadius += fAbsorberThickness[iMaterial];
167 if(fAbsorberSensitivity[iMaterial])
168 {
169 fLayerLogical.push_back(logical);
170 }
171 }
172 }
173
174 Print();
175 return fPhysicWorld;
176}
G4double fDetectorInnerRadius
Inner radius of the cylindrical detector.
std::array< G4bool, 2 > fAbsorberSensitivity
Sensitivity of the layers.
std::vector< G4LogicalVolume * > fLayerLogical
Logical volume(s) of the sensitive absorbers.
std::array< G4double, 2 > fAbsorberThickness
Thickness(es) of the layers.
void Print() const
Print detector information.
G4int fNbOfLayers
Number of layers = slices along z axis.
G4double fDetectorLength
Length of the cylindrical detector (along z axis)

◆ ConstructSDandField()

void Par04DetectorConstruction::ConstructSDandField ( )
finalvirtual

Definition at line 180 of file Par04DetectorConstruction.cc.

181{
182 Par04SensitiveDetector* caloSD =
183 new Par04SensitiveDetector("sensitiveDetector", fMeshNbOfCells, fMeshSizeOfCells);
184 G4SDManager::GetSDMpointer()->AddNewDetector(caloSD);
185 for(const auto logical : fLayerLogical)
186 {
187 SetSensitiveDetector(logical, caloSD);
188 }
189
190 auto detectorRegion = G4RegionStore::GetInstance()->GetRegion("DetectorRegion");
191 // Par04DefineMeshModel needs to be first model to call
192 new Par04DefineMeshModel("defineMesh", detectorRegion);
193#ifdef USE_INFERENCE
194 new Par04MLFastSimModel("inferenceModel", detectorRegion);
195#endif
196}
Defince mesh for energy scoring.
G4ThreeVector fMeshSizeOfCells
Mesh size of cells (dr, dphi, dz).
G4ThreeVector fMeshNbOfCells
Mesh number of cells (Nr, Nphi, Nz)

◆ SetInnerRadius()

void Par04DetectorConstruction::SetInnerRadius ( G4double  aInnerRadius)

Set inner radius of the cylindrical detector.

Definition at line 264 of file Par04DetectorConstruction.cc.

264{ fDetectorInnerRadius = aRadius; }

◆ GetInnerRadius()

G4double Par04DetectorConstruction::GetInnerRadius ( ) const
inline

Get inner radius of the cylindrical detector.

Definition at line 84 of file Par04DetectorConstruction.hh.

84{ return fDetectorInnerRadius; };

◆ SetLength()

void Par04DetectorConstruction::SetLength ( G4double  aLength)

Set length radius of the cylindrical detector.

Definition at line 268 of file Par04DetectorConstruction.cc.

268{ fDetectorLength = aLength; }

◆ GetLength()

G4double Par04DetectorConstruction::GetLength ( ) const
inline

Get length of the cylindrical detector (along z-axis)

Definition at line 88 of file Par04DetectorConstruction.hh.

88{ return fDetectorLength; };

◆ SetNbOfLayers()

void Par04DetectorConstruction::SetNbOfLayers ( G4int  aNumber)
inline

Set number of layers.

Definition at line 90 of file Par04DetectorConstruction.hh.

90{ fNbOfLayers = aNumber; };

◆ GetNbOfLayers()

G4int Par04DetectorConstruction::GetNbOfLayers ( ) const
inline

Get number of layers.

Definition at line 92 of file Par04DetectorConstruction.hh.

92{ return fNbOfLayers; };

◆ SetAbsorberMaterial()

void Par04DetectorConstruction::SetAbsorberMaterial ( const std::size_t  aLayer,
const G4String aMaterial 
)

Set material of the layer (from NIST materials)

Definition at line 218 of file Par04DetectorConstruction.cc.

219{
220 // search material by its name
221 G4Material* material = G4NistManager::Instance()->FindOrBuildMaterial(aName);
222 if(material)
223 fAbsorberMaterial[aLayer] = material;
224 else
225 G4Exception("Par04DetectorConstruction::SetAbsorberMaterial()", "InvalidSetup", FatalException,
226 ("Unknown material name: " + aName).c_str());
227 G4RunManager::GetRunManager()->PhysicsHasBeenModified();
228}

◆ GetAbsorberMaterial()

G4String Par04DetectorConstruction::GetAbsorberMaterial ( const std::size_t  aLayer) const
inline

Get name of the material of the layer.

Definition at line 97 of file Par04DetectorConstruction.hh.

98 {
99 return fAbsorberMaterial[aLayer]->GetName();
100 };

◆ SetAbsorberThickness()

void Par04DetectorConstruction::SetAbsorberThickness ( const std::size_t  aLayer,
const G4double  aThickness 
)

Set thickness of the layer.

Definition at line 232 of file Par04DetectorConstruction.cc.

234{
235 if(aLayer < fAbsorberThickness.size())
236 fAbsorberThickness[aLayer] = aThickness;
237 else
238 G4Exception("Par04DetectorConstruction::SetAbsorberThickness()", "InvalidSetup", FatalException,
239 ("Requested layer " + std::to_string(aLayer) +
240 " is larger than number of available layers (" +
241 std::to_string(fAbsorberThickness.size()) + ").")
242 .c_str());
243 G4RunManager::GetRunManager()->PhysicsHasBeenModified();
244}

◆ GetAbsorberThickness()

G4double Par04DetectorConstruction::GetAbsorberThickness ( const std::size_t  aLayer) const
inline

Get thickness of the layer.

Definition at line 104 of file Par04DetectorConstruction.hh.

105 {
106 return fAbsorberThickness[aLayer];
107 };

◆ SetAbsorberSensitivity()

void Par04DetectorConstruction::SetAbsorberSensitivity ( const std::size_t  aLayer,
const G4bool  aSensitivity 
)

Set sensitivity of the layer.

Definition at line 248 of file Par04DetectorConstruction.cc.

250{
251 if(aLayer < fAbsorberSensitivity.size())
252 fAbsorberSensitivity[aLayer] = aSensitivity;
253 else
254 G4Exception(
255 "Par04DetectorConstruction::SetAbsorberSensitivity()", "InvalidSetup", FatalException,
256 ("Requested layer " + std::to_string(aLayer) + " is larger than number of available layers ("+
257 std::to_string(fAbsorberSensitivity.size()) + ").")
258 .c_str());
259 G4RunManager::GetRunManager()->PhysicsHasBeenModified();
260}

◆ GetAbsorberSensitivity()

G4bool Par04DetectorConstruction::GetAbsorberSensitivity ( const std::size_t  aLayer) const
inline

Get sensitivity of the layer.

Definition at line 111 of file Par04DetectorConstruction.hh.

112 {
113 return fAbsorberSensitivity[aLayer];
114 };

◆ SetMeshNbOfCells() [1/2]

void Par04DetectorConstruction::SetMeshNbOfCells ( G4ThreeVector  aNb)
inline

Set number of Mesh cells in cylindrical coordinates (r, phi, z)

Definition at line 117 of file Par04DetectorConstruction.hh.

117{ fMeshNbOfCells = aNb; };

◆ SetMeshNbOfCells() [2/2]

void Par04DetectorConstruction::SetMeshNbOfCells ( std::size_t  aIndex,
G4double  aNb 
)
inline

Set number of Mesh cells in cylindrical coordinates along one of the axis.

Parameters
[in]aIndexindex of cylindrical axis (0,1,2) = (r, phi, z)

Definition at line 120 of file Par04DetectorConstruction.hh.

120{ fMeshNbOfCells[aIndex] = aNb; };

◆ GetMeshNbOfCells()

G4ThreeVector Par04DetectorConstruction::GetMeshNbOfCells ( ) const
inline

Get number of Mesh cells in cylindrical coordinates (r, phi, z)

Definition at line 122 of file Par04DetectorConstruction.hh.

122{ return fMeshNbOfCells; };

◆ SetMeshSizeOfCells() [1/2]

void Par04DetectorConstruction::SetMeshSizeOfCells ( G4ThreeVector  aNb)
inline

Set size of Mesh cells in cylindrical coordinates (r, phi, z)

Definition at line 124 of file Par04DetectorConstruction.hh.

124{ fMeshSizeOfCells = aNb; };

◆ SetMeshSizeOfCells() [2/2]

void Par04DetectorConstruction::SetMeshSizeOfCells ( std::size_t  aIndex,
G4double  aNb 
)
inline

Set size of Mesh cells in cylindrical coordinates along one of the axis.

Parameters
[in]aIndexindex of cylindrical axis (0,1,2) = (r, phi, z)

Definition at line 127 of file Par04DetectorConstruction.hh.

128 { fMeshSizeOfCells[aIndex] = aNb; };

◆ GetMeshSizeOfCells()

G4ThreeVector Par04DetectorConstruction::GetMeshSizeOfCells ( ) const
inline

Get size of Mesh cells in cylindrical coordinates (r, phi, z)

Definition at line 130 of file Par04DetectorConstruction.hh.

130{ return fMeshSizeOfCells; };

◆ Print()

void Par04DetectorConstruction::Print ( ) const

Print detector information.

Definition at line 200 of file Par04DetectorConstruction.cc.

201{
202 G4cout << "\n------------------------------------------------------"
203 << "\n--- Detector length:\t" << G4BestUnit(fDetectorLength, "Length")
204 << "\n--- Detector inner radius:\t" << G4BestUnit(fDetectorInnerRadius, "Length")
205 << "\n--- Number of layers:\t" << fNbOfLayers << G4endl << "\n--- 1st layer: \t"
206 << G4BestUnit(fAbsorberThickness[0], "Length") << " of "
207 << (fAbsorberSensitivity[0] ? "active " : "passive ") << fAbsorberMaterial[0]->GetName()
208 << G4endl;
209 if(fAbsorberMaterial[1] != nullptr)
210 G4cout << "--- 2nd layer: \t" << G4BestUnit(fAbsorberThickness[1], "Length") << " of "
211 << (fAbsorberSensitivity[1] ? "active " : "passive ") << fAbsorberMaterial[1]->GetName()
212 << G4endl;
213 G4cout << "-----------------------------------------------------" << G4endl;
214}

Member Data Documentation

◆ fDetectorMessenger

Par04DetectorMessenger* Par04DetectorConstruction::fDetectorMessenger = nullptr
private

Messenger that allows to modify geometry.

Definition at line 137 of file Par04DetectorConstruction.hh.

◆ fDetectorInnerRadius

G4double Par04DetectorConstruction::fDetectorInnerRadius = 80 * cm
private

Inner radius of the cylindrical detector.

Definition at line 139 of file Par04DetectorConstruction.hh.

◆ fDetectorLength

G4double Par04DetectorConstruction::fDetectorLength = 24 * cm
private

Length of the cylindrical detector (along z axis)

Definition at line 141 of file Par04DetectorConstruction.hh.

◆ fLayerLogical

std::vector<G4LogicalVolume*> Par04DetectorConstruction::fLayerLogical
private

Logical volume(s) of the sensitive absorbers.

Definition at line 143 of file Par04DetectorConstruction.hh.

◆ fAbsorberMaterial

std::array<G4Material*, 2> Par04DetectorConstruction::fAbsorberMaterial = { nullptr, nullptr }
private

Material(s) of the layers.

Definition at line 145 of file Par04DetectorConstruction.hh.

145{ nullptr, nullptr };

◆ fAbsorberThickness

std::array<G4double, 2> Par04DetectorConstruction::fAbsorberThickness = { 1 * cm, 0 }
private

Thickness(es) of the layers.

Definition at line 147 of file Par04DetectorConstruction.hh.

147{ 1 * cm, 0 };

◆ fAbsorberSensitivity

std::array<G4bool, 2> Par04DetectorConstruction::fAbsorberSensitivity = { true, 0 }
private

Sensitivity of the layers.

Definition at line 149 of file Par04DetectorConstruction.hh.

149{ true, 0 };

◆ fNbOfLayers

G4int Par04DetectorConstruction::fNbOfLayers = 24
private

Number of layers = slices along z axis.

Definition at line 151 of file Par04DetectorConstruction.hh.

◆ fMeshNbOfCells

G4ThreeVector Par04DetectorConstruction::fMeshNbOfCells = { 40, 50, 48 }
private

Mesh number of cells (Nr, Nphi, Nz)

Definition at line 153 of file Par04DetectorConstruction.hh.

153{ 40, 50, 48 };

◆ fMeshSizeOfCells

G4ThreeVector Par04DetectorConstruction::fMeshSizeOfCells = { 5 * mm, 2 * CLHEP::pi / 50 * CLHEP::rad, 5 * mm }
private

Mesh size of cells (dr, dphi, dz).

Definition at line 155 of file Par04DetectorConstruction.hh.

155{ 5 * mm, 2 * CLHEP::pi / 50 * CLHEP::rad, 5 * mm };

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

Applications | User Support | Publications | Collaboration