![]() |
Precalibrated Ion Beam Identification Detector Simulation 1.0
A pilot study detector simulation, written in C++ with Geant4.
|
00001 #include "DetectorMessenger.hh" 00002 00003 DetectorMessenger::DetectorMessenger(DetectorConstruction* Det) 00004 :Detector(Det) 00005 { 00006 PIBIDSDir = new G4UIdirectory("/PIBIDS/"); 00007 PIBIDSDir->SetGuidance("UI commands for the PIBIDS simulation."); 00008 00009 detDir = new G4UIdirectory("/PIBIDS/det/"); 00010 detDir->SetGuidance("Detector properties control."); 00011 00012 ScintillatorMaterialCmd = new G4UIcmdWithAString("/PIBIDS/det/setAbsMat",this); 00013 ScintillatorMaterialCmd->SetGuidance("Set material in the scintillators."); 00014 ScintillatorMaterialCmd->SetParameterName("choice",false); 00015 ScintillatorMaterialCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 00016 00017 GapMaterCmd = new G4UIcmdWithAString("/PIBIDS/det/setGapMat",this); 00018 GapMaterCmd->SetGuidance("Select material of the gap between the scintillators."); 00019 GapMaterCmd->SetParameterName("choice",false); 00020 GapMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 00021 00022 ScintillatorDiameterCmd = new G4UIcmdWithADoubleAndUnit("/PIBIDS/det/setScintillatorDiameter",this); 00023 ScintillatorDiameterCmd->SetGuidance("Set the scintillator diameter."); 00024 ScintillatorDiameterCmd->SetParameterName("Size",false); 00025 ScintillatorDiameterCmd->SetRange("Size>=0."); 00026 ScintillatorDiameterCmd->SetUnitCategory("Length"); 00027 ScintillatorDiameterCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 00028 00029 ScintillatorShieldingGapThicknessCmd = new G4UIcmdWithADoubleAndUnit("/PIBIDS/det/setScintillatorShieldingGapThickness",this); 00030 ScintillatorShieldingGapThicknessCmd->SetGuidance("Set thickness of the gap between scintillators."); 00031 ScintillatorShieldingGapThicknessCmd->SetParameterName("Size",false); 00032 ScintillatorShieldingGapThicknessCmd->SetRange("Size>=0."); 00033 ScintillatorShieldingGapThicknessCmd->SetUnitCategory("Length"); 00034 ScintillatorShieldingGapThicknessCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 00035 00036 00037 NumberOfScintillatorsPerBoxCmd = new G4UIcmdWithAnInteger("/PIBIDS/det/setNumberOfScintillatorsPerBox",this); 00038 NumberOfScintillatorsPerBoxCmd->SetGuidance("Set number of layers of scintillators."); 00039 NumberOfScintillatorsPerBoxCmd->SetParameterName("NbLayers",false); 00040 NumberOfScintillatorsPerBoxCmd->SetRange("NbLayers>0 && NbLayers<500"); 00041 NumberOfScintillatorsPerBoxCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 00042 00043 NumberOfScintillatorBoxesCmd = new G4UIcmdWithAnInteger("/PIBIDS/det/setNumberOfScintillatorBoxes",this); 00044 NumberOfScintillatorBoxesCmd->SetGuidance("Set number of scintillator boxes."); 00045 NumberOfScintillatorBoxesCmd->SetParameterName("NbLayers",false); 00046 NumberOfScintillatorBoxesCmd->SetRange("NbLayers>0 && NbLayers<20"); 00047 NumberOfScintillatorBoxesCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 00048 00049 EffectiveSlowdownThicknessCmd = new G4UIcmdWithADoubleAndUnit("/PIBIDS/det/setEffectiveSlowdownThickness",this); 00050 EffectiveSlowdownThicknessCmd->SetGuidance("Set effective slowdown thickness of wedges."); 00051 EffectiveSlowdownThicknessCmd->SetParameterName("Thickness",false); 00052 EffectiveSlowdownThicknessCmd->SetRange("Thickness>0."); 00053 EffectiveSlowdownThicknessCmd->SetUnitCategory("Length"); 00054 EffectiveSlowdownThicknessCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 00055 00056 SlowdownLengthCmd = new G4UIcmdWithADoubleAndUnit("/PIBIDS/det/setSlowdownLength",this); 00057 SlowdownLengthCmd->SetGuidance("Set slowdown (wedges) length."); 00058 SlowdownLengthCmd->SetParameterName("Length",false); 00059 SlowdownLengthCmd->SetRange("Length>0."); 00060 SlowdownLengthCmd->SetUnitCategory("Length"); 00061 SlowdownLengthCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 00062 00063 GeDetectorRadiusCmd = new G4UIcmdWithADoubleAndUnit("/PIBIDS/det/setGeDetectorRadius",this); 00064 GeDetectorRadiusCmd->SetGuidance("Set Ge detector radius."); 00065 GeDetectorRadiusCmd->SetParameterName("Radius",false); 00066 GeDetectorRadiusCmd->SetRange("Radius>0."); 00067 GeDetectorRadiusCmd->SetUnitCategory("Length"); 00068 GeDetectorRadiusCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 00069 00070 GeDetectorShellLengthCmd = new G4UIcmdWithADoubleAndUnit("/PIBIDS/det/setGeDetectorShellLength",this); 00071 GeDetectorShellLengthCmd->SetGuidance("Set Ge detector shell length."); 00072 GeDetectorShellLengthCmd->SetParameterName("Length",false); 00073 GeDetectorShellLengthCmd->SetRange("Length>0."); 00074 GeDetectorShellLengthCmd->SetUnitCategory("Length"); 00075 GeDetectorShellLengthCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 00076 00077 00078 GeDetectorLengthCmd = new G4UIcmdWithADoubleAndUnit("/PIBIDS/det/setGeDetectorLength",this); 00079 GeDetectorLengthCmd->SetGuidance("Set Ge detector length."); 00080 GeDetectorLengthCmd->SetParameterName("Length",false); 00081 GeDetectorLengthCmd->SetRange("Length>0."); 00082 GeDetectorLengthCmd->SetUnitCategory("Length"); 00083 GeDetectorLengthCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 00084 00085 GeDetectorShellInnerRadiusCmd = new G4UIcmdWithADoubleAndUnit("/PIBIDS/det/setGeDetectorShellInnerRadius",this); 00086 GeDetectorShellInnerRadiusCmd->SetGuidance("Set Ge detector shell inner radius"); 00087 GeDetectorShellInnerRadiusCmd->SetParameterName("Radius",false); 00088 GeDetectorShellInnerRadiusCmd->SetRange("Radius>0."); 00089 GeDetectorShellInnerRadiusCmd->SetUnitCategory("Length"); 00090 GeDetectorShellInnerRadiusCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 00091 00092 GeDetectorShellOuterRadiusCmd = new G4UIcmdWithADoubleAndUnit("/PIBIDS/det/setGeDetectorShellOuterRadius",this); 00093 GeDetectorShellOuterRadiusCmd->SetGuidance("Set Ge detector shell outer radius."); 00094 GeDetectorShellOuterRadiusCmd->SetParameterName("Radius",false); 00095 GeDetectorShellOuterRadiusCmd->SetRange("Radius>0."); 00096 GeDetectorShellOuterRadiusCmd->SetUnitCategory("Length"); 00097 GeDetectorShellOuterRadiusCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 00098 00099 00100 00101 00102 00103 00104 SlowdownThicknessCmd = new G4UIcmdWithADoubleAndUnit("/PIBIDS/det/setSlowdownThickness",this); 00105 SlowdownThicknessCmd->SetGuidance("Set slowdown (wedges) length."); 00106 SlowdownThicknessCmd->SetParameterName("Thickness",false); 00107 SlowdownThicknessCmd->SetRange("Thickness>0."); 00108 SlowdownThicknessCmd->SetUnitCategory("Length"); 00109 SlowdownThicknessCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 00110 00111 00112 BeamBlockerThicknessCmd = new G4UIcmdWithADoubleAndUnit("/PIBIDS/det/setBeamBlockerThickness",this); 00113 BeamBlockerThicknessCmd->SetGuidance("Set beam blocker thickness."); 00114 BeamBlockerThicknessCmd->SetParameterName("Thickness",false); 00115 BeamBlockerThicknessCmd->SetRange("Thickness>0."); 00116 BeamBlockerThicknessCmd->SetUnitCategory("Length"); 00117 BeamBlockerThicknessCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 00118 00119 ShieldingBeamBlockerThicknessCmd = new G4UIcmdWithADoubleAndUnit("/PIBIDS/det/setShieldingBeamBlockerThickness",this); 00120 ShieldingBeamBlockerThicknessCmd->SetGuidance("Set beam blocker thickness."); 00121 ShieldingBeamBlockerThicknessCmd->SetParameterName("Thickness",false); 00122 ShieldingBeamBlockerThicknessCmd->SetRange("Thickness>0."); 00123 ShieldingBeamBlockerThicknessCmd->SetUnitCategory("Length"); 00124 ShieldingBeamBlockerThicknessCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 00125 00126 00127 ShieldingThicknessCmd = new G4UIcmdWithADoubleAndUnit("/PIBIDS/det/setShieldingThickness",this); 00128 ShieldingThicknessCmd->SetGuidance("Set shielding thickness."); 00129 ShieldingThicknessCmd->SetParameterName("Thickness",false); 00130 ShieldingThicknessCmd->SetRange("Thickness>0."); 00131 ShieldingThicknessCmd->SetUnitCategory("Length"); 00132 ShieldingThicknessCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 00133 00134 00135 TopShieldingThicknessCmd = new G4UIcmdWithADoubleAndUnit("/PIBIDS/det/setTopShieldingThickness",this); 00136 TopShieldingThicknessCmd->SetGuidance("Set shielding thickness."); 00137 TopShieldingThicknessCmd->SetParameterName("Thickness",false); 00138 TopShieldingThicknessCmd->SetRange("Thickness>0."); 00139 TopShieldingThicknessCmd->SetUnitCategory("Length"); 00140 TopShieldingThicknessCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 00141 00142 00143 ShieldingMaterialCmd = new G4UIcmdWithAString("/PIBIDS/det/setShieldingMaterial",this); 00144 ShieldingMaterialCmd->SetGuidance("Set the shielding material."); 00145 ShieldingMaterialCmd->SetParameterName("choice",false); 00146 ShieldingMaterialCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 00147 00148 00149 GeDetectorShellMaterialCmd = new G4UIcmdWithAString("/PIBIDS/det/setGeDetectorShellMaterial",this); 00150 GeDetectorShellMaterialCmd->SetGuidance("Set the germanium detector shell material."); 00151 GeDetectorShellMaterialCmd->SetParameterName("choice",false); 00152 GeDetectorShellMaterialCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 00153 00154 GermaniumDetectorMaterialCmd = new G4UIcmdWithAString("/PIBIDS/det/setGermaniumDetectorMaterial",this); 00155 GermaniumDetectorMaterialCmd->SetGuidance("Set the germanium detector material."); 00156 GermaniumDetectorMaterialCmd->SetParameterName("choice",false); 00157 GermaniumDetectorMaterialCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 00158 00159 BeamBlockerMaterialCmd = new G4UIcmdWithAString("/PIBIDS/det/setBeamBlockerMaterial",this); 00160 BeamBlockerMaterialCmd->SetGuidance("Set the beam blocker material."); 00161 BeamBlockerMaterialCmd->SetParameterName("choice",false); 00162 BeamBlockerMaterialCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 00163 00164 00165 00166 ShieldingBeamBlockerMaterialCmd = new G4UIcmdWithAString("/PIBIDS/det/setShieldingBeamBlockerMaterial",this); 00167 ShieldingBeamBlockerMaterialCmd->SetGuidance("Set the beam blocker material."); 00168 ShieldingBeamBlockerMaterialCmd->SetParameterName("choice",false); 00169 ShieldingBeamBlockerMaterialCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 00170 00171 00172 SlowdownMaterialCmd = new G4UIcmdWithAString("/PIBIDS/det/setSlowdownMaterial",this); 00173 SlowdownMaterialCmd->SetGuidance("Set the slowdown material."); 00174 SlowdownMaterialCmd->SetParameterName("choice",false); 00175 SlowdownMaterialCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 00176 00177 00178 FlipBetaCmd = new G4UIcmdWithABool("/PIBIDS/det/flipBeta",this); 00179 FlipBetaCmd->SetGuidance("Use this to switch beta detector flipping on or off."); 00180 FlipBetaCmd->SetParameterName("Flip",false); 00181 00182 00183 00184 UpdateCmd = new G4UIcmdWithoutParameter("/PIBIDS/det/update",this); 00185 UpdateCmd->SetGuidance("Update detector geometry."); 00186 UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" "); 00187 UpdateCmd->SetGuidance("if you changed geometrical value(s)."); 00188 UpdateCmd->AvailableForStates(G4State_Idle); 00189 } 00190 00191 00192 DetectorMessenger::~DetectorMessenger() 00193 { 00194 delete NumberOfScintillatorBoxesCmd; 00195 delete NumberOfScintillatorsPerBoxCmd; 00196 delete ScintillatorMaterialCmd; 00197 delete GapMaterCmd; 00198 delete ScintillatorDiameterCmd; 00199 delete ScintillatorShieldingGapThicknessCmd; 00200 delete UpdateCmd; 00201 delete detDir; 00202 delete PIBIDSDir; 00203 delete BeamBlockerMaterialCmd; 00204 delete TopShieldingThicknessCmd; 00205 delete ShieldingThicknessCmd; 00206 delete ShieldingBeamBlockerMaterialCmd; 00207 delete BeamBlockerThicknessCmd; 00208 delete ShieldingBeamBlockerThicknessCmd; 00209 delete FlipBetaCmd; 00210 delete GeDetectorRadiusCmd; 00211 delete GeDetectorShellLengthCmd; 00212 delete GeDetectorLengthCmd; 00213 delete GeDetectorShellInnerRadiusCmd; 00214 delete GeDetectorShellOuterRadiusCmd; 00215 } 00216 00217 00218 00219 void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue) 00220 { 00221 if( command == ScintillatorMaterialCmd ) 00222 { Detector->SetScintillatorMaterial(newValue);} 00223 00224 if( command == GapMaterCmd ) 00225 { Detector->SetGapMaterial(newValue);} 00226 00227 if( command == ShieldingMaterialCmd) 00228 { Detector->SetShieldingMaterial(newValue);} 00229 00230 if( command == GeDetectorShellMaterialCmd) 00231 {Detector->SetGeDetectorShellMaterial(newValue);} 00232 00233 if( command == GermaniumDetectorMaterialCmd) 00234 {Detector->SetGermaniumDetectorMaterial(newValue);} 00235 00236 if( command == BeamBlockerMaterialCmd) 00237 {Detector->SetBeamBlockerMaterial(newValue);} 00238 00239 if( command == ShieldingBeamBlockerMaterialCmd) 00240 {Detector->SetShieldingBeamBlockerMaterial(newValue);} 00241 00242 if( command == SlowdownMaterialCmd) 00243 {Detector->SetSlowdownMaterial(newValue);} 00244 00245 if( command == ScintillatorDiameterCmd ) 00246 { Detector->SetScintillatorDiameter(ScintillatorDiameterCmd 00247 ->GetNewDoubleValue(newValue));} 00248 00249 if( command == ScintillatorShieldingGapThicknessCmd ) 00250 { Detector->SetScintillatorShieldingGapThickness(ScintillatorShieldingGapThicknessCmd->GetNewDoubleValue(newValue));} 00251 00252 if( command == NumberOfScintillatorsPerBoxCmd ) 00253 { Detector->SetNumberOfScintillatorsPerBox(NumberOfScintillatorsPerBoxCmd->GetNewIntValue(newValue));} 00254 00255 if(command == NumberOfScintillatorBoxesCmd) 00256 { Detector->SetNumberOfScintillatorBoxes(NumberOfScintillatorBoxesCmd->GetNewIntValue(newValue)); } 00257 00258 if( command == EffectiveSlowdownThicknessCmd) 00259 { Detector->SetEffectiveSlowdownThickness(EffectiveSlowdownThicknessCmd->GetNewDoubleValue(newValue));} 00260 00261 if( command == SlowdownLengthCmd) 00262 { Detector->SetSlowdownLength(SlowdownLengthCmd->GetNewDoubleValue(newValue));} 00263 00264 if( command == GeDetectorRadiusCmd) 00265 { Detector->SetGeDetectorRadius(GeDetectorRadiusCmd->GetNewDoubleValue(newValue));} 00266 00267 if( command == GeDetectorShellLengthCmd) 00268 { Detector->SetGeDetectorShellLength(GeDetectorShellLengthCmd->GetNewDoubleValue(newValue));} 00269 00270 if( command == GeDetectorLengthCmd) 00271 { Detector->SetGeDetectorLength(GeDetectorLengthCmd->GetNewDoubleValue(newValue));} 00272 00273 if( command == GeDetectorShellInnerRadiusCmd) 00274 { Detector->SetGeDetectorShellInnerRadius(GeDetectorShellInnerRadiusCmd->GetNewDoubleValue(newValue));} 00275 00276 if( command == GeDetectorShellOuterRadiusCmd) 00277 { Detector->SetGeDetectorShellOuterRadius(GeDetectorShellOuterRadiusCmd->GetNewDoubleValue(newValue));} 00278 00279 if( command == SlowdownThicknessCmd) 00280 { Detector->SetSlowdownThickness(SlowdownThicknessCmd->GetNewDoubleValue(newValue));} 00281 00282 if( command == BeamBlockerThicknessCmd) 00283 { Detector->SetBeamBlockerThickness(BeamBlockerThicknessCmd->GetNewDoubleValue(newValue));} 00284 00285 if( command == ShieldingBeamBlockerThicknessCmd) 00286 { Detector->SetShieldingBeamBlockerThickness(ShieldingBeamBlockerThicknessCmd->GetNewDoubleValue(newValue));} 00287 00288 if( command == ShieldingThicknessCmd) 00289 { Detector->SetShieldingThickness(ShieldingThicknessCmd->GetNewDoubleValue(newValue));} 00290 00291 if( command == TopShieldingThicknessCmd) 00292 { Detector->SetTopShieldingThickness(TopShieldingThicknessCmd->GetNewDoubleValue(newValue));} 00293 00294 if (command == FlipBetaCmd) 00295 {Detector->SetBetaFlipping(FlipBetaCmd->GetNewBoolValue(newValue));} 00296 00297 if( command == UpdateCmd ) 00298 { Detector->UpdateGeometry(); } 00299 00300 }