EDepSimVConstrainedPositionFactory.cc
Go to the documentation of this file.
3 
5  G4String name,
7  bool makeDirectory)
8  : EDepSim::VPositionFactory(name,parent,makeDirectory),
9  fCurrent(NULL) {
10 
12  = new G4UIcmdWithAString(CommandName("sample"),this);
13  fPositionSampleVolumeCMD->SetGuidance("[REQUIRED] "
14  " Set volume to sample for a "
15  "primary vertex.");
16  fPositionSampleVolumeCMD->SetParameterName("SampleVolume",false);
17 
18  fPositionClearCMD = new G4UIcmdWithoutParameter(CommandName("clear"),
19  this);
20  fPositionClearCMD->SetGuidance("Start a new vertex generator.");
21 
22  fPositionVolumeCMD = new G4UIcmdWithAString(CommandName("volume"),this);
23  fPositionVolumeCMD->SetGuidance("Set the name of the vertex volume.");
24  fPositionVolumeCMD->SetParameterName("PositionVolume",false);
25 
26  fPositionNotVolumeCMD = new G4UIcmdWithAString(CommandName("notVolume"),
27  this);
28  fPositionNotVolumeCMD->SetGuidance("Set the name of the vertex"
29  " volume to avoid.");
30  fPositionNotVolumeCMD->SetParameterName("NotPositionVolume",false);
31 
32  fPositionMaterialCMD = new G4UIcmdWithAString(CommandName("material"),
33  this);
34  fPositionMaterialCMD->SetGuidance("Set the name of the vertex material.");
35  fPositionMaterialCMD->SetParameterName("PositionMaterial",false);
36 
38  = new G4UIcmdWithAString(CommandName("notMaterial"),this);
39  fPositionNotMaterialCMD->SetGuidance("Set the name of the"
40  " material to avoid.");
41  fPositionNotMaterialCMD->SetParameterName("PositionNotMaterial",false);
42 
43  fPositionMinXCMD = new G4UIcmdWithADoubleAndUnit(CommandName("minX"),
44  this);
45  fPositionMinXCMD->SetGuidance("Set the minimum position of the vertex.");
46  fPositionMinXCMD->SetParameterName("X",false);
47  fPositionMinXCMD->SetUnitCategory("Length");
48 
49  fPositionMinYCMD = new G4UIcmdWithADoubleAndUnit(CommandName("minY"),
50  this);
51  fPositionMinYCMD->SetGuidance("Set the minimum position of the vertex.");
52  fPositionMinYCMD->SetParameterName("Y",false);
53  fPositionMinYCMD->SetUnitCategory("Length");
54 
55  fPositionMinZCMD = new G4UIcmdWithADoubleAndUnit(CommandName("minZ"),
56  this);
57  fPositionMinZCMD->SetGuidance("Set the minimum position of the vertex.");
58  fPositionMinZCMD->SetParameterName("Z",false);
59  fPositionMinZCMD->SetUnitCategory("Length");
60 
61  fPositionMinTCMD = new G4UIcmdWithADoubleAndUnit(CommandName("minT"),
62  this);
63  fPositionMinTCMD->SetGuidance("Set the minimum time of the vertex.");
64  fPositionMinTCMD->SetParameterName("T",false);
65  fPositionMinTCMD->SetUnitCategory("Time");
66 
67 
68  fPositionMaxXCMD = new G4UIcmdWithADoubleAndUnit(CommandName("maxX"),
69  this);
70  fPositionMaxXCMD->SetGuidance("Set the maximum position of the vertex.");
71  fPositionMaxXCMD->SetParameterName("X",false);
72  fPositionMaxXCMD->SetUnitCategory("Length");
73 
74  fPositionMaxYCMD = new G4UIcmdWithADoubleAndUnit(CommandName("maxY"),
75  this);
76  fPositionMaxYCMD->SetGuidance("Set the maximum position of the vertex.");
77  fPositionMaxYCMD->SetParameterName("Y",false);
78  fPositionMaxYCMD->SetUnitCategory("Length");
79 
80  fPositionMaxZCMD = new G4UIcmdWithADoubleAndUnit(CommandName("maxZ"),
81  this);
82  fPositionMaxZCMD->SetGuidance("Set the maximum position of the vertex.");
83  fPositionMaxZCMD->SetParameterName("Z",false);
84  fPositionMaxZCMD->SetUnitCategory("Length");
85 
86  fPositionMaxTCMD = new G4UIcmdWithADoubleAndUnit(CommandName("maxT"),
87  this);
88  fPositionMaxTCMD->SetGuidance("Set the maximum position of the vertex.");
89  fPositionMaxTCMD->SetParameterName("T",false);
90  fPositionMaxTCMD->SetUnitCategory("Time");
91 }
92 
95  delete fPositionClearCMD;
96  delete fPositionVolumeCMD;
97  delete fPositionNotVolumeCMD;
98  delete fPositionMaterialCMD;
100  delete fPositionMinXCMD;
101  delete fPositionMinYCMD;
102  delete fPositionMinZCMD;
103  delete fPositionMinTCMD;
104  delete fPositionMaxXCMD;
105  delete fPositionMaxYCMD;
106  delete fPositionMaxZCMD;
107  delete fPositionMaxTCMD;
108 }
109 
111  G4String newValue) {
112 
113  if (!fCurrent) {
115  CreateGenerator());
116  }
117 
118  if (command == fPositionClearCMD) {
119  if (fCurrent) {
121  }
122  }
123  else if (command == fPositionSampleVolumeCMD) {
124  if (fCurrent) {
125  fCurrent->SetVolumeName(newValue);
126  }
127  }
128  else if (command == fPositionVolumeCMD) {
129  if (fCurrent) {
130  fCurrent->CheckVolumeName(newValue);
131  }
132  }
133  else if (command == fPositionNotVolumeCMD) {
134  if (fCurrent) {
135  fCurrent->CheckNotVolumeName(newValue);
136  }
137  }
138  else if (command == fPositionMaterialCMD) {
139  if (fCurrent) {
140  fCurrent->CheckVolumeMaterial(newValue);
141  }
142  }
143  else if (command == fPositionNotMaterialCMD) {
144  if (fCurrent) {
145  fCurrent->CheckNotVolumeMaterial(newValue);
146  }
147  }
148  else if (command == fPositionMinXCMD) {
149  if (fCurrent) {
150  fCurrent->CheckMinX(fPositionMinXCMD->GetNewDoubleValue(newValue));
151  }
152  }
153  else if (command == fPositionMinYCMD) {
154  if (fCurrent) {
155  fCurrent->CheckMinY(fPositionMinYCMD->GetNewDoubleValue(newValue));
156  }
157  }
158  else if (command == fPositionMinZCMD) {
159  if (fCurrent) {
160  fCurrent->CheckMinZ(fPositionMinZCMD->GetNewDoubleValue(newValue));
161  }
162  }
163  else if (command == fPositionMaxXCMD) {
164  if (fCurrent) {
165  fCurrent->CheckMaxX(fPositionMaxXCMD->GetNewDoubleValue(newValue));
166  }
167  }
168  else if (command == fPositionMaxYCMD) {
169  if (fCurrent) {
170  fCurrent->CheckMaxY(fPositionMaxYCMD->GetNewDoubleValue(newValue));
171  }
172  }
173  else if (command == fPositionMaxZCMD) {
174  if (fCurrent) {
175  fCurrent->CheckMaxZ(fPositionMaxZCMD->GetNewDoubleValue(newValue));
176  }
177  }
178 }
179 
182  if (!stash) stash = CreateGenerator();
183  fCurrent = NULL;
184  return stash;
185 }
static QCString name
Definition: declinfo.cpp:673
void CheckMaxZ(double z)
Check that the vertex Z position is less than some value.
int command
virtual EDepSim::VPositionGenerator * GetGenerator()
EDepSim::VConstrainedPositionGenerator * fCurrent
void SetNewValue(G4UIcommand *, G4String)
Handle messages from the UI processor.
VConstrainedPositionFactory(G4String name, EDepSim::UserPrimaryGeneratorMessenger *fParent, bool makeDirectory=true)
Construct a module from components.
Definition: TG4HitSegment.h:10
void CheckMaxX(double x)
Check that the vertex X position is less than some value.
void SetVolumeName(const G4String &volume)
Set the name of the volume to be sampled for a vertex.
void CheckMinY(double y)
Check that the vertex Y position is greater than some value.
void CheckVolumeMaterial(const G4String &name)
Check that the vertex is inside of a material specified by name.
void CheckMaxY(double y)
Check that the vertex Y position is less than some value.
virtual EDepSim::VPositionGenerator * CreateGenerator()=0
G4String CommandName(G4String cmd)
Build a command name with the directory prefix.
void CheckMinX(double x)
Check that the vertex X position is greater than some value.
void ClearPositionTests(void)
Clear the current set of vertex checks.
void CheckMinZ(double z)
Check that the vertex Z position is greater than some value.
void CheckNotVolumeMaterial(const G4String &name)
Check that the vertex is not inside of a material specified by name.
def parent(G, child, parent_type)
Definition: graph.py:67