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 /// \file medical/fanoCavity2/src/DetectorMess 26 /// \file medical/fanoCavity2/src/DetectorMessenger.cc 27 /// \brief Implementation of the DetectorMesse 27 /// \brief Implementation of the DetectorMessenger class 28 // 28 // >> 29 // $Id: DetectorMessenger.cc 68763 2013-04-05 12:36:20Z gcosmo $ 29 // 30 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 33 33 #include "DetectorMessenger.hh" 34 #include "DetectorMessenger.hh" 34 35 35 #include "DetectorConstruction.hh" 36 #include "DetectorConstruction.hh" 36 << 37 #include "G4UIdirectory.hh" 37 #include "G4UIcmdWithADoubleAndUnit.hh" << 38 #include "G4UIcmdWithAString.hh" 38 #include "G4UIcmdWithAString.hh" >> 39 #include "G4UIcmdWithADoubleAndUnit.hh" 39 #include "G4UIcmdWithoutParameter.hh" 40 #include "G4UIcmdWithoutParameter.hh" 40 #include "G4UIdirectory.hh" << 41 41 42 //....oooOO0OOooo........oooOO0OOooo........oo 42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 43 43 44 DetectorMessenger::DetectorMessenger(DetectorC << 44 DetectorMessenger::DetectorMessenger(DetectorConstruction * Det) 45 { << 45 :fDetector(Det), fTestemDir(0), fDetDir(0), fWallMater(0), fWallThick(0), >> 46 fCavThick(0), fWorldRadius(0), fUpdateCmd(0) >> 47 { 46 fTestemDir = new G4UIdirectory("/testem/"); 48 fTestemDir = new G4UIdirectory("/testem/"); 47 fTestemDir->SetGuidance(" detector control." 49 fTestemDir->SetGuidance(" detector control."); 48 << 50 49 fDetDir = new G4UIdirectory("/testem/det/"); 51 fDetDir = new G4UIdirectory("/testem/det/"); 50 fDetDir->SetGuidance("detector construction 52 fDetDir->SetGuidance("detector construction commands"); 51 << 53 52 fWallMater = new G4UIcmdWithAString("/testem << 54 fWallMater = new G4UIcmdWithAString("/testem/det/wallMater",this); 53 fWallMater->SetGuidance("Set material of the 55 fWallMater->SetGuidance("Set material of the wall."); 54 fWallMater->SetParameterName("wallMat", fals << 56 fWallMater->SetParameterName("wallMat",false); 55 fWallMater->AvailableForStates(G4State_PreIn << 57 56 << 58 fWallThick = new G4UIcmdWithADoubleAndUnit("/testem/det/wallThickness",this); 57 fWallThick = new G4UIcmdWithADoubleAndUnit(" << 58 fWallThick->SetGuidance("Set tickness of the 59 fWallThick->SetGuidance("Set tickness of the wall"); 59 fWallThick->SetParameterName("wallTick", fal << 60 fWallThick->SetParameterName("wallTick",false); 60 fWallThick->SetRange("wallTick>0."); 61 fWallThick->SetRange("wallTick>0."); 61 fWallThick->SetUnitCategory("Length"); 62 fWallThick->SetUnitCategory("Length"); 62 fWallThick->AvailableForStates(G4State_PreIn << 63 63 << 64 fCavThick = new G4UIcmdWithADoubleAndUnit("/testem/det/cavityThickness",this); 64 fCavMater = new G4UIcmdWithAString("/testem/ << 65 fCavMater->SetGuidance("Set material of the << 66 fCavMater->SetParameterName("cavMat", false) << 67 fCavMater->AvailableForStates(G4State_PreIni << 68 << 69 fCavThick = new G4UIcmdWithADoubleAndUnit("/ << 70 fCavThick->SetGuidance("Set tickness of the 65 fCavThick->SetGuidance("Set tickness of the cavity"); 71 fCavThick->SetParameterName("cavityTick", fa << 66 fCavThick->SetParameterName("cavityTick",false); 72 fCavThick->SetRange("cavityTick>0."); 67 fCavThick->SetRange("cavityTick>0."); 73 fCavThick->SetUnitCategory("Length"); 68 fCavThick->SetUnitCategory("Length"); 74 fCavThick->AvailableForStates(G4State_PreIni << 69 75 << 70 fWorldRadius = new G4UIcmdWithADoubleAndUnit("/testem/det/worldRadius",this); 76 fCavRadius = new G4UIcmdWithADoubleAndUnit(" << 71 fWorldRadius->SetGuidance("Set radius of the cavity"); 77 fCavRadius->SetGuidance("Set radius of the c << 72 fWorldRadius->SetParameterName("cavityRadius",false); 78 fCavRadius->SetParameterName("cavityRadius", << 73 fWorldRadius->SetRange("cavityRadius>0."); 79 fCavRadius->SetRange("cavityRadius>0."); << 74 fWorldRadius->SetUnitCategory("Length"); 80 fCavRadius->SetUnitCategory("Length"); << 75 81 fCavRadius->AvailableForStates(G4State_PreIn << 76 fUpdateCmd = new G4UIcmdWithoutParameter("/testem/det/update",this); >> 77 fUpdateCmd->SetGuidance("Update geometry."); >> 78 fUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" "); >> 79 fUpdateCmd->SetGuidance("if you changed geometrical value(s)."); >> 80 fUpdateCmd->AvailableForStates(G4State_Idle); 82 } 81 } 83 82 84 //....oooOO0OOooo........oooOO0OOooo........oo 83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 85 84 86 DetectorMessenger::~DetectorMessenger() 85 DetectorMessenger::~DetectorMessenger() 87 { 86 { 88 delete fWallMater; 87 delete fWallMater; 89 delete fWallThick; << 88 90 << 89 delete fWallThick; 91 delete fCavMater; << 90 delete fCavThick; 92 delete fCavThick; << 91 delete fWorldRadius; 93 delete fCavRadius; << 92 94 << 93 delete fUpdateCmd; 95 delete fDetDir; << 94 delete fDetDir; 96 delete fTestemDir; 95 delete fTestemDir; 97 } 96 } 98 97 99 //....oooOO0OOooo........oooOO0OOooo........oo 98 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 100 99 101 void DetectorMessenger::SetNewValue(G4UIcomman << 100 void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue) 102 { << 101 { 103 if (command == fWallMater) { << 102 if( command == fWallMater ) 104 fDetector->SetWallMaterial(newValue); << 103 { fDetector->SetWallMaterial(newValue);} 105 } << 104 106 << 105 if( command == fWallThick ) 107 if (command == fWallThick) { << 106 { fDetector->SetWallThickness(fWallThick->GetNewDoubleValue(newValue));} 108 fDetector->SetWallThickness(fWallThick->Ge << 107 109 } << 108 if( command == fCavThick ) 110 << 109 { fDetector->SetCavityThickness(fCavThick->GetNewDoubleValue(newValue));} 111 if (command == fCavMater) { << 110 112 fDetector->SetCavityMaterial(newValue); << 111 if( command == fWorldRadius ) 113 } << 112 { fDetector->SetWorldRadius(fWorldRadius->GetNewDoubleValue(newValue));} 114 << 113 115 if (command == fCavThick) { << 114 if( command == fUpdateCmd ) 116 fDetector->SetCavityThickness(fCavThick->G << 115 { fDetector->UpdateGeometry();} 117 } << 118 << 119 if (command == fCavRadius) { << 120 fDetector->SetCavityRadius(fCavRadius->Get << 121 } << 122 } 116 } 123 117 124 //....oooOO0OOooo........oooOO0OOooo........oo 118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 125 119