Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
examples/extended/polarisation/Pol01/src/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 //
26 /// \file polarisation/Pol01/src/DetectorMessenger.cc
27 /// \brief Implementation of the DetectorMessenger class
28 //
29 // $Id: DetectorMessenger.cc 68753 2013-04-05 10:26:04Z 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"
41 
42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43 
45 :Detector(Det)
46 {
47  testemDir = new G4UIdirectory("/testem/");
48  testemDir->SetGuidance("commands specific to this example");
49 
50  detDir = new G4UIdirectory("/testem/det/");
51  detDir->SetGuidance("detector construction");
52 
53  MaterCmd = new G4UIcmdWithAString("/testem/det/setMat",this);
54  MaterCmd->SetGuidance("Select material of the box.");
55  MaterCmd->SetParameterName("choice",false);
57 
58  SizeXYCmd = new G4UIcmdWithADoubleAndUnit("/testem/det/setSizeXY",this);
59  SizeXYCmd->SetGuidance("Set sizeXY of the box");
60  SizeXYCmd->SetParameterName("Size",false);
61  SizeXYCmd->SetRange("Size>0.");
62  SizeXYCmd->SetUnitCategory("Length");
64 
65  SizeZCmd = new G4UIcmdWithADoubleAndUnit("/testem/det/setSizeZ",this);
66  SizeZCmd->SetGuidance("Set sizeZ of the box");
67  SizeZCmd->SetParameterName("SizeZ",false);
68  SizeZCmd->SetRange("SizeZ>0.");
69  SizeZCmd->SetUnitCategory("Length");
71 
72  UpdateCmd = new G4UIcmdWithoutParameter("/testem/det/update",this);
73  UpdateCmd->SetGuidance("Update calorimeter geometry.");
74  UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
75  UpdateCmd->SetGuidance("if you changed geometrical value(s).");
76  UpdateCmd->AvailableForStates(G4State_Idle);
77 }
78 
79 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
80 
82 {
83  delete MaterCmd;
84  delete SizeXYCmd;
85  delete SizeZCmd;
86  delete UpdateCmd;
87  delete detDir;
88  delete testemDir;
89 }
90 
91 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
92 
94 {
95  if( command == MaterCmd )
96  { Detector->SetTargetMaterial(newValue);}
97 
98  if( command == SizeXYCmd )
99  { Detector->SetSizeXY(SizeXYCmd->GetNewDoubleValue(newValue));}
100 
101  if( command == SizeZCmd )
102  { Detector->SetSizeZ(SizeZCmd->GetNewDoubleValue(newValue));}
103 
104  if( command == UpdateCmd )
105  { Detector->UpdateGeometry(); }
106 }
107 
108 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
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:225
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)