EDepSimTrajectoryMap.hh
Go to the documentation of this file.
1 #ifndef EDepSim_TrajectoryMap_hh_seen
2 #define EDepSim_TrajectoryMap_hh_seen
3 ////////////////////////////////////////////////////////////
4 // $Id: EDepSim::TrajectoryMap.hh,v 1.1 2007/01/01 05:32:49 mcgrew Exp $
5 //
6 
7 #include <map>
8 
9 class G4VTrajectory;
10 
11 /// Maintain a singleton map of track Id to the trajectory in the trajectory
12 /// container. THIS IS NOT THREAD SAFE AND CAN NOT BE USED WITH MULTITHREAD
13 /// GEANT4.
14 namespace EDepSim {class TrajectoryMap;}
16 public:
18 
19  /// Provide a map between the track id and the trajectory object.
20  static G4VTrajectory* Get(int trackId);
21 
22  /// Add a trajectory to the map.
23  static void Add(G4VTrajectory* traj);
24 
25  /// Clear the trajectory map. This must be done in the
26  /// EDepSim::UserEventAction::BeginOfEventAction() method.
27  static void Clear();
28 
29  /// Find the primary track ID for the current track. This is the primary
30  /// that is the ultimate parent of the current track.
31  static int FindPrimaryId(int trackId);
32 
33 private:
34  /// A map to the trajectories information indexed the the track id. Be
35  /// careful since the trajectory information is owned by the event, so if
36  /// you try to use this after a trajectory has been deleted... bad things
37  /// will happen.
38  static std::map<int,G4VTrajectory*> fMap;
39 
40  /// The constructor is private so that it can only be created using the
41  /// static get method.
43 };
44 #endif
static int FindPrimaryId(int trackId)
static std::map< int, G4VTrajectory * > fMap
Construct a module from components.
Definition: TG4HitSegment.h:10
static void Add(G4VTrajectory *traj)
Add a trajectory to the map.
static G4VTrajectory * Get(int trackId)
Provide a map between the track id and the trajectory object.