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

Detector messenger. More...

#include <Doxymodules_parameterisations.h>

Inheritance diagram for Par04DetectorMessenger:
G4UImessenger

Public Member Functions

 Par04DetectorMessenger (Par04DetectorConstruction *)
 
 ~Par04DetectorMessenger ()
 
virtual void SetNewValue (G4UIcommand *, G4String) final
 Invokes appropriate methods based on the typed command.
 
virtual G4String GetCurrentValue (G4UIcommand *) final
 Retrieves the current settings.
 

Private Attributes

Par04DetectorConstructionfDetector = nullptr
 Detector construction to setup.
 
G4UIdirectoryfExampleDir = nullptr
 Command to set the directory common to all messengers in this example /Par04.
 
G4UIdirectoryfDetectorDir = nullptr
 Command to set the directory for detector settings /Par04/detector.
 
G4UIcmdWithoutParameterfPrintCmd
 Command printing current settings.
 
G4UIcmdWithADoubleAndUnitfDetectorInnerRadiusCmd = nullptr
 Command to set the detector inner radius.
 
G4UIcmdWithADoubleAndUnitfDetectorLengthCmd = nullptr
 Command to set the detector length.
 
G4UIcmdWithAnIntegerfNbLayersCmd = nullptr
 Command to set the number of layers.
 
G4UIcommandfAbsorCmd = nullptr
 Commanbd to set the absorbers within layers (material, thickness, sensitivity)
 
G4UIdirectoryfMeshDir = nullptr
 Command to set the directory for sensitive detector settings /Par04/mesh.
 
G4UIcmdWithAnIntegerfMeshNbRhoCellsCmd = nullptr
 Command to set the number of cells in the cylindrical readout mesh (along rho axis)
 
G4UIcmdWithAnIntegerfMeshNbPhiCellsCmd = nullptr
 Command to set the number of cells in the cylindrical readout mesh (along phi axis)
 
G4UIcmdWithAnIntegerfMeshNbZCellsCmd = nullptr
 Command to set the number of cells in the cylindrical readout mesh (along z axis)
 
G4UIcmdWithADoubleAndUnitfMeshSizeRhoCellsCmd = nullptr
 Command to the size of cells in the cylindrical readout mesh (along rho axis)
 
G4UIcmdWithADoubleAndUnitfMeshSizeZCellsCmd = nullptr
 Command to the size of cells in the cylindrical readout mesh (along z axis)
 

Detailed Description

Detector messenger.

Provides UI commands to setup detector and readout geometry (prior to initialization). Radius, length, and material of the detector, as well as segmentation of the readout geometry can be changed.

Definition at line 80 of file Doxymodules_parameterisations.h.

Constructor & Destructor Documentation

◆ Par04DetectorMessenger()

Par04DetectorMessenger::Par04DetectorMessenger ( Par04DetectorConstruction aDetector)

Definition at line 44 of file Par04DetectorMessenger.cc.

