| 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 | //
|
|---|
| 28 |
|
|---|
| 29 | #include "F04FieldMessenger.hh"
|
|---|
| 30 |
|
|---|
| 31 | #include "F04GlobalField.hh"
|
|---|
| 32 | #include "G4UIdirectory.hh"
|
|---|
| 33 | #include "G4UIcmdWithAString.hh"
|
|---|
| 34 | #include "G4UIcmdWithAnInteger.hh"
|
|---|
| 35 | #include "G4UIcmdWithADoubleAndUnit.hh"
|
|---|
| 36 | #include "G4UIcmdWithoutParameter.hh"
|
|---|
| 37 |
|
|---|
| 38 | //////////////////////////////////////////////////////////////////////////////
|
|---|
| 39 |
|
|---|
| 40 | F04FieldMessenger::F04FieldMessenger(F04GlobalField* pEMfield)
|
|---|
| 41 | : fGlobalField(pEMfield)
|
|---|
| 42 | {
|
|---|
| 43 | detDir = new G4UIdirectory("/field/");
|
|---|
| 44 | detDir->SetGuidance(" Field tracking control ");
|
|---|
| 45 |
|
|---|
| 46 | fStepperCMD = new G4UIcmdWithAnInteger("/field/setStepperType",this);
|
|---|
| 47 | fStepperCMD->SetGuidance("Select stepper type for field");
|
|---|
| 48 | fStepperCMD->SetParameterName("choice",true);
|
|---|
| 49 | fStepperCMD->SetDefaultValue(4);
|
|---|
| 50 | fStepperCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
|---|
| 51 |
|
|---|
| 52 | fUpdateCMD = new G4UIcmdWithoutParameter("/field/update",this);
|
|---|
| 53 | fUpdateCMD->SetGuidance("Update Field");
|
|---|
| 54 | fUpdateCMD->SetGuidance("This command MUST be applied before \"beamOn\" ");
|
|---|
| 55 | fUpdateCMD->SetGuidance("if you changed field settings.");
|
|---|
| 56 | fUpdateCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
|---|
| 57 |
|
|---|
| 58 | fMinStepCMD = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this);
|
|---|
| 59 | fMinStepCMD->SetGuidance("Define minimal step");
|
|---|
| 60 | fMinStepCMD->SetParameterName("min step",false,false);
|
|---|
| 61 | fMinStepCMD->SetDefaultUnit("mm");
|
|---|
| 62 | fMinStepCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
|---|
| 63 |
|
|---|
| 64 | fDeltaChordCMD = new G4UIcmdWithADoubleAndUnit("/field/setDeltaChord",this);
|
|---|
| 65 | fDeltaChordCMD->SetGuidance("Define delta chord");
|
|---|
| 66 | fDeltaChordCMD->SetParameterName("delta chord",false,false);
|
|---|
| 67 | fDeltaChordCMD->SetDefaultUnit("mm");
|
|---|
| 68 | fDeltaChordCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
|---|
| 69 |
|
|---|
| 70 | fDeltaOneStepCMD =
|
|---|
| 71 | new G4UIcmdWithADoubleAndUnit("/field/setDeltaOneStep",this);
|
|---|
| 72 | fDeltaOneStepCMD->SetGuidance("Define delta one step");
|
|---|
| 73 | fDeltaOneStepCMD->SetParameterName("delta one step",false,false);
|
|---|
| 74 | fDeltaOneStepCMD->SetDefaultUnit("mm");
|
|---|
| 75 | fDeltaOneStepCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
|---|
| 76 |
|
|---|
| 77 | fDeltaIntersectionCMD =
|
|---|
| 78 | new G4UIcmdWithADoubleAndUnit("/field/setDeltaIntersection",this);
|
|---|
| 79 | fDeltaIntersectionCMD->SetGuidance("Define delta intersection");
|
|---|
| 80 | fDeltaIntersectionCMD->SetParameterName("delta intersection",false,false);
|
|---|
| 81 | fDeltaIntersectionCMD->SetDefaultUnit("mm");
|
|---|
| 82 | fDeltaIntersectionCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
|---|
| 83 |
|
|---|
| 84 | fEpsMinCMD = new G4UIcmdWithADoubleAndUnit("/field/setEpsMin",this);
|
|---|
| 85 | fEpsMinCMD->SetGuidance("Define eps min");
|
|---|
| 86 | fEpsMinCMD->SetParameterName("eps min",false,false);
|
|---|
| 87 | fEpsMinCMD->SetDefaultUnit("mm");
|
|---|
| 88 | fEpsMinCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
|---|
| 89 |
|
|---|
| 90 | fEpsMaxCMD = new G4UIcmdWithADoubleAndUnit("/field/setEpsMax",this);
|
|---|
| 91 | fEpsMaxCMD->SetGuidance("Define eps max");
|
|---|
| 92 | fEpsMaxCMD->SetParameterName("eps max",false,false);
|
|---|
| 93 | fEpsMaxCMD->SetDefaultUnit("mm");
|
|---|
| 94 | fEpsMaxCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
|---|
| 95 | }
|
|---|
| 96 |
|
|---|
| 97 | F04FieldMessenger::~F04FieldMessenger()
|
|---|
| 98 | {
|
|---|
| 99 | delete detDir;
|
|---|
| 100 |
|
|---|
| 101 | delete fStepperCMD;
|
|---|
| 102 | delete fMinStepCMD;
|
|---|
| 103 | delete fDeltaChordCMD;
|
|---|
| 104 | delete fDeltaOneStepCMD;
|
|---|
| 105 | delete fDeltaIntersectionCMD;
|
|---|
| 106 | delete fEpsMinCMD;
|
|---|
| 107 | delete fEpsMaxCMD;
|
|---|
| 108 | delete fUpdateCMD;
|
|---|
| 109 | }
|
|---|
| 110 |
|
|---|
| 111 | void F04FieldMessenger::SetNewValue( G4UIcommand* command, G4String newValue)
|
|---|
| 112 | {
|
|---|
| 113 | if( command == fStepperCMD )
|
|---|
| 114 | {
|
|---|
| 115 | fGlobalField->SetStepperType(fStepperCMD->GetNewIntValue(newValue));
|
|---|
| 116 | }
|
|---|
| 117 | if( command == fUpdateCMD )
|
|---|
| 118 | {
|
|---|
| 119 | fGlobalField->updateField();
|
|---|
| 120 | }
|
|---|
| 121 | if( command == fMinStepCMD )
|
|---|
| 122 | {
|
|---|
| 123 | fGlobalField->SetMinStep(fMinStepCMD->GetNewDoubleValue(newValue));
|
|---|
| 124 | }
|
|---|
| 125 | if( command == fDeltaChordCMD )
|
|---|
| 126 | {
|
|---|
| 127 | fGlobalField->SetDeltaChord(fDeltaChordCMD->GetNewDoubleValue(newValue));
|
|---|
| 128 | }
|
|---|
| 129 | if( command == fDeltaOneStepCMD )
|
|---|
| 130 | {
|
|---|
| 131 | fGlobalField->
|
|---|
| 132 | SetDeltaOneStep(fDeltaOneStepCMD->GetNewDoubleValue(newValue));
|
|---|
| 133 | }
|
|---|
| 134 | if( command == fDeltaIntersectionCMD )
|
|---|
| 135 | {
|
|---|
| 136 | fGlobalField->
|
|---|
| 137 | SetDeltaIntersection(fDeltaIntersectionCMD->GetNewDoubleValue(newValue));
|
|---|
| 138 | }
|
|---|
| 139 | if( command == fEpsMinCMD )
|
|---|
| 140 | {
|
|---|
| 141 | fGlobalField->SetEpsMin(fEpsMinCMD->GetNewDoubleValue(newValue));
|
|---|
| 142 | }
|
|---|
| 143 | if( command == fEpsMaxCMD )
|
|---|
| 144 | {
|
|---|
| 145 | fGlobalField->SetEpsMax(fEpsMaxCMD->GetNewDoubleValue(newValue));
|
|---|
| 146 | }
|
|---|
| 147 | }
|
|---|