Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
exrdmDetectorMessenger.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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
30 
32 
34 #include "G4UIdirectory.hh"
35 #include "G4UIcmdWithAString.hh"
37 #include "globals.hh"
38 
39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
40 
42 :fMyDetector(myDet)
43 {
44  fExrdmDir = new G4UIdirectory("/exrdm/");
45  fExrdmDir->SetGuidance("UI commands specific to this example.");
46 
47  fDetDir = new G4UIdirectory("/exrdm/det/");
48  fDetDir->SetGuidance("detector control.");
49 
50  fTargMatCmd = new G4UIcmdWithAString("/exrdm/det/setTargetMate",this);
51  fTargMatCmd->SetGuidance("Select Material of the Target.");
52  fTargMatCmd->SetParameterName("choice",false);
54 
55  fTargRadiusCmd = new G4UIcmdWithADoubleAndUnit("/exrdm/det/setTargetRadius", this);
56  fTargRadiusCmd->SetGuidance("Set the Target Radius.");
57  fTargRadiusCmd->SetUnitCategory("Length");
58  fTargRadiusCmd->SetParameterName("choice",false);
59  fTargRadiusCmd->AvailableForStates(G4State_PreInit);
60 
61  fTargLengthCmd = new G4UIcmdWithADoubleAndUnit("/exrdm/det/setTargetLength", this);
62  fTargLengthCmd->SetGuidance("Set the Target Length.");
63  fTargLengthCmd->SetUnitCategory("Length");
64  fTargLengthCmd->SetParameterName("choice",false);
65  fTargLengthCmd->AvailableForStates(G4State_PreInit);
66 
67  fDetectMatCmd = new G4UIcmdWithAString("/exrdm/det/setDetectorMate",this);
68  fDetectMatCmd->SetGuidance("Select Material of the Detector.");
69  fDetectMatCmd->SetParameterName("choice",false);
71 
72  fDetectThicknessCmd =
73  new G4UIcmdWithADoubleAndUnit("/exrdm/det/setDetectorThickness",this);
74  fDetectThicknessCmd->SetGuidance("Set the Detector Thickness.");
75  fDetectThicknessCmd->SetUnitCategory("Length");
76  fDetectThicknessCmd->SetParameterName("choice",false);
77  fDetectThicknessCmd->AvailableForStates(G4State_PreInit);
78 
79  fDetectLengthCmd =
80  new G4UIcmdWithADoubleAndUnit("/exrdm/det/setDetectorLength",this);
81  fDetectLengthCmd->SetGuidance("Set the Detector Length.");
82  fDetectLengthCmd->SetUnitCategory("Length");
83  fDetectLengthCmd->SetParameterName("choice",false);
84  fDetectLengthCmd->AvailableForStates(G4State_PreInit);
85 }
86 
87 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
88 
90 {
91  delete fTargMatCmd;
92  delete fDetectMatCmd;
93  delete fTargRadiusCmd;
94  delete fDetectThicknessCmd;
95  delete fTargLengthCmd;
96  delete fDetectLengthCmd;
97  delete fDetDir;
98  delete fExrdmDir;
99 }
100 
101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
102 
104 {
105  if( command == fTargMatCmd )fMyDetector->SetTargetMaterial(newValue);
106  else if ( command == fTargLengthCmd )
107  fMyDetector->SetTargetLength(fTargLengthCmd->GetNewDoubleValue(newValue));
108  else if ( command == fTargRadiusCmd )
109  fMyDetector->SetTargetRadius(fTargLengthCmd->GetNewDoubleValue(newValue));
110  else if( command == fDetectMatCmd )
111  fMyDetector->SetDetectorMaterial(newValue);
112  else if (command == fDetectLengthCmd )
113  fMyDetector->SetDetectorLength(
114  fDetectLengthCmd->GetNewDoubleValue(newValue));
115  else if (command == fDetectThicknessCmd )
116  fMyDetector->SetDetectorThickness(
117  fDetectThicknessCmd->GetNewDoubleValue(newValue));
118 }
119 
120 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......