00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #include <iomanip>
00038 #include <sstream>
00039
00040 #include "GFlashShowerModelMessenger.hh"
00041 #include "GFlashShowerModel.hh"
00042 #include "GFlashParticleBounds.hh"
00043 #include "globals.hh"
00044 #include "G4SystemOfUnits.hh"
00045 #include "G4UIdirectory.hh"
00046 #include "G4UIcmdWithAString.hh"
00047 #include "G4UIcmdWithADoubleAndUnit.hh"
00048 #include "G4UIcmdWithADouble.hh"
00049 #include "G4UIcmdWithAnInteger.hh"
00050 #include "G4Electron.hh"
00051 #include "G4Positron.hh"
00052
00053 GFlashShowerModelMessenger::
00054 GFlashShowerModelMessenger(GFlashShowerModel * aModel)
00055 {
00056 myParaDir = new G4UIdirectory("/GFlash/");
00057 myParaDir->SetGuidance("Parametrisation control.");
00058 myModel= aModel;
00059
00060 FlagCmd = new G4UIcmdWithAnInteger("/GFlash/flag",this);
00061 FlagCmd->SetGuidance("Defines if GFlash is activated");
00062 FlagCmd->SetParameterName("flag",false,false);
00063
00064 ContCmd = new G4UIcmdWithAnInteger("/GFlash/containment ",this);
00065 ContCmd->SetGuidance("Defines if Containment is checked");
00066 ContCmd->SetParameterName("flag",false,false);
00067
00068 StepInX0Cmd = new G4UIcmdWithADouble("/GFlash/stepXo",this);
00069 StepInX0Cmd->SetGuidance("Defines step lenghts");
00070 StepInX0Cmd->SetParameterName("flag",false,false);
00071
00072 EminCmd = new G4UIcmdWithADoubleAndUnit("/GFlash/Emin",this);
00073 EminCmd->SetGuidance("Set minimum kinetic energy to trigger parametrisation");
00074 EminCmd->SetParameterName("Emin",false,false);
00075 EminCmd->SetDefaultUnit("GeV");
00076 EminCmd->SetUnitCategory("Energy");
00077 EminCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00078
00079 EmaxCmd = new G4UIcmdWithADoubleAndUnit("/GFlash/Emax",this);
00080 EmaxCmd->SetGuidance("Set maximum kinetic energy to trigger parametrisation");
00081 EmaxCmd->SetParameterName("Emax",false,false);
00082 EmaxCmd->SetDefaultUnit("GeV");
00083 EmaxCmd->SetUnitCategory("Energy");
00084 EmaxCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00085
00086 EkillCmd = new G4UIcmdWithADoubleAndUnit("/GFlash/Ekill",this);
00087 EkillCmd->SetGuidance("Set maximum kinetic energy for electrons to be killed");
00088 EkillCmd->SetParameterName("Ekill",false,false);
00089 EkillCmd->SetDefaultUnit("GeV");
00090 EkillCmd->SetUnitCategory("Energy");
00091 EkillCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00092 }
00093
00094
00095 GFlashShowerModelMessenger::~GFlashShowerModelMessenger()
00096 {
00097 delete ContCmd;
00098 delete FlagCmd;
00099 delete StepInX0Cmd;
00100 delete EminCmd;
00101 delete EmaxCmd;
00102 delete EkillCmd;
00103 }
00104
00105
00106 void GFlashShowerModelMessenger::
00107 SetNewValue(G4UIcommand * command,G4String newValues)
00108 {
00109
00110 if( command == FlagCmd ) {
00111 myModel->SetFlagParamType(FlagCmd->GetNewIntValue(newValues));
00112 this->GetCurrentValue(command);
00113 }
00114 if( command == ContCmd ) {
00115 myModel->SetFlagParticleContainment(ContCmd->GetNewIntValue(newValues));
00116 this->GetCurrentValue(command);
00117 }
00118 if( command == StepInX0Cmd ) {
00119 myModel->SetStepInX0(StepInX0Cmd->GetNewDoubleValue(newValues));
00120 this->GetCurrentValue(command);
00121 }
00122
00123 else if( command == EminCmd ) {
00124 myModel->PBound->SetMinEneToParametrise(*G4Electron::ElectronDefinition(),
00125 EminCmd->GetNewDoubleValue(newValues));
00126 this->GetCurrentValue(command);
00127 }
00128
00129 else if( command == EmaxCmd ) {
00130 myModel->PBound->SetMaxEneToParametrise(*G4Electron::ElectronDefinition(),
00131 EmaxCmd->GetNewDoubleValue(newValues));
00132 this->GetCurrentValue(command);
00133 }
00134
00135 else if( command == EkillCmd ) {
00136 myModel->PBound->SetEneToKill(*G4Electron::ElectronDefinition(),
00137 EkillCmd->GetNewDoubleValue(newValues));
00138 this->GetCurrentValue(command);
00139 }
00140
00141 }
00142
00143
00144 G4String GFlashShowerModelMessenger::GetCurrentValue(G4UIcommand * command)
00145 {
00146 G4String returnValue('\0');
00147 std::ostringstream os;
00148
00149 if( command == FlagCmd ) {
00150 os << "/GFlash/flag " << myModel->GetFlagParamType() << '\0';
00151 returnValue = G4String(os.str());
00152 }
00153
00154 else if( command == EkillCmd ) {
00155 os << "/GFlash/Ekill "
00156 << myModel->PBound->GetEneToKill(*G4Electron::ElectronDefinition())/GeV
00157 << " GeV" << '\0';
00158 returnValue = G4String(os.str());
00159 }
00160
00161 else if( command == EminCmd ) {
00162 os << "/GFlash/Emin "
00163 << myModel->PBound->GetMinEneToParametrise(*G4Electron::ElectronDefinition())/GeV
00164 << " GeV" << '\0';
00165 returnValue = G4String(os.str());
00166 }
00167
00168 else if( command == EmaxCmd ) {
00169 os << "/GFlash/Emax "
00170 << myModel->PBound->GetMaxEneToParametrise(*G4Electron::ElectronDefinition())/GeV
00171 << " GeV" << '\0';
00172 returnValue = G4String(os.str());
00173 }
00174
00175 return returnValue;
00176 }