Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExN03DetectorMessenger.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 //
27 // $Id: ExN03DetectorMessenger.cc 66892 2013-01-17 10:57:59Z gunter $
28 //
29 //
30 
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 
35 
37 #include "G4UIdirectory.hh"
38 #include "G4UIcmdWithAString.hh"
39 #include "G4UIcmdWithAnInteger.hh"
42 
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44 
46  ExN03DetectorConstruction* ExN03Det)
47 :ExN03Detector(ExN03Det)
48 {
49  N03Dir = new G4UIdirectory("/N03/");
50  N03Dir->SetGuidance("UI commands of this example");
51 
52  detDir = new G4UIdirectory("/N03/det/");
53  detDir->SetGuidance("detector control");
54 
55  AbsMaterCmd = new G4UIcmdWithAString("/N03/det/setAbsMat",this);
56  AbsMaterCmd->SetGuidance("Select Material of the Absorber.");
57  AbsMaterCmd->SetParameterName("choice",false);
59 
60  GapMaterCmd = new G4UIcmdWithAString("/N03/det/setGapMat",this);
61  GapMaterCmd->SetGuidance("Select Material of the Gap.");
62  GapMaterCmd->SetParameterName("choice",false);
64 
65  AbsThickCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setAbsThick",this);
66  AbsThickCmd->SetGuidance("Set Thickness of the Absorber");
67  AbsThickCmd->SetParameterName("Size",false);
68  AbsThickCmd->SetRange("Size>=0.");
69  AbsThickCmd->SetUnitCategory("Length");
71 
72  GapThickCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setGapThick",this);
73  GapThickCmd->SetGuidance("Set Thickness of the Gap");
74  GapThickCmd->SetParameterName("Size",false);
75  GapThickCmd->SetRange("Size>=0.");
76  GapThickCmd->SetUnitCategory("Length");
78 
79  SizeYZCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setSizeYZ",this);
80  SizeYZCmd->SetGuidance("Set tranverse size of the calorimeter");
81  SizeYZCmd->SetParameterName("Size",false);
82  SizeYZCmd->SetRange("Size>0.");
83  SizeYZCmd->SetUnitCategory("Length");
85 
86  NbLayersCmd = new G4UIcmdWithAnInteger("/N03/det/setNbOfLayers",this);
87  NbLayersCmd->SetGuidance("Set number of layers.");
88  NbLayersCmd->SetParameterName("NbLayers",false);
89  NbLayersCmd->SetRange("NbLayers>0 && NbLayers<500");
91 
92  UpdateCmd = new G4UIcmdWithoutParameter("/N03/det/update",this);
93  UpdateCmd->SetGuidance("Update calorimeter geometry.");
94  UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
95  UpdateCmd->SetGuidance("if you changed geometrical value(s).");
96  UpdateCmd->AvailableForStates(G4State_Idle);
97 
98  MagFieldCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setField",this);
99  MagFieldCmd->SetGuidance("Define magnetic field.");
100  MagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
101  MagFieldCmd->SetParameterName("Bz",false);
102  MagFieldCmd->SetUnitCategory("Magnetic flux density");
104 }
105 
106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
107 
109 {
110  delete NbLayersCmd;
111  delete AbsMaterCmd; delete GapMaterCmd;
112  delete AbsThickCmd; delete GapThickCmd;
113  delete SizeYZCmd; delete UpdateCmd;
114  delete MagFieldCmd;
115  delete detDir;
116  delete N03Dir;
117 }
118 
119 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
120 
122 {
123  if( command == AbsMaterCmd )
124  { ExN03Detector->SetAbsorberMaterial(newValue);}
125 
126  if( command == GapMaterCmd )
127  { ExN03Detector->SetGapMaterial(newValue);}
128 
129  if( command == AbsThickCmd )
130  { ExN03Detector->SetAbsorberThickness(AbsThickCmd
131  ->GetNewDoubleValue(newValue));}
132 
133  if( command == GapThickCmd )
134  { ExN03Detector->SetGapThickness(GapThickCmd->GetNewDoubleValue(newValue));}
135 
136  if( command == SizeYZCmd )
137  { ExN03Detector->SetCalorSizeYZ(SizeYZCmd->GetNewDoubleValue(newValue));}
138 
139  if( command == NbLayersCmd )
140  { ExN03Detector->SetNbOfLayers(NbLayersCmd->GetNewIntValue(newValue));}
141 
142  if( command == UpdateCmd )
143  { ExN03Detector->UpdateGeometry(); }
144 
145  if( command == MagFieldCmd )
146  { ExN03Detector->SetMagField(MagFieldCmd->GetNewDoubleValue(newValue));}
147 }
148 
149 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
ExN03DetectorMessenger(ExN03DetectorConstruction *)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4int GetNewIntValue(const char *paramString)
void SetNewValue(G4UIcommand *, G4String)
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)