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");
158 if( command == gennamCmd )
159 { myAction->SetGeneratorName(newValue); }
160 else if( command == genbesCmd )
161 { myAction->SetGenbesName(newValue); }
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;
170 myAction->SetNParticle(np1);
171 myAction->SetParticleName(pname1);
172 myAction->SetMinCos(cosmin1);
173 myAction->SetMaxCos(cosmax1);
174 myAction->SetPhiStart(phimin1);
175 myAction->SetPhiEnd(phimax1);
176 myAction->SetMomentum(pp1);
177 myAction->SetDeltaP(dp1);
178 myAction->SetPosX(x);
179 myAction->SetPosY(
y);
180 myAction->SetPosZ(z);
182 else if( command == cosmicCmd )
186 std::istringstream is ((
char*)newValue.data());
187 is >> pname >> x >>
y >> z;
188 myAction->SetParticleName(pname);
189 myAction->SetPosX(x);
190 myAction->SetPosY(
y);
191 myAction->SetPosZ(z);