Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // 27 /// \file field/field04/src/F04FieldMessenger. 28 /// \brief Implementation of the F04FieldMesse 29 // 30 31 #include "F04FieldMessenger.hh" 32 33 #include "F04DetectorConstruction.hh" 34 #include "F04GlobalField.hh" 35 36 #include "G4UIcmdWithADoubleAndUnit.hh" 37 #include "G4UIcmdWithAString.hh" 38 #include "G4UIcmdWithAnInteger.hh" 39 #include "G4UIcmdWithoutParameter.hh" 40 #include "G4UIdirectory.hh" 41 42 //....oooOO0OOooo........oooOO0OOooo........oo 43 44 F04FieldMessenger::F04FieldMessenger(F04Global 45 : fGlobalField(pEMfield) 46 { 47 fDetector = detector; 48 49 fDetDir = new G4UIdirectory("/field/"); 50 fDetDir->SetGuidance(" Field tracking contro 51 52 fCaptureB1Cmd = new G4UIcmdWithADoubleAndUni 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 75 fStepperCMD->SetParameterName("choice", true 76 fStepperCMD->SetDefaultValue(4); 77 fStepperCMD->AvailableForStates(G4State_PreI 78 79 fMinStepCMD = new G4UIcmdWithADoubleAndUnit( 80 fMinStepCMD->SetGuidance("Define minimal ste 81 fMinStepCMD->SetParameterName("min step", fa 82 fMinStepCMD->SetDefaultUnit("mm"); 83 fMinStepCMD->AvailableForStates(G4State_PreI 84 85 fDeltaChordCMD = new G4UIcmdWithADoubleAndUn 86 fDeltaChordCMD->SetGuidance("Define delta ch 87 fDeltaChordCMD->SetParameterName("delta chor 88 fDeltaChordCMD->SetDefaultUnit("mm"); 89 fDeltaChordCMD->AvailableForStates(G4State_P 90 91 fDeltaOneStepCMD = new G4UIcmdWithADoubleAnd 92 fDeltaOneStepCMD->SetGuidance("Define delta 93 fDeltaOneStepCMD->SetParameterName("delta on 94 fDeltaOneStepCMD->SetDefaultUnit("mm"); 95 fDeltaOneStepCMD->AvailableForStates(G4State 96 97 fDeltaIntersectionCMD = new G4UIcmdWithADoub 98 fDeltaIntersectionCMD->SetGuidance("Define d 99 fDeltaIntersectionCMD->SetParameterName("del 100 fDeltaIntersectionCMD->SetDefaultUnit("mm"); 101 fDeltaIntersectionCMD->AvailableForStates(G4 102 103 fEpsMinCMD = new G4UIcmdWithADoubleAndUnit(" 104 fEpsMinCMD->SetGuidance("Define eps min"); 105 fEpsMinCMD->SetParameterName("eps min", fals 106 fEpsMinCMD->SetDefaultUnit("mm"); 107 fEpsMinCMD->AvailableForStates(G4State_PreIn 108 109 fEpsMaxCMD = new G4UIcmdWithADoubleAndUnit(" 110 fEpsMaxCMD->SetGuidance("Define eps max"); 111 fEpsMaxCMD->SetParameterName("eps max", fals 112 fEpsMaxCMD->SetDefaultUnit("mm"); 113 fEpsMaxCMD->AvailableForStates(G4State_PreIn 114 } 115 116 //....oooOO0OOooo........oooOO0OOooo........oo 117 118 F04FieldMessenger::~F04FieldMessenger() 119 { 120 delete fDetDir; 121 122 delete fCaptureB1Cmd; 123 delete fCaptureB2Cmd; 124 delete fTransferBCmd; 125 126 delete fStepperCMD; 127 delete fMinStepCMD; 128 delete fDeltaChordCMD; 129 delete fDeltaOneStepCMD; 130 delete fDeltaIntersectionCMD; 131 delete fEpsMinCMD; 132 delete fEpsMaxCMD; 133 } 134 135 //....oooOO0OOooo........oooOO0OOooo........oo 136 137 void F04FieldMessenger::SetNewValue(G4UIcomman 138 { 139 if (command == fCaptureB1Cmd) 140 fDetector->SetCaptureMgntB1(fCaptureB1Cmd- 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-> 150 } 151 if (command == fMinStepCMD) { 152 fGlobalField->SetMinStep(fMinStepCMD->GetN 153 } 154 if (command == fDeltaChordCMD) { 155 fGlobalField->SetDeltaChord(fDeltaChordCMD 156 } 157 if (command == fDeltaOneStepCMD) { 158 fGlobalField->SetDeltaOneStep(fDeltaOneSte 159 } 160 if (command == fDeltaIntersectionCMD) { 161 fGlobalField->SetDeltaIntersection(fDeltaI 162 } 163 if (command == fEpsMinCMD) { 164 fGlobalField->SetEpsMin(fEpsMinCMD->GetNew 165 } 166 if (command == fEpsMaxCMD) { 167 fGlobalField->SetEpsMax(fEpsMaxCMD->GetNew 168 } 169 } 170