Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4GeneralParticleSourceMessenger Class Reference

#include <G4GeneralParticleSourceMessenger.hh>

Inheritance diagram for G4GeneralParticleSourceMessenger:

Public Member Functions

void SetParticleGun (G4SingleParticleSource *fpg)
void SetNewValue (G4UIcommand *command, G4String newValues) override
G4String GetCurrentValue (G4UIcommand *command) override
Public Member Functions inherited from G4UImessenger
 G4UImessenger ()=default
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
virtual ~G4UImessenger ()
G4bool CommandsShouldBeInMaster () const

Static Public Member Functions

static G4GeneralParticleSourceMessengerGetInstance (G4GeneralParticleSource *)
static void Destroy ()

Additional Inherited Members

Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
G4String LtoS (G4long l)
G4String DtoS (G4double a)
G4String BtoS (G4bool b)
G4int StoI (const G4String &s)
G4long StoL (const G4String &s)
G4double StoD (const G4String &s)
G4bool StoB (const G4String &s)
void AddUIcommand (G4UIcommand *newCommand)
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
template<typename T>
T * CreateCommand (const G4String &cname, const G4String &dsc)
Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir = nullptr
G4String baseDirName = ""
G4bool commandsShouldBeInMaster = false

Detailed Description

Definition at line 74 of file G4GeneralParticleSourceMessenger.hh.

Member Function Documentation

◆ Destroy()

void G4GeneralParticleSourceMessenger::Destroy ( )
static

Definition at line 73 of file G4GeneralParticleSourceMessenger.cc.

74{
75 G4AutoLock l(&creationM);
76 if ( theInstance != nullptr )
77 {
78 delete theInstance;
79 theInstance = nullptr;
80 }
81}
G4TemplateAutoLock< G4Mutex > G4AutoLock

◆ GetCurrentValue()

G4String G4GeneralParticleSourceMessenger::GetCurrentValue ( G4UIcommand * command)
overridevirtual

Reimplemented from G4UImessenger.

Definition at line 1498 of file G4GeneralParticleSourceMessenger.cc.

1499{
1500 G4String cv;
1501
1502 if( command==volChkCmd )
1503 { cv = volChkCmd->ConvertToString(fParticleGun->IfCheckInside()); }
1504 else
1505 {
1506 // if( command==directionCmd )
1507 // { cv = directionCmd->ConvertToString(fParticleGun->GetParticleMomentumDirection()); }
1508 // else if( command==energyCmd )
1509 // { cv = energyCmd->ConvertToString(fParticleGun->GetParticleEnergy(),"GeV"); }
1510 // else if( command==positionCmd )
1511 // { cv = positionCmd->ConvertToString(fParticleGun->GetParticlePosition(),"cm"); }
1512 // else if( command==timeCmd )
1513 // { cv = timeCmd->ConvertToString(fParticleGun->GetParticleTime(),"ns"); }
1514 // else if( command==polCmd )
1515 // { cv = polCmd->ConvertToString(fParticleGun->GetParticlePolarization()); }
1516 // else if( command==numberCmd )
1517 // { cv = numberCmd->ConvertToString(fParticleGun->GetNumberOfParticles()); }
1518
1519 cv = "Not implemented yet";
1520 }
1521
1522 return cv;
1523}

◆ GetInstance()

G4GeneralParticleSourceMessenger * G4GeneralParticleSourceMessenger::GetInstance ( G4GeneralParticleSource * psc)
static

Definition at line 65 of file G4GeneralParticleSourceMessenger.cc.

66{
67 G4AutoLock l(&creationM);
68 if ( theInstance == nullptr )
69 theInstance = new G4GeneralParticleSourceMessenger(psc);
70 return theInstance;
71}

Referenced by G4GeneralParticleSource::G4GeneralParticleSource().

◆ SetNewValue()

void G4GeneralParticleSourceMessenger::SetNewValue ( G4UIcommand * command,
G4String newValues )
overridevirtual

Reimplemented from G4UImessenger.

Definition at line 699 of file G4GeneralParticleSourceMessenger.cc.

