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 78723 2014-01-20 10:32:17Z gcosmo $
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"
39 #include "G4UIcmdWithAnInteger.hh"
41 
42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43 
45 :G4UImessenger(),fDetector(Det),
46  fTestemDir(0),
47  fDetDir(0),
48  fMaterCmd(0),
49  fRadiusCmd(0),
50  fTrackingCutCmd(0)
51 {
52  fTestemDir = new G4UIdirectory("/range/");
53  fTestemDir->SetGuidance("Detector control.");
54 
55  fDetDir = new G4UIdirectory("/range/det/");
56  fDetDir->SetGuidance("Detector construction commands");
57 
58  fMaterCmd = new G4UIcmdWithAString("/range/det/setMat",this);
59  fMaterCmd->SetGuidance("Select material of the sphere.");
60  fMaterCmd->SetParameterName("choice",false);
63 
64  fRadiusCmd = new G4UIcmdWithADoubleAndUnit("/range/det/setRadius",this);
65  fRadiusCmd->SetGuidance("Set radius of the absorber");
66  fRadiusCmd->SetParameterName("Radius",false);
67  fRadiusCmd->SetRange("Radius>0.");
68  fRadiusCmd->SetUnitCategory("Length");
71 
73  new G4UIcmdWithADoubleAndUnit("/range/det/setTrackingCut",this);
74  fTrackingCutCmd->SetGuidance("Set tracking cut in the absorber");
75  fTrackingCutCmd->SetParameterName("Cut",false);
76  fTrackingCutCmd->SetRange("Cut>0.");
80 }
81 
82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
83 
85 {
86  delete fMaterCmd;
87  delete fRadiusCmd;
88  delete fTrackingCutCmd;
89  delete fDetDir;
90  delete fTestemDir;
91 }
92 
93 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
94 
96 {
97  if( command == fMaterCmd )
98  { fDetector->SetMaterial(newValue);}
99 
100  if( command == fRadiusCmd )
102 
103  if( command == fTrackingCutCmd )
105 }
106 
107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4UIcmdWithADoubleAndUnit * fTrackingCutCmd
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetNewValue(G4UIcommand *, G4String)
G4UIcmdWithAString * fMaterCmd
void SetToBeBroadcasted(G4bool val)
Definition: G4UIcommand.hh:184
void SetUnitCategory(const char *unitCategory)
static G4double GetNewDoubleValue(const char *paramString)
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:239
G4UIdirectory * fDetDir
G4UIdirectory * fTestemDir
DetectorMessenger(DetectorConstruction *)
Detector construction class to demonstrate various ways of placement.
DetectorConstruction * fDetector
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
G4UIcmdWithADoubleAndUnit * fRadiusCmd