28 #include <G4UIdirectory.hh> 29 #include <G4UIcmdWithoutParameter.hh> 30 #include <G4UIcmdWithADoubleAndUnit.hh> 31 #include <G4UIcmdWith3VectorAndUnit.hh> 32 #include <G4UIcmdWith3Vector.hh> 33 #include <G4UIcmdWithABool.hh> 34 #include <G4UIcmdWithAString.hh> 35 #include <G4UIcmdWithAnInteger.hh> 36 #include <G4UIcommand.hh> 48 fDir =
new G4UIdirectory(
"/generator/");
49 fDir->SetGuidance(
"Control of the particle generator.");
51 fCountDir =
new G4UIdirectory(
"/generator/count/");
52 fCountDir->SetGuidance(
"Control number of primary vertices per event.");
57 fPositionDir =
new G4UIdirectory(
"/generator/position/");
58 fPositionDir->SetGuidance(
"Control vertex position the generators.");
60 fTimeDir =
new G4UIdirectory(
"/generator/time/");
61 fTimeDir->SetGuidance(
"Control vertex time the generators.");
87 fClearCMD =
new G4UIcmdWithoutParameter(
"/generator/clear",
this);
88 fClearCMD->SetGuidance(
"Clear the current list of vertex generators.");
90 fAddCMD =
new G4UIcmdWithoutParameter(
"/generator/add",
this);
91 fAddCMD->SetGuidance(
"Add a generator using the current factories.");
93 fCombineCMD =
new G4UIcommand(
"/generator/combine",
this);
94 fCombineCMD->SetGuidance(
"Combine the previous two vertices into one.");
95 fCombineCMD->SetParameter(
new G4UIparameter(
"src",
'i',
false));
96 fCombineCMD->SetParameter(
new G4UIparameter(
"dest",
'i',
false));
97 fCombineCMD->SetParameter(
new G4UIparameter(
"relative",
'b',
true));
98 fCombineCMD->GetParameter(2)->SetDefaultValue(
"false");
101 =
new G4UIcmdWithAString(
"/generator/kinematics/set",
this);
107 =
new G4UIcmdWithAString(
"/generator/count/set",
this);
108 fSetCountCMD->SetGuidance(
"Set the current count factory.");
113 =
new G4UIcmdWithAString(
"/generator/position/set",
this);
119 =
new G4UIcmdWithAString(
"/generator/time/set",
this);
120 fSetTimeCMD->SetGuidance(
"Set the current time factory.");
125 =
new G4UIcmdWithABool(
"/generator/allowEmptyEvents",
this);
127 " if they don't contain a vertex.");
130 =
new G4UIcmdWithABool(
"/generator/addFakeGeantino",
this);
132 " by adding a geantino.");
135 =
new G4UIcmdWithABool(
"/generator/allowPartialEvents",
this);
137 " even if it ran out of interactions" 138 " in the input kinematics file.");
179 std::istringstream is(newValue);
180 is >> src >> dest >> relative;
183 src,dest,G4UIcommand::ConvertToBool(relative.c_str()));
211 EDepSimThrow(
"EDepSim::UserPrimaryGeneratorMessenger:: " 212 "Unimplemented command");
224 EDepSimLog(
"#############################################");
225 EDepSimLog(
"# Create a new EDepSim_PrimaryGenerator: " 227 EDepSimLog(
"#############################################");
232 return fDir->GetCommandPath();
241 const G4String&
name) {
259 list = list +
p->first +
" ";
270 const G4String&
name) {
288 list = list +
p->first +
" ";
299 const G4String&
name) {
317 list = list +
p->first +
" ";
328 const G4String&
name) {
346 list = list +
p->first +
" ";
#define EDepSimLog(outStream)
G4UIcmdWithABool * fAllowPartialEventsCMD
void SetTimeFactory(const G4String &factory)
Set the current time factory for the messenger.
std::map< G4String, EDepSim::VTimeFactory * > fTimeFactories
The list of available time factories;.
G4UIcmdWithAString * fSetTimeCMD
virtual EDepSim::VCountGenerator * GetGenerator()=0
std::map< G4String, EDepSim::VPositionFactory * > fPositionFactories
The list of available position factories;.
G4UIcmdWithABool * fAllowEmptyEventsCMD
virtual EDepSim::VTimeGenerator * GetGenerator()=0
void SetPositionFactory(const G4String &factory)
Set the current position factory for the messenger.
G4String GetTimeFactories()
Get the list of time factories available to the messenger.
EDepSim::VTimeFactory * fTime
The current time factory.
void SetAddFakeGeantino(bool flag)
EDepSim::VCountFactory * fCount
The current count factory.
EDepSim::PrimaryGenerator * CreateGenerator()
Create a new generator using the current generator factories.
void SetKinematicsFactory(const G4String &factory)
Set the current kinematics factory for the messenger.
void AddGenerator(G4VPrimaryGenerator *generator)
#define EDepSimThrow(message)
Print an error message, and then throw an exception.
virtual EDepSim::VPositionGenerator * GetGenerator()=0
G4String GetCountFactories()
Get the list of count factories available to the messenger.
G4UIcommand * fCombineCMD
void ClearGenerators()
Clear the current list of generators.
G4String GetPositionFactories()
Get the list of position factories available to the messenger.
G4UIcmdWithAString * fSetCountCMD
void SetNewValue(G4UIcommand *, G4String)
Handle messages from the UI processor.
void AddTimeFactory(EDepSim::VTimeFactory *factory)
Add a new time factory to the messenger.
UserPrimaryGeneratorMessenger(EDepSim::UserPrimaryGeneratorAction *)
G4String GetKinematicsFactories()
Get the list of kinematics factories available to the messenger.
G4String GetPath()
Get the base directory for the messenger commands.
void AddCountFactory(EDepSim::VCountFactory *factory)
Add a new count factory to the messenger.
std::map< G4String, EDepSim::VCountFactory * > fCountFactories
The list of available count factories;.
virtual EDepSim::VKinematicsGenerator * GetGenerator()=0
G4UIcmdWithAString * fSetKinematicsCMD
G4String GetName()
Return the name of this generator.
std::map< G4String, EDepSim::VKinematicsFactory * > fKinematicsFactories
The list of available kinematics factories;.
void SetCountFactory(const G4String &factory)
Set the current count factory for the messenger.
G4UIdirectory * fCountDir
void SetAllowEmptyEvents(bool flag)
G4UIcmdWithoutParameter * fClearCMD
G4UIdirectory * fPositionDir
void AddPositionFactory(EDepSim::VPositionFactory *factory)
Add a new position factory to the messenger.
EDepSim::VKinematicsFactory * fKinematics
The current kinematics factory.
void SetAllowPartialEvents(bool flag)
G4UIcmdWithoutParameter * fAddCMD
void AddKinematicsFactory(EDepSim::VKinematicsFactory *factory)
Add a new kinematics factory to the messenger.
G4UIdirectory * fKinematicsDir
EDepSim::VPositionFactory * fPosition
The current position factory.
EDepSim::UserPrimaryGeneratorAction * fAction
G4UIcmdWithAString * fSetPositionCMD
virtual ~UserPrimaryGeneratorMessenger()
G4UIcmdWithABool * fAddFakeGeantinoCMD