Geant4  10.02.p01
DetectorMessenger.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: DetectorMessenger.cc 70755 2013-06-05 12:17:48Z ihrivnac $
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 
34 #include "DetectorMessenger.hh"
35 
36 #include "DetectorConstruction.hh"
37 #include "G4UIdirectory.hh"
38 #include "G4UIcmdWithAString.hh"
40 
41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
42 
44 :G4UImessenger(),
45  fDetector(Det), fRdecayDir(0), fDetDir(0),
46  fTargMatCmd(0), fDetectMatCmd(0), fTargRadiusCmd(0),
47  fDetectThicknessCmd(0), fTargLengthCmd(0), fDetectLengthCmd(0)
48 {
49  fRdecayDir = new G4UIdirectory("/rdecay02/");
50  fRdecayDir->SetGuidance("commands specific to this example");
51 
52  G4bool broadcast = false;
53  fDetDir = new G4UIdirectory("/rdecay02/det/",broadcast);
54  fDetDir->SetGuidance("detector construction commands");
55 
56  fTargMatCmd = new G4UIcmdWithAString("/rdecay02/det/setTargetMate",this);
57  fTargMatCmd->SetGuidance("Select material of the target");
58  fTargMatCmd->SetParameterName("choice",false);
60 
62  new G4UIcmdWithADoubleAndUnit("/rdecay02/det/setTargetRadius", this);
63  fTargRadiusCmd->SetGuidance("Set the Target Radius.");
65  fTargRadiusCmd->SetParameterName("choice",false);
67 
68 
70  new G4UIcmdWithADoubleAndUnit("/rdecay02/det/setTargetLength", this);
71  fTargLengthCmd->SetGuidance("Set the Target Length.");
73  fTargLengthCmd->SetParameterName("choice",false);
75 
76 
77  fDetectMatCmd = new G4UIcmdWithAString("/rdecay02/det/setDetectorMate",this);
78  fDetectMatCmd->SetGuidance("Select Material of the Detector.");
79  fDetectMatCmd->SetParameterName("choice",false);
81 
83  new G4UIcmdWithADoubleAndUnit("/rdecay02/det/setDetectorThickness",this);
84  fDetectThicknessCmd->SetGuidance("Set the Detector Thickness.");
86  fDetectThicknessCmd->SetParameterName("choice",false);
88 
90  new G4UIcmdWithADoubleAndUnit("/rdecay02/det/setDetectorLength",this);
91  fDetectLengthCmd->SetGuidance("Set the Detector Length.");
93  fDetectLengthCmd->SetParameterName("choice",false);
95 }
96 
97 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
98 
100 {
101  delete fTargMatCmd;
102  delete fDetectMatCmd;
103  delete fTargRadiusCmd;
104  delete fDetectThicknessCmd;
105  delete fTargLengthCmd;
106  delete fDetectLengthCmd;
107  delete fDetDir;
108  delete fRdecayDir;
109 }
110 
111 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
112 
114 {
115  if (command == fTargMatCmd )
116  { fDetector->SetTargetMaterial(newValue);}
117 
118  if (command == fTargLengthCmd )
120 
121  if (command == fTargRadiusCmd )
123 
124  if (command == fDetectMatCmd )
125  { fDetector->SetDetectorMaterial(newValue);}
126 
127  if (command == fDetectLengthCmd )
129  fDetectLengthCmd->GetNewDoubleValue(newValue));}
130 
131  if (command == fDetectThicknessCmd )
134 }
135 
136 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
G4UIcmdWithADoubleAndUnit * fDetectLengthCmd
void SetDetectorMaterial(G4String)
G4UIcmdWithADoubleAndUnit * fDetectThicknessCmd
void SetTargetLength(G4double val)
void SetDetectorThickness(G4double value)
void SetNewValue(G4UIcommand *, G4String)
G4UIcmdWithADoubleAndUnit * fTargLengthCmd
G4UIcmdWithAString * fDetectMatCmd
void SetUnitCategory(const char *unitCategory)
static G4double GetNewDoubleValue(const char *paramString)
G4UIcmdWithAString * fTargMatCmd
G4UIdirectory * fRdecayDir
bool G4bool
Definition: G4Types.hh:79
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void SetDetectorLength(G4double value)
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:239
void SetTargetMaterial(const G4String &)
G4UIdirectory * fDetDir
void SetTargetRadius(G4double val)
DetectorMessenger(DetectorConstruction *)
Detector construction class to demonstrate various ways of placement.
DetectorConstruction * fDetector
G4UIcmdWithADoubleAndUnit * fTargRadiusCmd
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)