Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4GeneralParticleSourceMessenger Class Reference

#include <G4GeneralParticleSourceMessenger.hh>

Inheritance diagram for G4GeneralParticleSourceMessenger:
Collaboration 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 ()
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Static Public Member Functions

static
G4GeneralParticleSourceMessenger
GetInstance (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)
 
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
 
G4String baseDirName
 
G4bool commandsShouldBeInMaster
 

Detailed Description

Andrea Dotti Feb 2015 GPS messenger design requires some explanation for what distributions parameters are concerned : Each thread has its own GPS since primary generation is a user action. However to save memory the underlying structures that provide the GPS functionalities ( the G4SPS*Distribution classes and the G4SPSRandomGenerator class) are shared among threads. This implies that modifying parameters of sources requires some attention: 1- Only one thread should change source parameters. 2- Changing of parameters can happen only between runs, when is guaranteed that no thread is accessing them 2- UI commands require that even if messenger is instantiated in a thread the commands are executed in the master (this is possible since V10.1) The simplest solution is to use UI commands to change GPS parameters and avoid C++ APIs. If this is inevitable a simple solution is to instantiate an instance of G4GeneralParticleSource explicitly in the master thread (for example in G4VUserActionInitialization::BuildForMaster() and set the defaults parameter there).

Definition at line 130 of file G4GeneralParticleSourceMessenger.hh.

Member Function Documentation

void G4GeneralParticleSourceMessenger::Destroy ( )
static

Definition at line 93 of file G4GeneralParticleSourceMessenger.cc.

93  {
94  G4AutoLock l(&creationM);
95  if ( theInstance != 0 ) {
96  delete theInstance;
97  theInstance = 0;
98  }
99 }

Here is the caller graph for this function:

G4String G4GeneralParticleSourceMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 1723 of file G4GeneralParticleSourceMessenger.cc.

1724 {
1725  G4String cv;
1726 
1727  // if( command==directionCmd )
1728  // { cv = directionCmd->ConvertToString(fParticleGun->GetParticleMomentumDirection()); }
1729  // else if( command==energyCmd )
1730  // { cv = energyCmd->ConvertToString(fParticleGun->GetParticleEnergy(),"GeV"); }
1731  // else if( command==positionCmd )
1732  // { cv = positionCmd->ConvertToString(fParticleGun->GetParticlePosition(),"cm"); }
1733  // else if( command==timeCmd )
1734  // { cv = timeCmd->ConvertToString(fParticleGun->GetParticleTime(),"ns"); }
1735  // else if( command==polCmd )
1736  // { cv = polCmd->ConvertToString(fParticleGun->GetParticlePolarization()); }
1737  // else if( command==numberCmd )
1738  // { cv = numberCmd->ConvertToString(fParticleGun->GetNumberOfParticles()); }
1739 
1740  cv = "Not implemented yet";
1741 
1742  return cv;
1743 }
G4GeneralParticleSourceMessenger * G4GeneralParticleSourceMessenger::GetInstance ( G4GeneralParticleSource psc)
static

Definition at line 86 of file G4GeneralParticleSourceMessenger.cc.

87 {
88  G4AutoLock l(&creationM);
89  if ( theInstance == 0 ) theInstance = new G4GeneralParticleSourceMessenger(psc);
90  return theInstance;
91 }

Here is the caller graph for this function:

