Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // 23 // >> 24 // $Id: XrayFluoMercuryDetectorMessenger.cc >> 25 // GEANT4 tag $Name: 27 // 26 // 28 // Author: Alfonso Mantero (Alfonso.Mantero@ge 27 // Author: Alfonso Mantero (Alfonso.Mantero@ge.infn.it) 29 // 28 // 30 // History: 29 // History: 31 // ----------- 30 // ----------- 32 // 31 // 33 // 18 Sep 2003 Alfonso Mantero created 32 // 18 Sep 2003 Alfonso Mantero created 34 // 33 // 35 // ------------------------------------------- 34 // ------------------------------------------------------------------- 36 35 37 36 38 #include "XrayFluoMercuryDetectorMessenger.hh" 37 #include "XrayFluoMercuryDetectorMessenger.hh" 39 #include "XrayFluoMercuryDetectorConstruction. 38 #include "XrayFluoMercuryDetectorConstruction.hh" 40 #include "G4UIdirectory.hh" 39 #include "G4UIdirectory.hh" 41 #include "G4UIcmdWithAString.hh" 40 #include "G4UIcmdWithAString.hh" 42 #include "G4UIcmdWithADoubleAndUnit.hh" 41 #include "G4UIcmdWithADoubleAndUnit.hh" 43 #include "G4UIcmdWithoutParameter.hh" 42 #include "G4UIcmdWithoutParameter.hh" 44 #include "G4UIcmdWithABool.hh" 43 #include "G4UIcmdWithABool.hh" 45 #include "G4RunManager.hh" << 46 44 47 //....oooOO0OOooo........oooOO0OOooo........oo 45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 48 46 49 XrayFluoMercuryDetectorMessenger::XrayFluoMerc 47 XrayFluoMercuryDetectorMessenger::XrayFluoMercuryDetectorMessenger(XrayFluoMercuryDetectorConstruction * Det) 50 :Detector(Det) 48 :Detector(Det) 51 { 49 { 52 detDir = new G4UIdirectory("/apparate/"); 50 detDir = new G4UIdirectory("/apparate/"); 53 detDir->SetGuidance("detector control."); 51 detDir->SetGuidance("detector control."); 54 52 55 UpdateCmd = new G4UIcmdWithoutParameter("/ap 53 UpdateCmd = new G4UIcmdWithoutParameter("/apparate/update",this); 56 UpdateCmd->SetGuidance("Update apparate geom 54 UpdateCmd->SetGuidance("Update apparate geometry."); 57 UpdateCmd->SetGuidance("This command MUST be 55 UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" "); 58 UpdateCmd->SetGuidance("if you changed geome 56 UpdateCmd->SetGuidance("if you changed geometrical value(s): /apparate/GrainDiameter and /apparate/sampleGranularity"); 59 57 60 UpdateCmd->AvailableForStates(G4State_Idle); 58 UpdateCmd->AvailableForStates(G4State_Idle); 61 59 62 sampleCmd = new G4UIcmdWithAString("/apparat 60 sampleCmd = new G4UIcmdWithAString("/apparate/mercuryMaterial",this); 63 sampleCmd->SetGuidance("select a diferent ma 61 sampleCmd->SetGuidance("select a diferent material for the mercury"); 64 sampleCmd->SetParameterName("material",true) 62 sampleCmd->SetParameterName("material",true); 65 sampleCmd->SetDefaultValue("mars1"); 63 sampleCmd->SetDefaultValue("mars1"); 66 sampleCmd->SetCandidates("Dolorite Anorthosi 64 sampleCmd->SetCandidates("Dolorite Anorthosite Mars1 IceBasalt"); 67 sampleCmd->AvailableForStates(G4State_Idle); 65 sampleCmd->AvailableForStates(G4State_Idle); 68 66 69 detectorCmd = new G4UIcmdWithAString("/appar 67 detectorCmd = new G4UIcmdWithAString("/apparate/detector",this); 70 detectorCmd->SetGuidance("select a diferent 68 detectorCmd->SetGuidance("select a diferent detectorType"); 71 detectorCmd->SetParameterName("detector",tru 69 detectorCmd->SetParameterName("detector",true); 72 detectorCmd->SetDefaultValue("sili"); 70 detectorCmd->SetDefaultValue("sili"); 73 detectorCmd->SetCandidates("sili hpge"); 71 detectorCmd->SetCandidates("sili hpge"); 74 detectorCmd->AvailableForStates(G4State_Idle 72 detectorCmd->AvailableForStates(G4State_Idle); 75 73 76 latitudeAngleCmd = new G4UIcmdWithADoubleAnd 74 latitudeAngleCmd = new G4UIcmdWithADoubleAndUnit( "/apparate/latitude",this ); 77 latitudeAngleCmd->SetGuidance( "Set latitude 75 latitudeAngleCmd->SetGuidance( "Set latitude angle of the spacecraft" ); 78 latitudeAngleCmd->SetGuidance( "After this, 76 latitudeAngleCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" ); 79 latitudeAngleCmd->SetGuidance( "Default: 45 77 latitudeAngleCmd->SetGuidance( "Default: 45 deg " ); 80 latitudeAngleCmd->SetParameterName( "Latitud 78 latitudeAngleCmd->SetParameterName( "Latitude Angle", true, true ); 81 latitudeAngleCmd->SetDefaultUnit( "deg" ); 79 latitudeAngleCmd->SetDefaultUnit( "deg" ); 82 latitudeAngleCmd->SetUnitCategory( "Angle" ) 80 latitudeAngleCmd->SetUnitCategory( "Angle" ); 83 latitudeAngleCmd->AvailableForStates(G4State 81 latitudeAngleCmd->AvailableForStates(G4State_Idle); 84 82 85 orbitHeightCmd = new G4UIcmdWithADoubleAndUn 83 orbitHeightCmd = new G4UIcmdWithADoubleAndUnit( "/apparate/orbitHeight",this ); 86 orbitHeightCmd->SetGuidance( "Set height of << 84 orbitHeightCmd->SetGuidance( "Set height of the spacecraft above Mercuey Surface" ); 87 orbitHeightCmd->SetGuidance( "After this, /a 85 orbitHeightCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" ); 88 orbitHeightCmd->SetGuidance( "Default: 400 k 86 orbitHeightCmd->SetGuidance( "Default: 400 km " ); 89 orbitHeightCmd->SetParameterName( "Spacecraf 87 orbitHeightCmd->SetParameterName( "Spacecraft Altitude", true, true ); 90 orbitHeightCmd->SetDefaultUnit( "km" ); 88 orbitHeightCmd->SetDefaultUnit( "km" ); 91 orbitHeightCmd->SetUnitCategory( "Length" ); 89 orbitHeightCmd->SetUnitCategory( "Length" ); 92 orbitHeightCmd->AvailableForStates(G4State_I 90 orbitHeightCmd->AvailableForStates(G4State_Idle); >> 91 >> 92 >> 93 >> 94 // granularityFlagCmd= new G4UIcmdWithABool("/apparate/sampleGranularity",this); >> 95 // granularityFlagCmd->SetGuidance("Set if sample granularity is present"); >> 96 // granularityFlagCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" ); >> 97 // granularityFlagCmd->SetParameterName("Granularity Flag",true); >> 98 // granularityFlagCmd->SetDefaultValue(false); >> 99 // granularityFlagCmd->AvailableForStates(G4State_Idle); >> 100 93 } 101 } 94 102 95 //....oooOO0OOooo........oooOO0OOooo........oo 103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 96 104 97 XrayFluoMercuryDetectorMessenger::~XrayFluoMe 105 XrayFluoMercuryDetectorMessenger::~XrayFluoMercuryDetectorMessenger() 98 { 106 { 99 delete UpdateCmd; 107 delete UpdateCmd; 100 delete detDir; 108 delete detDir; 101 } 109 } 102 110 103 //....oooOO0OOooo........oooOO0OOooo........oo 111 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 104 112 105 void XrayFluoMercuryDetectorMessenger::SetNewV 113 void XrayFluoMercuryDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue) 106 { 114 { 107 if( command == UpdateCmd ) 115 if( command == UpdateCmd ) 108 { << 116 { Detector->UpdateGeometry(); } 109 //This triggers a full re-build of the ge << 117 110 //geometry will take care of that. << 111 Detector->UpdateGeometry(); << 112 return; << 113 } << 114 else if ( command == sampleCmd ) 118 else if ( command == sampleCmd ) 115 { Detector->SetMercuryMaterial(newValue);} 119 { Detector->SetMercuryMaterial(newValue);} 116 120 117 else if ( command == detectorCmd ) 121 else if ( command == detectorCmd ) 118 { Detector->SetDetectorType(newValue);} 122 { Detector->SetDetectorType(newValue);} 119 123 120 else if ( command == latitudeAngleCmd ) 124 else if ( command == latitudeAngleCmd ) 121 { 125 { 122 G4double newAngle = latitudeAngleCmd->Get 126 G4double newAngle = latitudeAngleCmd->GetNewDoubleValue(newValue); 123 Detector->SetLatitude(newAngle); 127 Detector->SetLatitude(newAngle); 124 } 128 } 125 129 126 else if ( command == orbitHeightCmd ) 130 else if ( command == orbitHeightCmd ) 127 { 131 { 128 G4double newAngle = orbitHeightCmd->GetNe 132 G4double newAngle = orbitHeightCmd->GetNewDoubleValue(newValue); 129 Detector->SetOribitHeight(newAngle); 133 Detector->SetOribitHeight(newAngle); 130 } 134 } 131 //Notify the run manager that the geometry ha << 135 132 G4RunManager::GetRunManager()->GeometryHasBee << 136 >> 137 // else if ( command == granularityFlagCmd ) >> 138 // { >> 139 // Detector->DeleteGrainObjects(); >> 140 // G4bool newGranFlag = granularityFlagCmd->GetNewBoolValue(newValue); >> 141 // Detector->SetMercuryGranularity(newGranFlag); >> 142 // } 133 143 134 } 144 } 135 145 136 146 137 //....oooOO0OOooo........oooOO0OOooo........oo 147 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 138 148 139 149 140 150 141 151 142 152 143 153 144 154 145 155 146 156 147 157