]>
Commit | Line | Data |
---|---|---|
6fc5df41 | 1 | // $Id$ |
2 | // Category: event | |
3 | // | |
e5967ab3 | 4 | // Author: I.Hrivnacova |
5 | // | |
6 | // Class TG4TrackingAction | |
7 | // ----------------------- | |
6fc5df41 | 8 | // See the class description in the header file. |
9 | ||
10 | #include "TG4TrackingAction.h" | |
11 | #include "TG4StepManager.h" | |
12 | #include "TG4VSensitiveDetector.h" | |
e5967ab3 | 13 | #include "TG4SDServices.h" |
6fc5df41 | 14 | #include "TG4Globals.h" |
15 | ||
72095f7c | 16 | //_____________________________________________________________________________ |
6fc5df41 | 17 | TG4TrackingAction::TG4TrackingAction() { |
18 | // | |
19 | } | |
20 | ||
72095f7c | 21 | //_____________________________________________________________________________ |
6fc5df41 | 22 | TG4TrackingAction::TG4TrackingAction(const TG4TrackingAction& right) { |
23 | // | |
24 | TG4Globals::Exception("TG4TrackingAction is protected from copying."); | |
25 | } | |
26 | ||
72095f7c | 27 | //_____________________________________________________________________________ |
6fc5df41 | 28 | TG4TrackingAction::~TG4TrackingAction() { |
29 | // | |
30 | } | |
31 | ||
32 | // operators | |
33 | ||
72095f7c | 34 | //_____________________________________________________________________________ |
6fc5df41 | 35 | TG4TrackingAction& |
36 | TG4TrackingAction::operator=(const TG4TrackingAction &right) | |
37 | { | |
38 | // check assignement to self | |
39 | if (this == &right) return *this; | |
40 | ||
41 | TG4Globals::Exception("TG4TrackingAction is protected from assigning."); | |
42 | ||
43 | return *this; | |
44 | } | |
45 | ||
46 | // public methods | |
47 | ||
72095f7c | 48 | //_____________________________________________________________________________ |
6fc5df41 | 49 | void TG4TrackingAction::PreUserTrackingAction(const G4Track* track) |
50 | { | |
51 | // Called by G4 kernel before starting tracking. | |
52 | // --- | |
53 | ||
d94b6f87 | 54 | // set step manager status |
55 | TG4StepManager* stepManager = TG4StepManager::Instance(); | |
56 | stepManager->SetStep((G4Track*)track, kVertex); | |
57 | ||
6fc5df41 | 58 | // call pre-tracking action of derived class |
59 | PreTrackingAction(track); | |
60 | ||
61 | // let sensitive detector process vertex step | |
62 | // (this ensures compatibility with G3 that | |
63 | // makes first step of zero length) | |
64 | ||
6fc5df41 | 65 | G4VPhysicalVolume* pv = stepManager->GetCurrentPhysicalVolume(); |
66 | ||
67 | if (!pv) { | |
68 | G4String text = "TG4TrackingAction::PreUserTrackingAction: \n"; | |
69 | text = text + " Cannot locate track vertex."; | |
70 | TG4Globals::Exception(text); | |
71 | } | |
72 | ||
e5967ab3 | 73 | #ifdef TGEANT4_DEBUG |
74 | TG4VSensitiveDetector* tsd | |
75 | = TG4SDServices::Instance() | |
76 | ->GetSensitiveDetector( | |
77 | pv->GetLogicalVolume()->GetSensitiveDetector()); | |
78 | ||
79 | if (tsd) tsd->UserProcessHits((G4Track*)track, 0); | |
80 | #else | |
81 | TG4VSensitiveDetector* tsd | |
82 | = (TG4VSensitiveDetector*) pv->GetLogicalVolume()->GetSensitiveDetector(); | |
83 | ||
84 | if (tsd) tsd->UserProcessHits((G4Track*)track, 0); | |
85 | #endif | |
6fc5df41 | 86 | } |
87 | ||
72095f7c | 88 | //_____________________________________________________________________________ |
6fc5df41 | 89 | void TG4TrackingAction::PostUserTrackingAction(const G4Track* track) |
90 | { | |
91 | // Called by G4 kernel after finishing tracking. | |
92 | // --- | |
93 | ||
94 | // call post-tracking action of derived class | |
95 | PostTrackingAction(track); | |
96 | } | |
97 |