]>
Commit | Line | Data |
---|---|---|
6fc5df41 | 1 | // $Id$ |
2 | // Category: event | |
3 | // | |
4 | // See the class description in the header file. | |
5 | ||
6 | #include "TG4SteppingAction.h" | |
6fc5df41 | 7 | #include "TG4VSensitiveDetector.h" |
8 | #include "TG4Globals.h" | |
9 | ||
10 | TG4SteppingAction::TG4SteppingAction() { | |
11 | // | |
12 | } | |
13 | ||
14 | TG4SteppingAction::TG4SteppingAction(const TG4SteppingAction& right) { | |
15 | // | |
16 | TG4Globals::Exception("TG4SteppingAction is protected from copying."); | |
17 | } | |
18 | ||
19 | TG4SteppingAction::~TG4SteppingAction() { | |
20 | // | |
21 | } | |
22 | ||
23 | // operators | |
24 | ||
25 | TG4SteppingAction& | |
26 | TG4SteppingAction::operator=(const TG4SteppingAction &right) | |
27 | { | |
28 | // check assignement to self | |
29 | if (this == &right) return *this; | |
30 | ||
31 | TG4Globals::Exception("TG4SteppingAction is protected from assigning."); | |
32 | ||
33 | return *this; | |
34 | } | |
35 | ||
36 | // public methods | |
37 | ||
38 | void TG4SteppingAction::UserSteppingAction(const G4Step* step) | |
39 | { | |
40 | // Called by G4 kernel at the end of each step. | |
41 | // --- | |
42 | ||
43 | // call stepping action of derived class | |
44 | SteppingAction(step); | |
45 | ||
46 | // let sensitive detector process boundary step | |
47 | // if crossing geometry border | |
48 | // (this ensures compatibility with G3 that | |
49 | // makes boundary step of zero length) | |
50 | ||
51 | if (step->GetPostStepPoint()->GetStepStatus() == fGeomBoundary && | |
c2c02aa6 | 52 | step->GetTrack()->GetTrackStatus() == fAlive && |
6fc5df41 | 53 | step->GetTrack()->GetNextVolume() != 0) { |
54 | ||
55 | G4VSensitiveDetector* sd | |
56 | = step->GetPostStepPoint()->GetPhysicalVolume() | |
57 | ->GetLogicalVolume()->GetSensitiveDetector(); | |
58 | ||
59 | if (sd) { | |
60 | TG4VSensitiveDetector* tsd = dynamic_cast<TG4VSensitiveDetector*>(sd); | |
61 | if (tsd) | |
62 | tsd->ProcessHitsOnBoundary((G4Step*)step); | |
63 | else { | |
64 | G4String text = "TG4SteppingAction:::UserSteppingAction: \n"; | |
65 | text = text + " Unknown sensitive detector type"; | |
66 | TG4Globals::Exception(text); | |
67 | } | |
68 | } | |
69 | } | |
70 | } | |
71 |