source: trunk/examples/extended/field/field02/src/F02FieldMessenger.cc @ 1230

Last change on this file since 1230 was 1230, checked in by garnier, 14 years ago

update to geant4.9.3

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.8 2008/05/14 15:27:13 tnikitin Exp $
28// GEANT4 tag $Name: geant4-09-03-cand-01 $
29//
30//
31
32#include "F02FieldMessenger.hh"
33
34#include "F02ElectricFieldSetup.hh"
35#include "G4UIdirectory.hh"
36#include "G4UIcmdWithAString.hh"
37#include "G4UIcmdWithAnInteger.hh"
38#include "G4UIcmdWithADouble.hh"
39#include "G4UIcmdWithADoubleAndUnit.hh"
40#include "G4UIcmdWithoutParameter.hh"
41
42//////////////////////////////////////////////////////////////////////////////
43
44F02FieldMessenger::F02FieldMessenger(F02ElectricFieldSetup* pEMfield)
45  :fEFieldSetup(pEMfield)
46{ 
47  F02detDir = new G4UIdirectory("/field/");
48  F02detDir->SetGuidance("F02 field tracking control.");
49
50  StepperCmd = new G4UIcmdWithAnInteger("/field/setStepperType",this);
51  StepperCmd->SetGuidance("Select stepper type for electric field");
52  StepperCmd->SetParameterName("choice",true);
53  StepperCmd->SetDefaultValue(4);
54  StepperCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
55
56 
57  UpdateCmd = new G4UIcmdWithoutParameter("/field/update",this);
58  UpdateCmd->SetGuidance("Update calorimeter geometry.");
59  UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
60  UpdateCmd->SetGuidance("if you changed geometrical value(s).");
61  UpdateCmd->AvailableForStates(G4State_Idle);
62     
63  ElFieldCmd = new G4UIcmdWithADoubleAndUnit("/field/setFieldZ",this); 
64  ElFieldCmd->SetGuidance("Define uniform Electric field.");
65  ElFieldCmd->SetGuidance("Electric field will be in Z direction.");
66  ElFieldCmd->SetGuidance("Value of Electric field has to be given in volt/m");
67  ElFieldCmd->SetParameterName("Ez",false,false);
68  ElFieldCmd->SetDefaultUnit("volt/m");
69  ElFieldCmd->AvailableForStates(G4State_Idle); 
70 
71  MinStepCmd = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this); 
72  MinStepCmd->SetGuidance("Define minimal step");
73  MinStepCmd->SetParameterName("min step",false,false);
74  MinStepCmd->SetDefaultUnit("mm");
75  MinStepCmd->AvailableForStates(G4State_Idle); 
76       
77  AbsMaterCmd = new G4UIcmdWithAString("/field/setAbsMat",this);
78  AbsMaterCmd->SetGuidance("Select Material of the Absorber.");
79  AbsMaterCmd->SetParameterName("choice",true);
80  AbsMaterCmd->SetDefaultValue("Xe");
81  AbsMaterCmd->AvailableForStates(G4State_Idle);
82
83
84}
85
86///////////////////////////////////////////////////////////////////////////////
87
88F02FieldMessenger::~F02FieldMessenger()
89{
90  delete StepperCmd;
91  delete ElFieldCmd;
92  delete MinStepCmd;
93  delete F02detDir;
94  delete UpdateCmd;
95
96  delete AbsMaterCmd; 
97}
98
99////////////////////////////////////////////////////////////////////////////
100//
101//
102
103void F02FieldMessenger::SetNewValue( G4UIcommand* command, G4String newValue)
104{ 
105  if( command == StepperCmd )
106  { 
107    fEFieldSetup->SetStepperType(StepperCmd->GetNewIntValue(newValue));
108  } 
109  if( command == UpdateCmd )
110  { 
111    fEFieldSetup->UpdateField(); 
112  }
113  if( command == ElFieldCmd )
114  { 
115    fEFieldSetup->SetFieldValue(ElFieldCmd->GetNewDoubleValue(newValue));
116  }
117  if( command == MinStepCmd )
118  { 
119    fEFieldSetup->SetMinStep(MinStepCmd->GetNewDoubleValue(newValue));
120  }
121}
122
123//
124//
125/////////////////////////////////////////////////////////////////////////
Note: See TracBrowser for help on using the repository browser.