Loading...
Searching...
No Matches
F03FieldMessenger.cc
Go to the documentation of this file.
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/// \file field/field03/src/F03FieldMessenger.cc
27/// \brief Implementation of the F03FieldMessenger class
28//
29//
30//
31//
32//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34
35#include "F03FieldMessenger.hh"
36
37#include "F03FieldSetup.hh"
38#include "G4UIcmdWithAnInteger.hh"
39#include "G4UIcmdWithADoubleAndUnit.hh"
40#include "G4UIcmdWith3VectorAndUnit.hh"
41#include "G4UIcmdWithoutParameter.hh"
42
43#include "G4SystemOfUnits.hh"
44
45//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46
48 : fEMfieldSetup(fieldSetup)
49{
50 fFieldDir = new G4UIdirectory("/field/");
51 fFieldDir->SetGuidance("F03 field tracking control.");
52
53 fStepperCmd = new G4UIcmdWithAnInteger("/field/setStepperType",this);
54 fStepperCmd->SetGuidance("Select stepper type for magnetic field");
55 fStepperCmd->SetParameterName("choice",true);
56 fStepperCmd->SetDefaultValue(4);
57 fStepperCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
58
59 fUpdateCmd = new G4UIcmdWithoutParameter("/field/update",this);
60 fUpdateCmd->SetGuidance("Update calorimeter geometry.");
61 fUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
62 fUpdateCmd->SetGuidance("if you changed geometrical value(s).");
63 fUpdateCmd->AvailableForStates(G4State_Idle);
64
65 fMagFieldZCmd = new G4UIcmdWithADoubleAndUnit("/field/setFieldZ",this);
66 fMagFieldZCmd->SetGuidance("Define global magnetic field.");
67 fMagFieldZCmd->SetGuidance("Global magnetic field will be in Z direction.");
68 fMagFieldZCmd->SetParameterName("Bz",false,false);
69 fMagFieldZCmd->SetDefaultUnit("tesla");
70 fMagFieldZCmd->AvailableForStates(G4State_Idle);
71
72 fMagFieldCmd = new G4UIcmdWith3VectorAndUnit("/field/setField",this);
73 fMagFieldCmd->SetGuidance("Define global magnetic field.");
74 fMagFieldCmd->SetParameterName("Bx","By","Bz",false,false);
75 fMagFieldCmd->SetDefaultUnit("tesla");
76 fMagFieldCmd->AvailableForStates(G4State_Idle);
77
78 fLocalMagFieldCmd = new G4UIcmdWith3VectorAndUnit("/field/setLocalField",this);
79 fLocalMagFieldCmd->SetGuidance("Define local magnetic field.");
80 fLocalMagFieldCmd->SetParameterName("Blx","Bly","Blz",false,false);
81 fLocalMagFieldCmd->SetDefaultUnit("tesla");
82 fLocalMagFieldCmd->AvailableForStates(G4State_Idle);
83
84 fMinStepCmd = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this);
85 fMinStepCmd->SetGuidance("Define minimal step");
86 fMinStepCmd->SetGuidance("Magnetic field will be in Z direction.");
87 fMinStepCmd->SetParameterName("min step",false,false);
88 fMinStepCmd->SetDefaultUnit("mm");
89 fMinStepCmd->AvailableForStates(G4State_Idle);
90}
91
92//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
93
95{
96 delete fStepperCmd;
97 delete fMagFieldZCmd;
98 delete fMagFieldCmd;
99 delete fLocalMagFieldCmd;
100 delete fMinStepCmd;
101 delete fFieldDir;
102 delete fUpdateCmd;
103}
104
105//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
106
108{
109 if( command == fStepperCmd )
110 fEMfieldSetup->SetStepperType(fStepperCmd->GetNewIntValue(newValue));
111 if( command == fUpdateCmd )
113 if( command == fMagFieldZCmd )
114 {
115 fEMfieldSetup->SetFieldZValue(fMagFieldZCmd->GetNewDoubleValue(newValue));
116 // Check the value
117 G4cout << "Set global field value to " <<
118 fEMfieldSetup->GetGlobalFieldValue() / gauss << " Gauss " << G4endl;
119 }
120 if( command == fMagFieldCmd )
121 {
122 fEMfieldSetup->SetFieldValue(fMagFieldCmd->GetNew3VectorValue(newValue));
123 // Check the value
124 G4cout << "Set global field value to " <<
125 fEMfieldSetup->GetGlobalFieldValue() / gauss << " Gauss " << G4endl;
126 }
127 if( command == fLocalMagFieldCmd )
128 {
129 fEMfieldSetup->SetLocalFieldValue(fLocalMagFieldCmd->GetNew3VectorValue(newValue));
131 // Check the value
132 G4cout << "Set local field value to " <<
133 fEMfieldSetup->GetLocalFieldValue() / gauss << " Gauss " << G4endl;
134 }
135 if( command == fMinStepCmd )
136 fEMfieldSetup->SetMinStep(fMinStepCmd->GetNewDoubleValue(newValue));
137}
138
139//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Definition of the F03FieldMessenger class.
Definition of the F03FieldSetup class.
G4UIcmdWithAnInteger * fStepperCmd
G4UIdirectory * fFieldDir
G4UIcmdWith3VectorAndUnit * fLocalMagFieldCmd
G4UIcmdWithoutParameter * fUpdateCmd
G4UIcmdWith3VectorAndUnit * fMagFieldCmd
G4UIcmdWithADoubleAndUnit * fMagFieldZCmd
G4UIcmdWithADoubleAndUnit * fMinStepCmd
F03FieldMessenger(F03FieldSetup *)
void SetNewValue(G4UIcommand *, G4String) override
F03FieldSetup * fEMfieldSetup
~F03FieldMessenger() override
A class for setting up the Magnetic Field.
G4ThreeVector GetGlobalFieldValue() const
void SetMinStep(G4double s)
void SetFieldValue(G4ThreeVector fieldVector)
void SetLocalFieldValue(G4ThreeVector fieldVector)
void SetStepperType(G4int i)
G4ThreeVector GetLocalFieldValue() const
void SetFieldZValue(G4double fieldValue)

Applications | User Support | Publications | Collaboration