46 , fDetector(aDetector)
47{
48 fExampleDir = new G4UIdirectory("/Par04/");
49 fExampleDir->SetGuidance("UI commands specific to this example");
50
51 fDetectorDir = new G4UIdirectory("/Par04/detector/");
52 fDetectorDir->SetGuidance("Detector construction UI commands");
53
54 fPrintCmd = new G4UIcmdWithoutParameter("/Par04/detector/print", this);
55 fPrintCmd->SetGuidance("Print current settings.");
56
58 new G4UIcmdWithADoubleAndUnit("/Par04/detector/setDetectorInnerRadius", this);
59 fDetectorInnerRadiusCmd->SetGuidance("Set cylindrical detector inner radius");
60 fDetectorInnerRadiusCmd->SetParameterName("Size", false);
61 fDetectorInnerRadiusCmd->SetRange("Size>0.");
62 fDetectorInnerRadiusCmd->SetUnitCategory("Length");
63 fDetectorInnerRadiusCmd->AvailableForStates(G4State_PreInit);
64 fDetectorInnerRadiusCmd->SetToBeBroadcasted(false);
65
66 fDetectorLengthCmd = new G4UIcmdWithADoubleAndUnit("/Par04/detector/setDetectorLength", this);
67 fDetectorLengthCmd->SetGuidance("Set length of the detector (cylinder length)");
68 fDetectorLengthCmd->SetParameterName("Size", false);
69 fDetectorLengthCmd->SetRange("Size>0.");
70 fDetectorLengthCmd->SetUnitCategory("Length");
71 fDetectorLengthCmd->AvailableForStates(G4State_PreInit);
72 fDetectorLengthCmd->SetToBeBroadcasted(false);
73
74 fNbLayersCmd = new G4UIcmdWithAnInteger("/Par04/detector/setNbOfLayers", this);
75 fNbLayersCmd->SetGuidance("Set number of layers.");
76 fNbLayersCmd->SetParameterName("NbLayers", false);
77 fNbLayersCmd->SetRange("NbLayers>0");
78 fNbLayersCmd->AvailableForStates(G4State_PreInit);
79 fNbLayersCmd->SetToBeBroadcasted(false);
80
81 fAbsorCmd = new G4UIcommand("/Par04/detector/setAbsorber", this);
82 fAbsorCmd->SetGuidance("Set the absorber id, the material, the thickness.");
83 fAbsorCmd->SetGuidance(" absorber number : from 0 to 1");
84 fAbsorCmd->SetGuidance(" material name");
85 fAbsorCmd->SetGuidance(" thickness (with unit) : t>0");
86 fAbsorCmd->SetGuidance(" if sensitive : true/false.");
87 auto absNbPrm = new G4UIparameter("AbsorNb", 'i', false);
88 absNbPrm->SetGuidance("absor number : from 0 to 1");
89 absNbPrm->SetParameterRange("AbsorNb>-1&AbsoNb<2");
90 fAbsorCmd->SetParameter(absNbPrm);
91 auto matPrm = new G4UIparameter("material", 's', false);
92 matPrm->SetGuidance("material name");
93 fAbsorCmd->SetParameter(matPrm);
94 auto thickPrm = new G4UIparameter("thickness", 'd', false);
95 thickPrm->SetGuidance("thickness of absorber");
96 thickPrm->SetParameterRange("thickness>0.");
97 fAbsorCmd->SetParameter(thickPrm);
98 auto unitPrm = new G4UIparameter("unit", 's', false);
99 unitPrm->SetGuidance("unit of thickness");
100 G4String unitList = G4UIcommand::UnitsList(G4UIcommand::CategoryOf("mm"));
101 unitPrm->SetParameterCandidates(unitList);
102 fAbsorCmd->SetParameter(unitPrm);
103 auto sensitivePrm = new G4UIparameter("sensitive", 'b', false);
104 sensitivePrm->SetGuidance("if absorber is sensitive (registers energy deposits)");
105 fAbsorCmd->SetParameter(sensitivePrm);
106
107 fAbsorCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
108 fAbsorCmd->SetToBeBroadcasted(false);
109
110 fMeshDir = new G4UIdirectory("/Par04/mesh/");
111 fMeshDir->SetGuidance("Mesh UI commands");
112
113 fMeshNbRhoCellsCmd = new G4UIcmdWithAnInteger("/Par04/mesh/setNbOfRhoCells", this);
114 fMeshNbRhoCellsCmd->SetGuidance("Set number of rho cells in the cylindrical mesh readout.");
115 fMeshNbRhoCellsCmd->SetParameterName("NbRhoCells", false);
116 fMeshNbRhoCellsCmd->SetRange("NbRhoCells>0");
117 fMeshNbRhoCellsCmd->AvailableForStates(G4State_PreInit);
118 fMeshNbRhoCellsCmd->SetToBeBroadcasted(false);
119
120 fMeshNbPhiCellsCmd = new G4UIcmdWithAnInteger("/Par04/mesh/setNbOfPhiCells", this);
121 fMeshNbPhiCellsCmd->SetGuidance("Set number of phi cells in the cylindrical mesh readout.");
122 fMeshNbPhiCellsCmd->SetParameterName("NbPhiCells", false);
123 fMeshNbPhiCellsCmd->SetRange("NbPhiCells>0");
124 fMeshNbPhiCellsCmd->AvailableForStates(G4State_PreInit);
125 fMeshNbPhiCellsCmd->SetToBeBroadcasted(false);
126
127 fMeshNbZCellsCmd = new G4UIcmdWithAnInteger("/Par04/mesh/setNbOfZCells", this);
128 fMeshNbZCellsCmd->SetGuidance("Set number of z cells in the cylindrical mesh readout.");
129 fMeshNbZCellsCmd->SetParameterName("NbZCells", false);
130 fMeshNbZCellsCmd->SetRange("NbZCells>0");
131 fMeshNbZCellsCmd->AvailableForStates(G4State_PreInit);
132 fMeshNbZCellsCmd->SetToBeBroadcasted(false);
133
134 fMeshSizeRhoCellsCmd = new G4UIcmdWithADoubleAndUnit("/Par04/mesh/setSizeOfRhoCells", this);
135 fMeshSizeRhoCellsCmd->SetGuidance("Set size of rho cells in the cylindrical readout mesh");
136 fMeshSizeRhoCellsCmd->SetParameterName("Size", false);
137 fMeshSizeRhoCellsCmd->SetRange("Size>0.");
138 fMeshSizeRhoCellsCmd->SetUnitCategory("Length");
139 fMeshSizeRhoCellsCmd->AvailableForStates(G4State_PreInit);
140 fMeshSizeRhoCellsCmd->SetToBeBroadcasted(false);
141
142 fMeshSizeZCellsCmd = new G4UIcmdWithADoubleAndUnit("/Par04/mesh/setSizeOfZCells", this);
143 fMeshSizeZCellsCmd->SetGuidance("Set size of z cells in the cylindrical readout mesh");
144 fMeshSizeZCellsCmd->SetParameterName("Size", false);
145 fMeshSizeZCellsCmd->SetRange("Size>0.");
146 fMeshSizeZCellsCmd->SetUnitCategory("Length");
147 fMeshSizeZCellsCmd->AvailableForStates(G4State_PreInit);
148 fMeshSizeZCellsCmd->SetToBeBroadcasted(false);
149}
G4UIcmdWithAnInteger * fMeshNbPhiCellsCmd
Command to set the number of cells in the cylindrical readout mesh (along phi axis)
G4UIcmdWithADoubleAndUnit * fMeshSizeRhoCellsCmd
Command to the size of cells in the cylindrical readout mesh (along rho axis)
G4UIcmdWithoutParameter * fPrintCmd
Command printing current settings.
G4UIcommand * fAbsorCmd
Commanbd to set the absorbers within layers (material, thickness, sensitivity)
G4UIcmdWithADoubleAndUnit * fDetectorLengthCmd
Command to set the detector length.
G4UIcmdWithADoubleAndUnit * fDetectorInnerRadiusCmd
Command to set the detector inner radius.
Par04DetectorConstruction * fDetector
Detector construction to setup.
G4UIcmdWithAnInteger * fNbLayersCmd
Command to set the number of layers.
G4UIdirectory * fExampleDir
Command to set the directory common to all messengers in this example /Par04.
G4UIcmdWithADoubleAndUnit * fMeshSizeZCellsCmd
Command to the size of cells in the cylindrical readout mesh (along z axis)
G4UIcmdWithAnInteger * fMeshNbZCellsCmd
Command to set the number of cells in the cylindrical readout mesh (along z axis)
G4UIdirectory * fDetectorDir
Command to set the directory for detector settings /Par04/detector.
G4UIdirectory * fMeshDir
Command to set the directory for sensitive detector settings /Par04/mesh.
G4UIcmdWithAnInteger * fMeshNbRhoCellsCmd
Command to set the number of cells in the cylindrical readout mesh (along rho axis)

