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 // 26 // 27 ////////////////////////////////////////////// 27 ////////////////////////////////////////////////////////////////////////////////////////////// 28 28 29 #include "FlashDetectorMessenger.hh" 29 #include "FlashDetectorMessenger.hh" 30 #include "FlashDetectorConstruction.hh" 30 #include "FlashDetectorConstruction.hh" 31 #include "G4UIdirectory.hh" 31 #include "G4UIdirectory.hh" 32 #include "G4UIcmdWith3VectorAndUnit.hh" 32 #include "G4UIcmdWith3VectorAndUnit.hh" 33 #include "G4UIcmdWithoutParameter.hh" 33 #include "G4UIcmdWithoutParameter.hh" 34 #include "G4UIcmdWithAString.hh" 34 #include "G4UIcmdWithAString.hh" 35 #include "G4UIcmdWithADoubleAndUnit.hh" 35 #include "G4UIcmdWithADoubleAndUnit.hh" 36 #include "G4UIcmdWithABool.hh" << 37 << 38 #include "G4SystemOfUnits.hh" << 39 36 40 ////////////////////////////////////////////// 37 ///////////////////////////////////////////////////////////////////////////// 41 FlashDetectorMessenger::FlashDetectorMessenger 38 FlashDetectorMessenger::FlashDetectorMessenger(FlashDetectorConstruction* detector) 42 :flashDetector(detector) 39 :flashDetector(detector) 43 { 40 { 44 // fChange Phantom size 41 // fChange Phantom size 45 fChangeThePhantomDir = new G4UIdirectory(" 42 fChangeThePhantomDir = new G4UIdirectory("/fChangePhantom/"); 46 fChangeThePhantomDir -> SetGuidance("Comma 43 fChangeThePhantomDir -> SetGuidance("Command to fChange the Phantom Size/position"); 47 44 48 // fChange Phantom material 45 // fChange Phantom material 49 fChangeThePhantomMaterialCmd = new G4UIcmd 46 fChangeThePhantomMaterialCmd = new G4UIcmdWithAString("/changePhantom/material", this); 50 fChangeThePhantomMaterialCmd -> SetGuidanc 47 fChangeThePhantomMaterialCmd -> SetGuidance("fChange the Phantom and the detector material"); 51 fChangeThePhantomMaterialCmd -> SetParamet 48 fChangeThePhantomMaterialCmd -> SetParameterName("PhantomMaterial", false); 52 fChangeThePhantomMaterialCmd -> SetDefault 49 fChangeThePhantomMaterialCmd -> SetDefaultValue("G4_WATER"); 53 fChangeThePhantomMaterialCmd -> AvailableF 50 fChangeThePhantomMaterialCmd -> AvailableForStates(G4State_Idle); 54 51 >> 52 >> 53 55 // fChange Detector size 54 // fChange Detector size 56 fChangeTheDetectorDir = new G4UIdirectory( 55 fChangeTheDetectorDir = new G4UIdirectory("/changeDetector/"); 57 fChangeTheDetectorDir -> SetGuidance("Comm 56 fChangeTheDetectorDir -> SetGuidance("Command to fChange the Detector Size"); 58 57 59 // fChange Detector material << 58 // fChange Detector material 60 fChangeTheDetectorMaterialCmd = new G4UIcm 59 fChangeTheDetectorMaterialCmd = new G4UIcmdWithAString("/changeDetector/material", this); 61 fChangeTheDetectorMaterialCmd -> SetGuida 60 fChangeTheDetectorMaterialCmd -> SetGuidance("fChange the Phantom and the detector material"); 62 fChangeTheDetectorMaterialCmd -> SetParam 61 fChangeTheDetectorMaterialCmd -> SetParameterName("PhantomMaterial", false); >> 62 63 fChangeTheDetectorMaterialCmd -> Availabl 63 fChangeTheDetectorMaterialCmd -> AvailableForStates(G4State_Idle); 64 64 >> 65 65 66 66 fUpdateCmd = new G4UIcmdWithoutParameter(" 67 fUpdateCmd = new G4UIcmdWithoutParameter("/changePhantom/update",this); 67 fUpdateCmd->SetGuidance("Update Phantom/De 68 fUpdateCmd->SetGuidance("Update Phantom/Detector geometry."); 68 fUpdateCmd->SetGuidance("This command MUST 69 fUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" "); 69 fUpdateCmd->SetGuidance("if you fChanged g 70 fUpdateCmd->SetGuidance("if you fChanged geometrical value(s)."); 70 fUpdateCmd->AvailableForStates(G4State_Idl 71 fUpdateCmd->AvailableForStates(G4State_Idle); 71 72 72 fUpdateCmd_d = new G4UIcmdWithoutParameter 73 fUpdateCmd_d = new G4UIcmdWithoutParameter("/changeDetector/update",this); 73 fUpdateCmd_d->SetGuidance("Update Detector 74 fUpdateCmd_d->SetGuidance("Update Detector geometry."); 74 fUpdateCmd_d->SetGuidance("This command MU 75 fUpdateCmd_d->SetGuidance("This command MUST be applied before \"beamOn\" "); 75 fUpdateCmd_d->SetGuidance("if you fChanged 76 fUpdateCmd_d->SetGuidance("if you fChanged geometrical value(s)."); 76 fUpdateCmd_d->AvailableForStates(G4State_I 77 fUpdateCmd_d->AvailableForStates(G4State_Idle); >> 78 >> 79 77 80 78 fActivateDetArrayCmd = new G4UIcmdWithABoo << 79 fActivateDetArrayCmd -> SetParameterName(" << 80 fActivateDetArrayCmd -> SetGuidance("Activ << 81 fActivateDetArrayCmd -> SetGuidance("This << 82 fActivateDetArrayCmd -> AvailableForStates << 83 } 81 } 84 82 85 ////////////////////////////////////////////// 83 ///////////////////////////////////////////////////////////////////////////// 86 FlashDetectorMessenger::~FlashDetectorMessenge 84 FlashDetectorMessenger::~FlashDetectorMessenger() 87 { 85 { 88 86 89 87 90 delete fChangeThePhantomDir; 88 delete fChangeThePhantomDir; 91 delete fChangeTheDetectorDir; 89 delete fChangeTheDetectorDir; 92 90 93 delete fChangeThePhantomMaterialCmd; 91 delete fChangeThePhantomMaterialCmd; 94 delete fChangeTheDetectorMaterialCmd; 92 delete fChangeTheDetectorMaterialCmd; 95 << 96 delete fActivateDetArrayCmd; << 97 93 98 } 94 } 99 95 100 ////////////////////////////////////////////// 96 ///////////////////////////////////////////////////////////////////////////// 101 void FlashDetectorMessenger::SetNewValue(G4UIc 97 void FlashDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue) 102 { 98 { 103 99 104 100 105 if (command == fChangeThePhantomMaterialCmd) 101 if (command == fChangeThePhantomMaterialCmd) 106 { 102 { 107 flashDetector -> SetPhantomMaterial(newV 103 flashDetector -> SetPhantomMaterial(newValue); 108 } 104 } 109 105 110 else if (command == fChangeTheDetectorMate 106 else if (command == fChangeTheDetectorMaterialCmd) 111 { 107 { 112 flashDetector -> SetDetectorMaterial(new 108 flashDetector -> SetDetectorMaterial(newValue); 113 } 109 } 114 << 110 115 else if (command == fActivateDetArrayCmd){ << 111 116 G4bool fbool = fActivateDetArrayCmd -> Get << 117 flashDetector -> ActivateDetArray(fbool); << 118 } << 119 112 120 } 113 } 121 114