EDepSimVKinematicsGenerator.hh
Go to the documentation of this file.
1 #ifndef EDepSim_VKinematicsGenerator_hh_Seen
2 #define EDepSim_VKinematicsGenerator_hh_Seen
3 
4 #include <G4ThreeVector.hh>
5 #include <G4LorentzVector.hh>
6 #include <G4Material.hh>
7 #include <G4SystemOfUnits.hh>
8 #include <G4PhysicalConstants.hh>
9 
10 #include "EDepSimException.hh"
11 
12 class G4Event;
13 
14 /// A base class for specific kinematics generators used by
15 /// EDepSim::PrimaryGenerator to construct G4PrimaryVertex, and the kinematics
16 /// for primary particles from that vertex. Classes derived from
17 /// EDepSim::VKinematicsGenerator are responsible for constructing a
18 /// G4PrimaryVertex, adding particles to the primary vertex, and adding the
19 /// vertex to the current G4Event. The derived classes must override the pure
20 /// virtual methods. The GeneratePrimaryVertex() method does the actual work.
21 ///
22 /// The EDepSim::VKinematicsGenerator derived class should throw an
23 /// ENoMoreEvents when it runs out of input events.
24 namespace EDepSim {class VKinematicsGenerator;}
26 public:
27  VKinematicsGenerator(const G4String& name) : fName(name) {}
28  virtual ~VKinematicsGenerator() {}
29 
30  /// A status value that can be returned by GeneratePrimaryVertex.
31  typedef enum {
32  /// The generation failed and should be tried again.
33  kFail = 0,
34  /// A vertex was successfully generated.
36  /// The new vertex should be generated, but it is the last one for the
37  /// event. This only has an effect if the EDepSim::PrimaryGenerator
38  /// object is building a multiple vertex event.
40  /// A new vertex should not be generated and EDepSim::PrimaryGenerator
41  /// should return. It is the users responsibility to make sure that
42  /// at least one primary vertex will have been generated.
45 
46  /// Add a G4PrimaryVertex object to the event. This should return
47  /// EDepSim::VKinematicsGenerator::kFail if a vertex could not be
48  /// generated for some reason (e.g. an event was discarded due to event
49  /// weighting probabilities, or occurred on an illegal target). The
50  /// vertex will be constructed as normal for G4, and added using the
51  /// G4Event::AddPrimaryVertex(G4PrimaryVertex*) method.
52  virtual GeneratorStatus GeneratePrimaryVertex(
53  G4Event* evt, const G4LorentzVector& position) = 0;
54 
55  /// Return the name of the generator.
56  G4String GetName() const {return fName;}
57 
58 private:
59  /// The name of the generator.
60  G4String fName;
61 
62 };
63 
64 /// The exception to be thrown when the generator can't make any more events.
65 namespace EDepSim {class NoMoreEvents;}
67 public:
69  ~NoMoreEvents() throw() {}
70  const char* what(void) const throw() {return "EDepSim::NoMoreEvents";}
71 };
72 
73 #endif
static QCString name
Definition: declinfo.cpp:673
G4String fName
The name of the generator.
GeneratorStatus
A status value that can be returned by GeneratePrimaryVertex.
Construct a module from components.
Definition: TG4HitSegment.h:10
A vertex was successfully generated.
const char * what(void) const
virtual GeneratorStatus GeneratePrimaryVertex(G4Event *evt, const G4LorentzVector &position)=0
The generation failed and should be tried again.
TCEvent evt
Definition: DataStructs.cxx:7
G4String GetName() const
Return the name of the generator.