Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
F02DetectorMessenger.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 //
28 //
29 // $Id$
30 //
31 
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
34 
35 #include "F02DetectorMessenger.hh"
37 
38 #include "G4UIdirectory.hh"
39 #include "G4UIcmdWithAString.hh"
40 #include "G4UIcmdWithAnInteger.hh"
43 
44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
45 
47  : G4UImessenger(),
48  fDetector(det),
49  fDetDir(0),
50  fAbsMaterCmd(0),
51  fAbsThickCmd(0),
52  fAbsRadCmd(0),
53  fAbsZposCmd(0),
54  fWorldMaterCmd(0),
55  fWorldZCmd(0),
56  fWorldRCmd(0),
57  fUpdateCmd(0)
58 {
59  fDetDir = new G4UIdirectory("/calor/");
60  fDetDir->SetGuidance("F02 detector control.");
61 
62  fAbsMaterCmd = new G4UIcmdWithAString("/calor/setAbsMat",this);
63  fAbsMaterCmd->SetGuidance("Select Material of the Absorber.");
64  fAbsMaterCmd->SetParameterName("choice",true);
65  fAbsMaterCmd->SetDefaultValue("Lead");
66  fAbsMaterCmd->AvailableForStates(G4State_Idle);
67 
68  fWorldMaterCmd = new G4UIcmdWithAString("/calor/setWorldMat",this);
69  fWorldMaterCmd->SetGuidance("Select Material of the World.");
70  fWorldMaterCmd->SetParameterName("wchoice",true);
71  fWorldMaterCmd->SetDefaultValue("Air");
72  fWorldMaterCmd->AvailableForStates(G4State_Idle);
73 
74  fAbsThickCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsThick",this);
75  fAbsThickCmd->SetGuidance("Set Thickness of the Absorber");
76  fAbsThickCmd->SetParameterName("SizeZ",false,false);
77  fAbsThickCmd->SetDefaultUnit("mm");
78  fAbsThickCmd->SetRange("SizeZ>0.");
79  fAbsThickCmd->AvailableForStates(G4State_Idle);
80 
81  fAbsRadCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsRad",this);
82  fAbsRadCmd->SetGuidance("Set radius of the Absorber");
83  fAbsRadCmd->SetParameterName("SizeR",false,false);
84  fAbsRadCmd->SetDefaultUnit("mm");
85  fAbsRadCmd->SetRange("SizeR>0.");
86  fAbsRadCmd->AvailableForStates(G4State_Idle);
87 
88  fAbsZposCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsZpos",this);
89  fAbsZposCmd->SetGuidance("Set Z pos. of the Absorber");
90  fAbsZposCmd->SetParameterName("Zpos",false,false);
91  fAbsZposCmd->SetDefaultUnit("mm");
92  fAbsZposCmd->AvailableForStates(G4State_Idle);
93 
94  fWorldZCmd = new G4UIcmdWithADoubleAndUnit("/calor/setWorldZ",this);
95  fWorldZCmd->SetGuidance("Set Z size of the World");
96  fWorldZCmd->SetParameterName("WSizeZ",false,false);
97  fWorldZCmd->SetDefaultUnit("mm");
98  fWorldZCmd->SetRange("WSizeZ>0.");
99  fWorldZCmd->AvailableForStates(G4State_Idle);
100 
101  fWorldRCmd = new G4UIcmdWithADoubleAndUnit("/calor/setWorldR",this);
102  fWorldRCmd->SetGuidance("Set R size of the World");
103  fWorldRCmd->SetParameterName("WSizeR",false,false);
104  fWorldRCmd->SetDefaultUnit("mm");
105  fWorldRCmd->SetRange("WSizeR>0.");
106  fWorldRCmd->AvailableForStates(G4State_Idle);
107 
108  fUpdateCmd = new G4UIcmdWithoutParameter("/calor/update",this);
109  fUpdateCmd->SetGuidance("Update calorimeter geometry.");
110  fUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
111  fUpdateCmd->SetGuidance("if you changed geometrical value(s).");
112  fUpdateCmd->AvailableForStates(G4State_Idle);
113 
114 }
115 
116 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
117 
119 {
120  delete fAbsMaterCmd;
121  delete fAbsThickCmd;
122  delete fAbsRadCmd;
123  delete fAbsZposCmd;
124  delete fWorldMaterCmd;
125  delete fWorldZCmd;
126  delete fWorldRCmd;
127  delete fUpdateCmd;
128  delete fDetDir;
129 }
130 
131 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
132 
134 {
135  if( command == fAbsMaterCmd )
136  { fDetector->SetAbsorberMaterial(newValue);}
137 
138  if( command == fWorldMaterCmd )
139  { fDetector->SetWorldMaterial(newValue);}
140 
141  if( command == fAbsThickCmd )
142  { fDetector->SetAbsorberThickness(fAbsThickCmd->GetNewDoubleValue(newValue));}
143 
144  if( command == fAbsRadCmd )
145  { fDetector->SetAbsorberRadius(fAbsRadCmd->GetNewDoubleValue(newValue));}
146 
147  if( command == fAbsZposCmd )
148  { fDetector->SetAbsorberZpos(fAbsZposCmd->GetNewDoubleValue(newValue));}
149 
150  if( command == fWorldZCmd )
151  { fDetector->SetWorldSizeZ(fWorldZCmd->GetNewDoubleValue(newValue));}
152 
153  if( command == fWorldRCmd )
154  { fDetector->SetWorldSizeR(fWorldRCmd->GetNewDoubleValue(newValue));}
155 
156  if( command == fUpdateCmd )
157  { fDetector->UpdateGeometry(); }
158 
159 }
160 
161 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....