Geant4  9.6.p02
 All Classes 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,v 1.1 2006-12-01 02:37:01 kmura Exp $
28 // GEANT4 tag $Name: not supported by cvs2svn $
29 //
30 //
31 
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 
36 
38 #include "G4UIdirectory.hh"
39 #include "G4UIcmdWithAString.hh"
40 #include "G4UIcmdWithAnInteger.hh"
43 
44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
45 
47  ExN03DetectorConstruction* ExN03Det)
48 :ExN03Detector(ExN03Det)
49 {
50  N03Dir = new G4UIdirectory("/N03/");
51  N03Dir->SetGuidance("UI commands of this example");
52 
53  detDir = new G4UIdirectory("/N03/det/");
54  detDir->SetGuidance("detector control");
55 
56  AbsMaterCmd = new G4UIcmdWithAString("/N03/det/setAbsMat",this);
57  AbsMaterCmd->SetGuidance("Select Material of the Absorber.");
58  AbsMaterCmd->SetParameterName("choice",false);
60 
61  GapMaterCmd = new G4UIcmdWithAString("/N03/det/setGapMat",this);
62  GapMaterCmd->SetGuidance("Select Material of the Gap.");
63  GapMaterCmd->SetParameterName("choice",false);
65 
66  AbsThickCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setAbsThick",this);
67  AbsThickCmd->SetGuidance("Set Thickness of the Absorber");
68  AbsThickCmd->SetParameterName("Size",false);
69  AbsThickCmd->SetRange("Size>=0.");
70  AbsThickCmd->SetUnitCategory("Length");
72 
73  GapThickCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setGapThick",this);
74  GapThickCmd->SetGuidance("Set Thickness of the Gap");
75  GapThickCmd->SetParameterName("Size",false);
76  GapThickCmd->SetRange("Size>=0.");
77  GapThickCmd->SetUnitCategory("Length");
79 
80  SizeYZCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setSizeYZ",this);
81  SizeYZCmd->SetGuidance("Set tranverse size of the calorimeter");
82  SizeYZCmd->SetParameterName("Size",false);
83  SizeYZCmd->SetRange("Size>0.");
84  SizeYZCmd->SetUnitCategory("Length");
86 
87  NbLayersCmd = new G4UIcmdWithAnInteger("/N03/det/setNbOfLayers",this);
88  NbLayersCmd->SetGuidance("Set number of layers.");
89  NbLayersCmd->SetParameterName("NbLayers",false);
90  NbLayersCmd->SetRange("NbLayers>0 && NbLayers<500");
92 
93  UpdateCmd = new G4UIcmdWithoutParameter("/N03/det/update",this);
94  UpdateCmd->SetGuidance("Update calorimeter geometry.");
95  UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
96  UpdateCmd->SetGuidance("if you changed geometrical value(s).");
97  UpdateCmd->AvailableForStates(G4State_Idle);
98 
99  MagFieldCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setField",this);
100  MagFieldCmd->SetGuidance("Define magnetic field.");
101  MagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
102  MagFieldCmd->SetParameterName("Bz",false);
103  MagFieldCmd->SetUnitCategory("Magnetic flux density");
105 }
106 
107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
108 
110 {
111  delete NbLayersCmd;
112  delete AbsMaterCmd; delete GapMaterCmd;
113  delete AbsThickCmd; delete GapThickCmd;
114  delete SizeYZCmd; delete UpdateCmd;
115  delete MagFieldCmd;
116  delete detDir;
117  delete N03Dir;
118 }
119 
120 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
121 
123 {
124  if( command == AbsMaterCmd )
125  { ExN03Detector->SetAbsorberMaterial(newValue);}
126 
127  if( command == GapMaterCmd )
128  { ExN03Detector->SetGapMaterial(newValue);}
129 
130  if( command == AbsThickCmd )
131  { ExN03Detector->SetAbsorberThickness(AbsThickCmd
132  ->GetNewDoubleValue(newValue));}
133 
134  if( command == GapThickCmd )
135  { ExN03Detector->SetGapThickness(GapThickCmd->GetNewDoubleValue(newValue));}
136 
137  if( command == SizeYZCmd )
138  { ExN03Detector->SetCalorSizeYZ(SizeYZCmd->GetNewDoubleValue(newValue));}
139 
140  if( command == NbLayersCmd )
141  { ExN03Detector->SetNbOfLayers(NbLayersCmd->GetNewIntValue(newValue));}
142 
143  if( command == UpdateCmd )
144  { ExN03Detector->UpdateGeometry(); }
145 
146  if( command == MagFieldCmd )
147  { ExN03Detector->SetMagField(MagFieldCmd->GetNewDoubleValue(newValue));}
148 }
149 
150 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......