source: trunk/examples/extended/radioactivedecay/exrdm/src/exrdmDetectorMessenger.cc@ 1036

Last change on this file since 1036 was 807, checked in by garnier, 17 years ago

update

File size: 5.2 KB
Line 
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//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
27
28#include "exrdmDetectorMessenger.hh"
29
30#include "exrdmDetectorConstruction.hh"
31#include "G4UIdirectory.hh"
32#include "G4UIcmdWithAString.hh"
33#include "G4UIcmdWithADoubleAndUnit.hh"
34#include "globals.hh"
35
36//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
37
38exrdmDetectorMessenger::exrdmDetectorMessenger(exrdmDetectorConstruction* myDet)
39:myDetector(myDet)
40{
41 exrdmDir = new G4UIdirectory("/exrdm/");
42 exrdmDir->SetGuidance("UI commands specific to this example.");
43
44 detDir = new G4UIdirectory("/exrdm/det/");
45 detDir->SetGuidance("detector control.");
46
47 TargMatCmd = new G4UIcmdWithAString("/exrdm/det/setTargetMate",this);
48 TargMatCmd->SetGuidance("Select Material of the Target.");
49 TargMatCmd->SetParameterName("choice",false);
50 TargMatCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
51
52 TargRadiusCmd = new G4UIcmdWithADoubleAndUnit("/exrdm/det/setTargetRadius",this);
53 TargRadiusCmd->SetGuidance("Set the Target Radius.");
54 TargRadiusCmd->SetUnitCategory("Length");
55 TargRadiusCmd->SetParameterName("choice",false);
56 TargRadiusCmd->AvailableForStates(G4State_PreInit);
57
58 TargLengthCmd = new G4UIcmdWithADoubleAndUnit("/exrdm/det/setTargetLength",this);
59 TargLengthCmd->SetGuidance("Set the Target Length.");
60 TargLengthCmd->SetUnitCategory("Length");
61 TargLengthCmd->SetParameterName("choice",false);
62 TargLengthCmd->AvailableForStates(G4State_PreInit);
63
64 DetectMatCmd = new G4UIcmdWithAString("/exrdm/det/setDetectorMate",this);
65 DetectMatCmd->SetGuidance("Select Material of the Detector.");
66 DetectMatCmd->SetParameterName("choice",false);
67 DetectMatCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
68
69 DetectThicknessCmd = new G4UIcmdWithADoubleAndUnit("/exrdm/det/setDetectorThickness",this);
70 DetectThicknessCmd->SetGuidance("Set the Detector Thickness.");
71 DetectThicknessCmd->SetUnitCategory("Length");
72 DetectThicknessCmd->SetParameterName("choice",false);
73 DetectThicknessCmd->AvailableForStates(G4State_PreInit);
74
75 DetectLengthCmd = new G4UIcmdWithADoubleAndUnit("/exrdm/det/setDetectorLength",this);
76 DetectLengthCmd->SetGuidance("Set the Detector Length.");
77 DetectLengthCmd->SetUnitCategory("Length");
78 DetectLengthCmd->SetParameterName("choice",false);
79 DetectLengthCmd->AvailableForStates(G4State_PreInit);
80}
81
82//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
83
84exrdmDetectorMessenger::~exrdmDetectorMessenger()
85{
86 delete TargMatCmd;
87 delete DetectMatCmd;
88 delete TargRadiusCmd;
89 delete DetectThicknessCmd;
90 delete TargLengthCmd;
91 delete DetectLengthCmd;
92 delete detDir;
93 delete exrdmDir;
94}
95
96//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
97
98void exrdmDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
99{
100 if( command == TargMatCmd )
101 { myDetector->setTargetMaterial(newValue);}
102 else if ( command == TargLengthCmd )
103 { myDetector->setTargetLength(TargLengthCmd->GetNewDoubleValue(newValue));}
104 else if ( command == TargRadiusCmd )
105 { myDetector->setTargetRadius(TargLengthCmd->GetNewDoubleValue(newValue));}
106 else if( command == DetectMatCmd )
107 { myDetector->setDetectorMaterial(newValue);}
108 else if (command == DetectLengthCmd )
109 { myDetector->setDetectorLength(DetectLengthCmd->GetNewDoubleValue(newValue));}
110 else if (command == DetectThicknessCmd )
111 { myDetector->setDetectorThickness(DetectThicknessCmd->GetNewDoubleValue(newValue));}
112}
113
114//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Note: See TracBrowser for help on using the repository browser.