source: trunk/examples/advanced/radioprotection/src/RemSimDetectorMessenger.cc@ 1305

Last change on this file since 1305 was 1230, checked in by garnier, 16 years ago

update to geant4.9.3

File size: 5.3 KB
RevLine 
[807]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// Code developed by:
28// S.Guatelli
29//
30// *********************************
31// * *
32// * RemSimDetectorMessenger.cc *
33// * *
34// *********************************
35//
36//
37// $Id: RemSimDetectorMessenger.cc,v 1.13 2006/06/29 16:23:41 gunter Exp $
[1230]38// GEANT4 tag $Name: geant4-09-03-cand-01 $
[807]39//
40//
41
42#include "RemSimDetectorMessenger.hh"
43#include "RemSimDetectorConstruction.hh"
44#include "G4UIdirectory.hh"
45#include "G4UIcmdWithAString.hh"
46#include "G4UIcmdWithADoubleAndUnit.hh"
47
48RemSimDetectorMessenger::RemSimDetectorMessenger( RemSimDetectorConstruction* Det): detector(Det)
49{
50 vehicleDir = new G4UIdirectory("/configuration/");
51 vehicleDir -> SetGuidance("geometry control.");
52
53 vehicleCmd = new G4UIcmdWithAString("/configuration/choose",this);
54 vehicleCmd -> SetGuidance("Assign the geometrical set-up to G4RunManager.");
55 vehicleCmd -> SetParameterName("choice",true);
56 vehicleCmd -> SetCandidates("vehicle moon");
57 vehicleCmd -> AvailableForStates(G4State_Idle);
58
59 shieldingCmd = new G4UIcmdWithAString("/configuration/AddShielding",this);
60 shieldingCmd -> SetGuidance("Add shielding layer in vehicle configuration.");
61 shieldingCmd -> SetParameterName("choice",true);
62 shieldingCmd -> SetCandidates("On Off");
63 shieldingCmd -> AvailableForStates(G4State_Idle);
64
65 SPECmd = new G4UIcmdWithAString("/configuration/AddSPE",this);
66 SPECmd -> SetGuidance("Add SPE shelter in vehicle configuration.");
67 SPECmd -> SetParameterName("choice",true);
68 SPECmd -> SetCandidates("On Off");
69 SPECmd -> AvailableForStates(G4State_Idle);
70
71 roofCmd = new G4UIcmdWithAString("/configuration/AddRoof",this);
72 roofCmd -> SetGuidance("Add the Roof to the moon habitat.");
73 roofCmd -> SetParameterName("choice",true);
74 roofCmd -> SetCandidates("On Off");
75 roofCmd -> AvailableForStates(G4State_Idle);
76
77
78 // Fix the parameters of the shielding: material and thickness
79 shieldingDir = new G4UIdirectory("/shielding/");
80 shieldingDir -> SetGuidance("shielding control.");
81
82 thicknessCmd = new G4UIcmdWithADoubleAndUnit("/shielding/thickness",this);
83 thicknessCmd -> SetGuidance("Set the thickness of the shielding.");
84 thicknessCmd -> SetParameterName("Size",true);
85 thicknessCmd -> SetRange("Size>=0.");
86 thicknessCmd -> SetUnitCategory("Length");
87 thicknessCmd -> AvailableForStates(G4State_Idle);
88
89 roofDir = new G4UIdirectory("/roof/");
90 roofDir -> SetGuidance("Roof control.");
91 thicknessRoofCmd = new G4UIcmdWithADoubleAndUnit("/roof/thickness",this);
92 thicknessRoofCmd -> SetGuidance("Set the thickness of the Roof.");
93 thicknessRoofCmd -> SetParameterName("Size",true);
94 thicknessRoofCmd -> SetRange("Size>=0.");
95 thicknessRoofCmd -> SetUnitCategory("Length");
96 thicknessRoofCmd -> AvailableForStates(G4State_Idle);
97}
98
99RemSimDetectorMessenger::~RemSimDetectorMessenger()
100{
101 delete thicknessRoofCmd;
102 delete roofDir;
103 delete thicknessCmd;
104 delete shieldingDir;
105 delete roofCmd;
106 delete SPECmd;
107 delete shieldingCmd;
108 delete vehicleCmd;
109 delete vehicleDir;
110}
111
112void RemSimDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
113{
114 if(command == vehicleCmd)
115 detector -> ChooseConfiguration(newValue);
116
117 if(command == shieldingCmd)
118 detector -> AddShielding(newValue);
119
120 if(command == SPECmd)
121 detector -> AddShelterSPE(newValue);
122
123 if(command == roofCmd)
124 detector -> AddHabitatRoof(newValue);
125
126 if(command == thicknessCmd)
127 detector -> ChangeShieldingThickness
128 (thicknessCmd -> GetNewDoubleValue(newValue));
129
130 if(command == thicknessRoofCmd)
131 detector -> ChangeRoofThickness
132 (thicknessRoofCmd -> GetNewDoubleValue(newValue));
133}
134
Note: See TracBrowser for help on using the repository browser.