◆ ~Par04DetectorMessenger()

Par04DetectorMessenger::~Par04DetectorMessenger ( )

Definition at line 153 of file Par04DetectorMessenger.cc.

154{
155 delete fPrintCmd;
157 delete fDetectorLengthCmd;
158 delete fNbLayersCmd;
159 delete fAbsorCmd;
160 delete fDetectorDir;
161 delete fMeshNbRhoCellsCmd;
162 delete fMeshNbPhiCellsCmd;
163 delete fMeshNbZCellsCmd;
165 delete fMeshSizeZCellsCmd;
166 delete fMeshDir;
167 delete fExampleDir;
168}

Member Function Documentation

◆ SetNewValue()

void Par04DetectorMessenger::SetNewValue ( G4UIcommand aCommand,
G4String  aNewValue 
)
finalvirtual

Invokes appropriate methods based on the typed command.

Definition at line 172 of file Par04DetectorMessenger.cc.

173{
174 if(aCommand == fPrintCmd)
175 {
176 fDetector->Print();
177 }
178 else if(aCommand == fDetectorInnerRadiusCmd)
179 {
180 fDetector->SetInnerRadius(fDetectorInnerRadiusCmd->GetNewDoubleValue(aNewValue));
181 }
182 else if(aCommand == fDetectorLengthCmd)
183 {
184 fDetector->SetLength(fDetectorInnerRadiusCmd->GetNewDoubleValue(aNewValue));
185 }
186 else if(aCommand == fNbLayersCmd)
187 {
188 fDetector->SetNbOfLayers(fNbLayersCmd->GetNewIntValue(aNewValue));
189 }
190 else if(aCommand == fAbsorCmd)
191 {
192 G4int num;
193 G4double thick;
194 G4String unt, mat;
195 G4bool sensitive;
196 std::istringstream is(aNewValue);
197 is >> num >> mat >> thick >> unt >> std::boolalpha >> sensitive;
198 G4String material = mat;
199 thick *= G4UIcommand::ValueOf(unt);
200 fDetector->SetAbsorberMaterial(num, material);
201 fDetector->SetAbsorberThickness(num, thick);
202 fDetector->SetAbsorberSensitivity(num, sensitive);
203 }
204 else if(aCommand == fMeshNbRhoCellsCmd)
205 {
206 fDetector->SetMeshNbOfCells(0, fMeshNbRhoCellsCmd->GetNewIntValue(aNewValue));
207 }
208 else if(aCommand == fMeshNbPhiCellsCmd)
209 {
210 fDetector->SetMeshNbOfCells(1, fMeshNbPhiCellsCmd->GetNewIntValue(aNewValue));
212 2. * CLHEP::pi / fMeshNbPhiCellsCmd->GetNewIntValue(aNewValue));
213 }
214 else if(aCommand == fMeshNbZCellsCmd)
215 {
216 fDetector->SetMeshNbOfCells(2, fMeshNbZCellsCmd->GetNewIntValue(aNewValue));
217 }
218 else if(aCommand == fMeshSizeRhoCellsCmd)
219 {
220 fDetector->SetMeshSizeOfCells(0, fMeshSizeRhoCellsCmd->GetNewDoubleValue(aNewValue));
221 }
222 else if(aCommand == fMeshSizeZCellsCmd)
223 {
224 fDetector->SetMeshSizeOfCells(2, fMeshSizeZCellsCmd->GetNewDoubleValue(aNewValue));
225 }
226}
void SetMeshSizeOfCells(G4ThreeVector aNb)
Set size of Mesh cells in cylindrical coordinates (r, phi, z)
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.
void SetMeshNbOfCells(G4ThreeVector aNb)
Set number of Mesh cells in cylindrical coordinates (r, phi, z)
void SetAbsorberMaterial(const std::size_t aLayer, const G4String &aMaterial)
Set material of the layer (from NIST materials)
void Print() const
Print detector information.
void SetInnerRadius(G4double aInnerRadius)
Set inner radius of the cylindrical detector.
void SetNbOfLayers(G4int aNumber)
Set number of layers.
void SetAbsorberThickness(const std::size_t aLayer, const G4double aThickness)
Set thickness of the layer.

