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 // $Id: XrayFluoMercuryDetectorMessenger.cc >> 28 // GEANT4 tag $Name: 27 // 29 // 28 // Author: Alfonso Mantero (Alfonso.Mantero@ge 30 // Author: Alfonso Mantero (Alfonso.Mantero@ge.infn.it) 29 // 31 // 30 // History: 32 // History: 31 // ----------- 33 // ----------- 32 // 34 // 33 // 18 Sep 2003 Alfonso Mantero created 35 // 18 Sep 2003 Alfonso Mantero created 34 // 36 // 35 // ------------------------------------------- 37 // ------------------------------------------------------------------- 36 38 37 39 38 #include "XrayFluoMercuryDetectorMessenger.hh" 40 #include "XrayFluoMercuryDetectorMessenger.hh" 39 #include "XrayFluoMercuryDetectorConstruction. 41 #include "XrayFluoMercuryDetectorConstruction.hh" 40 #include "G4UIdirectory.hh" 42 #include "G4UIdirectory.hh" 41 #include "G4UIcmdWithAString.hh" 43 #include "G4UIcmdWithAString.hh" 42 #include "G4UIcmdWithADoubleAndUnit.hh" 44 #include "G4UIcmdWithADoubleAndUnit.hh" 43 #include "G4UIcmdWithoutParameter.hh" 45 #include "G4UIcmdWithoutParameter.hh" 44 #include "G4UIcmdWithABool.hh" 46 #include "G4UIcmdWithABool.hh" 45 #include "G4RunManager.hh" 47 #include "G4RunManager.hh" 46 48 47 //....oooOO0OOooo........oooOO0OOooo........oo 49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 48 50 49 XrayFluoMercuryDetectorMessenger::XrayFluoMerc 51 XrayFluoMercuryDetectorMessenger::XrayFluoMercuryDetectorMessenger(XrayFluoMercuryDetectorConstruction * Det) 50 :Detector(Det) 52 :Detector(Det) 51 { 53 { 52 detDir = new G4UIdirectory("/apparate/"); 54 detDir = new G4UIdirectory("/apparate/"); 53 detDir->SetGuidance("detector control."); 55 detDir->SetGuidance("detector control."); 54 56 55 UpdateCmd = new G4UIcmdWithoutParameter("/ap 57 UpdateCmd = new G4UIcmdWithoutParameter("/apparate/update",this); 56 UpdateCmd->SetGuidance("Update apparate geom 58 UpdateCmd->SetGuidance("Update apparate geometry."); 57 UpdateCmd->SetGuidance("This command MUST be 59 UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" "); 58 UpdateCmd->SetGuidance("if you changed geome 60 UpdateCmd->SetGuidance("if you changed geometrical value(s): /apparate/GrainDiameter and /apparate/sampleGranularity"); 59 61 60 UpdateCmd->AvailableForStates(G4State_Idle); 62 UpdateCmd->AvailableForStates(G4State_Idle); 61 63 62 sampleCmd = new G4UIcmdWithAString("/apparat 64 sampleCmd = new G4UIcmdWithAString("/apparate/mercuryMaterial",this); 63 sampleCmd->SetGuidance("select a diferent ma 65 sampleCmd->SetGuidance("select a diferent material for the mercury"); 64 sampleCmd->SetParameterName("material",true) 66 sampleCmd->SetParameterName("material",true); 65 sampleCmd->SetDefaultValue("mars1"); 67 sampleCmd->SetDefaultValue("mars1"); 66 sampleCmd->SetCandidates("Dolorite Anorthosi 68 sampleCmd->SetCandidates("Dolorite Anorthosite Mars1 IceBasalt"); 67 sampleCmd->AvailableForStates(G4State_Idle); 69 sampleCmd->AvailableForStates(G4State_Idle); 68 70 69 detectorCmd = new G4UIcmdWithAString("/appar 71 detectorCmd = new G4UIcmdWithAString("/apparate/detector",this); 70 detectorCmd->SetGuidance("select a diferent 72 detectorCmd->SetGuidance("select a diferent detectorType"); 71 detectorCmd->SetParameterName("detector",tru 73 detectorCmd->SetParameterName("detector",true); 72 detectorCmd->SetDefaultValue("sili"); 74 detectorCmd->SetDefaultValue("sili"); 73 detectorCmd->SetCandidates("sili hpge"); 75 detectorCmd->SetCandidates("sili hpge"); 74 detectorCmd->AvailableForStates(G4State_Idle 76 detectorCmd->AvailableForStates(G4State_Idle); 75 77 76 latitudeAngleCmd = new G4UIcmdWithADoubleAnd 78 latitudeAngleCmd = new G4UIcmdWithADoubleAndUnit( "/apparate/latitude",this ); 77 latitudeAngleCmd->SetGuidance( "Set latitude 79 latitudeAngleCmd->SetGuidance( "Set latitude angle of the spacecraft" ); 78 latitudeAngleCmd->SetGuidance( "After this, 80 latitudeAngleCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" ); 79 latitudeAngleCmd->SetGuidance( "Default: 45 81 latitudeAngleCmd->SetGuidance( "Default: 45 deg " ); 80 latitudeAngleCmd->SetParameterName( "Latitud 82 latitudeAngleCmd->SetParameterName( "Latitude Angle", true, true ); 81 latitudeAngleCmd->SetDefaultUnit( "deg" ); 83 latitudeAngleCmd->SetDefaultUnit( "deg" ); 82 latitudeAngleCmd->SetUnitCategory( "Angle" ) 84 latitudeAngleCmd->SetUnitCategory( "Angle" ); 83 latitudeAngleCmd->AvailableForStates(G4State 85 latitudeAngleCmd->AvailableForStates(G4State_Idle); 84 86 85 orbitHeightCmd = new G4UIcmdWithADoubleAndUn 87 orbitHeightCmd = new G4UIcmdWithADoubleAndUnit( "/apparate/orbitHeight",this ); 86 orbitHeightCmd->SetGuidance( "Set height of << 88 orbitHeightCmd->SetGuidance( "Set height of the spacecraft above Mercuey Surface" ); 87 orbitHeightCmd->SetGuidance( "After this, /a 89 orbitHeightCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" ); 88 orbitHeightCmd->SetGuidance( "Default: 400 k 90 orbitHeightCmd->SetGuidance( "Default: 400 km " ); 89 orbitHeightCmd->SetParameterName( "Spacecraf 91 orbitHeightCmd->SetParameterName( "Spacecraft Altitude", true, true ); 90 orbitHeightCmd->SetDefaultUnit( "km" ); 92 orbitHeightCmd->SetDefaultUnit( "km" ); 91 orbitHeightCmd->SetUnitCategory( "Length" ); 93 orbitHeightCmd->SetUnitCategory( "Length" ); 92 orbitHeightCmd->AvailableForStates(G4State_I 94 orbitHeightCmd->AvailableForStates(G4State_Idle); 93 } 95 } 94 96 95 //....oooOO0OOooo........oooOO0OOooo........oo 97 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 96 98 97 XrayFluoMercuryDetectorMessenger::~XrayFluoMe 99 XrayFluoMercuryDetectorMessenger::~XrayFluoMercuryDetectorMessenger() 98 { 100 { 99 delete UpdateCmd; 101 delete UpdateCmd; 100 delete detDir; 102 delete detDir; 101 } 103 } 102 104 103 //....oooOO0OOooo........oooOO0OOooo........oo 105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 104 106 105 void XrayFluoMercuryDetectorMessenger::SetNewV 107 void XrayFluoMercuryDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue) 106 { 108 { 107 if( command == UpdateCmd ) 109 if( command == UpdateCmd ) 108 { 110 { 109 //This triggers a full re-build of the ge 111 //This triggers a full re-build of the geometry. The method in the 110 //geometry will take care of that. 112 //geometry will take care of that. 111 Detector->UpdateGeometry(); 113 Detector->UpdateGeometry(); 112 return; 114 return; 113 } 115 } 114 else if ( command == sampleCmd ) 116 else if ( command == sampleCmd ) 115 { Detector->SetMercuryMaterial(newValue);} 117 { Detector->SetMercuryMaterial(newValue);} 116 118 117 else if ( command == detectorCmd ) 119 else if ( command == detectorCmd ) 118 { Detector->SetDetectorType(newValue);} 120 { Detector->SetDetectorType(newValue);} 119 121 120 else if ( command == latitudeAngleCmd ) 122 else if ( command == latitudeAngleCmd ) 121 { 123 { 122 G4double newAngle = latitudeAngleCmd->Get 124 G4double newAngle = latitudeAngleCmd->GetNewDoubleValue(newValue); 123 Detector->SetLatitude(newAngle); 125 Detector->SetLatitude(newAngle); 124 } 126 } 125 127 126 else if ( command == orbitHeightCmd ) 128 else if ( command == orbitHeightCmd ) 127 { 129 { 128 G4double newAngle = orbitHeightCmd->GetNe 130 G4double newAngle = orbitHeightCmd->GetNewDoubleValue(newValue); 129 Detector->SetOribitHeight(newAngle); 131 Detector->SetOribitHeight(newAngle); 130 } 132 } 131 //Notify the run manager that the geometry ha 133 //Notify the run manager that the geometry has been modified 132 G4RunManager::GetRunManager()->GeometryHasBee 134 G4RunManager::GetRunManager()->GeometryHasBeenModified(); 133 135 134 } 136 } 135 137 136 138 137 //....oooOO0OOooo........oooOO0OOooo........oo 139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 138 140 139 141 140 142 141 143 142 144 143 145 144 146 145 147 146 148 147 149