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