SLIC  6.1.1
Simulation for the Linear Collider (SLIC) - Geant4 simulation application
TrackManager.hh
Go to the documentation of this file.
1 #ifndef SLIC_TRACKMANAGER_HH_
2 #define SLIC_TRACKMANAGER_HH_ 1
3 
4 // SLIC
5 #include "Module.hh"
6 #include "TrackSummary.hh"
7 #include "Singleton.hh"
8 
9 // LCIO
10 #include "EVENT/LCEvent.h"
11 
12 // Geant4
13 #include "G4Event.hh"
14 
15 using EVENT::LCEvent;
16 
17 namespace slic {
18 
23 class TrackManager: public Singleton<TrackManager>, public Module {
24 
25  public:
26 
31  Module("TrackManager") {
34  }
35 
39  virtual ~TrackManager() {
40  delete _trackSummaries;
41  delete _trackSummaryMap;
42  }
43 
44  public:
45 
51  return _trackSummaries;
52  }
53 
59  void saveTrackSummaries(const G4Event* event, LCEvent* lcevent);
60 
64  void reset() {
65  /* Clear the vector. */
66  for (TrackSummaryVector::iterator it = _trackSummaries->begin(); it != _trackSummaries->end(); it++) {
67  delete *it;
68  }
69  _trackSummaries->clear();
70 
71  /* Clear the map. */
72  _trackSummaryMap->clear();
73  }
74 
80  return _trackSummaryMap;
81  }
82 
87  void registerTrackSummary(TrackSummary* trackSummary) {
88  (*_trackSummaryMap)[trackSummary->getTrackID()] = trackSummary;
89  }
90 
96  TrackSummary* findTrackSummary(G4int trackID) {
97  return (*_trackSummaryMap)[trackID];
98  }
99 
100  private:
101 
109 
110  private:
111 
114 };
115 
116 }
117 
118 #endif
Base class for slic code modules that provides common functionality, such as logging to an output str...
Definition: Module.hh:25
Manages access to stored track information used for MCParticle output.
Definition: TrackManager.hh:23
TrackSummaryMap * getTrackSummaryMap()
Definition: TrackManager.hh:79
TrackSummary * findFirstSavedAncestor(TrackSummary *trackSummary)
void registerTrackSummary(TrackSummary *trackSummary)
Definition: TrackManager.hh:87
virtual ~TrackManager()
Definition: TrackManager.hh:39
TrackSummary * findTrackSummary(G4int trackID)
Definition: TrackManager.hh:96
TrackSummaryMap * _trackSummaryMap
TrackSummaryVector * getTrackSummaries()
Definition: TrackManager.hh:50
TrackSummaryVector * _trackSummaries
void saveTrackSummaries(const G4Event *event, LCEvent *lcevent)
Definition: TrackManager.cc:23
Container for all information from G4Track that may be persisted to MCParticle output collection.
Definition: TrackSummary.hh:33
G4int getTrackID() const
std::vector< TrackSummary * > TrackSummaryVector
Definition: TrackSummary.hh:24
std::map< G4int, TrackSummary * > TrackSummaryMap
Definition: TrackSummary.hh:27