Geant4  10.01
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 //
26 // $Id: exrdmDetectorMessenger.cc 68030 2013-03-13 13:51:27Z gcosmo $
27 //
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 
34 
36 #include "G4UIdirectory.hh"
37 #include "G4UIcmdWithAString.hh"
39 #include "globals.hh"
40 
41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
42 
44 :G4UImessenger(),
45  fMyDetector(myDet),
46  fExrdmDir(0),
47  fDetDir(0),
48  fTargMatCmd(0),
49  fDetectMatCmd(0),
50  fTargRadiusCmd(0),
51  fDetectThicknessCmd(0),
52  fTargLengthCmd(0),
53  fDetectLengthCmd(0)
54 {
55  fExrdmDir = new G4UIdirectory("/exrdm/");
56  fExrdmDir->SetGuidance("UI commands specific to this example.");
57 
58  fDetDir = new G4UIdirectory("/exrdm/det/");
59  fDetDir->SetGuidance("detector control.");
60 
61  fTargMatCmd = new G4UIcmdWithAString("/exrdm/det/setTargetMate",this);
62  fTargMatCmd->SetGuidance("Select Material of the Target.");
63  fTargMatCmd->SetParameterName("choice",false);
65 
66  fTargRadiusCmd = new G4UIcmdWithADoubleAndUnit("/exrdm/det/setTargetRadius", this);
67  fTargRadiusCmd->SetGuidance("Set the Target Radius.");
69  fTargRadiusCmd->SetParameterName("choice",false);
71 
72  fTargLengthCmd = new G4UIcmdWithADoubleAndUnit("/exrdm/det/setTargetLength", this);
73  fTargLengthCmd->SetGuidance("Set the Target Length.");
75  fTargLengthCmd->SetParameterName("choice",false);
77 
78  fDetectMatCmd = new G4UIcmdWithAString("/exrdm/det/setDetectorMate",this);
79  fDetectMatCmd->SetGuidance("Select Material of the Detector.");
80  fDetectMatCmd->SetParameterName("choice",false);
82 
84  new G4UIcmdWithADoubleAndUnit("/exrdm/det/setDetectorThickness",this);
85  fDetectThicknessCmd->SetGuidance("Set the Detector Thickness.");
87  fDetectThicknessCmd->SetParameterName("choice",false);
89 
91  new G4UIcmdWithADoubleAndUnit("/exrdm/det/setDetectorLength",this);
92  fDetectLengthCmd->SetGuidance("Set the Detector Length.");
94  fDetectLengthCmd->SetParameterName("choice",false);
96 }
97 
98 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
99 
101 {
102  delete fTargMatCmd;
103  delete fDetectMatCmd;
104  delete fTargRadiusCmd;
105  delete fDetectThicknessCmd;
106  delete fTargLengthCmd;
107  delete fDetectLengthCmd;
108  delete fDetDir;
109  delete fExrdmDir;
110 }
111 
112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
113 
115 {
116  if( command == fTargMatCmd )fMyDetector->SetTargetMaterial(newValue);
117  else if ( command == fTargLengthCmd )
119  else if ( command == fTargRadiusCmd )
121  else if( command == fDetectMatCmd )
122  fMyDetector->SetDetectorMaterial(newValue);
123  else if (command == fDetectLengthCmd )
126  else if (command == fDetectThicknessCmd )
129 }
130 
131 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
Definition of the exrdmDetectorConstruction class.
G4UIcmdWithADoubleAndUnit * fTargLengthCmd
G4UIcmdWithADoubleAndUnit * fTargRadiusCmd
exrdmDetectorMessenger(exrdmDetectorConstruction *)
virtual void SetNewValue(G4UIcommand *, G4String)
void SetUnitCategory(const char *unitCategory)
G4UIcmdWithAString * fDetectMatCmd
static G4double GetNewDoubleValue(const char *paramString)
G4UIcmdWithAString * fTargMatCmd
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:239
exrdmDetectorConstruction * fMyDetector
G4UIcmdWithADoubleAndUnit * fDetectLengthCmd
G4UIcmdWithADoubleAndUnit * fDetectThicknessCmd
Definition of the exrdmDetectorMessenger class.
void SetDetectorThickness(G4double value)
void SetDetectorLength(G4double value)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)