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 // $Id: F04FieldMessenger.cc 78551 2014-01-07 09:45:08Z gcosmo $ 26 // 27 // 27 /// \file field/field04/src/F04FieldMessenger. 28 /// \file field/field04/src/F04FieldMessenger.cc 28 /// \brief Implementation of the F04FieldMesse 29 /// \brief Implementation of the F04FieldMessenger class 29 // 30 // 30 31 31 #include "F04FieldMessenger.hh" 32 #include "F04FieldMessenger.hh" 32 33 33 #include "F04DetectorConstruction.hh" << 34 #include "F04GlobalField.hh" 34 #include "F04GlobalField.hh" 35 << 35 #include "G4UIdirectory.hh" 36 #include "G4UIcmdWithADoubleAndUnit.hh" << 37 #include "G4UIcmdWithAString.hh" 36 #include "G4UIcmdWithAString.hh" 38 #include "G4UIcmdWithAnInteger.hh" 37 #include "G4UIcmdWithAnInteger.hh" >> 38 #include "G4UIcmdWithADoubleAndUnit.hh" 39 #include "G4UIcmdWithoutParameter.hh" 39 #include "G4UIcmdWithoutParameter.hh" 40 #include "G4UIdirectory.hh" << 40 >> 41 #include "F04DetectorConstruction.hh" 41 42 42 //....oooOO0OOooo........oooOO0OOooo........oo 43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 43 44 44 F04FieldMessenger::F04FieldMessenger(F04Global << 45 F04FieldMessenger::F04FieldMessenger(F04GlobalField* pEMfield, >> 46 F04DetectorConstruction* detector) 45 : fGlobalField(pEMfield) 47 : fGlobalField(pEMfield) 46 { 48 { 47 fDetector = detector; 49 fDetector = detector; 48 50 49 fDetDir = new G4UIdirectory("/field/"); 51 fDetDir = new G4UIdirectory("/field/"); 50 fDetDir->SetGuidance(" Field tracking contro 52 fDetDir->SetGuidance(" Field tracking control "); 51 53 52 fCaptureB1Cmd = new G4UIcmdWithADoubleAndUni << 54 fCaptureB1Cmd = new G4UIcmdWithADoubleAndUnit("/field/SetCaptureB1",this); 53 fCaptureB1Cmd->SetGuidance("Set B1 of the Ca 55 fCaptureB1Cmd->SetGuidance("Set B1 of the Capture Magnet"); 54 fCaptureB1Cmd->SetParameterName("CSizeB1", f << 56 fCaptureB1Cmd->SetParameterName("CSizeB1",false,false); 55 fCaptureB1Cmd->SetDefaultUnit("tesla"); 57 fCaptureB1Cmd->SetDefaultUnit("tesla"); 56 fCaptureB1Cmd->SetRange("CSizeB1>0."); 58 fCaptureB1Cmd->SetRange("CSizeB1>0."); 57 fCaptureB1Cmd->AvailableForStates(G4State_Pr << 59 fCaptureB1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle); 58 60 59 fCaptureB2Cmd = new G4UIcmdWithADoubleAndUni << 61 fCaptureB2Cmd = new G4UIcmdWithADoubleAndUnit("/field/SetCaptureB2",this); 60 fCaptureB2Cmd->SetGuidance("Set B2 of the Ca 62 fCaptureB2Cmd->SetGuidance("Set B2 of the Capture Magnet"); 61 fCaptureB2Cmd->SetParameterName("CSizeB2", f << 63 fCaptureB2Cmd->SetParameterName("CSizeB2",false,false); 62 fCaptureB2Cmd->SetDefaultUnit("tesla"); 64 fCaptureB2Cmd->SetDefaultUnit("tesla"); 63 fCaptureB2Cmd->SetRange("CSizeB2>0."); 65 fCaptureB2Cmd->SetRange("CSizeB2>0."); 64 fCaptureB2Cmd->AvailableForStates(G4State_Pr << 66 fCaptureB2Cmd->AvailableForStates(G4State_PreInit,G4State_Idle); 65 67 66 fTransferBCmd = new G4UIcmdWithADoubleAndUni << 68 fTransferBCmd = new G4UIcmdWithADoubleAndUnit("/field/SetTransferB",this); 67 fTransferBCmd->SetGuidance("Set B of the Tra 69 fTransferBCmd->SetGuidance("Set B of the Transfer Magnet"); 68 fTransferBCmd->SetParameterName("TSizeB", fa << 70 fTransferBCmd->SetParameterName("TSizeB",false,false); 69 fTransferBCmd->SetDefaultUnit("tesla"); 71 fTransferBCmd->SetDefaultUnit("tesla"); 70 fTransferBCmd->SetRange("TSizeB>0."); 72 fTransferBCmd->SetRange("TSizeB>0."); 71 fTransferBCmd->AvailableForStates(G4State_Pr << 73 fTransferBCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 72 74 73 fStepperCMD = new G4UIcmdWithAnInteger("/fie << 75 fStepperCMD = new G4UIcmdWithAnInteger("/field/setStepperType",this); 74 fStepperCMD->SetGuidance("Select stepper typ 76 fStepperCMD->SetGuidance("Select stepper type for field"); 75 fStepperCMD->SetParameterName("choice", true << 77 fStepperCMD->SetParameterName("choice",true); 76 fStepperCMD->SetDefaultValue(4); 78 fStepperCMD->SetDefaultValue(4); 77 fStepperCMD->AvailableForStates(G4State_PreI << 79 fStepperCMD->AvailableForStates(G4State_PreInit,G4State_Idle); 78 << 80 79 fMinStepCMD = new G4UIcmdWithADoubleAndUnit( << 81 fMinStepCMD = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this); 80 fMinStepCMD->SetGuidance("Define minimal ste 82 fMinStepCMD->SetGuidance("Define minimal step"); 81 fMinStepCMD->SetParameterName("min step", fa << 83 fMinStepCMD->SetParameterName("min step",false,false); 82 fMinStepCMD->SetDefaultUnit("mm"); 84 fMinStepCMD->SetDefaultUnit("mm"); 83 fMinStepCMD->AvailableForStates(G4State_PreI << 85 fMinStepCMD->AvailableForStates(G4State_PreInit,G4State_Idle); 84 86 85 fDeltaChordCMD = new G4UIcmdWithADoubleAndUn << 87 fDeltaChordCMD = new G4UIcmdWithADoubleAndUnit("/field/setDeltaChord",this); 86 fDeltaChordCMD->SetGuidance("Define delta ch 88 fDeltaChordCMD->SetGuidance("Define delta chord"); 87 fDeltaChordCMD->SetParameterName("delta chor << 89 fDeltaChordCMD->SetParameterName("delta chord",false,false); 88 fDeltaChordCMD->SetDefaultUnit("mm"); 90 fDeltaChordCMD->SetDefaultUnit("mm"); 89 fDeltaChordCMD->AvailableForStates(G4State_P << 91 fDeltaChordCMD->AvailableForStates(G4State_PreInit,G4State_Idle); 90 92 91 fDeltaOneStepCMD = new G4UIcmdWithADoubleAnd << 93 fDeltaOneStepCMD = >> 94 new G4UIcmdWithADoubleAndUnit("/field/setDeltaOneStep",this); 92 fDeltaOneStepCMD->SetGuidance("Define delta 95 fDeltaOneStepCMD->SetGuidance("Define delta one step"); 93 fDeltaOneStepCMD->SetParameterName("delta on << 96 fDeltaOneStepCMD->SetParameterName("delta one step",false,false); 94 fDeltaOneStepCMD->SetDefaultUnit("mm"); 97 fDeltaOneStepCMD->SetDefaultUnit("mm"); 95 fDeltaOneStepCMD->AvailableForStates(G4State << 98 fDeltaOneStepCMD->AvailableForStates(G4State_PreInit,G4State_Idle); 96 99 97 fDeltaIntersectionCMD = new G4UIcmdWithADoub << 100 fDeltaIntersectionCMD = >> 101 new G4UIcmdWithADoubleAndUnit("/field/setDeltaIntersection",this); 98 fDeltaIntersectionCMD->SetGuidance("Define d 102 fDeltaIntersectionCMD->SetGuidance("Define delta intersection"); 99 fDeltaIntersectionCMD->SetParameterName("del << 103 fDeltaIntersectionCMD->SetParameterName("delta intersection",false,false); 100 fDeltaIntersectionCMD->SetDefaultUnit("mm"); 104 fDeltaIntersectionCMD->SetDefaultUnit("mm"); 101 fDeltaIntersectionCMD->AvailableForStates(G4 << 105 fDeltaIntersectionCMD->AvailableForStates(G4State_PreInit,G4State_Idle); 102 106 103 fEpsMinCMD = new G4UIcmdWithADoubleAndUnit(" << 107 fEpsMinCMD = new G4UIcmdWithADoubleAndUnit("/field/setEpsMin",this); 104 fEpsMinCMD->SetGuidance("Define eps min"); 108 fEpsMinCMD->SetGuidance("Define eps min"); 105 fEpsMinCMD->SetParameterName("eps min", fals << 109 fEpsMinCMD->SetParameterName("eps min",false,false); 106 fEpsMinCMD->SetDefaultUnit("mm"); 110 fEpsMinCMD->SetDefaultUnit("mm"); 107 fEpsMinCMD->AvailableForStates(G4State_PreIn << 111 fEpsMinCMD->AvailableForStates(G4State_PreInit,G4State_Idle); 108 112 109 fEpsMaxCMD = new G4UIcmdWithADoubleAndUnit(" << 113 fEpsMaxCMD = new G4UIcmdWithADoubleAndUnit("/field/setEpsMax",this); 110 fEpsMaxCMD->SetGuidance("Define eps max"); 114 fEpsMaxCMD->SetGuidance("Define eps max"); 111 fEpsMaxCMD->SetParameterName("eps max", fals << 115 fEpsMaxCMD->SetParameterName("eps max",false,false); 112 fEpsMaxCMD->SetDefaultUnit("mm"); 116 fEpsMaxCMD->SetDefaultUnit("mm"); 113 fEpsMaxCMD->AvailableForStates(G4State_PreIn << 117 fEpsMaxCMD->AvailableForStates(G4State_PreInit,G4State_Idle); 114 } 118 } 115 119 116 //....oooOO0OOooo........oooOO0OOooo........oo 120 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 117 121 118 F04FieldMessenger::~F04FieldMessenger() 122 F04FieldMessenger::~F04FieldMessenger() 119 { 123 { 120 delete fDetDir; 124 delete fDetDir; 121 125 122 delete fCaptureB1Cmd; 126 delete fCaptureB1Cmd; 123 delete fCaptureB2Cmd; 127 delete fCaptureB2Cmd; 124 delete fTransferBCmd; 128 delete fTransferBCmd; 125 129 126 delete fStepperCMD; 130 delete fStepperCMD; 127 delete fMinStepCMD; 131 delete fMinStepCMD; 128 delete fDeltaChordCMD; 132 delete fDeltaChordCMD; 129 delete fDeltaOneStepCMD; 133 delete fDeltaOneStepCMD; 130 delete fDeltaIntersectionCMD; 134 delete fDeltaIntersectionCMD; 131 delete fEpsMinCMD; 135 delete fEpsMinCMD; 132 delete fEpsMaxCMD; 136 delete fEpsMaxCMD; 133 } 137 } 134 138 135 //....oooOO0OOooo........oooOO0OOooo........oo 139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 136 140 137 void F04FieldMessenger::SetNewValue(G4UIcomman << 141 void F04FieldMessenger::SetNewValue( G4UIcommand* command, G4String newValue) 138 { 142 { 139 if (command == fCaptureB1Cmd) << 143 >> 144 if( command == fCaptureB1Cmd ) 140 fDetector->SetCaptureMgntB1(fCaptureB1Cmd- 145 fDetector->SetCaptureMgntB1(fCaptureB1Cmd->GetNewDoubleValue(newValue)); 141 146 142 if (command == fCaptureB2Cmd) << 147 if( command == fCaptureB2Cmd ) 143 fDetector->SetCaptureMgntB2(fCaptureB2Cmd- 148 fDetector->SetCaptureMgntB2(fCaptureB2Cmd->GetNewDoubleValue(newValue)); 144 149 145 if (command == fTransferBCmd) << 150 if( command == fTransferBCmd ) 146 fDetector->SetTransferMgntB(fTransferBCmd- 151 fDetector->SetTransferMgntB(fTransferBCmd->GetNewDoubleValue(newValue)); 147 152 148 if (command == fStepperCMD) { << 153 if( command == fStepperCMD ) >> 154 { 149 fGlobalField->SetStepperType(fStepperCMD-> 155 fGlobalField->SetStepperType(fStepperCMD->GetNewIntValue(newValue)); 150 } 156 } 151 if (command == fMinStepCMD) { << 157 if( command == fMinStepCMD ) >> 158 { 152 fGlobalField->SetMinStep(fMinStepCMD->GetN 159 fGlobalField->SetMinStep(fMinStepCMD->GetNewDoubleValue(newValue)); 153 } 160 } 154 if (command == fDeltaChordCMD) { << 161 if( command == fDeltaChordCMD ) >> 162 { 155 fGlobalField->SetDeltaChord(fDeltaChordCMD 163 fGlobalField->SetDeltaChord(fDeltaChordCMD->GetNewDoubleValue(newValue)); 156 } 164 } 157 if (command == fDeltaOneStepCMD) { << 165 if( command == fDeltaOneStepCMD ) 158 fGlobalField->SetDeltaOneStep(fDeltaOneSte << 166 { 159 } << 167 fGlobalField-> 160 if (command == fDeltaIntersectionCMD) { << 168 SetDeltaOneStep(fDeltaOneStepCMD->GetNewDoubleValue(newValue)); 161 fGlobalField->SetDeltaIntersection(fDeltaI << 169 } >> 170 if( command == fDeltaIntersectionCMD ) >> 171 { >> 172 fGlobalField-> >> 173 SetDeltaIntersection(fDeltaIntersectionCMD->GetNewDoubleValue(newValue)); 162 } 174 } 163 if (command == fEpsMinCMD) { << 175 if( command == fEpsMinCMD ) >> 176 { 164 fGlobalField->SetEpsMin(fEpsMinCMD->GetNew 177 fGlobalField->SetEpsMin(fEpsMinCMD->GetNewDoubleValue(newValue)); 165 } 178 } 166 if (command == fEpsMaxCMD) { << 179 if( command == fEpsMaxCMD ) >> 180 { 167 fGlobalField->SetEpsMax(fEpsMaxCMD->GetNew 181 fGlobalField->SetEpsMax(fEpsMaxCMD->GetNewDoubleValue(newValue)); 168 } 182 } 169 } 183 } 170 184