File indexing completed on 2025-01-18 09:17:10
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
0037
0038 #include "XrayFluoPlaneDetectorMessenger.hh"
0039 #include "XrayFluoPlaneDetectorConstruction.hh"
0040 #include "G4RunManager.hh"
0041 #include "G4UIdirectory.hh"
0042 #include "G4UIcmdWithAString.hh"
0043 #include "G4UIcmdWithADoubleAndUnit.hh"
0044 #include "G4UIcmdWithoutParameter.hh"
0045 #include "G4UIcmdWithABool.hh"
0046
0047
0048
0049 XrayFluoPlaneDetectorMessenger::XrayFluoPlaneDetectorMessenger(XrayFluoPlaneDetectorConstruction * Det)
0050 :Detector(Det)
0051 {
0052 detDir = new G4UIdirectory("/apparate/");
0053 detDir->SetGuidance("detector control.");
0054
0055 UpdateCmd = new G4UIcmdWithoutParameter("/apparate/update",this);
0056 UpdateCmd->SetGuidance("Update apparate geometry.");
0057 UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
0058 UpdateCmd->SetGuidance("if you changed geometrical value(s): /apparate/GrainDiameter and /apparate/sampleGranularity");
0059
0060 UpdateCmd->AvailableForStates(G4State_Idle);
0061
0062 sampleCmd = new G4UIcmdWithAString("/apparate/planeMaterial",this);
0063 sampleCmd->SetGuidance("select a diferent material for the plane");
0064 sampleCmd->SetParameterName("material",true);
0065 sampleCmd->SetDefaultValue("mars1");
0066 sampleCmd->SetCandidates("Dolorite Anorthosite Mars1 IceBasalt");
0067 sampleCmd->AvailableForStates(G4State_Idle);
0068
0069 detectorCmd = new G4UIcmdWithAString("/apparate/detector",this);
0070 detectorCmd->SetGuidance("select a diferent detectorType");
0071 detectorCmd->SetParameterName("detector",true);
0072 detectorCmd->SetDefaultValue("sili");
0073 detectorCmd->SetCandidates("sili hpge");
0074 detectorCmd->AvailableForStates(G4State_Idle);
0075
0076 grainDiaCmd = new G4UIcmdWithADoubleAndUnit( "/apparate/GrainDiameter",this );
0077 grainDiaCmd->SetGuidance( "Set diameter of grains" );
0078 grainDiaCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
0079 grainDiaCmd->SetGuidance( "Default: 0.5 mm " );
0080 grainDiaCmd->SetParameterName( "Grain Diameter", true, true );
0081 grainDiaCmd->SetDefaultUnit( "mm" );
0082 grainDiaCmd->SetUnitCategory( "Length" );
0083 grainDiaCmd->AvailableForStates(G4State_Idle);
0084
0085 granularityFlagCmd= new G4UIcmdWithABool("/apparate/sampleGranularity",this);
0086 granularityFlagCmd->SetGuidance("Set if sample granularity is present");
0087 granularityFlagCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
0088 granularityFlagCmd->SetParameterName("Granularity Flag",true);
0089 granularityFlagCmd->SetDefaultValue(false);
0090 granularityFlagCmd->AvailableForStates(G4State_Idle);
0091
0092 }
0093
0094
0095
0096 XrayFluoPlaneDetectorMessenger::~XrayFluoPlaneDetectorMessenger()
0097 {
0098 delete UpdateCmd;
0099 delete detDir;
0100 }
0101
0102
0103
0104 void XrayFluoPlaneDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
0105 {
0106 if( command == UpdateCmd )
0107 {
0108
0109
0110 Detector->UpdateGeometry();
0111 return;
0112 }
0113 else if ( command == sampleCmd )
0114 {
0115 Detector->SetPlaneMaterial(newValue);
0116 }
0117 else if ( command == detectorCmd )
0118 {
0119 Detector->SetDetectorType(newValue);
0120 }
0121 else if ( command == grainDiaCmd )
0122 {
0123 G4double newSize = grainDiaCmd->GetNewDoubleValue(newValue);
0124 Detector->SetGrainDia(newSize);
0125 }
0126 else if ( command == granularityFlagCmd )
0127 {
0128 Detector->DeleteGrainObjects();
0129 G4bool newGranFlag = granularityFlagCmd->GetNewBoolValue(newValue);
0130 Detector->SetPlaneGranularity(newGranFlag);
0131 }
0132
0133 G4RunManager::GetRunManager()->GeometryHasBeenModified();
0134
0135 }
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147