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

Last change on this file since 829 was 807, checked in by garnier, 16 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: F02FieldMessenger.cc,v 1.6.2.1 2008/05/05 09:23:53 gcosmo Exp $
28// GEANT4 tag $Name: geant4-09-01-patch-02 $
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 G4UIcmdWithADouble("/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/mm");
67  ElFieldCmd->SetParameterName("Ez",false);
68  ElFieldCmd->AvailableForStates(G4State_Idle); 
69 
70  MinStepCmd = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this); 
71  MinStepCmd->SetGuidance("Define minimal step");
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 ElFieldCmd;
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    fEFieldSetup->SetStepperType(StepperCmd->GetNewIntValue(newValue));
107  } 
108  if( command == UpdateCmd )
109  { 
110    fEFieldSetup->UpdateField(); 
111  }
112  if( command == ElFieldCmd )
113  { 
114    fEFieldSetup->SetFieldValue(ElFieldCmd->GetNewDoubleValue(newValue));
115  }
116  if( command == MinStepCmd )
117  { 
118    fEFieldSetup->SetMinStep(MinStepCmd->GetNewDoubleValue(newValue));
119  }
120}
121
122//
123//
124/////////////////////////////////////////////////////////////////////////
Note: See TracBrowser for help on using the repository browser.