File indexing completed on 2025-02-23 09:21:13
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 "G4MonopolePhysicsMessenger.hh"
0037
0038 #include "G4MonopolePhysics.hh"
0039 #include "G4UIcmdWithADouble.hh"
0040 #include "G4UIcmdWithADoubleAndUnit.hh"
0041 #include "G4UIcommand.hh"
0042 #include "G4UIdirectory.hh"
0043
0044 #include <sstream>
0045
0046
0047
0048 G4MonopolePhysicsMessenger::G4MonopolePhysicsMessenger(G4MonopolePhysics* p)
0049 : G4UImessenger(), fPhys(p)
0050 {
0051 fPhysicsDir = new G4UIdirectory("/monopole/");
0052 fPhysicsDir->SetGuidance("histograms control");
0053
0054 fPhysicsCmd = new G4UIcommand("/monopole/setup", this);
0055 fPhysicsCmd->SetGuidance("Setup monopole");
0056
0057 G4UIparameter* qmag = new G4UIparameter("qmag", 'd', false);
0058 qmag->SetGuidance("Magnetic charge");
0059 qmag->SetDefaultValue("1");
0060 fPhysicsCmd->SetParameter(qmag);
0061
0062 G4UIparameter* q = new G4UIparameter("qelec", 'd', false);
0063 q->SetGuidance("Electric charge charge");
0064 q->SetDefaultValue("0");
0065 fPhysicsCmd->SetParameter(q);
0066
0067 G4UIparameter* mass = new G4UIparameter("mass", 'd', false);
0068 mass->SetGuidance("mass");
0069 mass->SetParameterRange("mass>0.");
0070 qmag->SetDefaultValue("100");
0071 fPhysicsCmd->SetParameter(mass);
0072
0073 G4UIparameter* unit = new G4UIparameter("unit", 's', false);
0074 fPhysicsCmd->SetParameter(unit);
0075 qmag->SetDefaultValue("GeV");
0076 fPhysicsCmd->AvailableForStates(G4State_PreInit);
0077 }
0078
0079
0080
0081 G4MonopolePhysicsMessenger::~G4MonopolePhysicsMessenger()
0082 {
0083 delete fPhysicsCmd;
0084 delete fPhysicsDir;
0085 }
0086
0087
0088
0089 void G4MonopolePhysicsMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0090 {
0091 if (command == fPhysicsCmd) {
0092 G4double q, m;
0093 G4double mass;
0094 G4String unts;
0095 std::istringstream is(newValue);
0096 is >> m >> q >> mass >> unts;
0097 G4String unit = unts;
0098 G4double vUnit = G4UIcommand::ValueOf(unit);
0099 fPhys->SetMagneticCharge(m);
0100 fPhys->SetElectricCharge(q);
0101 fPhys->SetMonopoleMass(mass * vUnit);
0102 }
0103 }
0104
0105