-
Notifications
You must be signed in to change notification settings - Fork 0
/
stepping.cc
executable file
·75 lines (50 loc) · 2.04 KB
/
stepping.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include "stepping.hh"
#include "G4RunManager.hh"
steppingaction::steppingaction(eventaction* eventAction){
fEventAction=eventAction;
}
steppingaction::~steppingaction(){}
void steppingaction::UserSteppingAction (const G4Step* step){
const detectorconstruction* detectorConstruction = static_cast<const detectorconstruction*>
(G4RunManager::GetRunManager()->GetUserDetectorConstruction());
G4LogicalVolume* fScoringVolume1 = detectorConstruction->GetScoringVolume1();
G4LogicalVolume* fScoringVolume2 = detectorConstruction->GetScoringVolume2();
G4LogicalVolume* fScoringVolume3 = detectorConstruction->GetScoringVolume3();
G4LogicalVolume* fScoringVolume4 = detectorConstruction->GetScoringVolume4();
G4LogicalVolume *volume = step->GetPreStepPoint()->GetTouchableHandle()
->GetVolume()->GetLogicalVolume();
G4double edep= step->GetTotalEnergyDeposit();
G4Track *track = step->GetTrack();
if (volume == fScoringVolume1) {
fEventAction->AddEdep1(edep);
G4bool st1 = step->IsFirstStepInVolume();
if (st1 == true){
G4double tof1 = track->GetGlobalTime();
fEventAction->AddTOF1(tof1);
}
}
else if(volume == fScoringVolume2) {
fEventAction->AddEdep2(edep);
G4bool st2= step->IsFirstStepInVolume();
if (st2 == true){
G4double tof2 = track->GetGlobalTime();
fEventAction->AddTOF2(tof2);
}
}
else if(volume == fScoringVolume3) {
fEventAction->AddEdep3(edep);
G4bool st3= step->IsFirstStepInVolume();
if (st3 == true){
G4double tof3 = track->GetGlobalTime();
fEventAction->AddTOF3(tof3);
}
}
else if(volume == fScoringVolume4) {
fEventAction->AddEdep4(edep);
G4bool st4= step->IsFirstStepInVolume();
if (st4 == true){
G4double tof4 = track->GetGlobalTime();
fEventAction->AddTOF4(tof4);
}
}
}