◆ GetCurrentValue()

G4String Par04DetectorMessenger::GetCurrentValue ( G4UIcommand aCommand)
finalvirtual

Retrieves the current settings.

Definition at line 230 of file Par04DetectorMessenger.cc.

231{
232 G4String cv;
233
234 if(aCommand == fDetectorInnerRadiusCmd)
235 {
236 cv = fDetectorInnerRadiusCmd->ConvertToString(fDetector->GetInnerRadius(), "mm");
237 }
238 else if(aCommand == fDetectorLengthCmd)
239 {
240 cv = fDetectorLengthCmd->ConvertToString(fDetector->GetLength(), "mm");
241 }
242 else if(aCommand == fNbLayersCmd)
243 {
244 cv = fNbLayersCmd->ConvertToString(fDetector->GetNbOfLayers());
245 }
246 else if(aCommand == fMeshNbRhoCellsCmd)
247 {
248 cv = fMeshNbRhoCellsCmd->ConvertToString(fDetector->GetMeshNbOfCells()[0]);
249 }
250 else if(aCommand == fMeshNbPhiCellsCmd)
251 {
252 cv = fMeshNbPhiCellsCmd->ConvertToString(fDetector->GetMeshNbOfCells()[1]);
253 }
254 else if(aCommand == fMeshNbZCellsCmd)
255 {
256 cv = fMeshNbZCellsCmd->ConvertToString(fDetector->GetMeshNbOfCells()[2]);
257 }
258 else if(aCommand == fMeshSizeRhoCellsCmd)
259 {
260 cv = fMeshSizeRhoCellsCmd->ConvertToString(fDetector->GetMeshSizeOfCells()[0]);
261 }
262 else if(aCommand == fMeshSizeZCellsCmd)
263 {
264 cv = fMeshSizeZCellsCmd->ConvertToString(fDetector->GetMeshSizeOfCells()[2]);
265 }
266 return cv;
267}
G4double GetLength() const
Get length of the cylindrical detector (along z-axis)
G4ThreeVector GetMeshSizeOfCells() const
Get size of Mesh cells in cylindrical coordinates (r, phi, z)
G4ThreeVector GetMeshNbOfCells() const
Get number of Mesh cells in cylindrical coordinates (r, phi, z)
G4int GetNbOfLayers() const
Get number of layers.
G4double GetInnerRadius() const
Get inner radius of the cylindrical detector.

