BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
BesPrimaryGeneratorMessenger.cc
Go to the documentation of this file.
1//---------------------------------------------------------------------------//
2// BOOST --- BESIII Object_Oriented Simulation Tool //
3//---------------------------------------------------------------------------//
4//Description: passing parameters to Generator TESTER and GENBES
5//Author: Liuhm
6//Created: Jun. 5, 2003
7//Modified:
8//Comment:
9//---------------------------------------------------------------------------//
10
13#include "G4UIdirectory.hh"
14#include "G4UIcommand.hh"
15#include "G4ParticleTable.hh"
16#include "G4UIcmdWithAString.hh"
17#include "G4ios.hh"
18
20:myAction(mpga)
21{
22 G4UIparameter* parameter;
23 G4bool omittable;
24 particleTable = G4ParticleTable::GetParticleTable();
25
26 generatorDirectory = new G4UIdirectory("/generator/");
27 generatorDirectory->SetGuidance("BESIII event gnerator");
28
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");
35
36 genbesCmd = new G4UIcmdWithAString("/generator/genbes",this);
37 genbesCmd->SetGuidance("The BES data file");
38 genbesCmd->SetGuidance("directory/filename");
39 genbesCmd->SetParameterName("name",false);
40
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");
44
45 cosmicCmd = new G4UIcommand("/generator/cosmic",this);
46 cosmicCmd->SetGuidance("The cosmic generator");
47 cosmicCmd->SetGuidance("PID x y z");
48
49 parameter = new G4UIparameter("np",'i',omittable = true);
50 parameter->SetGuidance("Number of particles in an event");
51 parameter->SetParameterRange("np > 0");
52 parameter->SetDefaultValue(1);
53 testerCmd->SetParameter(parameter);
54
55 parameter = new G4UIparameter("pname",'s',omittable = true);
56 parameter->SetGuidance("Particle name in Geant4");
57 parameter->SetDefaultValue("pi-");
58 G4String candidatelist;
59 G4int nPtable = particleTable->entries();
60 for(G4int i=0;i<nPtable;i++)
61 {
62 candidatelist += particleTable->GetParticleName(i);
63 candidatelist += " ";
64 }
65 parameter->SetParameterCandidates(candidatelist);
66 testerCmd->SetParameter(parameter);
67
68 parameter = new G4UIparameter("cosmin",'d',omittable = true);
69 parameter->SetGuidance("Minimum cos(theta)");
70 parameter->SetParameterRange("cosmin >= -1. && cosmin <= 1.");
71 parameter->SetDefaultValue(-0.8);
72 testerCmd->SetParameter(parameter);
73
74 parameter = new G4UIparameter("cosmax",'d',omittable = true);
75 parameter->SetGuidance("Maximum cos(theta)");
76 parameter->SetParameterRange("cosmax >= -1. && cosmax <= 1.");
77 parameter->SetDefaultValue(0.8);
78 testerCmd->SetParameter(parameter);
79
80 parameter = new G4UIparameter("phimin",'d',omittable = true);
81 parameter->SetGuidance("Minimum azimuthal angle in degree");
82 parameter->SetParameterRange("phimin >= 0. && phimin <= 360.");
83 parameter->SetDefaultValue(0.);
84 testerCmd->SetParameter(parameter);
85
86 parameter = new G4UIparameter("phimax",'d',omittable = true);
87 parameter->SetGuidance("Maximum azimuthal angle in degree");
88 parameter->SetParameterRange("phimax >= 0. && phimax <= 360.");
89 parameter->SetDefaultValue(360.);
90 testerCmd->SetParameter(parameter);
91
92 parameter = new G4UIparameter("pp",'d',omittable = true);
93 parameter->SetGuidance("Particle Momentum in GeV");
94 parameter->SetParameterRange("pp>=0.");
95 parameter->SetDefaultValue(1.0);
96 testerCmd->SetParameter(parameter);
97
98 parameter = new G4UIparameter("dp",'d',omittable = true);
99 parameter->SetGuidance("Particle Momentum range in GeV");
100 parameter->SetParameterRange("dp>=0.");
101 parameter->SetDefaultValue(0.0);
102 testerCmd->SetParameter(parameter);
103
104 parameter = new G4UIparameter("x",'d',omittable = true);
105 parameter->SetGuidance("Particle x position");
106 parameter->SetParameterRange("x >= -10000 && x <= 10000");
107 parameter->SetDefaultValue(0.);
108 testerCmd->SetParameter(parameter);
109
110 parameter = new G4UIparameter("y",'d',omittable = true);
111 parameter->SetGuidance("Particle y position");
112 parameter->SetParameterRange("y >= -10000 && y <= 10000");
113 parameter->SetDefaultValue(0.);
114 testerCmd->SetParameter(parameter);
115
116 parameter = new G4UIparameter("z",'d',omittable = true);
117 parameter->SetGuidance("Particle z position");
118 parameter->SetParameterRange("z >= -10000 && z <= 10000");
119 parameter->SetDefaultValue(0.);
120 testerCmd->SetParameter(parameter);
121
122 parameter = new G4UIparameter("pname",'s',omittable = true);
123 parameter->SetGuidance("Particle name in Geant4");
124 parameter->SetDefaultValue("mu-");
125 cosmicCmd->SetParameter(parameter);
126
127 parameter = new G4UIparameter("x",'d',omittable = true);
128 parameter->SetGuidance("Particle x position");
129 parameter->SetParameterRange("x >= -10000 && x <= 10000");
130 parameter->SetDefaultValue(0.);
131 cosmicCmd->SetParameter(parameter);
132
133 parameter = new G4UIparameter("y",'d',omittable = true);
134 parameter->SetGuidance("Particle y position");
135 parameter->SetParameterRange("y >= -10000 && y <= 10000");
136 parameter->SetDefaultValue(0.);
137 cosmicCmd->SetParameter(parameter);
138
139 parameter = new G4UIparameter("z",'d',omittable = true);
140 parameter->SetGuidance("Particle z position");
141 parameter->SetParameterRange("z >= -10000 && z <= 10000");
142 parameter->SetDefaultValue(0.);
143 cosmicCmd->SetParameter(parameter);
144
145}
146
148{
149 delete generatorDirectory;
150 delete gennamCmd;
151 delete genbesCmd;
152 delete testerCmd;
153 delete cosmicCmd;
154}
155
156void BesPrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
157{
158 if( command == gennamCmd )
159 { myAction->SetGeneratorName(newValue); }
160 else if( command == genbesCmd )
161 { myAction->SetGenbesName(newValue); }
162 else if( command == testerCmd )
163 { G4int np1;
164 G4String pname1;
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;
169
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);
181 }
182 else if( command == cosmicCmd )
183 {
184 G4String pname;
185 G4double x,y,z;
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);
192 }
193}
194
196{
197 G4String cv;
198 if( command == gennamCmd )
199 {cv = myAction->GetGeneratorName() ;}
200 else if ( command == genbesCmd )
201 { cv = myAction->GetGenbesName();}
202 return cv;
203}
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
Double_t x[10]
void SetGeneratorName(G4String genNew)
void SetGenbesName(G4String genbesNew)
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValues)
BesPrimaryGeneratorMessenger(BesPrimaryGeneratorAction *mpga)