Geant4
9.6.p02
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
geant4_9_6_p02
examples
advanced
nanobeam
src
DetectorMessenger.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
// $Id$
28
// -------------------------------------------------------------------
29
30
#include "DetectorMessenger.hh"
31
#include "DetectorConstruction.hh"
32
33
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34
35
DetectorMessenger::DetectorMessenger
(
DetectorConstruction
* Det)
36
:Detector(Det)
37
{
38
quadDir =
new
G4UIdirectory
(
"/quad/"
);
39
quadDir->
SetGuidance
(
"Quadrupole control."
);
40
41
modelCmd =
new
G4UIcmdWithAnInteger
(
"/quad/setModel"
,
this
);
42
modelCmd->
SetGuidance
(
"Select magnetic field model."
);
43
modelCmd->
SetParameterName
(
"model"
,
false
);
44
modelCmd->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
45
46
profileCmd =
new
G4UIcmdWithAnInteger
(
"/displayProfile"
,
this
);
47
profileCmd->
SetGuidance
(
"Display beam profile."
);
48
profileCmd->
SetParameterName
(
"profile"
,
false
);
49
profileCmd->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
50
51
gridCmd =
new
G4UIcmdWithAnInteger
(
"/setGrid"
,
this
);
52
gridCmd->
SetGuidance
(
"Put grid and shadow plane."
);
53
gridCmd->
SetParameterName
(
"grid"
,
false
);
54
gridCmd->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
55
56
G1Cmd =
new
G4UIcmdWithADouble
(
"/quad/setG1"
,
this
);
57
G1Cmd->
SetGuidance
(
"Set G1."
);
58
G1Cmd->
SetParameterName
(
"G1"
,
false
);
59
G1Cmd->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
60
61
G2Cmd =
new
G4UIcmdWithADouble
(
"/quad/setG2"
,
this
);
62
G2Cmd->
SetGuidance
(
"Set G2."
);
63
G2Cmd->
SetParameterName
(
"G2"
,
false
);
64
G2Cmd->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
65
66
G3Cmd =
new
G4UIcmdWithADouble
(
"/quad/setG3"
,
this
);
67
G3Cmd->
SetGuidance
(
"Set G3."
);
68
G3Cmd->
SetParameterName
(
"G3"
,
false
);
69
G3Cmd->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
70
71
G4Cmd =
new
G4UIcmdWithADouble
(
"/quad/setG4"
,
this
);
72
G4Cmd->
SetGuidance
(
"Set G4."
);
73
G4Cmd->
SetParameterName
(
"G4"
,
false
);
74
G4Cmd->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
75
76
UpdateCmd =
new
G4UIcmdWithoutParameter
(
"/quad/update"
,
this
);
77
UpdateCmd->
SetGuidance
(
"Update calorimeter geometry."
);
78
UpdateCmd->
SetGuidance
(
"This command MUST be applied before \"beamOn\" "
);
79
UpdateCmd->
SetGuidance
(
"if you changed geometrical value(s)."
);
80
UpdateCmd->
AvailableForStates
(
G4State_Idle
);
81
}
82
83
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
84
85
DetectorMessenger::~DetectorMessenger
()
86
{
87
delete
G1Cmd;
88
delete
G2Cmd;
89
delete
G3Cmd;
90
delete
G4Cmd;
91
delete
UpdateCmd;
92
delete
quadDir;
93
delete
modelCmd;
94
delete
profileCmd;
95
delete
gridCmd;
96
}
97
98
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
99
100
void
DetectorMessenger::SetNewValue
(
G4UIcommand
* command,
G4String
newValue)
101
{
102
if
( command == modelCmd )
103
{ Detector->
SetModel
(modelCmd->
GetNewIntValue
(newValue));}
104
105
if
( command == profileCmd )
106
{ Detector->
SetProfile
(profileCmd->
GetNewIntValue
(newValue));}
107
108
if
( command == gridCmd )
109
{ Detector->
SetGrid
(gridCmd->
GetNewIntValue
(newValue));}
110
111
if
( command == G1Cmd )
112
{ Detector->
SetG1
(G1Cmd->
GetNewDoubleValue
(newValue));}
113
114
if
( command == G2Cmd )
115
{ Detector->
SetG2
(G1Cmd->
GetNewDoubleValue
(newValue));}
116
117
if
( command == G3Cmd )
118
{ Detector->
SetG3
(G1Cmd->
GetNewDoubleValue
(newValue));}
119
120
if
( command == G4Cmd )
121
{ Detector->
SetG4
(G1Cmd->
GetNewDoubleValue
(newValue));}
122
123
if
( command == UpdateCmd )
124
{ Detector->
UpdateGeometry
();}
125
}
Generated on Sat May 25 2013 14:31:56 for Geant4 by
1.8.4