source: trunk/geant4/N03/src/ExN03DetectorMessenger.cc@ 578

Last change on this file since 578 was 483, checked in by garnier, 18 years ago

r569@mac-90108: laurentgarnier | 2007-06-05 15:53:34 +0200
version contre geant4.8.2.p01

File size: 6.4 KB
RevLine 
[474]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.10 2006/06/29 17:48:58 gunter Exp $
[483]28// GEANT4 tag $Name: geant4-08-01-patch-01 $
[474]29//
30//
31
32//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34
35#include "ExN03DetectorMessenger.hh"
36
37#include "ExN03DetectorConstruction.hh"
38#include "G4UIdirectory.hh"
39#include "G4UIcmdWithAString.hh"
40#include "G4UIcmdWithAnInteger.hh"
41#include "G4UIcmdWithADoubleAndUnit.hh"
42#include "G4UIcmdWithoutParameter.hh"
43
44//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
45
46ExN03DetectorMessenger::ExN03DetectorMessenger(
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);
59 AbsMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
60
61 GapMaterCmd = new G4UIcmdWithAString("/N03/det/setGapMat",this);
62 GapMaterCmd->SetGuidance("Select Material of the Gap.");
63 GapMaterCmd->SetParameterName("choice",false);
64 GapMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
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");
71 AbsThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
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");
78 GapThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
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");
85 SizeYZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
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");
91 NbLayersCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
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");
104 MagFieldCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
105}
106
107//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
108
109ExN03DetectorMessenger::~ExN03DetectorMessenger()
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
122void ExN03DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
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......
Note: See TracBrowser for help on using the repository browser.