SLIC  6.1.1
Simulation for the Linear Collider (SLIC) - Geant4 simulation application
TrackUtil.hh
Go to the documentation of this file.
1 #ifndef SLIC_TRACKUTIL_HH_
2 #define SLIC_TRACKUTIL_HH_ 1
3 
4 // LCDD
5 #include "lcdd/core/UserRegionInformation.hh"
6 
7 // SLIC
8 #include "TrackManager.hh"
10 
11 // Geant4
12 #include "G4TransportationManager.hh"
13 
14 namespace slic {
15 
20 class TrackUtil {
21 
22  public:
23 
29  static UserRegionInformation* getRegionInformation(const G4Track* track) {
30  G4VPhysicalVolume* volume = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->LocateGlobalPointAndSetup(track->GetPosition());
31  G4Region* region = volume->GetLogicalVolume()->GetRegion();
32  UserRegionInformation* regionInfo = dynamic_cast<UserRegionInformation*>(region->GetUserInformation());
33  return regionInfo;
34  }
35 
42  static UserTrackInformation* setupUserTrackInformation(const G4Track* track, G4bool save) {
43 
44  /* Create new TrackSummary. */
45  TrackSummary* trackSummary = new TrackSummary(track, save);
46 
47  /* Add it to the master list. */
48  TrackManager::instance()->getTrackSummaries()->push_back(trackSummary);
49 
50  /* Associate it to its track ID. */
51  (*TrackManager::instance()->getTrackSummaryMap())[track->GetTrackID()] = trackSummary;
52 
53  /* Create new UserTrackInformation. */
54  UserTrackInformation* trackInfo = new UserTrackInformation(trackSummary);
55 
56  /* Set the UserTrackInformation on the track. */
57  ((G4Track*) track)->SetUserInformation(trackInfo);
58 
59  return trackInfo;
60  }
61 
66  static UserTrackInformation* getUserTrackInformation(const G4Track* track) {
67  return dynamic_cast<UserTrackInformation*>(track->GetUserInformation());
68  }
69 };
70 
71 }
72 
73 #endif
static TrackManager * instance()
Container for all information from G4Track that may be persisted to MCParticle output collection.
Definition: TrackSummary.hh:33
Miscellaneous helper methods for G4Track and related classes.
Definition: TrackUtil.hh:20
static UserTrackInformation * getUserTrackInformation(const G4Track *track)
Definition: TrackUtil.hh:66
static UserRegionInformation * getRegionInformation(const G4Track *track)
Definition: TrackUtil.hh:29
static UserTrackInformation * setupUserTrackInformation(const G4Track *track, G4bool save)
Definition: TrackUtil.hh:42
The implementation of the G4VUserTrackInformation class for storing track information within the even...