source: trunk/source/geometry/magneticfield/test/field02/src/F02FieldMessenger.cc @ 1347

Last change on this file since 1347 was 1347, checked in by garnier, 13 years ago

geant4 tag 9.4

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: F02FieldMessenger.cc,v 1.3 2006/06/29 18:28:01 gunter Exp $
28// GEANT4 tag $Name: geant4-09-04-ref-00 $
29//
30//
31
32#include "F02FieldMessenger.hh"
33
34#include "F02ElectroMagneticField.hh"
35#include "G4UIdirectory.hh"
36#include "G4UIcmdWithAString.hh"
37#include "G4UIcmdWithAnInteger.hh"
38#include "G4UIcmdWithADoubleAndUnit.hh"
39#include "G4UIcmdWithoutParameter.hh"
40
41//////////////////////////////////////////////////////////////////////////////
42
43F02FieldMessenger::F02FieldMessenger(F02ElectroMagneticField* pEMfield)
44  :fEMfield(pEMfield)
45{ 
46  F02detDir = new G4UIdirectory("/field/");
47  F02detDir->SetGuidance("F02 field tracking control.");
48
49  StepperCmd = new G4UIcmdWithAnInteger("/field/setStepperType",this);
50  StepperCmd->SetGuidance("Select stepper type for electric 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
85///////////////////////////////////////////////////////////////////////////////
86
87F02FieldMessenger::~F02FieldMessenger()
88{
89  delete StepperCmd;
90  delete MagFieldCmd;
91  delete MinStepCmd;
92  delete F02detDir;
93  delete UpdateCmd;
94
95  delete AbsMaterCmd; 
96}
97
98////////////////////////////////////////////////////////////////////////////
99//
100//
101
102void F02FieldMessenger::SetNewValue( G4UIcommand* command, G4String newValue)
103{ 
104  if( command == StepperCmd )
105  { 
106    fEMfield->SetStepperType(StepperCmd->GetNewIntValue(newValue));
107  } 
108  if( command == UpdateCmd )
109  { 
110    fEMfield->UpdateField(); 
111  }
112  if( command == MagFieldCmd )
113  { 
114    fEMfield->SetFieldValue(MagFieldCmd->GetNewDoubleValue(newValue));
115  }
116  if( command == MinStepCmd )
117  { 
118    fEMfield->SetMinStep(MinStepCmd->GetNewDoubleValue(newValue));
119  }
120}
121
122//
123//
124/////////////////////////////////////////////////////////////////////////
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
Note: See TracBrowser for help on using the repository browser.