Member Data Documentation

◆ fDetector

Par04DetectorConstruction* Par04DetectorMessenger::fDetector = nullptr
private

Detector construction to setup.

Definition at line 61 of file Par04DetectorMessenger.hh.

◆ fExampleDir

G4UIdirectory* Par04DetectorMessenger::fExampleDir = nullptr
private

Command to set the directory common to all messengers in this example /Par04.

Definition at line 64 of file Par04DetectorMessenger.hh.

◆ fDetectorDir

G4UIdirectory* Par04DetectorMessenger::fDetectorDir = nullptr
private

Command to set the directory for detector settings /Par04/detector.

Definition at line 66 of file Par04DetectorMessenger.hh.

◆ fPrintCmd

G4UIcmdWithoutParameter* Par04DetectorMessenger::fPrintCmd
private

Command printing current settings.

Definition at line 68 of file Par04DetectorMessenger.hh.

◆ fDetectorInnerRadiusCmd

G4UIcmdWithADoubleAndUnit* Par04DetectorMessenger::fDetectorInnerRadiusCmd = nullptr
private

Command to set the detector inner radius.

Definition at line 70 of file Par04DetectorMessenger.hh.

◆ fDetectorLengthCmd

G4UIcmdWithADoubleAndUnit* Par04DetectorMessenger::fDetectorLengthCmd = nullptr
private

Command to set the detector length.

Definition at line 72 of file Par04DetectorMessenger.hh.

◆ fNbLayersCmd

G4UIcmdWithAnInteger* Par04DetectorMessenger::fNbLayersCmd = nullptr
private

Command to set the number of layers.

Definition at line 74 of file Par04DetectorMessenger.hh.

◆ fAbsorCmd

G4UIcommand* Par04DetectorMessenger::fAbsorCmd = nullptr
private

Commanbd to set the absorbers within layers (material, thickness, sensitivity)

Definition at line 76 of file Par04DetectorMessenger.hh.

◆ fMeshDir

G4UIdirectory* Par04DetectorMessenger::fMeshDir = nullptr
private

Command to set the directory for sensitive detector settings /Par04/mesh.

Definition at line 78 of file Par04DetectorMessenger.hh.

◆ fMeshNbRhoCellsCmd

G4UIcmdWithAnInteger* Par04DetectorMessenger::fMeshNbRhoCellsCmd = nullptr
private

Command to set the number of cells in the cylindrical readout mesh (along rho axis)

Definition at line 80 of file Par04DetectorMessenger.hh.

◆ fMeshNbPhiCellsCmd

G4UIcmdWithAnInteger* Par04DetectorMessenger::fMeshNbPhiCellsCmd = nullptr
private

Command to set the number of cells in the cylindrical readout mesh (along phi axis)

Definition at line 82 of file Par04DetectorMessenger.hh.

◆ fMeshNbZCellsCmd

G4UIcmdWithAnInteger* Par04DetectorMessenger::fMeshNbZCellsCmd = nullptr
private

Command to set the number of cells in the cylindrical readout mesh (along z axis)

Definition at line 84 of file Par04DetectorMessenger.hh.

◆ fMeshSizeRhoCellsCmd

G4UIcmdWithADoubleAndUnit* Par04DetectorMessenger::fMeshSizeRhoCellsCmd = nullptr
private

Command to the size of cells in the cylindrical readout mesh (along rho axis)

Definition at line 86 of file Par04DetectorMessenger.hh.

◆ fMeshSizeZCellsCmd

G4UIcmdWithADoubleAndUnit* Par04DetectorMessenger::fMeshSizeZCellsCmd = nullptr
private

Command to the size of cells in the cylindrical readout mesh (along z axis)

Definition at line 88 of file Par04DetectorMessenger.hh.


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

Applications | User Support | Publications | Collaboration