File indexing completed on 2025-01-18 09:17:09
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 #include "XrayFluoDetectorMessenger.hh"
0037 #include "XrayFluoDetectorConstruction.hh"
0038 #include "G4RunManager.hh"
0039 #include "G4UIdirectory.hh"
0040 #include "G4UIcmdWithAString.hh"
0041 #include "G4UIcmdWithADoubleAndUnit.hh"
0042 #include "G4UIcmdWithoutParameter.hh"
0043 #include "G4UIcmdWithABool.hh"
0044
0045
0046
0047 XrayFluoDetectorMessenger::XrayFluoDetectorMessenger(XrayFluoDetectorConstruction * Det)
0048 :Detector(Det)
0049 {
0050 detDir = new G4UIdirectory("/apparate/");
0051 detDir->SetGuidance("detector control.");
0052
0053 UpdateCmd = new G4UIcmdWithoutParameter("/apparate/update",this);
0054 UpdateCmd->SetGuidance("Update apparate geometry.");
0055 UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
0056 UpdateCmd->SetGuidance("if you changed geometrical value(s): /apparate/GrainDiameter and /apparate/sampleGranularity");
0057
0058 UpdateCmd->AvailableForStates(G4State_Idle);
0059
0060 sampleCmd = new G4UIcmdWithAString("/apparate/sampleMaterial",this);
0061 sampleCmd->SetGuidance("select a diferent material for the sample: materials can be: Dolorite, Anorthosite, Mars1, HawaiianWD, HawaiianRF, IceBasalt, IcelandicWD, IcelandicRF, Gabbro, GabbroWD, GabbroRF, HPGe OR choosen from Nist database (see /material/nist/listMaterials for details");
0062 sampleCmd->SetParameterName("material",true);
0063 sampleCmd->SetDefaultValue("mars1");
0064 sampleCmd->AvailableForStates(G4State_Idle);
0065
0066 detectorCmd = new G4UIcmdWithAString("/apparate/detector",this);
0067 detectorCmd->SetGuidance("select a diferent detectorType");
0068 detectorCmd->SetParameterName("detector",true);
0069 detectorCmd->SetDefaultValue("sili");
0070 detectorCmd->SetCandidates("sili hpge");
0071 detectorCmd->AvailableForStates(G4State_Idle);
0072
0073 grainDiaCmd = new G4UIcmdWithADoubleAndUnit( "/apparate/GrainDiameter",this );
0074 grainDiaCmd->SetGuidance( "Set diameter of grains" );
0075 grainDiaCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
0076 grainDiaCmd->SetGuidance( "Default: 0.5 mm " );
0077 grainDiaCmd->SetParameterName( "Grain Diameter", true, true );
0078 grainDiaCmd->SetDefaultUnit( "mm" );
0079 grainDiaCmd->SetUnitCategory( "Length" );
0080 grainDiaCmd->AvailableForStates(G4State_Idle);
0081
0082 granularityFlagCmd= new G4UIcmdWithABool("/apparate/sampleGranularity",this);
0083 granularityFlagCmd->SetGuidance("Set if sample granularity is present");
0084 granularityFlagCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
0085 granularityFlagCmd->SetParameterName("Granularity Flag",true);
0086 granularityFlagCmd->SetDefaultValue(false);
0087 granularityFlagCmd->AvailableForStates(G4State_Idle);
0088
0089 OhmicPosThicknessCmd = new G4UIcmdWithADoubleAndUnit( "/apparate/ohmicPosThickness",this );
0090 OhmicPosThicknessCmd->SetGuidance( "Changes thickness of the detector anode" );
0091 OhmicPosThicknessCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
0092 OhmicPosThicknessCmd->SetGuidance( "Default: 0.005 mm " );
0093 OhmicPosThicknessCmd->SetParameterName( "OhmicPos Thickness", true, true );
0094 OhmicPosThicknessCmd->SetDefaultUnit( "mm" );
0095 OhmicPosThicknessCmd->SetUnitCategory( "Length" );
0096 OhmicPosThicknessCmd->AvailableForStates(G4State_Idle);
0097 }
0098
0099
0100
0101 XrayFluoDetectorMessenger::~XrayFluoDetectorMessenger()
0102 {
0103 delete UpdateCmd;
0104 delete detDir;
0105 }
0106
0107
0108
0109 void XrayFluoDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
0110 {
0111 if( command == UpdateCmd )
0112 {
0113
0114
0115 Detector->UpdateGeometry();
0116 return;
0117 }
0118 else if ( command == sampleCmd )
0119 {
0120 Detector->SetSampleMaterial(newValue);
0121 }
0122
0123 else if ( command == detectorCmd )
0124 {
0125 Detector->SetDetectorType(newValue);
0126 }
0127 else if ( command == grainDiaCmd )
0128 {
0129 G4double newSize = grainDiaCmd->GetNewDoubleValue(newValue);
0130 Detector->SetGrainDia(newSize);
0131 }
0132
0133 else if ( command == granularityFlagCmd )
0134 {
0135 Detector->DeleteGrainObjects();
0136 G4bool newGranFlag = granularityFlagCmd->GetNewBoolValue(newValue);
0137 Detector->SetSampleGranularity(newGranFlag);
0138 }
0139 else if ( command == OhmicPosThicknessCmd )
0140 {
0141 G4double newSize = OhmicPosThicknessCmd->GetNewDoubleValue(newValue);
0142 Detector->SetOhmicPosThickness(newSize);
0143 }
0144
0145 G4RunManager::GetRunManager()->GeometryHasBeenModified();
0146 }
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159