[286] | 1 | #include "ELYSE/PrimaryGeneratorMessenger.hh"
|
---|
| 2 |
|
---|
| 3 | //Geant4
|
---|
| 4 | #include "G4UIdirectory.hh"
|
---|
| 5 | #include "G4UIcmdWithAString.hh"
|
---|
| 6 | #include "G4UIcmdWith3Vector.hh"
|
---|
| 7 | #include "G4UIcmdWithADoubleAndUnit.hh"
|
---|
| 8 | #include "G4UIcmdWith3VectorAndUnit.hh"
|
---|
| 9 | #include "G4ios.hh"
|
---|
| 10 |
|
---|
| 11 | //ELYSE
|
---|
| 12 | #include "ELYSE/PrimaryGeneratorAction.hh"
|
---|
| 13 |
|
---|
| 14 |
|
---|
| 15 | ELYSE::PrimaryGeneratorMessenger::PrimaryGeneratorMessenger(ELYSE::PrimaryGeneratorAction* pointerToAction)
|
---|
| 16 | :myAction(pointerToAction) {
|
---|
| 17 |
|
---|
| 18 | ELYSEDir = new G4UIdirectory("/ELYSE/gun/");
|
---|
| 19 | ELYSEDir->SetGuidance("ELYSE gun control commands.");
|
---|
| 20 |
|
---|
| 21 | particleTypeCmd = new G4UIcmdWithAString("/ELYSE/gun/partName",this);
|
---|
| 22 | particleTypeCmd->SetGuidance("Particle Name of the beam");
|
---|
| 23 | particleTypeCmd->SetParameterName("beampdg",false);
|
---|
| 24 |
|
---|
| 25 | energyCmd = new G4UIcmdWithADoubleAndUnit("/ELYSE/gun/energy",this);
|
---|
| 26 | energyCmd->SetGuidance("The Energy of the beam");
|
---|
| 27 | energyCmd->SetParameterName("beamenergy",false);
|
---|
| 28 | energyCmd->SetDefaultUnit("MeV");
|
---|
| 29 |
|
---|
| 30 | beamDirectionCmd = new G4UIcmdWith3Vector("/ELYSE/gun/BeamDir",this);
|
---|
| 31 | beamDirectionCmd->SetGuidance("Set the direction of the beam.");
|
---|
| 32 | beamDirectionCmd->SetParameterName("beamdir_x","beamdir_y","beamdir_z",false);
|
---|
| 33 |
|
---|
| 34 | beamVertexCmd = new G4UIcmdWith3VectorAndUnit("/ELYSE/gun/vertex",this);
|
---|
| 35 | beamVertexCmd->SetGuidance("Set the vertex of the beam.");
|
---|
| 36 | beamVertexCmd->SetParameterName("vertex_x","vertex_y","vertex_z",false);
|
---|
| 37 | beamVertexCmd->SetDefaultUnit("cm");
|
---|
| 38 |
|
---|
| 39 | polarCmd = new G4UIcmdWith3Vector("/ELYSE/gun/OpPhotonPolarisation",this);
|
---|
| 40 | polarCmd->SetGuidance("Set polarization direction");
|
---|
| 41 | polarCmd->SetParameterName("polar_x","polar_y","polar_z",false);
|
---|
| 42 |
|
---|
| 43 | }//Ctor
|
---|
| 44 |
|
---|
| 45 | //--------------------------------------------------------------------------------------------
|
---|
| 46 |
|
---|
| 47 | ELYSE::PrimaryGeneratorMessenger::~PrimaryGeneratorMessenger() {
|
---|
| 48 | delete particleTypeCmd;
|
---|
| 49 | delete energyCmd;
|
---|
| 50 | delete beamDirectionCmd;
|
---|
| 51 | delete beamVertexCmd;
|
---|
| 52 | delete polarCmd;
|
---|
| 53 |
|
---|
| 54 | delete ELYSEDir;
|
---|
| 55 | }//Dtor
|
---|
| 56 |
|
---|
| 57 | //--------------------------------------------------------------------------------------------
|
---|
| 58 |
|
---|
| 59 | void ELYSE::PrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String newValue) {
|
---|
| 60 |
|
---|
| 61 | if( command == particleTypeCmd ) {
|
---|
| 62 | myAction->SetBeamName(newValue);
|
---|
| 63 |
|
---|
| 64 | } else if ( command == energyCmd ) {
|
---|
| 65 | myAction->SetBeamEnergy(energyCmd->GetNewDoubleValue(newValue));
|
---|
| 66 |
|
---|
| 67 | } else if ( command == beamDirectionCmd ) {
|
---|
| 68 | myAction->SetBeamDir(beamDirectionCmd->GetNew3VectorValue(newValue));
|
---|
| 69 |
|
---|
| 70 | } else if ( command == beamVertexCmd ) {
|
---|
| 71 | myAction->SetVtx(beamVertexCmd->GetNew3VectorValue(newValue));
|
---|
| 72 |
|
---|
| 73 | } else if ( command == polarCmd ) {
|
---|
| 74 | myAction->SetOptPhotonPolar(polarCmd->GetNew3VectorValue(newValue));
|
---|
| 75 |
|
---|
| 76 | }
|
---|
| 77 |
|
---|
| 78 | }//SetNewValue
|
---|
| 79 |
|
---|
| 80 | //--------------------------------------------------------------------------------------------
|
---|
| 81 |
|
---|