Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // << 27 /// \file field/field04/src/F04FieldMessenger. 26 /// \file field/field04/src/F04FieldMessenger.cc 28 /// \brief Implementation of the F04FieldMesse 27 /// \brief Implementation of the F04FieldMessenger class 29 // 28 // 30 << 29 // 31 #include "F04FieldMessenger.hh" 30 #include "F04FieldMessenger.hh" 32 31 33 #include "F04DetectorConstruction.hh" << 34 #include "F04GlobalField.hh" 32 #include "F04GlobalField.hh" 35 << 33 #include "G4UIdirectory.hh" 36 #include "G4UIcmdWithADoubleAndUnit.hh" << 37 #include "G4UIcmdWithAString.hh" 34 #include "G4UIcmdWithAString.hh" 38 #include "G4UIcmdWithAnInteger.hh" 35 #include "G4UIcmdWithAnInteger.hh" >> 36 #include "G4UIcmdWithADoubleAndUnit.hh" 39 #include "G4UIcmdWithoutParameter.hh" 37 #include "G4UIcmdWithoutParameter.hh" 40 #include "G4UIdirectory.hh" << 41 38 42 //....oooOO0OOooo........oooOO0OOooo........oo 39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 43 40 44 F04FieldMessenger::F04FieldMessenger(F04Global << 41 F04FieldMessenger::F04FieldMessenger(F04GlobalField* pEMfield) 45 : fGlobalField(pEMfield) 42 : fGlobalField(pEMfield) 46 { 43 { 47 fDetector = detector; << 48 << 49 fDetDir = new G4UIdirectory("/field/"); 44 fDetDir = new G4UIdirectory("/field/"); 50 fDetDir->SetGuidance(" Field tracking contro 45 fDetDir->SetGuidance(" Field tracking control "); 51 46 52 fCaptureB1Cmd = new G4UIcmdWithADoubleAndUni << 47 fStepperCMD = new G4UIcmdWithAnInteger("/field/setStepperType",this); 53 fCaptureB1Cmd->SetGuidance("Set B1 of the Ca << 54 fCaptureB1Cmd->SetParameterName("CSizeB1", f << 55 fCaptureB1Cmd->SetDefaultUnit("tesla"); << 56 fCaptureB1Cmd->SetRange("CSizeB1>0."); << 57 fCaptureB1Cmd->AvailableForStates(G4State_Pr << 58 << 59 fCaptureB2Cmd = new G4UIcmdWithADoubleAndUni << 60 fCaptureB2Cmd->SetGuidance("Set B2 of the Ca << 61 fCaptureB2Cmd->SetParameterName("CSizeB2", f << 62 fCaptureB2Cmd->SetDefaultUnit("tesla"); << 63 fCaptureB2Cmd->SetRange("CSizeB2>0."); << 64 fCaptureB2Cmd->AvailableForStates(G4State_Pr << 65 << 66 fTransferBCmd = new G4UIcmdWithADoubleAndUni << 67 fTransferBCmd->SetGuidance("Set B of the Tra << 68 fTransferBCmd->SetParameterName("TSizeB", fa << 69 fTransferBCmd->SetDefaultUnit("tesla"); << 70 fTransferBCmd->SetRange("TSizeB>0."); << 71 fTransferBCmd->AvailableForStates(G4State_Pr << 72 << 73 fStepperCMD = new G4UIcmdWithAnInteger("/fie << 74 fStepperCMD->SetGuidance("Select stepper typ 48 fStepperCMD->SetGuidance("Select stepper type for field"); 75 fStepperCMD->SetParameterName("choice", true << 49 fStepperCMD->SetParameterName("choice",true); 76 fStepperCMD->SetDefaultValue(4); 50 fStepperCMD->SetDefaultValue(4); 77 fStepperCMD->AvailableForStates(G4State_PreI << 51 fStepperCMD->AvailableForStates(G4State_PreInit,G4State_Idle); >> 52 >> 53 fUpdateCMD = new G4UIcmdWithoutParameter("/field/update",this); >> 54 fUpdateCMD->SetGuidance("Update Field"); >> 55 fUpdateCMD->SetGuidance("This command MUST be applied before \"beamOn\" "); >> 56 fUpdateCMD->SetGuidance("if you changed field settings."); >> 57 fUpdateCMD->AvailableForStates(G4State_PreInit,G4State_Idle); 78 58 79 fMinStepCMD = new G4UIcmdWithADoubleAndUnit( << 59 fMinStepCMD = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this); 80 fMinStepCMD->SetGuidance("Define minimal ste 60 fMinStepCMD->SetGuidance("Define minimal step"); 81 fMinStepCMD->SetParameterName("min step", fa << 61 fMinStepCMD->SetParameterName("min step",false,false); 82 fMinStepCMD->SetDefaultUnit("mm"); 62 fMinStepCMD->SetDefaultUnit("mm"); 83 fMinStepCMD->AvailableForStates(G4State_PreI << 63 fMinStepCMD->AvailableForStates(G4State_PreInit,G4State_Idle); 84 64 85 fDeltaChordCMD = new G4UIcmdWithADoubleAndUn << 65 fDeltaChordCMD = new G4UIcmdWithADoubleAndUnit("/field/setDeltaChord",this); 86 fDeltaChordCMD->SetGuidance("Define delta ch 66 fDeltaChordCMD->SetGuidance("Define delta chord"); 87 fDeltaChordCMD->SetParameterName("delta chor << 67 fDeltaChordCMD->SetParameterName("delta chord",false,false); 88 fDeltaChordCMD->SetDefaultUnit("mm"); 68 fDeltaChordCMD->SetDefaultUnit("mm"); 89 fDeltaChordCMD->AvailableForStates(G4State_P << 69 fDeltaChordCMD->AvailableForStates(G4State_PreInit,G4State_Idle); 90 70 91 fDeltaOneStepCMD = new G4UIcmdWithADoubleAnd << 71 fDeltaOneStepCMD = >> 72 new G4UIcmdWithADoubleAndUnit("/field/setDeltaOneStep",this); 92 fDeltaOneStepCMD->SetGuidance("Define delta 73 fDeltaOneStepCMD->SetGuidance("Define delta one step"); 93 fDeltaOneStepCMD->SetParameterName("delta on << 74 fDeltaOneStepCMD->SetParameterName("delta one step",false,false); 94 fDeltaOneStepCMD->SetDefaultUnit("mm"); 75 fDeltaOneStepCMD->SetDefaultUnit("mm"); 95 fDeltaOneStepCMD->AvailableForStates(G4State << 76 fDeltaOneStepCMD->AvailableForStates(G4State_PreInit,G4State_Idle); 96 77 97 fDeltaIntersectionCMD = new G4UIcmdWithADoub << 78 fDeltaIntersectionCMD = >> 79 new G4UIcmdWithADoubleAndUnit("/field/setDeltaIntersection",this); 98 fDeltaIntersectionCMD->SetGuidance("Define d 80 fDeltaIntersectionCMD->SetGuidance("Define delta intersection"); 99 fDeltaIntersectionCMD->SetParameterName("del << 81 fDeltaIntersectionCMD->SetParameterName("delta intersection",false,false); 100 fDeltaIntersectionCMD->SetDefaultUnit("mm"); 82 fDeltaIntersectionCMD->SetDefaultUnit("mm"); 101 fDeltaIntersectionCMD->AvailableForStates(G4 << 83 fDeltaIntersectionCMD->AvailableForStates(G4State_PreInit,G4State_Idle); 102 84 103 fEpsMinCMD = new G4UIcmdWithADoubleAndUnit(" << 85 fEpsMinCMD = new G4UIcmdWithADoubleAndUnit("/field/setEpsMin",this); 104 fEpsMinCMD->SetGuidance("Define eps min"); 86 fEpsMinCMD->SetGuidance("Define eps min"); 105 fEpsMinCMD->SetParameterName("eps min", fals << 87 fEpsMinCMD->SetParameterName("eps min",false,false); 106 fEpsMinCMD->SetDefaultUnit("mm"); 88 fEpsMinCMD->SetDefaultUnit("mm"); 107 fEpsMinCMD->AvailableForStates(G4State_PreIn << 89 fEpsMinCMD->AvailableForStates(G4State_PreInit,G4State_Idle); 108 90 109 fEpsMaxCMD = new G4UIcmdWithADoubleAndUnit(" << 91 fEpsMaxCMD = new G4UIcmdWithADoubleAndUnit("/field/setEpsMax",this); 110 fEpsMaxCMD->SetGuidance("Define eps max"); 92 fEpsMaxCMD->SetGuidance("Define eps max"); 111 fEpsMaxCMD->SetParameterName("eps max", fals << 93 fEpsMaxCMD->SetParameterName("eps max",false,false); 112 fEpsMaxCMD->SetDefaultUnit("mm"); 94 fEpsMaxCMD->SetDefaultUnit("mm"); 113 fEpsMaxCMD->AvailableForStates(G4State_PreIn << 95 fEpsMaxCMD->AvailableForStates(G4State_PreInit,G4State_Idle); 114 } 96 } 115 97 116 //....oooOO0OOooo........oooOO0OOooo........oo 98 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 117 99 118 F04FieldMessenger::~F04FieldMessenger() 100 F04FieldMessenger::~F04FieldMessenger() 119 { 101 { 120 delete fDetDir; 102 delete fDetDir; 121 103 122 delete fCaptureB1Cmd; << 123 delete fCaptureB2Cmd; << 124 delete fTransferBCmd; << 125 << 126 delete fStepperCMD; 104 delete fStepperCMD; 127 delete fMinStepCMD; 105 delete fMinStepCMD; 128 delete fDeltaChordCMD; 106 delete fDeltaChordCMD; 129 delete fDeltaOneStepCMD; 107 delete fDeltaOneStepCMD; 130 delete fDeltaIntersectionCMD; 108 delete fDeltaIntersectionCMD; 131 delete fEpsMinCMD; 109 delete fEpsMinCMD; 132 delete fEpsMaxCMD; 110 delete fEpsMaxCMD; >> 111 delete fUpdateCMD; 133 } 112 } 134 113 135 //....oooOO0OOooo........oooOO0OOooo........oo 114 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 136 115 137 void F04FieldMessenger::SetNewValue(G4UIcomman << 116 void F04FieldMessenger::SetNewValue( G4UIcommand* command, G4String newValue) 138 { 117 { 139 if (command == fCaptureB1Cmd) << 118 if( command == fStepperCMD ) 140 fDetector->SetCaptureMgntB1(fCaptureB1Cmd- << 119 { 141 << 142 if (command == fCaptureB2Cmd) << 143 fDetector->SetCaptureMgntB2(fCaptureB2Cmd- << 144 << 145 if (command == fTransferBCmd) << 146 fDetector->SetTransferMgntB(fTransferBCmd- << 147 << 148 if (command == fStepperCMD) { << 149 fGlobalField->SetStepperType(fStepperCMD-> 120 fGlobalField->SetStepperType(fStepperCMD->GetNewIntValue(newValue)); 150 } 121 } 151 if (command == fMinStepCMD) { << 122 if( command == fUpdateCMD ) >> 123 { >> 124 fGlobalField->UpdateField(); >> 125 } >> 126 if( command == fMinStepCMD ) >> 127 { 152 fGlobalField->SetMinStep(fMinStepCMD->GetN 128 fGlobalField->SetMinStep(fMinStepCMD->GetNewDoubleValue(newValue)); 153 } 129 } 154 if (command == fDeltaChordCMD) { << 130 if( command == fDeltaChordCMD ) >> 131 { 155 fGlobalField->SetDeltaChord(fDeltaChordCMD 132 fGlobalField->SetDeltaChord(fDeltaChordCMD->GetNewDoubleValue(newValue)); 156 } 133 } 157 if (command == fDeltaOneStepCMD) { << 134 if( command == fDeltaOneStepCMD ) 158 fGlobalField->SetDeltaOneStep(fDeltaOneSte << 135 { 159 } << 136 fGlobalField-> 160 if (command == fDeltaIntersectionCMD) { << 137 SetDeltaOneStep(fDeltaOneStepCMD->GetNewDoubleValue(newValue)); 161 fGlobalField->SetDeltaIntersection(fDeltaI << 138 } >> 139 if( command == fDeltaIntersectionCMD ) >> 140 { >> 141 fGlobalField-> >> 142 SetDeltaIntersection(fDeltaIntersectionCMD->GetNewDoubleValue(newValue)); 162 } 143 } 163 if (command == fEpsMinCMD) { << 144 if( command == fEpsMinCMD ) >> 145 { 164 fGlobalField->SetEpsMin(fEpsMinCMD->GetNew 146 fGlobalField->SetEpsMin(fEpsMinCMD->GetNewDoubleValue(newValue)); 165 } 147 } 166 if (command == fEpsMaxCMD) { << 148 if( command == fEpsMaxCMD ) >> 149 { 167 fGlobalField->SetEpsMax(fEpsMaxCMD->GetNew 150 fGlobalField->SetEpsMax(fEpsMaxCMD->GetNewDoubleValue(newValue)); 168 } 151 } 169 } 152 } 170 153