700{
701// if(command == typeCmd)
702// {
703// CHECKPG(); fParticleGun->GetPosDist()->SetPosDisType(newValues);
704// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
705// << " The command is obsolete and will be removed soon." << G4endl
706// << " Please try to use the new structured commands!" << G4endl;
707// }
708// else if(command == shapeCmd)
709// {
710// CHECKPG(); fParticleGun->GetPosDist()->SetPosDisShape(newValues);
711// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
712// << " The command is obsolete and will be removed soon." << G4endl
713// << " Please try to use the new structured commands!" << G4endl;
714// }
715// else if(command == centreCmd)
716// {
717// CHECKPG(); fParticleGun->GetPosDist()->SetCentreCoords(centreCmd->GetNew3VectorValue(newValues));
718// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
719// << " The command is obsolete and will be removed soon." << G4endl
720// << " Please try to use the new structured commands!" << G4endl;
721// }
722// else if(command == posrot1Cmd)
723// {
724// CHECKPG(); fParticleGun->GetPosDist()->SetPosRot1(posrot1Cmd->GetNew3VectorValue(newValues));
725// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
726// << " The command is obsolete and will be removed soon." << G4endl
727// << " Please try to use the new structured commands!" << G4endl;
728// }
729// else if(command == posrot2Cmd)
730// {
731// CHECKPG(); fParticleGun->GetPosDist()->SetPosRot2(posrot2Cmd->GetNew3VectorValue(newValues));
732// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
733// << " The command is obsolete and will be removed soon." << G4endl
734// << " Please try to use the new structured commands!" << G4endl;
735// }
736// else if(command == halfxCmd)
737// {
738// CHECKPG(); fParticleGun->GetPosDist()->SetHalfX(halfxCmd->GetNewDoubleValue(newValues));
739// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
740// << " The command is obsolete and will be removed soon." << G4endl
741// << " Please try to use the new structured commands!" << G4endl;
742// }
743// else if(command == halfyCmd)
744// {
745// CHECKPG(); fParticleGun->GetPosDist()->SetHalfY(halfyCmd->GetNewDoubleValue(newValues));
746// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
747// << " The command is obsolete and will be removed soon." << G4endl
748// << " Please try to use the new structured commands!" << G4endl;
749// }
750// else if(command == halfzCmd)
751// {
752// CHECKPG(); fParticleGun->GetPosDist()->SetHalfZ(halfzCmd->GetNewDoubleValue(newValues));
753// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
754// << " The command is obsolete and will be removed soon." << G4endl
755// << " Please try to use the new structured commands!" << G4endl;
756// }
757// else if(command == radiusCmd)
758// {
759// CHECKPG(); fParticleGun->GetPosDist()->SetRadius(radiusCmd->GetNewDoubleValue(newValues));
760// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
761// << " The command is obsolete and will be removed soon." << G4endl
762// << " Please try to use the new structured commands!" << G4endl;
763// }
764// else if(command == radius0Cmd)
765// {
766// CHECKPG(); fParticleGun->GetPosDist()->SetRadius0(radius0Cmd->GetNewDoubleValue(newValues));
767// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
768// << " The command is obsolete and will be removed soon." << G4endl
769// << " Please try to use the new structured commands!" << G4endl;
770// }
771// else if(command == possigmarCmd)
772// {
773// CHECKPG(); fParticleGun->GetPosDist()->SetBeamSigmaInR(possigmarCmd->GetNewDoubleValue(newValues));
774// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
775// << " The command is obsolete and will be removed soon." << G4endl
776// << " Please try to use the new structured commands!" << G4endl;
777// }
778// else if(command == possigmaxCmd)
779// {
780// CHECKPG(); fParticleGun->GetPosDist()->SetBeamSigmaInX(possigmaxCmd->GetNewDoubleValue(newValues));
781// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
782// << " The command is obsolete and will be removed soon." << G4endl
783// << " Please try to use the new structured commands!" << G4endl;
784// }
785// else if(command == possigmayCmd)
786// {
787// CHECKPG(); fParticleGun->GetPosDist()->SetBeamSigmaInY(possigmayCmd->GetNewDoubleValue(newValues));
788// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
789// << " The command is obsolete and will be removed soon." << G4endl
790// << " Please try to use the new structured commands!" << G4endl;
791// }
792// else if(command == paralpCmd)
793// {
794// CHECKPG(); fParticleGun->GetPosDist()->SetParAlpha(paralpCmd->GetNewDoubleValue(newValues));
795// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
796// << " The command is obsolete and will be removed soon." << G4endl
797// << " Please try to use the new structured commands!" << G4endl;
798// }
799// else if(command == partheCmd)
800// {
801// CHECKPG(); fParticleGun->GetPosDist()->SetParTheta(partheCmd->GetNewDoubleValue(newValues));
802// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
803// << " The command is obsolete and will be removed soon." << G4endl
804// << " Please try to use the new structured commands!" << G4endl;
805// }
806// else if(command == parphiCmd)
807// {
808// CHECKPG(); fParticleGun->GetPosDist()->SetParPhi(parphiCmd->GetNewDoubleValue(newValues));
809// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
810// << " The command is obsolete and will be removed soon." << G4endl
811// << " Please try to use the new structured commands!" << G4endl;
812// }
813// else if(command == confineCmd)
814// {
815// CHECKPG(); fParticleGun->GetPosDist()->ConfineSourceToVolume(newValues);
816// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
817// << " The command is obsolete and will be removed soon." << G4endl
818// << " Please try to use the new structured commands!" << G4endl;
819// }
820// else if(command == angtypeCmd)
821// {
822// CHECKPG(); fParticleGun->GetAngDist()->SetAngDistType(newValues);
823// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
824// << " The command is obsolete and will be removed soon." << G4endl
825// << " Please try to use the new structured commands!" << G4endl;
826// }
827// else if(command == angrot1Cmd)
828// {
829// CHECKPG();
830// G4String a = "angref1";
831// fParticleGun->GetAngDist()->DefineAngRefAxes(a,angrot1Cmd->GetNew3VectorValue(newValues));
832// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
833// << " The command is obsolete and will be removed soon." << G4endl
834// << " Please try to use the new structured commands!" << G4endl;
835// }
836// else if(command == angrot2Cmd)
837// {
838// CHECKPG();
839// G4String a = "angref2";
840// fParticleGun->GetAngDist()->DefineAngRefAxes(a,angrot2Cmd->GetNew3VectorValue(newValues));
841// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
842// << " The command is obsolete and will be removed soon." << G4endl
843// << " Please try to use the new structured commands!" << G4endl;
844// }
845// else if(command == minthetaCmd)
846// {
847// CHECKPG(); fParticleGun->GetAngDist()->SetMinTheta(minthetaCmd->GetNewDoubleValue(newValues));
848// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
849// << " The command is obsolete and will be removed soon." << G4endl
850// << " Please try to use the new structured commands!" << G4endl;
851// }
852// else if(command == minphiCmd)
853// {
854// CHECKPG(); fParticleGun->GetAngDist()->SetMinPhi(minphiCmd->GetNewDoubleValue(newValues));
855// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
856// << " The command is obsolete and will be removed soon." << G4endl
857// << " Please try to use the new structured commands!" << G4endl;
858// }
859// else if(command == maxthetaCmd)
860// {
861// CHECKPG(); fParticleGun->GetAngDist()->SetMaxTheta(maxthetaCmd->GetNewDoubleValue(newValues));
862// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
863// << " The command is obsolete and will be removed soon." << G4endl
864// << " Please try to use the new structured commands!" << G4endl;
865// }
866// else if(command == maxphiCmd)
867// {
868// CHECKPG(); fParticleGun->GetAngDist()->SetMaxPhi(maxphiCmd->GetNewDoubleValue(newValues));
869// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
870// << " The command is obsolete and will be removed soon." << G4endl
871// << " Please try to use the new structured commands!" << G4endl;
872// }
873// else if(command == angsigmarCmd)
874// {
875// CHECKPG(); fParticleGun->GetAngDist()->SetBeamSigmaInAngR(angsigmarCmd->GetNewDoubleValue(newValues));
876// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
877// << " The command is obsolete and will be removed soon." << G4endl
878// << " Please try to use the new structured commands!" << G4endl;
879// }
880// else if(command == angsigmaxCmd)
881// {
882// CHECKPG(); fParticleGun->GetAngDist()->SetBeamSigmaInAngX(angsigmaxCmd->GetNewDoubleValue(newValues));
883// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
884// << " The command is obsolete and will be removed soon." << G4endl
885// << " Please try to use the new structured commands!" << G4endl;
886// }
887// else if(command == angsigmayCmd)
888// {
889// CHECKPG(); fParticleGun->GetAngDist()->SetBeamSigmaInAngY(angsigmayCmd->GetNewDoubleValue(newValues));
890// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
891// << " The command is obsolete and will be removed soon." << G4endl
892// << " Please try to use the new structured commands!" << G4endl;
893// }
894// else if(command == useuserangaxisCmd)
895// {
896// CHECKPG(); fParticleGun->GetAngDist()->SetUseUserAngAxis(useuserangaxisCmd->GetNewBoolValue(newValues));
897// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
898// << " The command is obsolete and will be removed soon." << G4endl
899// << " Please try to use the new structured commands!" << G4endl;
900// }
901// else if(command == surfnormCmd)
902// {
903// CHECKPG(); fParticleGun->GetAngDist()->SetUserWRTSurface(surfnormCmd->GetNewBoolValue(newValues));
904// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
905// << " The command is obsolete and will be removed soon." << G4endl
906// << " Please try to use the new structured commands!" << G4endl;
907// }
908// else if(command == energytypeCmd)
909// {
910// CHECKPG(); fParticleGun->GetEneDist()->SetEnergyDisType(newValues);
911// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
912// << " The command is obsolete and will be removed soon." << G4endl
913// << " Please try to use the new structured commands!" << G4endl;
914// }
915// else if(command == eminCmd)
916// {
917// CHECKPG(); fParticleGun->GetEneDist()->SetEmin(eminCmd->GetNewDoubleValue(newValues));
918// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
919// << " The command is obsolete and will be removed soon." << G4endl
920// << " Please try to use the new structured commands!" << G4endl;
921// }
922// else if(command == emaxCmd)
923// {
924// CHECKPG(); fParticleGun->GetEneDist()->SetEmax(emaxCmd->GetNewDoubleValue(newValues));
925// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
926// << " The command is obsolete and will be removed soon." << G4endl
927// << " Please try to use the new structured commands!" << G4endl;
928// }
929// else if(command == monoenergyCmd)
930// {
931// CHECKPG(); fParticleGun->GetEneDist()->SetMonoEnergy(monoenergyCmd->GetNewDoubleValue(newValues));
932// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
933// << " The command is obsolete and will be removed soon." << G4endl
934// << " Please try to use the new structured commands!" << G4endl;
935// }
936// else if(command == engsigmaCmd)
937// {
938// CHECKPG(); fParticleGun->GetEneDist()->SetBeamSigmaInE(engsigmaCmd->GetNewDoubleValue(newValues));
939// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
940// << " The command is obsolete and will be removed soon." << G4endl
941// << " Please try to use the new structured commands!" << G4endl;
942// }
943// else if(command == alphaCmd)
944// {
945// CHECKPG(); fParticleGun->GetEneDist()->SetAlpha(alphaCmd->GetNewDoubleValue(newValues));
946// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
947// << " The command is obsolete and will be removed soon." << G4endl
948// << " Please try to use the new structured commands!" << G4endl;
949// }
950// else if(command == tempCmd)
951// {
952// CHECKPG(); fParticleGun->GetEneDist()->SetTemp(tempCmd->GetNewDoubleValue(newValues));
953// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
954// << " The command is obsolete and will be removed soon." << G4endl
955// << " Please try to use the new structured commands!" << G4endl;
956// }
957// else if(command == ezeroCmd)
958// {
959// CHECKPG(); fParticleGun->GetEneDist()->SetEzero(ezeroCmd->GetNewDoubleValue(newValues));
960// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
961// << " The command is obsolete and will be removed soon." << G4endl
962// << " Please try to use the new structured commands!" << G4endl;
963// }
964// else if(command == gradientCmd)
965// {
966// CHECKPG(); fParticleGun->GetEneDist()->SetGradient(gradientCmd->GetNewDoubleValue(newValues));
967// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
968// << " The command is obsolete and will be removed soon." << G4endl
969// << " Please try to use the new structured commands!" << G4endl;
970// }
971// else if(command == interceptCmd)
972// {
973// CHECKPG(); fParticleGun->GetEneDist()->SetInterCept(interceptCmd->GetNewDoubleValue(newValues));
974// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
975// << " The command is obsolete and will be removed soon." << G4endl
976// << " Please try to use the new structured commands!" << G4endl;
977// }
978// else if(command == calculateCmd)
979// {
980// CHECKPG(); fParticleGun->GetEneDist()->Calculate();
981// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
982// << " The command is obsolete and will be removed soon." << G4endl
983// << " Please try to use the new structured commands!" << G4endl;
984// }
985// else if(command == energyspecCmd)
986// {
987// CHECKPG(); fParticleGun->GetEneDist()->InputEnergySpectra(energyspecCmd->GetNewBoolValue(newValues));
988// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
989// << " The command is obsolete and will be removed soon." << G4endl
990// << " Please try to use the new structured commands!" << G4endl;
991// }
992// else if(command == diffspecCmd)
993// {
994// CHECKPG(); fParticleGun->GetEneDist()->InputDifferentialSpectra(diffspecCmd->GetNewBoolValue(newValues));
995// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
996// << " The command is obsolete and will be removed soon." << G4endl
997// << " Please try to use the new structured commands!" << G4endl;
998// }
999// else if(command == histnameCmd)
1000// {
1001// histtype = newValues;
1002// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1003// << " The command is obsolete and will be removed soon." << G4endl
1004// << " Please try to use the new structured commands!" << G4endl;
1005// }
1006// else
1007// if(command == histpointCmd)
1008// {
1009// CHECKPG();
1010// if(histtype == "biasx")
1011// fParticleGun->GetBiasRndm()->SetXBias(histpointCmd->GetNew3VectorValue(newValues));
1012// if(histtype == "biasy")
1013// fParticleGun->GetBiasRndm()->SetYBias(histpointCmd->GetNew3VectorValue(newValues));
1014// if(histtype == "biasz")
1015// fParticleGun->GetBiasRndm()->SetZBias(histpointCmd->GetNew3VectorValue(newValues));
1016// if(histtype == "biast")
1017// fParticleGun->GetBiasRndm()->SetThetaBias(histpointCmd->GetNew3VectorValue(newValues));
1018// if(histtype == "biasp")
1019// fParticleGun->GetBiasRndm()->SetPhiBias(histpointCmd->GetNew3VectorValue(newValues));
1020// if(histtype == "biase")
1021// fParticleGun->GetBiasRndm()->SetEnergyBias(histpointCmd->GetNew3VectorValue(newValues));
1022// if(histtype == "theta")
1023// fParticleGun->GetAngDist()->UserDefAngTheta(histpointCmd->GetNew3VectorValue(newValues));
1024// if(histtype == "phi")
1025// fParticleGun->GetAngDist()->UserDefAngPhi(histpointCmd->GetNew3VectorValue(newValues));
1026// if(histtype == "energy")
1027// fParticleGun->GetEneDist()->UserEnergyHisto(histpointCmd->GetNew3VectorValue(newValues));
1028// if(histtype == "arb")
1029// fParticleGun->GetEneDist()->ArbEnergyHisto(histpointCmd->GetNew3VectorValue(newValues));
1030// if(histtype == "epn")
1031// fParticleGun->GetEneDist()->EpnEnergyHisto(histpointCmd->GetNew3VectorValue(newValues));
1032// G4cout << " G4GeneralParticleSourceMessenger - Warning: The command is obsolete and will be removed soon. Please try to use the new structured commands!" << G4endl;
1033// }
1034// else if(command == resethistCmd)
1035// {
1036// CHECKPG();
1037// if(newValues == "theta" || newValues == "phi") {
1038// fParticleGun->GetAngDist()->ReSetHist(newValues);
1039// } else if (newValues == "energy" || newValues == "arb" || newValues == "epn") {
1040// fParticleGun->GetEneDist()->ReSetHist(newValues);
1041// } else {
1042// fParticleGun->GetBiasRndm()->ReSetHist(newValues);
1043// }
1044// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1045// << " The command is obsolete and will be removed soon." << G4endl
1046// << " Please try to use the new structured commands!" << G4endl;
1047// }
1048// else if(command == arbintCmd)
1049// {
1050// CHECKPG();
1051// fParticleGun->GetEneDist()->ArbInterpolate(newValues);
1052// G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1053// << " The command is obsolete and will be removed soon." << G4endl
1054// << " Please try to use the new structured commands!" << G4endl;
1055// }
1056// else
1057 if( command==directionCmd )
1058 {
1059 CHECKPG();
1060 fParticleGun->GetAngDist()->SetAngDistType("planar");
1061 fParticleGun->GetAngDist()->SetParticleMomentumDirection(directionCmd->GetNew3VectorValue(newValues));
1062 }
1063 else if( command==energyCmd )
1064 {
1065 CHECKPG();
1066 fParticleGun->GetEneDist()->SetEnergyDisType("Mono");
1067 fParticleGun->GetEneDist()->SetMonoEnergy(energyCmd->GetNewDoubleValue(newValues));
1068 }
1069 else if( command==positionCmd )
1070 {
1071 CHECKPG();
1072 fParticleGun->GetPosDist()->SetPosDisType("Point");
1073 fParticleGun->GetPosDist()->SetCentreCoords(positionCmd->GetNew3VectorValue(newValues));
1074 }
1075 else if(command == verbosityCmd)
1076 {
1077 fGPS->SetVerbosity(verbosityCmd->GetNewIntValue(newValues));
1078 // CHECKPG();
1079 // fParticleGun->SetVerbosity(verbosityCmd->GetNewIntValue(newValues));
1080 }
1081 else if( command==volChkCmd )
1082 {
1083 fGPS->CheckInside(volChkCmd->GetNewBoolValue(newValues));
1084 }
1085 else if( command==particleCmd )
1086 {
1087 if (newValues =="ion")
1088 {
1089 fShootIon = true;
1090 }
1091 else
1092 {
1093 fShootIon = false;
1094 G4ParticleDefinition* pd = particleTable->FindParticle(newValues);
1095 if(pd != nullptr)
1096 {
1097 CHECKPG();
1098 fParticleGun->SetParticleDefinition( pd );
1099 }
1100 }
1101 }
1102 else if( command==timeCmd )
1103 {
1104 CHECKPG();
1105 fParticleGun->SetParticleTime(timeCmd->GetNewDoubleValue(newValues));
1106 }
1107 else if( command==polCmd )
1108 {
1109 CHECKPG();
1110 fParticleGun->SetParticlePolarization(polCmd->GetNew3VectorValue(newValues));
1111 }
1112 else if( command==numberCmd )
1113 {
1114 CHECKPG();
1115 fParticleGun->SetNumberOfParticles(numberCmd->GetNewIntValue(newValues));
1116 }
1117 else if( command==ionCmd )
1118 {
1119 IonCommand(newValues);
1120 }
1121 else if( command==ionLvlCmd )
1122 {
1123 IonLvlCommand(newValues);
1124 }
1125 else if( command==listCmd )
1126 {
1127 particleTable->DumpTable();
1128 }
1129 else if( command==addsourceCmd )
1130 {
1131 fGPS->AddaSource(addsourceCmd->GetNewDoubleValue(newValues));
1132 }
1133 else if( command==listsourceCmd )
1134 {
1135 fGPS->ListSource();
1136 }
1137 else if( command==clearsourceCmd )
1138 {
1139 fGPS->ClearAll();
1140 fParticleGun = nullptr;
1141 }
1142 else if( command==getsourceCmd )
1143 {
1144 G4cout << " Current source index:" << fGPS->GetCurrentSourceIndex()
1145 << " ; Intensity:" << fGPS->GetCurrentSourceIntensity() << G4endl;
1146 }
1147 else if( command==setsourceCmd )
1148 {
1149 // NOTE: This will also sets fParticleGun to the courrent source
1150 // Not very clean, the GPS::SetCurrentSourceto will call:
1151 // SetParticleSource( G4ParticleSource* )
1152 // The point is that GPS has no public API to get a source by index
1153 // TODO: Can we add this API?
1154 const G4int sn = setsourceCmd->GetNewIntValue(newValues);
1155 if ( sn >= fGPS->GetNumberofSource() )
1156 {
1158 msg << "Using command " << setsourceCmd->GetCommandPath() << "/"
1159 << setsourceCmd->GetCommandName() << " " << sn;
1160 msg << " is invalid " << fGPS->GetNumberofSource()
1161 << " source(s) are defined.";
1162 G4Exception("G4GeneralParticleSourceMessenger::SetNewValue",
1163 "G4GPS005", FatalException, msg);
1164 }
1165 fGPS->SetCurrentSourceto(setsourceCmd->GetNewIntValue(newValues));
1166 }
1167 else if( command==setintensityCmd )
1168 {
1169 fGPS->SetCurrentSourceIntensity(setintensityCmd->GetNewDoubleValue(newValues));
1170 }
1171 else if( command==deletesourceCmd )
1172 {
1173 fGPS->DeleteaSource(deletesourceCmd->GetNewIntValue(newValues));
1174 }
1175 else if(command == multiplevertexCmd)
1176 {
1177 fGPS->SetMultipleVertex(multiplevertexCmd->GetNewBoolValue(newValues));
1178 }
1179 else if(command == flatsamplingCmd)
1180 {
1181 fGPS->SetFlatSampling(flatsamplingCmd->GetNewBoolValue(newValues));
1182 }
1183 //
1184 // new implementations
1185 //
1186 else if(command == typeCmd1)
1187 {
1188 CHECKPG();
1189 fParticleGun->GetPosDist()->SetPosDisType(newValues);
1190 }
1191 else if(command == shapeCmd1)
1192 {
1193 CHECKPG();
1194 fParticleGun->GetPosDist()->SetPosDisShape(newValues);
1195 }
1196 else if(command == centreCmd1)
1197 {
1198 CHECKPG();
1199 fParticleGun->GetPosDist()->SetCentreCoords(centreCmd1->GetNew3VectorValue(newValues));
1200 }
1201 else if(command == posrot1Cmd1)
1202 {
1203 CHECKPG();
1204 fParticleGun->GetPosDist()->SetPosRot1(posrot1Cmd1->GetNew3VectorValue(newValues));
1205 }
1206 else if(command == posrot2Cmd1)
1207 {
1208 CHECKPG();
1209 fParticleGun->GetPosDist()->SetPosRot2(posrot2Cmd1->GetNew3VectorValue(newValues));
1210 }
1211 else if(command == halfxCmd1)
1212 {
1213 CHECKPG();
1214 fParticleGun->GetPosDist()->SetHalfX(halfxCmd1->GetNewDoubleValue(newValues));
1215 }
1216 else if(command == halfyCmd1)
1217 {
1218 CHECKPG();
1219 fParticleGun->GetPosDist()->SetHalfY(halfyCmd1->GetNewDoubleValue(newValues));
1220 }
1221 else if(command == halfzCmd1)
1222 {
1223 CHECKPG();
1224 fParticleGun->GetPosDist()->SetHalfZ(halfzCmd1->GetNewDoubleValue(newValues));
1225 }
1226 else if(command == radiusCmd1)
1227 {
1228 CHECKPG();
1229 fParticleGun->GetPosDist()->SetRadius(radiusCmd1->GetNewDoubleValue(newValues));
1230 }
1231 else if(command == radius0Cmd1)
1232 {
1233 CHECKPG();
1234 fParticleGun->GetPosDist()->SetRadius0(radius0Cmd1->GetNewDoubleValue(newValues));
1235 }
1236 else if(command == possigmarCmd1)
1237 {
1238 CHECKPG();
1239 fParticleGun->GetPosDist()->SetBeamSigmaInR(possigmarCmd1->GetNewDoubleValue(newValues));
1240 }
1241 else if(command == possigmaxCmd1)
1242 {
1243 CHECKPG();
1244 fParticleGun->GetPosDist()->SetBeamSigmaInX(possigmaxCmd1->GetNewDoubleValue(newValues));
1245 }
1246 else if(command == possigmayCmd1)
1247 {
1248 CHECKPG();
1249 fParticleGun->GetPosDist()->SetBeamSigmaInY(possigmayCmd1->GetNewDoubleValue(newValues));
1250 }
1251 else if(command == paralpCmd1)
1252 {
1253 CHECKPG();
1254 fParticleGun->GetPosDist()->SetParAlpha(paralpCmd1->GetNewDoubleValue(newValues));
1255 }
1256 else if(command == partheCmd1)
1257 {
1258 CHECKPG();
1259 fParticleGun->GetPosDist()->SetParTheta(partheCmd1->GetNewDoubleValue(newValues));
1260 }
1261 else if(command == parphiCmd1)
1262 {
1263 CHECKPG();
1264 fParticleGun->GetPosDist()->SetParPhi(parphiCmd1->GetNewDoubleValue(newValues));
1265 }
1266 else if(command == confineCmd1)
1267 {
1268 CHECKPG();
1269 fParticleGun->GetPosDist()->ConfineSourceToVolume(newValues);
1270 }
1271 else if(command == angtypeCmd1)
1272 {
1273 CHECKPG();
1274 fParticleGun->GetAngDist()->SetAngDistType(newValues);
1275 }
1276 else if(command == angrot1Cmd1)
1277 {
1278 CHECKPG();
1279 G4String a = "angref1";
1280 fParticleGun->GetAngDist()->DefineAngRefAxes(a,angrot1Cmd1->GetNew3VectorValue(newValues));
1281 }
1282 else if(command == angrot2Cmd1)
1283 {
1284 CHECKPG();
1285 G4String a = "angref2";
1286 fParticleGun->GetAngDist()->DefineAngRefAxes(a,angrot2Cmd1->GetNew3VectorValue(newValues));
1287 }
1288 else if(command == minthetaCmd1)
1289 {
1290 CHECKPG();
1291 fParticleGun->GetAngDist()->SetMinTheta(minthetaCmd1->GetNewDoubleValue(newValues));
1292 }
1293 else if(command == minphiCmd1)
1294 {
1295 CHECKPG();
1296 fParticleGun->GetAngDist()->SetMinPhi(minphiCmd1->GetNewDoubleValue(newValues));
1297 }
1298 else if(command == maxthetaCmd1)
1299 {
1300 CHECKPG();
1301 fParticleGun->GetAngDist()->SetMaxTheta(maxthetaCmd1->GetNewDoubleValue(newValues));
1302 }
1303 else if(command == maxphiCmd1)
1304 {
1305 CHECKPG();
1306 fParticleGun->GetAngDist()->SetMaxPhi(maxphiCmd1->GetNewDoubleValue(newValues));
1307 }
1308 else if(command == angsigmarCmd1)
1309 {
1310 CHECKPG();
1311 fParticleGun->GetAngDist()->SetBeamSigmaInAngR(angsigmarCmd1->GetNewDoubleValue(newValues));
1312 }
1313 else if(command == angsigmaxCmd1)
1314 {
1315 CHECKPG();
1316 fParticleGun->GetAngDist()->SetBeamSigmaInAngX(angsigmaxCmd1->GetNewDoubleValue(newValues));
1317 }
1318 else if(command == angsigmayCmd1)
1319 {
1320 CHECKPG();
1321 fParticleGun->GetAngDist()->SetBeamSigmaInAngY(angsigmayCmd1->GetNewDoubleValue(newValues));
1322 }
1323 else if(command == angfocusCmd)
1324 {
1325 CHECKPG();
1326 fParticleGun->GetAngDist()->SetFocusPoint(angfocusCmd->GetNew3VectorValue(newValues));
1327 }
1328 else if(command == useuserangaxisCmd1)
1329 {
1330 CHECKPG();
1331 fParticleGun->GetAngDist()->SetUseUserAngAxis(useuserangaxisCmd1->GetNewBoolValue(newValues));
1332 }
1333 else if(command == surfnormCmd1)
1334 {
1335 CHECKPG();
1336 fParticleGun->GetAngDist()->SetUserWRTSurface(surfnormCmd1->GetNewBoolValue(newValues));
1337 }
1338 else if(command == energytypeCmd1)
1339 {
1340 CHECKPG();
1341 if(newValues=="LW")
1342 {
1343 fParticleGun->GetEneDist()->SetEnergyDisType("Lin");
1344 fParticleGun->GetEneDist()->SetGradient(0.);
1345 fParticleGun->GetEneDist()->SetInterCept(1.);
1346 fParticleGun->GetEneDist()->ApplyEnergyWeight(true);
1347 }
1348 else
1349 {
1350 fParticleGun->GetEneDist()->SetEnergyDisType(newValues);
1351 fParticleGun->GetEneDist()->ApplyEnergyWeight(false);
1352 }
1353 }
1354 else if(command == eminCmd1)
1355 {
1356 CHECKPG();
1357 fParticleGun->GetEneDist()->SetEmin(eminCmd1->GetNewDoubleValue(newValues));
1358 }
1359 else if(command == emaxCmd1)
1360 {
1361 CHECKPG();
1362 fParticleGun->GetEneDist()->SetEmax(emaxCmd1->GetNewDoubleValue(newValues));
1363 }
1364 else if(command == monoenergyCmd1)
1365 {
1366 CHECKPG();
1367 fParticleGun->GetEneDist()->SetMonoEnergy(monoenergyCmd1->GetNewDoubleValue(newValues));
1368 }
1369 else if(command == engsigmaCmd1)
1370 {
1371 CHECKPG();
1372 fParticleGun->GetEneDist()->SetBeamSigmaInE(engsigmaCmd1->GetNewDoubleValue(newValues));
1373 }
1374 else if(command == alphaCmd1)
1375 {
1376 CHECKPG();
1377 fParticleGun->GetEneDist()->SetAlpha(alphaCmd1->GetNewDoubleValue(newValues));
1378 }
1379 else if(command == tempCmd1)
1380 {
1381 CHECKPG();
1382 fParticleGun->GetEneDist()->SetTemp(tempCmd1->GetNewDoubleValue(newValues));
1383 }
1384 else if(command == ezeroCmd1)
1385 {
1386 CHECKPG();
1387 fParticleGun->GetEneDist()->SetEzero(ezeroCmd1->GetNewDoubleValue(newValues));
1388 }
1389 else if(command == gradientCmd1)
1390 {
1391 CHECKPG();
1392 fParticleGun->GetEneDist()->SetGradient(gradientCmd1->GetNewDoubleValue(newValues));
1393 }
1394 else if(command == interceptCmd1)
1395 {
1396 CHECKPG();
1397 fParticleGun->GetEneDist()->SetInterCept(interceptCmd1->GetNewDoubleValue(newValues));
1398 }
1399 else if(command == arbeintCmd1)
1400 {
1401 CHECKPG();
1402 fParticleGun->GetEneDist()->SetBiasAlpha(arbeintCmd1->GetNewDoubleValue(newValues));
1403 }
1404 else if(command == calculateCmd1)
1405 {
1406 CHECKPG();
1407 fParticleGun->GetEneDist()->Calculate();
1408 }
1409 else if(command == energyspecCmd1)
1410 {
1411 CHECKPG();
1412 fParticleGun->GetEneDist()->InputEnergySpectra(energyspecCmd1->GetNewBoolValue(newValues));
1413 }
1414 else if(command == diffspecCmd1)
1415 {
1416 CHECKPG();
1417 fParticleGun->GetEneDist()->InputDifferentialSpectra(diffspecCmd1->GetNewBoolValue(newValues));
1418 }
1419 else if(command == applyEnergyWeightCmd1)
1420 {
1421 CHECKPG();
1422 const auto& eDisType = fParticleGun->GetEneDist()->GetEnergyDisType();
1423 if(eDisType != "Lin")
1424 {
1426 ed << "Energy distribution is defined as " << eDisType << ". /gps/ene/applyEneWeight is available only for Linear distribution.";
1427 command->CommandFailed(ed);
1428 return;
1429 }
1430 fParticleGun->GetEneDist()->ApplyEnergyWeight(applyEnergyWeightCmd1->GetNewBoolValue(newValues));
1431 }
1432 else if(command == histnameCmd1)
1433 {
1434 histtype = newValues;
1435 }
1436 else if(command == histfileCmd1)
1437 {
1438 histtype = "arb";
1439 CHECKPG();
1440 fParticleGun->GetEneDist()->ArbEnergyHistoFile(newValues);
1441 }
1442 else if(command == histpointCmd1)
1443 {
1444 CHECKPG();
1445 if(histtype == "biasx")
1446 fParticleGun->GetBiasRndm()->SetXBias(histpointCmd1->GetNew3VectorValue(newValues));
1447 if(histtype == "biasy")
1448 fParticleGun->GetBiasRndm()->SetYBias(histpointCmd1->GetNew3VectorValue(newValues));
1449 if(histtype == "biasz")
1450 fParticleGun->GetBiasRndm()->SetZBias(histpointCmd1->GetNew3VectorValue(newValues));
1451 if(histtype == "biast")
1452 fParticleGun->GetBiasRndm()->SetThetaBias(histpointCmd1->GetNew3VectorValue(newValues));
1453 if(histtype == "biasp")
1454 fParticleGun->GetBiasRndm()->SetPhiBias(histpointCmd1->GetNew3VectorValue(newValues));
1455 if(histtype == "biaspt")
1456 fParticleGun->GetBiasRndm()->SetPosThetaBias(histpointCmd1->GetNew3VectorValue(newValues));
1457 if(histtype == "biaspp")
1458 fParticleGun->GetBiasRndm()->SetPosPhiBias(histpointCmd1->GetNew3VectorValue(newValues));
1459 if(histtype == "biase")
1460 fParticleGun->GetBiasRndm()->SetEnergyBias(histpointCmd1->GetNew3VectorValue(newValues));
1461 if(histtype == "theta")
1462 fParticleGun->GetAngDist()->UserDefAngTheta(histpointCmd1->GetNew3VectorValue(newValues));
1463 if(histtype == "phi")
1464 fParticleGun->GetAngDist()->UserDefAngPhi(histpointCmd1->GetNew3VectorValue(newValues));
1465 if(histtype == "energy")
1466 fParticleGun->GetEneDist()->UserEnergyHisto(histpointCmd1->GetNew3VectorValue(newValues));
1467 if(histtype == "arb")
1468 fParticleGun->GetEneDist()->ArbEnergyHisto(histpointCmd1->GetNew3VectorValue(newValues));
1469 if(histtype == "epn")
1470 fParticleGun->GetEneDist()->EpnEnergyHisto(histpointCmd1->GetNew3VectorValue(newValues));
1471 }
1472 else if(command == resethistCmd1)
1473 {
1474 CHECKPG();
1475 if(newValues == "theta" || newValues == "phi")
1476 {
1477 fParticleGun->GetAngDist()->ReSetHist(newValues);
1478 }
1479 else if (newValues == "energy" || newValues == "arb" || newValues == "epn")
1480 {
1481 fParticleGun->GetEneDist()->ReSetHist(newValues);
1482 }
1483 else
1484 {
1485 fParticleGun->GetBiasRndm()->ReSetHist(newValues);
1486 }
1487 }
1488 else if(command == arbintCmd1)
1489 {
1490 CHECKPG(); fParticleGun->GetEneDist()->ArbInterpolate(newValues);
1491 }
1492 else
1493 {
1494 G4cout << "Error entering command" << G4endl;
1495 }
1496}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
int G4int
Definition G4Types.hh:85
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
void CommandFailed(G4int errCode, G4ExceptionDescription &ed)

◆ SetParticleGun()

void G4GeneralParticleSourceMessenger::SetParticleGun ( G4SingleParticleSource * fpg)
inline

Definition at line 78 of file G4GeneralParticleSourceMessenger.hh.

78{ fParticleGun = fpg; } ;

The documentation for this class was generated from the following files: