Geant4  10.00.p02
ExG4DetectorConstruction02Messenger.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$
27 //
30 
33 
34 #include "G4UIdirectory.hh"
35 #include "G4UIcmdWithAString.hh"
37 #include "G4UIcmdWithADouble.hh"
38 
39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
40 
42  ExG4DetectorConstruction02* detectorConstruction)
43  : G4UImessenger(),
44  fDetectorConstruction(detectorConstruction),
45  fTopDirectory(0),
46  fDirectory(0),
47  fSetBoxMaterialCmd(0),
48  fSetWorldMaterialCmd(0),
49  fSetBoxDimensionsCmd(0),
50  fSetWorldSizeFactorCmd(0)
51 
52 {
53  fTopDirectory = new G4UIdirectory("/ExG4/");
54  fTopDirectory->SetGuidance("UI commands of common example classes");
55 
56  fDirectory = new G4UIdirectory("/ExG4/det/");
57  fDirectory->SetGuidance("Detector control");
58 
60  = new G4UIcmdWithAString("/ExG4/det/setBoxMaterial",this);
61  fSetBoxMaterialCmd->SetGuidance("Select material of the box.");
62  fSetBoxMaterialCmd->SetParameterName("BoxMaterial", false);
64 
66  = new G4UIcmdWithAString("/ExG4/det/setWorldMaterial",this);
67  fSetWorldMaterialCmd->SetGuidance("Select material of the world.");
68  fSetWorldMaterialCmd->SetParameterName("WorldMaterial", false);
70 
72  = new G4UIcmdWith3VectorAndUnit("/ExG4/det/setBoxDimensions",this);
73  fSetBoxDimensionsCmd->SetGuidance("Set box dimensions (in half lentgh).");
75  "BoxDimensionsHx", "BoxDimensionsHy","BoxDimensionsHz",
76  false);
77  //fSetBoxDimensionsCmd->SetUnitCategory("Length");
79 
81  = new G4UIcmdWithADouble("/ExG4/det/setWorldSizeFactor",this);
83  "Set the multiplication factor from box dimensions to world dimensions.");
84  fSetWorldSizeFactorCmd->SetParameterName("WorldSizeFactor", false);
85  fSetWorldSizeFactorCmd->SetRange("WorldSizeFactor >= 1");
87 }
88 
89 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
90 
92 {
93  delete fTopDirectory;
94  delete fDirectory;
95  delete fSetBoxMaterialCmd;
96  delete fSetWorldMaterialCmd;
97  delete fSetBoxDimensionsCmd;
99 }
100 
101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
102 
104  G4String newValue)
105 {
106  if( command == fSetBoxMaterialCmd ) {
108  }
109  else if( command == fSetWorldMaterialCmd ) {
111  }
112  else if( command == fSetBoxDimensionsCmd ) {
113  G4ThreeVector newDimensions
117  newDimensions.x(), newDimensions.y(), newDimensions.z());
118  }
119  else if ( command == fSetWorldSizeFactorCmd ) {
122  }
123 }
124 
125 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
virtual void SetNewValue(G4UIcommand *command, G4String newValue)
CLHEP::Hep3Vector G4ThreeVector
void SetWorldMaterial(const G4String &materialName)
void SetBoxDimensions(G4double hx, G4double hy, G4double hz)
static G4ThreeVector GetNew3VectorValue(const char *paramString)
void SetParameterName(const char *theNameX, const char *theNameY, const char *theNameZ, G4bool omittable, G4bool currentAsDefault=false)
Definition of the ExG4DetectorConstruction02 class.
Simple detector construction with a box volume placed in a world.
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 SetBoxMaterial(const G4String &materialName)
Definition of the ExG4DetectorConstruction02Messenger class.
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
ExG4DetectorConstruction02Messenger(ExG4DetectorConstruction02 *)