EDepSimVConstrainedPositionGenerator.hh
Go to the documentation of this file.
1 #ifndef EDepSim_VConstrainedPositionGenerator_hh_seen
2 #define EDepSim_VConstrainedPositionGenerator_hh_seen
3 
4 #include <vector>
5 
6 #include <G4ThreeVector.hh>
7 
9 
10 /// Select a position and time to be used as the vertex of a primary particle,
11 /// but which is constrained by various standard tests.
12 namespace EDepSim {class VConstrainedPositionGenerator;}
14 public:
15  VConstrainedPositionGenerator(const G4String& name);
17 
18  /// Flag if the vertex should be forced to the candidate vertex returned
19  /// by GetPosition().
20  virtual bool ForcePosition();
21 
22  class PositionTest {
23  public:
25  virtual ~PositionTest() {}
26  virtual bool Apply(const G4LorentzVector& /* vtx */) {return true;}
27  };
28  typedef std::vector<PositionTest*> PositionTests;
29 
30  /// Set the name of the volume to be sampled for a vertex.
31  void SetVolumeName(const G4String& volume) {fSampleVolume = volume;}
32 
33  /// Clear the current set of vertex checks.
34  void ClearPositionTests(void) {fPositionTests.clear();}
35 
36  /// Check that the vertex is inside of a volume specified by name. Name
37  /// may be a sub-string contanied in the full volume name.
38  void CheckVolumeName(const G4String& name);
39 
40  /// Check that the vertex is not inside of a volume specified by name.
41  /// Name may be a sub-string contained in the full volume name.
42  void CheckNotVolumeName(const G4String& name);
43 
44  /// Check that the vertex is inside of a material specified by name.
45  void CheckVolumeMaterial(const G4String& name);
46 
47  /// Check that the vertex is not inside of a material specified by name.
48  void CheckNotVolumeMaterial(const G4String& name);
49 
50  /// Check that the vertex X position is greater than some value.
51  void CheckMinX(double x);
52 
53  /// Check that the vertex X position is less than some value.
54  void CheckMaxX(double x);
55 
56  /// Check that the vertex Y position is greater than some value.
57  void CheckMinY(double y);
58 
59  /// Check that the vertex Y position is less than some value.
60  void CheckMaxY(double y);
61 
62  /// Check that the vertex Z position is greater than some value.
63  void CheckMinZ(double z);
64 
65  /// Check that the vertex Z position is less than some value.
66  void CheckMaxZ(double z);
67 
68 protected:
69  /// Return true if the vertex is valid. This is used in the derived class.
70  virtual bool ValidPosition(const G4LorentzVector& vtx);
71 
72  /// Generate a trial position uniformly in the sample box.
73  G4LorentzVector TrialPosition();
74 
75 private:
76  /// The name of the volume to be sampled
77  G4String fSampleVolume;
78 
79  /// True if the limits have been initialized.
81 
82  /// Find the limits of the volume to be sampled for a good vertex.
83  void FindLimits();
84 
85  /// The vertex tests to apply.
86  PositionTests fPositionTests;
87 
88  /// The lower boundary of the volume to be sampled for the vertex.
89  G4ThreeVector fMinimumCorner;
90 
91  /// The upper boundary of the volume to be sampled for the vertex.
92  G4ThreeVector fMaximumCorner;
93 };
94 #endif
static QCString name
Definition: declinfo.cpp:673
G4ThreeVector fMinimumCorner
The lower boundary of the volume to be sampled for the vertex.
virtual bool ValidPosition(const G4LorentzVector &vtx)
Return true if the vertex is valid. This is used in the derived class.
void CheckMaxZ(double z)
Check that the vertex Z position is less than some value.
G4String fSampleVolume
The name of the volume to be sampled.
static const std::string volume[nvol]
void FindLimits()
Find the limits of the volume to be sampled for a good vertex.
bool fLimitsFound
True if the limits have been initialized.
G4LorentzVector TrialPosition()
Generate a trial position uniformly in the sample box.
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.
G4ThreeVector fMaximumCorner
The upper boundary of the volume to be sampled for the vertex.
void CheckMaxY(double y)
Check that the vertex Y position is less than some value.
void CheckMinX(double x)
Check that the vertex X position is greater than some value.
PositionTests fPositionTests
The vertex tests to apply.
void ClearPositionTests(void)
Clear the current set of vertex checks.
list x
Definition: train.py:276
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.