Geant4 10.7.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)
 
G4String GetCurrentValue (G4UIcommand *command)
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool operator!= (const G4UImessenger &messenger) const
 
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 DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4long StoL (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (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}

Referenced by G4GeneralParticleSource::~G4GeneralParticleSource().

◆ GetCurrentValue()

G4String G4GeneralParticleSourceMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 1485 of file G4GeneralParticleSourceMessenger.cc.

1486{
1487 G4String cv;
1488
1489 // if( command==directionCmd )
1490 // { cv = directionCmd->ConvertToString(fParticleGun->GetParticleMomentumDirection()); }
1491 // else if( command==energyCmd )
1492 // { cv = energyCmd->ConvertToString(fParticleGun->GetParticleEnergy(),"GeV"); }
1493 // else if( command==positionCmd )
1494 // { cv = positionCmd->ConvertToString(fParticleGun->GetParticlePosition(),"cm"); }
1495 // else if( command==timeCmd )
1496 // { cv = timeCmd->ConvertToString(fParticleGun->GetParticleTime(),"ns"); }
1497 // else if( command==polCmd )
1498 // { cv = polCmd->ConvertToString(fParticleGun->GetParticlePolarization()); }
1499 // else if( command==numberCmd )
1500 // { cv = numberCmd->ConvertToString(fParticleGun->GetNumberOfParticles()); }
1501
1502 cv = "Not implemented yet";
1503
1504 return cv;
1505}

◆ 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 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 690 of file G4GeneralParticleSourceMessenger.cc.

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

◆ SetParticleGun()

void G4GeneralParticleSourceMessenger::SetParticleGun ( G4SingleParticleSource fpg)
inline

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