EDepSimTrajectoryPoint.hh
Go to the documentation of this file.
1 #ifndef EDepSim_TrajectoryPoint_hh_seen
2 #define EDepSim_TrajectoryPoint_hh_seen
3 
4 #include <globals.hh>
5 #include <G4TrajectoryPoint.hh>
6 #include <G4ThreeVector.hh>
7 #include <G4Allocator.hh>
8 #include <G4StepStatus.hh>
9 #include <G4ProcessType.hh>
10 
11 class G4Track;
12 class G4Step;
13 class G4VProcess;
14 
15 /// Store a point along a particle trajectory. This is used internally for
16 /// some bookkeeping, and then is translated into an output class when the
17 /// event is saved. It keeps track of information like the momentum at the
18 /// point, the process that occured the the point, the volume containing the
19 /// point, and the energy deposited at the point.
20 namespace EDepSim {class TrajectoryPoint;}
21 class EDepSim::TrajectoryPoint : public G4TrajectoryPoint {
22 public:
24  TrajectoryPoint(const G4Track* aTrack);
25  TrajectoryPoint(const G4Step* aStep);
27  virtual ~TrajectoryPoint();
28 
29  inline void *operator new(size_t);
30  inline void operator delete(void *aTrajectoryPoint);
31  inline int operator==(const EDepSim::TrajectoryPoint& right) const
32  { return (this==&right); };
33 
34  /// Get the time that the particle passed this trajectory point.
35  G4double GetTime() const { return fTime; }
36 
37  /// Get the 3-momentum of the particle at this trajectory point.
38  const G4ThreeVector GetMomentum() const { return fMomentum; }
39 
40  /// Get the G4 stepping status of the interaction that instigated this
41  /// trajectory point.
42  G4StepStatus GetStepStatus() const { return fStepStatus; }
43 
44  /// Get the process type for this point (the process types are defined in
45  /// G4ProcessType.hh).
46  G4ProcessType GetProcessType() const { return fProcessType; }
47 
48  /// Get the process sub type for this point. The sub-types depend on the
49  /// specific processes and are defined in a few different include files.
50  /// For EM and hadronic interacitons, see G4EmProcessSubType.hh, and
51  /// G4HadronicProcessType.hh.
52  G4int GetProcessSubType() const { return fProcessSubType; }
53 
54  /// Get the process name for this point.
55  G4String GetProcessName() const { return fProcessName; }
56 
57  /// Get the energy deposit by this process for this point. This is NOT
58  /// enough information to calculate the total energy deposit for the
59  /// track, but can be used to help decide which trajectory points are
60  /// interesting to save to the output file.
61  G4double GetProcessDeposit() const { return fProcessDeposit; }
62 
63  /// The name of the physical volume containing the stopping point of the
64  /// current step. This may (often) be a different volume than the volume
65  /// referenced by GetVolumeNode().
66  G4String GetPhysVolName() const { return fPhysVolName; }
67 
68  /// Get the node for the volume containing the stopping point. If the
69  /// stopping point is on a geometric boundary, this is the volume that the
70  /// track is just exiting.
71  int GetVolumeNode() const;
72 
73  // Get method for HEPRep style attributes
74 
75  virtual const std::map<G4String,G4AttDef>* GetAttDefs() const;
76  virtual std::vector<G4AttValue>* CreateAttValues() const;
77 
78 //---------
79  private:
80 //---------
81 
82 // Member data
83 
84  G4double fTime;
85  G4ThreeVector fMomentum;
86  G4StepStatus fStepStatus;
87  G4ProcessType fProcessType;
89  G4String fProcessName;
90  G4double fProcessDeposit;
91  G4String fPhysVolName;
92  G4ThreeVector fPrevPosition;
93 };
94 
95 #if defined G4TRACKING_ALLOC_EXPORT
96 extern G4DLLEXPORT G4Allocator<EDepSim::TrajectoryPoint> aTrajPointAllocator;
97 #else
98 extern G4DLLIMPORT G4Allocator<EDepSim::TrajectoryPoint> aTrajPointAllocator;
99 #endif
100 
101 inline void* EDepSim::TrajectoryPoint::operator new(size_t) {
102  void *aTrajectoryPoint = (void *) aTrajPointAllocator.MallocSingle();
103  return aTrajectoryPoint;
104 }
105 
106 inline void EDepSim::TrajectoryPoint::operator delete(void *aTrajectoryPoint) {
107  aTrajPointAllocator.FreeSingle(
108  (EDepSim::TrajectoryPoint *) aTrajectoryPoint);
109 }
110 #endif
111 
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
G4DLLIMPORT G4Allocator< EDepSim::TrajectoryPoint > aTrajPointAllocator
G4double GetTime() const
Get the time that the particle passed this trajectory point.
const G4ThreeVector GetMomentum() const
Get the 3-momentum of the particle at this trajectory point.
Construct a module from components.
Definition: TG4HitSegment.h:10
int operator==(const EDepSim::TrajectoryPoint &right) const
G4ProcessType GetProcessType() const
G4String GetProcessName() const
Get the process name for this point.
G4StepStatus GetStepStatus() const
virtual std::vector< G4AttValue > * CreateAttValues() const