void G4GeneralParticleSourceMessenger::SetNewValue ( G4UIcommand command,
G4String  newValues 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 1008 of file G4GeneralParticleSourceMessenger.cc.

1009 {
1010 // if(command == typeCmd)
1011 // {
1012 // CHECKPG(); fParticleGun->GetPosDist()->SetPosDisType(newValues);
1013 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1014 // << " The command is obsolete and will be removed soon." << G4endl
1015 // << " Please try to use the new structured commands!" << G4endl;
1016 // }
1017 // else if(command == shapeCmd)
1018 // {
1019 // CHECKPG(); fParticleGun->GetPosDist()->SetPosDisShape(newValues);
1020 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1021 // << " The command is obsolete and will be removed soon." << G4endl
1022 // << " Please try to use the new structured commands!" << G4endl;
1023 // }
1024 // else if(command == centreCmd)
1025 // {
1026 // CHECKPG(); fParticleGun->GetPosDist()->SetCentreCoords(centreCmd->GetNew3VectorValue(newValues));
1027 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1028 // << " The command is obsolete and will be removed soon." << G4endl
1029 // << " Please try to use the new structured commands!" << G4endl;
1030 // }
1031 // else if(command == posrot1Cmd)
1032 // {
1033 // CHECKPG(); fParticleGun->GetPosDist()->SetPosRot1(posrot1Cmd->GetNew3VectorValue(newValues));
1034 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1035 // << " The command is obsolete and will be removed soon." << G4endl
1036 // << " Please try to use the new structured commands!" << G4endl;
1037 // }
1038 // else if(command == posrot2Cmd)
1039 // {
1040 // CHECKPG(); fParticleGun->GetPosDist()->SetPosRot2(posrot2Cmd->GetNew3VectorValue(newValues));
1041 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1042 // << " The command is obsolete and will be removed soon." << G4endl
1043 // << " Please try to use the new structured commands!" << G4endl;
1044 // }
1045 // else if(command == halfxCmd)
1046 // {
1047 // CHECKPG(); fParticleGun->GetPosDist()->SetHalfX(halfxCmd->GetNewDoubleValue(newValues));
1048 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1049 // << " The command is obsolete and will be removed soon." << G4endl
1050 // << " Please try to use the new structured commands!" << G4endl;
1051 // }
1052 // else if(command == halfyCmd)
1053 // {
1054 // CHECKPG(); fParticleGun->GetPosDist()->SetHalfY(halfyCmd->GetNewDoubleValue(newValues));
1055 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1056 // << " The command is obsolete and will be removed soon." << G4endl
1057 // << " Please try to use the new structured commands!" << G4endl;
1058 // }
1059 // else if(command == halfzCmd)
1060 // {
1061 // CHECKPG(); fParticleGun->GetPosDist()->SetHalfZ(halfzCmd->GetNewDoubleValue(newValues));
1062 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1063 // << " The command is obsolete and will be removed soon." << G4endl
1064 // << " Please try to use the new structured commands!" << G4endl;
1065 // }
1066 // else if(command == radiusCmd)
1067 // {
1068 // CHECKPG(); fParticleGun->GetPosDist()->SetRadius(radiusCmd->GetNewDoubleValue(newValues));
1069 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1070 // << " The command is obsolete and will be removed soon." << G4endl
1071 // << " Please try to use the new structured commands!" << G4endl;
1072 // }
1073 // else if(command == radius0Cmd)
1074 // {
1075 // CHECKPG(); fParticleGun->GetPosDist()->SetRadius0(radius0Cmd->GetNewDoubleValue(newValues));
1076 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1077 // << " The command is obsolete and will be removed soon." << G4endl
1078 // << " Please try to use the new structured commands!" << G4endl;
1079 // }
1080 // else if(command == possigmarCmd)
1081 // {
1082 // CHECKPG(); fParticleGun->GetPosDist()->SetBeamSigmaInR(possigmarCmd->GetNewDoubleValue(newValues));
1083 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1084 // << " The command is obsolete and will be removed soon." << G4endl
1085 // << " Please try to use the new structured commands!" << G4endl;
1086 // }
1087 // else if(command == possigmaxCmd)
1088 // {
1089 // CHECKPG(); fParticleGun->GetPosDist()->SetBeamSigmaInX(possigmaxCmd->GetNewDoubleValue(newValues));
1090 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1091 // << " The command is obsolete and will be removed soon." << G4endl
1092 // << " Please try to use the new structured commands!" << G4endl;
1093 // }
1094 // else if(command == possigmayCmd)
1095 // {
1096 // CHECKPG(); fParticleGun->GetPosDist()->SetBeamSigmaInY(possigmayCmd->GetNewDoubleValue(newValues));
1097 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1098 // << " The command is obsolete and will be removed soon." << G4endl
1099 // << " Please try to use the new structured commands!" << G4endl;
1100 // }
1101 // else if(command == paralpCmd)
1102 // {
1103 // CHECKPG(); fParticleGun->GetPosDist()->SetParAlpha(paralpCmd->GetNewDoubleValue(newValues));
1104 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1105 // << " The command is obsolete and will be removed soon." << G4endl
1106 // << " Please try to use the new structured commands!" << G4endl;
1107 // }
1108 // else if(command == partheCmd)
1109 // {
1110 // CHECKPG(); fParticleGun->GetPosDist()->SetParTheta(partheCmd->GetNewDoubleValue(newValues));
1111 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1112 // << " The command is obsolete and will be removed soon." << G4endl
1113 // << " Please try to use the new structured commands!" << G4endl;
1114 // }
1115 // else if(command == parphiCmd)
1116 // {
1117 // CHECKPG(); fParticleGun->GetPosDist()->SetParPhi(parphiCmd->GetNewDoubleValue(newValues));
1118 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1119 // << " The command is obsolete and will be removed soon." << G4endl
1120 // << " Please try to use the new structured commands!" << G4endl;
1121 // }
1122 // else if(command == confineCmd)
1123 // {
1124 // CHECKPG(); fParticleGun->GetPosDist()->ConfineSourceToVolume(newValues);
1125 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1126 // << " The command is obsolete and will be removed soon." << G4endl
1127 // << " Please try to use the new structured commands!" << G4endl;
1128 // }
1129 // else if(command == angtypeCmd)
1130 // {
1131 // CHECKPG(); fParticleGun->GetAngDist()->SetAngDistType(newValues);
1132 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1133 // << " The command is obsolete and will be removed soon." << G4endl
1134 // << " Please try to use the new structured commands!" << G4endl;
1135 // }
1136 // else if(command == angrot1Cmd)
1137 // {
1138 // CHECKPG();
1139 // G4String a = "angref1";
1140 // fParticleGun->GetAngDist()->DefineAngRefAxes(a,angrot1Cmd->GetNew3VectorValue(newValues));
1141 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1142 // << " The command is obsolete and will be removed soon." << G4endl
1143 // << " Please try to use the new structured commands!" << G4endl;
1144 // }
1145 // else if(command == angrot2Cmd)
1146 // {
1147 // CHECKPG();
1148 // G4String a = "angref2";
1149 // fParticleGun->GetAngDist()->DefineAngRefAxes(a,angrot2Cmd->GetNew3VectorValue(newValues));
1150 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1151 // << " The command is obsolete and will be removed soon." << G4endl
1152 // << " Please try to use the new structured commands!" << G4endl;
1153 // }
1154 // else if(command == minthetaCmd)
1155 // {
1156 // CHECKPG(); fParticleGun->GetAngDist()->SetMinTheta(minthetaCmd->GetNewDoubleValue(newValues));
1157 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1158 // << " The command is obsolete and will be removed soon." << G4endl
1159 // << " Please try to use the new structured commands!" << G4endl;
1160 // }
1161 // else if(command == minphiCmd)
1162 // {
1163 // CHECKPG(); fParticleGun->GetAngDist()->SetMinPhi(minphiCmd->GetNewDoubleValue(newValues));
1164 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1165 // << " The command is obsolete and will be removed soon." << G4endl
1166 // << " Please try to use the new structured commands!" << G4endl;
1167 // }
1168 // else if(command == maxthetaCmd)
1169 // {
1170 // CHECKPG(); fParticleGun->GetAngDist()->SetMaxTheta(maxthetaCmd->GetNewDoubleValue(newValues));
1171 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1172 // << " The command is obsolete and will be removed soon." << G4endl
1173 // << " Please try to use the new structured commands!" << G4endl;
1174 // }
1175 // else if(command == maxphiCmd)
1176 // {
1177 // CHECKPG(); fParticleGun->GetAngDist()->SetMaxPhi(maxphiCmd->GetNewDoubleValue(newValues));
1178 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1179 // << " The command is obsolete and will be removed soon." << G4endl
1180 // << " Please try to use the new structured commands!" << G4endl;
1181 // }
1182 // else if(command == angsigmarCmd)
1183 // {
1184 // CHECKPG(); fParticleGun->GetAngDist()->SetBeamSigmaInAngR(angsigmarCmd->GetNewDoubleValue(newValues));
1185 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1186 // << " The command is obsolete and will be removed soon." << G4endl
1187 // << " Please try to use the new structured commands!" << G4endl;
1188 // }
1189 // else if(command == angsigmaxCmd)
1190 // {
1191 // CHECKPG(); fParticleGun->GetAngDist()->SetBeamSigmaInAngX(angsigmaxCmd->GetNewDoubleValue(newValues));
1192 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1193 // << " The command is obsolete and will be removed soon." << G4endl
1194 // << " Please try to use the new structured commands!" << G4endl;
1195 // }
1196 // else if(command == angsigmayCmd)
1197 // {
1198 // CHECKPG(); fParticleGun->GetAngDist()->SetBeamSigmaInAngY(angsigmayCmd->GetNewDoubleValue(newValues));
1199 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1200 // << " The command is obsolete and will be removed soon." << G4endl
1201 // << " Please try to use the new structured commands!" << G4endl;
1202 // }
1203 // else if(command == useuserangaxisCmd)
1204 // {
1205 // CHECKPG(); fParticleGun->GetAngDist()->SetUseUserAngAxis(useuserangaxisCmd->GetNewBoolValue(newValues));
1206 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1207 // << " The command is obsolete and will be removed soon." << G4endl
1208 // << " Please try to use the new structured commands!" << G4endl;
1209 // }
1210 // else if(command == surfnormCmd)
1211 // {
1212 // CHECKPG(); fParticleGun->GetAngDist()->SetUserWRTSurface(surfnormCmd->GetNewBoolValue(newValues));
1213 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1214 // << " The command is obsolete and will be removed soon." << G4endl
1215 // << " Please try to use the new structured commands!" << G4endl;
1216 // }
1217 // else if(command == energytypeCmd)
1218 // {
1219 // CHECKPG(); fParticleGun->GetEneDist()->SetEnergyDisType(newValues);
1220 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1221 // << " The command is obsolete and will be removed soon." << G4endl
1222 // << " Please try to use the new structured commands!" << G4endl;
1223 // }
1224 // else if(command == eminCmd)
1225 // {
1226 // CHECKPG(); fParticleGun->GetEneDist()->SetEmin(eminCmd->GetNewDoubleValue(newValues));
1227 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1228 // << " The command is obsolete and will be removed soon." << G4endl
1229 // << " Please try to use the new structured commands!" << G4endl;
1230 // }
1231 // else if(command == emaxCmd)
1232 // {
1233 // CHECKPG(); fParticleGun->GetEneDist()->SetEmax(emaxCmd->GetNewDoubleValue(newValues));
1234 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1235 // << " The command is obsolete and will be removed soon." << G4endl
1236 // << " Please try to use the new structured commands!" << G4endl;
1237 // }
1238 // else if(command == monoenergyCmd)
1239 // {
1240 // CHECKPG(); fParticleGun->GetEneDist()->SetMonoEnergy(monoenergyCmd->GetNewDoubleValue(newValues));
1241 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1242 // << " The command is obsolete and will be removed soon." << G4endl
1243 // << " Please try to use the new structured commands!" << G4endl;
1244 // }
1245 // else if(command == engsigmaCmd)
1246 // {
1247 // CHECKPG(); fParticleGun->GetEneDist()->SetBeamSigmaInE(engsigmaCmd->GetNewDoubleValue(newValues));
1248 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1249 // << " The command is obsolete and will be removed soon." << G4endl
1250 // << " Please try to use the new structured commands!" << G4endl;
1251 // }
1252 // else if(command == alphaCmd)
1253 // {
1254 // CHECKPG(); fParticleGun->GetEneDist()->SetAlpha(alphaCmd->GetNewDoubleValue(newValues));
1255 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1256 // << " The command is obsolete and will be removed soon." << G4endl
1257 // << " Please try to use the new structured commands!" << G4endl;
1258 // }
1259 // else if(command == tempCmd)
1260 // {
1261 // CHECKPG(); fParticleGun->GetEneDist()->SetTemp(tempCmd->GetNewDoubleValue(newValues));
1262 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1263 // << " The command is obsolete and will be removed soon." << G4endl
1264 // << " Please try to use the new structured commands!" << G4endl;
1265 // }
1266 // else if(command == ezeroCmd)
1267 // {
1268 // CHECKPG(); fParticleGun->GetEneDist()->SetEzero(ezeroCmd->GetNewDoubleValue(newValues));
1269 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1270 // << " The command is obsolete and will be removed soon." << G4endl
1271 // << " Please try to use the new structured commands!" << G4endl;
1272 // }
1273 // else if(command == gradientCmd)
1274 // {
1275 // CHECKPG(); fParticleGun->GetEneDist()->SetGradient(gradientCmd->GetNewDoubleValue(newValues));
1276 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1277 // << " The command is obsolete and will be removed soon." << G4endl
1278 // << " Please try to use the new structured commands!" << G4endl;
1279 // }
1280 // else if(command == interceptCmd)
1281 // {
1282 // CHECKPG(); fParticleGun->GetEneDist()->SetInterCept(interceptCmd->GetNewDoubleValue(newValues));
1283 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1284 // << " The command is obsolete and will be removed soon." << G4endl
1285 // << " Please try to use the new structured commands!" << G4endl;
1286 // }
1287 // else if(command == calculateCmd)
1288 // {
1289 // CHECKPG(); fParticleGun->GetEneDist()->Calculate();
1290 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1291 // << " The command is obsolete and will be removed soon." << G4endl
1292 // << " Please try to use the new structured commands!" << G4endl;
1293 // }
1294 // else if(command == energyspecCmd)
1295 // {
1296 // CHECKPG(); fParticleGun->GetEneDist()->InputEnergySpectra(energyspecCmd->GetNewBoolValue(newValues));
1297 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1298 // << " The command is obsolete and will be removed soon." << G4endl
1299 // << " Please try to use the new structured commands!" << G4endl;
1300 // }
1301 // else if(command == diffspecCmd)
1302 // {
1303 // CHECKPG(); fParticleGun->GetEneDist()->InputDifferentialSpectra(diffspecCmd->GetNewBoolValue(newValues));
1304 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1305 // << " The command is obsolete and will be removed soon." << G4endl
1306 // << " Please try to use the new structured commands!" << G4endl;
1307 // }
1308 // else if(command == histnameCmd)
1309 // {
1310 // histtype = newValues;
1311 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1312 // << " The command is obsolete and will be removed soon." << G4endl
1313 // << " Please try to use the new structured commands!" << G4endl;
1314 // }
1315 // else
1316 // if(command == histpointCmd)
1317 // {
1318 // CHECKPG();
1319 // if(histtype == "biasx")
1320 // fParticleGun->GetBiasRndm()->SetXBias(histpointCmd->GetNew3VectorValue(newValues));
1321 // if(histtype == "biasy")
1322 // fParticleGun->GetBiasRndm()->SetYBias(histpointCmd->GetNew3VectorValue(newValues));
1323 // if(histtype == "biasz")
1324 // fParticleGun->GetBiasRndm()->SetZBias(histpointCmd->GetNew3VectorValue(newValues));
1325 // if(histtype == "biast")
1326 // fParticleGun->GetBiasRndm()->SetThetaBias(histpointCmd->GetNew3VectorValue(newValues));
1327 // if(histtype == "biasp")
1328 // fParticleGun->GetBiasRndm()->SetPhiBias(histpointCmd->GetNew3VectorValue(newValues));
1329 // if(histtype == "biase")
1330 // fParticleGun->GetBiasRndm()->SetEnergyBias(histpointCmd->GetNew3VectorValue(newValues));
1331 // if(histtype == "theta")
1332 // fParticleGun->GetAngDist()->UserDefAngTheta(histpointCmd->GetNew3VectorValue(newValues));
1333 // if(histtype == "phi")
1334 // fParticleGun->GetAngDist()->UserDefAngPhi(histpointCmd->GetNew3VectorValue(newValues));
1335 // if(histtype == "energy")
1336 // fParticleGun->GetEneDist()->UserEnergyHisto(histpointCmd->GetNew3VectorValue(newValues));
1337 // if(histtype == "arb")
1338 // fParticleGun->GetEneDist()->ArbEnergyHisto(histpointCmd->GetNew3VectorValue(newValues));
1339 // if(histtype == "epn")
1340 // fParticleGun->GetEneDist()->EpnEnergyHisto(histpointCmd->GetNew3VectorValue(newValues));
1341 // G4cout << " G4GeneralParticleSourceMessenger - Warning: The command is obsolete and will be removed soon. Please try to use the new structured commands!" << G4endl;
1342 // }
1343 // else if(command == resethistCmd)
1344 // {
1345 // CHECKPG();
1346 // if(newValues == "theta" || newValues == "phi") {
1347 // fParticleGun->GetAngDist()->ReSetHist(newValues);
1348 // } else if (newValues == "energy" || newValues == "arb" || newValues == "epn") {
1349 // fParticleGun->GetEneDist()->ReSetHist(newValues);
1350 // } else {
1351 // fParticleGun->GetBiasRndm()->ReSetHist(newValues);
1352 // }
1353 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1354 // << " The command is obsolete and will be removed soon." << G4endl
1355 // << " Please try to use the new structured commands!" << G4endl;
1356 // }
1357 // else if(command == arbintCmd)
1358 // {
1359 // CHECKPG();
1360 // fParticleGun->GetEneDist()->ArbInterpolate(newValues);
1361 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1362 // << " The command is obsolete and will be removed soon." << G4endl
1363 // << " Please try to use the new structured commands!" << G4endl;
1364 // }
1365 // else
1366  if( command==directionCmd )
1367  {
1368  CHECKPG();
1369  fParticleGun->GetAngDist()->SetAngDistType("planar");
1370  fParticleGun->GetAngDist()->SetParticleMomentumDirection(directionCmd->GetNew3VectorValue(newValues));
1371  }
1372  else if( command==energyCmd )
1373  {
1374  CHECKPG();
1375  fParticleGun->GetEneDist()->SetEnergyDisType("Mono");
1376  fParticleGun->GetEneDist()->SetMonoEnergy(energyCmd->GetNewDoubleValue(newValues));
1377  }
1378  else if( command==positionCmd )
1379  {
1380  CHECKPG();
1381  fParticleGun->GetPosDist()->SetPosDisType("Point");
1382  fParticleGun->GetPosDist()->SetCentreCoords(positionCmd->GetNew3VectorValue(newValues));
1383  }
1384  else if(command == verbosityCmd)
1385  {
1386  fGPS->SetVerbosity(verbosityCmd->GetNewIntValue(newValues));
1387  //CHECKPG();
1388  //fParticleGun->SetVerbosity(verbosityCmd->GetNewIntValue(newValues));
1389  }
1390  else if( command==particleCmd )
1391  {
1392  if (newValues =="ion") {
1393  fShootIon = true;
1394  } else {
1395  fShootIon = false;
1396  G4ParticleDefinition* pd = particleTable->FindParticle(newValues);
1397  if(pd != NULL)
1398  { CHECKPG(); fParticleGun->SetParticleDefinition( pd ); }
1399  }
1400  }
1401  else if( command==timeCmd )
1402  { CHECKPG(); fParticleGun->SetParticleTime(timeCmd->GetNewDoubleValue(newValues)); }
1403  else if( command==polCmd )
1404  { CHECKPG(); fParticleGun->SetParticlePolarization(polCmd->GetNew3VectorValue(newValues)); }
1405  else if( command==numberCmd )
1406  { CHECKPG(); fParticleGun->SetNumberOfParticles(numberCmd->GetNewIntValue(newValues)); }
1407  else if( command==ionCmd )
1408  { IonCommand(newValues); }
1409  else if( command==ionLvlCmd )
1410  { IonLvlCommand(newValues); }
1411  else if( command==listCmd ){
1412  particleTable->DumpTable();
1413  }
1414  else if( command==addsourceCmd )
1415  {
1416  fGPS->AddaSource(addsourceCmd->GetNewDoubleValue(newValues));
1417  }
1418  else if( command==listsourceCmd )
1419  {
1420  fGPS->ListSource();
1421  }
1422  else if( command==clearsourceCmd )
1423  {
1424  fGPS->ClearAll();
1425  fParticleGun = 0;
1426  }
1427  else if( command==getsourceCmd )
1428  {
1429  G4cout << " Current source index:" << fGPS->GetCurrentSourceIndex()
1430  << " ; Intensity:" << fGPS->GetCurrentSourceIntensity() << G4endl;
1431  }
1432  else if( command==setsourceCmd )
1433  {
1434  //NOTE: This will also sets fParticleGun to the courrent source
1435  // Not very clean, the GPS::SetCurrentSourceto will call:
1436  // this::SetParticleSource( G4ParticleSource* )
1437  // The point is that GPS has no public API to get a source by
1438  // index
1439  //TODO: Can we add this API?
1440  const G4int sn = setsourceCmd->GetNewIntValue(newValues);
1441  if ( sn >= fGPS->GetNumberofSource() )
1442  {
1444  msg << "Using command "<<setsourceCmd->GetCommandPath()<<"/"<<setsourceCmd->GetCommandName()<<" "<<sn;
1445  msg << " is invalid "<<fGPS->GetNumberofSource()<<" source(s) are defined.";
1446  G4Exception("G4GeneralParticleSourceMessenger::SetNewValue","G4GPS005",FatalException,msg);
1447  }
1448  fGPS->SetCurrentSourceto(setsourceCmd->GetNewIntValue(newValues));
1449 
1450  }
1451  else if( command==setintensityCmd )
1452  {
1453  fGPS->SetCurrentSourceIntensity(setintensityCmd->GetNewDoubleValue(newValues));
1454  }
1455  else if( command==deletesourceCmd )
1456  {
1457  fGPS->DeleteaSource(deletesourceCmd->GetNewIntValue(newValues));
1458  }
1459  else if(command == multiplevertexCmd)
1460  {
1461  fGPS->SetMultipleVertex(multiplevertexCmd->GetNewBoolValue(newValues));
1462  }
1463  else if(command == flatsamplingCmd)
1464  {
1465  fGPS->SetFlatSampling(flatsamplingCmd->GetNewBoolValue(newValues));
1466  }
1467  //
1468  // new implementations
1469  //
1470  //
1471  else if(command == typeCmd1)
1472  {
1473  CHECKPG();
1474  fParticleGun->GetPosDist()->SetPosDisType(newValues);
1475  }
1476  else if(command == shapeCmd1)
1477  {
1478  CHECKPG();
1479  fParticleGun->GetPosDist()->SetPosDisShape(newValues);
1480  }
1481  else if(command == centreCmd1)
1482  {
1483  CHECKPG();
1484  fParticleGun->GetPosDist()->SetCentreCoords(centreCmd1->GetNew3VectorValue(newValues));
1485  }
1486  else if(command == posrot1Cmd1)
1487  {
1488  CHECKPG();
1489  fParticleGun->GetPosDist()->SetPosRot1(posrot1Cmd1->GetNew3VectorValue(newValues));
1490  }
1491  else if(command == posrot2Cmd1)
1492  {
1493  CHECKPG();
1494  fParticleGun->GetPosDist()->SetPosRot2(posrot2Cmd1->GetNew3VectorValue(newValues));
1495  }
1496  else if(command == halfxCmd1)
1497  {
1498  CHECKPG();
1499  fParticleGun->GetPosDist()->SetHalfX(halfxCmd1->GetNewDoubleValue(newValues));
1500  }
1501  else if(command == halfyCmd1)
1502  {
1503  CHECKPG();
1504  fParticleGun->GetPosDist()->SetHalfY(halfyCmd1->GetNewDoubleValue(newValues));
1505  }
1506  else if(command == halfzCmd1)
1507  {
1508  CHECKPG();
1509  fParticleGun->GetPosDist()->SetHalfZ(halfzCmd1->GetNewDoubleValue(newValues));
1510  }
1511  else if(command == radiusCmd1)
1512  {
1513  CHECKPG();
1514  fParticleGun->GetPosDist()->SetRadius(radiusCmd1->GetNewDoubleValue(newValues));
1515  }
1516  else if(command == radius0Cmd1)
1517  {
1518  CHECKPG();
1519  fParticleGun->GetPosDist()->SetRadius0(radius0Cmd1->GetNewDoubleValue(newValues));
1520  }
1521  else if(command == possigmarCmd1)
1522  {
1523  CHECKPG();
1524  fParticleGun->GetPosDist()->SetBeamSigmaInR(possigmarCmd1->GetNewDoubleValue(newValues));
1525  }
1526  else if(command == possigmaxCmd1)
1527  {
1528  CHECKPG(); fParticleGun->GetPosDist()->SetBeamSigmaInX(possigmaxCmd1->GetNewDoubleValue(newValues));
1529  }
1530  else if(command == possigmayCmd1)
1531  {
1532  CHECKPG(); fParticleGun->GetPosDist()->SetBeamSigmaInY(possigmayCmd1->GetNewDoubleValue(newValues));
1533  }
1534  else if(command == paralpCmd1)
1535  {
1536  CHECKPG(); fParticleGun->GetPosDist()->SetParAlpha(paralpCmd1->GetNewDoubleValue(newValues));
1537  }
1538  else if(command == partheCmd1)
1539  {
1540  CHECKPG(); fParticleGun->GetPosDist()->SetParTheta(partheCmd1->GetNewDoubleValue(newValues));
1541  }
1542  else if(command == parphiCmd1)
1543  {
1544  CHECKPG(); fParticleGun->GetPosDist()->SetParPhi(parphiCmd1->GetNewDoubleValue(newValues));
1545  }
1546  else if(command == confineCmd1)
1547  {
1548  CHECKPG(); fParticleGun->GetPosDist()->ConfineSourceToVolume(newValues);
1549  }
1550  else if(command == angtypeCmd1)
1551  {
1552  CHECKPG(); fParticleGun->GetAngDist()->SetAngDistType(newValues);
1553  }
1554  else if(command == angrot1Cmd1)
1555  {
1556  CHECKPG();
1557  G4String a = "angref1";
1558  fParticleGun->GetAngDist()->DefineAngRefAxes(a,angrot1Cmd1->GetNew3VectorValue(newValues));
1559  }
1560  else if(command == angrot2Cmd1)
1561  {
1562  CHECKPG();
1563  G4String a = "angref2";
1564  fParticleGun->GetAngDist()->DefineAngRefAxes(a,angrot2Cmd1->GetNew3VectorValue(newValues));
1565  }
1566  else if(command == minthetaCmd1)
1567  {
1568  CHECKPG();
1569  fParticleGun->GetAngDist()->SetMinTheta(minthetaCmd1->GetNewDoubleValue(newValues));
1570  }
1571  else if(command == minphiCmd1)
1572  {
1573  CHECKPG(); fParticleGun->GetAngDist()->SetMinPhi(minphiCmd1->GetNewDoubleValue(newValues));
1574  }
1575  else if(command == maxthetaCmd1)
1576  {
1577  CHECKPG(); fParticleGun->GetAngDist()->SetMaxTheta(maxthetaCmd1->GetNewDoubleValue(newValues));
1578  }
1579  else if(command == maxphiCmd1)
1580  {
1581  CHECKPG(); fParticleGun->GetAngDist()->SetMaxPhi(maxphiCmd1->GetNewDoubleValue(newValues));
1582  }
1583  else if(command == angsigmarCmd1)
1584  {
1585  CHECKPG(); fParticleGun->GetAngDist()->SetBeamSigmaInAngR(angsigmarCmd1->GetNewDoubleValue(newValues));
1586  }
1587  else if(command == angsigmaxCmd1)
1588  {
1589  CHECKPG(); fParticleGun->GetAngDist()->SetBeamSigmaInAngX(angsigmaxCmd1->GetNewDoubleValue(newValues));
1590  }
1591  else if(command == angsigmayCmd1)
1592  {
1593  CHECKPG(); fParticleGun->GetAngDist()->SetBeamSigmaInAngY(angsigmayCmd1->GetNewDoubleValue(newValues));
1594  }
1595  else if(command == angfocusCmd)
1596  {
1597  CHECKPG(); fParticleGun->GetAngDist()->SetFocusPoint(angfocusCmd->GetNew3VectorValue(newValues));
1598  }
1599  else if(command == useuserangaxisCmd1)
1600  {
1601  CHECKPG(); fParticleGun->GetAngDist()->SetUseUserAngAxis(useuserangaxisCmd1->GetNewBoolValue(newValues));
1602  }
1603  else if(command == surfnormCmd1)
1604  {
1605  CHECKPG(); fParticleGun->GetAngDist()->SetUserWRTSurface(surfnormCmd1->GetNewBoolValue(newValues));
1606  }
1607  else if(command == energytypeCmd1)
1608  {
1609  CHECKPG(); fParticleGun->GetEneDist()->SetEnergyDisType(newValues);
1610  }
1611  else if(command == eminCmd1)
1612  {
1613  CHECKPG(); fParticleGun->GetEneDist()->SetEmin(eminCmd1->GetNewDoubleValue(newValues));
1614  }
1615  else if(command == emaxCmd1)
1616  {
1617  CHECKPG(); fParticleGun->GetEneDist()->SetEmax(emaxCmd1->GetNewDoubleValue(newValues));
1618  }
1619  else if(command == monoenergyCmd1)
1620  {
1621  CHECKPG(); fParticleGun->GetEneDist()->SetMonoEnergy(monoenergyCmd1->GetNewDoubleValue(newValues));
1622  }
1623  else if(command == engsigmaCmd1)
1624  {
1625  CHECKPG(); fParticleGun->GetEneDist()->SetBeamSigmaInE(engsigmaCmd1->GetNewDoubleValue(newValues));
1626  }
1627  else if(command == alphaCmd1)
1628  {
1629  CHECKPG(); fParticleGun->GetEneDist()->SetAlpha(alphaCmd1->GetNewDoubleValue(newValues));
1630  }
1631  else if(command == tempCmd1)
1632  {
1633  CHECKPG(); fParticleGun->GetEneDist()->SetTemp(tempCmd1->GetNewDoubleValue(newValues));
1634  }
1635  else if(command == ezeroCmd1)
1636  {
1637  CHECKPG(); fParticleGun->GetEneDist()->SetEzero(ezeroCmd1->GetNewDoubleValue(newValues));
1638  }
1639  else if(command == gradientCmd1)
1640  {
1641  CHECKPG(); fParticleGun->GetEneDist()->SetGradient(gradientCmd1->GetNewDoubleValue(newValues));
1642  }
1643  else if(command == interceptCmd1)
1644  {
1645  CHECKPG(); fParticleGun->GetEneDist()->SetInterCept(interceptCmd1->GetNewDoubleValue(newValues));
1646  }
1647  else if(command == arbeintCmd1)
1648  {
1649  CHECKPG(); fParticleGun->GetEneDist()->SetBiasAlpha(arbeintCmd1->GetNewDoubleValue(newValues));
1650  }
1651  else if(command == calculateCmd1)
1652  {
1653  CHECKPG(); fParticleGun->GetEneDist()->Calculate();
1654  }
1655  else if(command == energyspecCmd1)
1656  {
1657  CHECKPG(); fParticleGun->GetEneDist()->InputEnergySpectra(energyspecCmd1->GetNewBoolValue(newValues));
1658  }
1659  else if(command == diffspecCmd1)
1660  {
1661  CHECKPG(); fParticleGun->GetEneDist()->InputDifferentialSpectra(diffspecCmd1->GetNewBoolValue(newValues));
1662  }
1663  else if(command == histnameCmd1)
1664  {
1665  histtype = newValues;
1666  }
1667  else if(command == histfileCmd1)
1668  {
1669  histtype = "arb";
1670  CHECKPG(); fParticleGun->GetEneDist()->ArbEnergyHistoFile(newValues);
1671  }
1672  else if(command == histpointCmd1)
1673  {
1674  CHECKPG();
1675  if(histtype == "biasx")
1676  fParticleGun->GetBiasRndm()->SetXBias(histpointCmd1->GetNew3VectorValue(newValues));
1677  if(histtype == "biasy")
1678  fParticleGun->GetBiasRndm()->SetYBias(histpointCmd1->GetNew3VectorValue(newValues));
1679  if(histtype == "biasz")
1680  fParticleGun->GetBiasRndm()->SetZBias(histpointCmd1->GetNew3VectorValue(newValues));
1681  if(histtype == "biast")
1682  fParticleGun->GetBiasRndm()->SetThetaBias(histpointCmd1->GetNew3VectorValue(newValues));
1683  if(histtype == "biasp")
1684  fParticleGun->GetBiasRndm()->SetPhiBias(histpointCmd1->GetNew3VectorValue(newValues));
1685  if(histtype == "biaspt")
1686  fParticleGun->GetBiasRndm()->SetPosThetaBias(histpointCmd1->GetNew3VectorValue(newValues));
1687  if(histtype == "biaspp")
1688  fParticleGun->GetBiasRndm()->SetPosPhiBias(histpointCmd1->GetNew3VectorValue(newValues));
1689  if(histtype == "biase")
1690  fParticleGun->GetBiasRndm()->SetEnergyBias(histpointCmd1->GetNew3VectorValue(newValues));
1691  if(histtype == "theta")
1692  fParticleGun->GetAngDist()->UserDefAngTheta(histpointCmd1->GetNew3VectorValue(newValues));
1693  if(histtype == "phi")
1694  fParticleGun->GetAngDist()->UserDefAngPhi(histpointCmd1->GetNew3VectorValue(newValues));
1695  if(histtype == "energy")
1696  fParticleGun->GetEneDist()->UserEnergyHisto(histpointCmd1->GetNew3VectorValue(newValues));
1697  if(histtype == "arb")
1698  fParticleGun->GetEneDist()->ArbEnergyHisto(histpointCmd1->GetNew3VectorValue(newValues));
1699  if(histtype == "epn")
1700  fParticleGun->GetEneDist()->EpnEnergyHisto(histpointCmd1->GetNew3VectorValue(newValues));
1701  }
1702  else if(command == resethistCmd1)
1703  {
1704  CHECKPG();
1705  if(newValues == "theta" || newValues == "phi") {
1706  fParticleGun->GetAngDist()->ReSetHist(newValues);
1707  } else if (newValues == "energy" || newValues == "arb" || newValues == "epn") {
1708  fParticleGun->GetEneDist()->ReSetHist(newValues);
1709  } else {
1710  fParticleGun->GetBiasRndm()->ReSetHist(newValues);
1711  }
1712  }
1713  else if(command == arbintCmd1)
1714  {
1715  CHECKPG(); fParticleGun->GetEneDist()->ArbInterpolate(newValues);
1716  }
1717  else
1718  {
1719  G4cout << "Error entering command" << G4endl;
1720  }
1721 }
G4SPSAngDistribution * GetAngDist() const
G4SPSEneDistribution * GetEneDist() const
void SetParticleTime(G4double aTime)
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
G4SPSPosDistribution * GetPosDist() const
void DumpTable(const G4String &particle_name="ALL")
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
void ArbEnergyHisto(G4ThreeVector)
static G4int GetNewIntValue(const char *paramString)
void SetBeamSigmaInAngR(G4double)
static G4ThreeVector GetNew3VectorValue(const char *paramString)
void SetBeamSigmaInAngY(G4double)
void SetEnergyBias(G4ThreeVector)
void SetYBias(G4ThreeVector)
static G4double GetNewDoubleValue(const char *paramString)
int G4int
Definition: G4Types.hh:78
void SetPosThetaBias(G4ThreeVector)
static G4bool GetNewBoolValue(const char *paramString)
void SetThetaBias(G4ThreeVector)
void SetZBias(G4ThreeVector)
void SetXBias(G4ThreeVector)
void UserDefAngPhi(G4ThreeVector)
void UserDefAngTheta(G4ThreeVector)
G4GLOB_DLL std::ostream G4cout
void SetCentreCoords(G4ThreeVector)
static G4ThreeVector GetNew3VectorValue(const char *paramString)
G4SPSRandomGenerator * GetBiasRndm() const
static G4double GetNewDoubleValue(const char *paramString)
void DefineAngRefAxes(G4String, G4ThreeVector)
void SetParticlePolarization(G4ThreeVector aVal)
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)
void SetPosRot1(G4ThreeVector)
const G4String & GetCommandPath() const
Definition: G4UIcommand.hh:139
G4double GetCurrentSourceIntensity() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
void EpnEnergyHisto(G4ThreeVector)
const G4String & GetCommandName() const
Definition: G4UIcommand.hh:141
void SetPhiBias(G4ThreeVector)
void UserEnergyHisto(G4ThreeVector)
void SetPosRot2(G4ThreeVector)
void InputDifferentialSpectra(G4bool)
void SetFocusPoint(G4ThreeVector)
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
#define G4endl
Definition: G4ios.hh:61
void ArbEnergyHistoFile(G4String)
void ConfineSourceToVolume(G4String)
void SetPosPhiBias(G4ThreeVector)
void SetBeamSigmaInAngX(G4double)
void G4GeneralParticleSourceMessenger::SetParticleGun ( G4SingleParticleSource fpg)
inline

Definition at line 134 of file G4GeneralParticleSourceMessenger.hh.

134 { fParticleGun = fpg; } ;

Here is the caller graph for this function:


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