Loading...
Searching...
No Matches
F01FieldMessenger.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/field01/src/F01FieldMessenger.cc
27/// \brief Implementation of the F01FieldMessenger class
28//
29//
30//
31//
32//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34
35#include "F01FieldMessenger.hh"
36
37#include "F01FieldSetup.hh"
38#include "G4UIcmdWithAnInteger.hh"
39#include "G4UIcmdWithADouble.hh"
40#include "G4UIcmdWithADoubleAndUnit.hh"
41#include "G4UIcmdWith3VectorAndUnit.hh"
42#include "G4UIcmdWithoutParameter.hh"
43
44#include "G4FieldManager.hh"
45
46//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
47
49 : fEMfieldSetup(fieldSetup)
50{
51 fFieldDir = new G4UIdirectory("/field/");
52 fFieldDir->SetGuidance("F01 field tracking control.");
53
54 fStepperCmd = new G4UIcmdWithAnInteger("/field/setStepperType",this);
55 fStepperCmd->SetGuidance("Select stepper type for magnetic field");
56 fStepperCmd->SetParameterName("choice",true);
57 fStepperCmd->SetDefaultValue(4);
58 fStepperCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
59
60 fUpdateCmd = new G4UIcmdWithoutParameter("/field/update",this);
61 fUpdateCmd->SetGuidance("Update calorimeter geometry.");
62 fUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
63 fUpdateCmd->SetGuidance("if you changed geometrical value(s).");
64 fUpdateCmd->AvailableForStates(G4State_Idle);
65
66 fMagFieldZCmd = new G4UIcmdWithADoubleAndUnit("/field/setFieldZ",this);
67 fMagFieldZCmd->SetGuidance("Define magnetic field.");
68 fMagFieldZCmd->SetGuidance("Magnetic field will be in Z direction.");
69 fMagFieldZCmd->SetParameterName("Bz",false,false);
70 fMagFieldZCmd->SetDefaultUnit("tesla");
71 fMagFieldZCmd->AvailableForStates(G4State_Idle);
72
73 fMagFieldCmd = new G4UIcmdWith3VectorAndUnit("/field/setField",this);
74 fMagFieldCmd->SetGuidance("Define magnetic field.");
75 fMagFieldCmd->SetParameterName("Bx", "By", "Bz" ,false,false);
76 fMagFieldCmd->SetDefaultUnit("tesla");
77 fMagFieldCmd->AvailableForStates(G4State_Idle);
78
79 fMinStepCmd = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this);
80 fMinStepCmd->SetGuidance("Define minimal step");
81 fMinStepCmd->SetGuidance("Magnetic field will be in Z direction.");
82 fMinStepCmd->SetParameterName("minStep",false,false);
83 fMinStepCmd->SetDefaultUnit("mm");
84 fMinStepCmd->AvailableForStates(G4State_Idle);
85
86 // Commands for integration accuracy
87 // 1. Delta One Step = length of potential error in each integration substep
88 // Recall that there can be up to 300 substeps in a physics step !!
89 fDeltaOneStepCmd = new G4UIcmdWithADoubleAndUnit("/field/setDeltaOneStep",this);
90 fDeltaOneStepCmd->SetGuidance("Define minimal step");
91 fDeltaOneStepCmd->SetGuidance("Magnetic field will be in Z direction.");
92 fDeltaOneStepCmd->SetParameterName("minStep",false,false);
93 fDeltaOneStepCmd->SetDefaultUnit("mm");
94 fDeltaOneStepCmd->AvailableForStates(G4State_Idle);
95
96 // A choice: Allow the user to reset the Eps Min/Max values to our default
97 G4bool omitable= true, currentAsDefault= false;
98 fEpsMinCmd = new G4UIcmdWithADouble("/field/setEpsilonMin",this);
99 fEpsMinCmd->SetGuidance(
100 "Define minimum value of the relative integration error (EpsilonMin)"
101 " - a dimensionless number\n"
102 "Limit to ensure that large steps do NOT result in a very low value"
103 "(ie high accuracy) that integration needs many steps and CPU cycles.");
104 fEpsMinCmd->SetParameterName("minEpsilon",omitable,currentAsDefault);
105 fEpsMinCmd->SetDefaultValue(1.0e-4); // A default eps_min
106 fEpsMinCmd->AvailableForStates(G4State_Idle);
107
108 fEpsMaxCmd = new G4UIcmdWithADouble("/field/setEpsilonMax",this);
109 fEpsMaxCmd->SetGuidance(
110 "Define minimum value of the relative integration error (EpsilonMax)"
111 " - a dimensionless number\n"
112 "Limit to ensure a very small step does NOT result in a large relative"
113 " error (ie low accuracy) with unreliable results.");
114 fEpsMaxCmd->SetParameterName("maxEpsilon",omitable,currentAsDefault);
115 fEpsMinCmd->SetDefaultValue(1.0e-5); // A default eps_max
116 fEpsMaxCmd->AvailableForStates(G4State_Idle);
117
118 // HOW to Ensure that its value is val < G4FieldManager::GetMaxAcceptedEpsilon() ??
119
120}
121
122//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
123
125{
126 delete fStepperCmd;
127 delete fMagFieldZCmd;
128 delete fMagFieldCmd;
129 delete fMinStepCmd;
130 delete fDeltaOneStepCmd;
131 delete fEpsMinCmd;
132 delete fEpsMaxCmd;
133 delete fFieldDir;
134 delete fUpdateCmd;
135}
136
137//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
138
140{
141 if( command == fStepperCmd )
142 fEMfieldSetup->SetStepperType(fStepperCmd->GetNewIntValue(newValue));
143 if( command == fUpdateCmd )
145 if( command == fMagFieldZCmd )
146 fEMfieldSetup->SetFieldZValue(fMagFieldZCmd->GetNewDoubleValue(newValue));
147 if( command == fMagFieldCmd )
148 fEMfieldSetup->SetFieldValue(fMagFieldCmd->GetNew3VectorValue(newValue));
149 if( command == fMinStepCmd )
150 fEMfieldSetup->SetMinStep(fMinStepCmd->GetNewDoubleValue(newValue));
151 if( command == fDeltaOneStepCmd )
152 fEMfieldSetup->SetDeltaOneStep(fDeltaOneStepCmd->GetNewDoubleValue(newValue));
153 if( command == fEpsMinCmd )
154 fEMfieldSetup->SetEpsilonMin(fEpsMinCmd->GetNewDoubleValue(newValue));
155 if( command == fEpsMaxCmd )
156 fEMfieldSetup->SetEpsilonMax(fEpsMaxCmd->GetNewDoubleValue(newValue));
157}
158
159//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01FieldMessenger allows interactive user control of.
Definition of the F01FieldSetup class.
G4UIcmdWithADoubleAndUnit * fMinStepCmd
G4UIcmdWithADoubleAndUnit * fDeltaOneStepCmd
G4UIcmdWithAnInteger * fStepperCmd
G4UIcmdWithADoubleAndUnit * fMagFieldZCmd
G4UIcmdWithoutParameter * fUpdateCmd
F01FieldMessenger(F01FieldSetup *)
F01FieldSetup * fEMfieldSetup
void SetNewValue(G4UIcommand *, G4String) override
G4UIcmdWithADouble * fEpsMinCmd
G4UIcmdWithADouble * fEpsMaxCmd
G4UIdirectory * fFieldDir
G4UIcmdWith3VectorAndUnit * fMagFieldCmd
void SetMinStep(G4double s)
void CreateStepperAndChordFinder()
void SetFieldZValue(G4double fieldValue)
void SetStepperType(G4int i)
void SetEpsilonMax(G4double val)
void SetDeltaOneStep(G4double val)
void SetFieldValue(G4ThreeVector fieldVector)
void SetEpsilonMin(G4double val)

Applications | User Support | Publications | Collaboration