source: trunk/examples/extended/field/field01/src/F01FieldMessenger.cc@ 1036

Last change on this file since 1036 was 807, checked in by garnier, 17 years ago

update

File size: 4.7 KB
Line 
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: F01FieldMessenger.cc,v 1.8 2006/06/29 17:16:33 gunter Exp $
28// GEANT4 tag $Name: $
29//
30//
31
32#include "F01FieldMessenger.hh"
33
34#include "F01FieldSetup.hh"
35#include "G4UIdirectory.hh"
36#include "G4UIcmdWithAString.hh"
37#include "G4UIcmdWithAnInteger.hh"
38#include "G4UIcmdWithADoubleAndUnit.hh"
39#include "G4UIcmdWithoutParameter.hh"
40
41//////////////////////////////////////////////////////////////////////////////
42
43F01FieldMessenger::F01FieldMessenger(F01FieldSetup* pEMfieldSetup)
44 :fEMfieldSetup(pEMfieldSetup)
45{
46 F01detDir = new G4UIdirectory("/field/");
47 F01detDir->SetGuidance("F01 field tracking control.");
48
49 StepperCmd = new G4UIcmdWithAnInteger("/field/setStepperType",this);
50 StepperCmd->SetGuidance("Select stepper type for magnetic field");
51 StepperCmd->SetParameterName("choice",true);
52 StepperCmd->SetDefaultValue(4);
53 StepperCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
54
55
56 UpdateCmd = new G4UIcmdWithoutParameter("/field/update",this);
57 UpdateCmd->SetGuidance("Update calorimeter geometry.");
58 UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
59 UpdateCmd->SetGuidance("if you changed geometrical value(s).");
60 UpdateCmd->AvailableForStates(G4State_Idle);
61
62 MagFieldCmd = new G4UIcmdWithADoubleAndUnit("/field/setFieldZ",this);
63 MagFieldCmd->SetGuidance("Define magnetic field.");
64 MagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
65 MagFieldCmd->SetParameterName("Bz",false,false);
66 MagFieldCmd->SetDefaultUnit("tesla");
67 MagFieldCmd->AvailableForStates(G4State_Idle);
68
69 MinStepCmd = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this);
70 MinStepCmd->SetGuidance("Define minimal step");
71 MinStepCmd->SetGuidance("Magnetic field will be in Z direction.");
72 MinStepCmd->SetParameterName("min step",false,false);
73 MinStepCmd->SetDefaultUnit("mm");
74 MinStepCmd->AvailableForStates(G4State_Idle);
75
76 AbsMaterCmd = new G4UIcmdWithAString("/field/setAbsMat",this);
77 AbsMaterCmd->SetGuidance("Select Material of the Absorber.");
78 AbsMaterCmd->SetParameterName("choice",true);
79 AbsMaterCmd->SetDefaultValue("Xe");
80 AbsMaterCmd->AvailableForStates(G4State_Idle);
81}
82
83///////////////////////////////////////////////////////////////////////////////
84
85F01FieldMessenger::~F01FieldMessenger()
86{
87 delete StepperCmd;
88 delete MagFieldCmd;
89 delete MinStepCmd;
90 delete F01detDir;
91 delete UpdateCmd;
92
93 delete AbsMaterCmd;
94}
95
96////////////////////////////////////////////////////////////////////////////
97//
98//
99
100void F01FieldMessenger::SetNewValue( G4UIcommand* command, G4String newValue)
101{
102 if( command == StepperCmd )
103 {
104 fEMfieldSetup->SetStepperType(StepperCmd->GetNewIntValue(newValue));
105 }
106 if( command == UpdateCmd )
107 {
108 fEMfieldSetup->CreateStepperAndChordFinder();
109 }
110 if( command == MagFieldCmd )
111 {
112 fEMfieldSetup->SetFieldValue(MagFieldCmd->GetNewDoubleValue(newValue));
113 }
114 if( command == MinStepCmd )
115 {
116 fEMfieldSetup->SetMinStep(MinStepCmd->GetNewDoubleValue(newValue));
117 }
118}
119
120//
121//
122/////////////////////////////////////////////////////////////////////////
Note: See TracBrowser for help on using the repository browser.