13#include "G4UIdirectory.hh"
14#include "G4UIcommand.hh"
15#include "G4ParticleTable.hh"
16#include "G4UIcmdWithAString.hh"
24 particleTable = G4ParticleTable::GetParticleTable();
26 generatorDirectory =
new G4UIdirectory(
"/generator/");
27 generatorDirectory->SetGuidance(
"BESIII event gnerator");
29 gennamCmd =
new G4UIcmdWithAString(
"/generator/name",
this);
30 gennamCmd->SetGuidance(
"Select your event gerator: genbes or tester");
31 gennamCmd->SetGuidance(
"The default generator is tester");
32 gennamCmd->SetParameterName(
"name",
true);
33 gennamCmd->SetDefaultValue(
"tester");
34 gennamCmd->SetCandidates(
"tester cosmic genbes");
36 genbesCmd =
new G4UIcmdWithAString(
"/generator/genbes",
this);
37 genbesCmd->SetGuidance(
"The BES data file");
38 genbesCmd->SetGuidance(
"directory/filename");
39 genbesCmd->SetParameterName(
"name",
false);
41 testerCmd =
new G4UIcommand(
"/generator/tester",
this);
42 testerCmd->SetGuidance(
"The BES TESTER generator");
43 testerCmd->SetGuidance(
"NP PID Cosmin Cosmax phimin phimax p delp");
45 cosmicCmd =
new G4UIcommand(
"/generator/cosmic",
this);
46 cosmicCmd->SetGuidance(
"The cosmic generator");
47 cosmicCmd->SetGuidance(
"PID x y z");
49 parameter =
new G4UIparameter(
"np",
'i',omittable =
true);
50 parameter->SetGuidance(
"Number of particles in an event");
55 parameter =
new G4UIparameter(
"pname",
's',omittable =
true);
56 parameter->SetGuidance(
"Particle name in Geant4");
58 G4String candidatelist;
59 G4int nPtable = particleTable->entries();
60 for(G4int i=0;i<nPtable;i++)
62 candidatelist += particleTable->GetParticleName(i);
65 parameter->SetParameterCandidates(candidatelist);
68 parameter =
new G4UIparameter(
"cosmin",
'd',omittable =
true);
69 parameter->SetGuidance(
"Minimum cos(theta)");
70 parameter->SetParameterRange(
"cosmin >= -1. && cosmin <= 1.");
74 parameter =
new G4UIparameter(
"cosmax",
'd',omittable =
true);
75 parameter->SetGuidance(
"Maximum cos(theta)");
76 parameter->SetParameterRange(
"cosmax >= -1. && cosmax <= 1.");
80 parameter =
new G4UIparameter(
"phimin",
'd',omittable =
true);
81 parameter->SetGuidance(
"Minimum azimuthal angle in degree");
82 parameter->SetParameterRange(
"phimin >= 0. && phimin <= 360.");
86 parameter =
new G4UIparameter(
"phimax",
'd',omittable =
true);
87 parameter->SetGuidance(
"Maximum azimuthal angle in degree");
88 parameter->SetParameterRange(
"phimax >= 0. && phimax <= 360.");
92 parameter =
new G4UIparameter(
"pp",
'd',omittable =
true);
93 parameter->SetGuidance(
"Particle Momentum in GeV");
98 parameter =
new G4UIparameter(
"dp",
'd',omittable =
true);
99 parameter->SetGuidance(
"Particle Momentum range in GeV");
104 parameter =
new G4UIparameter(
"x",
'd',omittable =
true);
105 parameter->SetGuidance(
"Particle x position");
106 parameter->SetParameterRange(
"x >= -10000 && x <= 10000");
110 parameter =
new G4UIparameter(
"y",
'd',omittable =
true);
111 parameter->SetGuidance(
"Particle y position");
112 parameter->SetParameterRange(
"y >= -10000 && y <= 10000");
116 parameter =
new G4UIparameter(
"z",
'd',omittable =
true);
117 parameter->SetGuidance(
"Particle z position");
118 parameter->SetParameterRange(
"z >= -10000 && z <= 10000");
122 parameter =
new G4UIparameter(
"pname",
's',omittable =
true);
123 parameter->SetGuidance(
"Particle name in Geant4");
127 parameter =
new G4UIparameter(
"x",
'd',omittable =
true);
128 parameter->SetGuidance(
"Particle x position");
129 parameter->SetParameterRange(
"x >= -10000 && x <= 10000");
133 parameter =
new G4UIparameter(
"y",
'd',omittable =
true);
134 parameter->SetGuidance(
"Particle y position");
135 parameter->SetParameterRange(
"y >= -10000 && y <= 10000");
139 parameter =
new G4UIparameter(
"z",
'd',omittable =
true);
140 parameter->SetGuidance(
"Particle z position");
141 parameter->SetParameterRange(
"z >= -10000 && z <= 10000");
149 delete generatorDirectory;
158 if( command == gennamCmd )
160 else if( command == genbesCmd )
162 else if( command == testerCmd )
165 G4double cosmin1,cosmax1,phimin1,phimax1,pp1,dp1,
x,
y,z;
166 std::istringstream is ((
char*)newValue.data());
167 is >> np1 >> pname1 >> cosmin1 >> cosmax1
168 >> phimin1 >> phimax1 >> pp1 >> dp1 >>
x >>
y >> z;
182 else if( command == cosmicCmd )
186 std::istringstream is ((
char*)newValue.data());
187 is >> pname >>
x >>
y >> z;
198 if( command == gennamCmd )
200 else if ( command == genbesCmd )
double precision pisqo6 parameter(pi=3.14159265358979d0, pisq=pi *pi, pisqo6=pisq/6d0) double precision zip
void SetMinCos(G4double min1)
G4String GetGeneratorName()
void SetGeneratorName(G4String genNew)
void SetDeltaP(G4double dp)
void SetGenbesName(G4String genbesNew)
void SetMomentum(G4double pm)
void SetMaxCos(G4double max1)
void SetParticleName(G4String pname)
void SetPhiEnd(G4double pe)
void SetPhiStart(G4double ps)
void SetNParticle(G4int np)
G4String GetCurrentValue(G4UIcommand *command)
~BesPrimaryGeneratorMessenger()
void SetNewValue(G4UIcommand *command, G4String newValues)
BesPrimaryGeneratorMessenger(BesPrimaryGeneratorAction *mpga)