-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathEventAction.cc
134 lines (110 loc) · 2.9 KB
/
EventAction.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// Geant4 Libraries
//
#include "G4UserEventAction.hh"
#include "G4Event.hh"
#include "G4Track.hh"
#include "g4root.hh"
#include "G4SystemOfUnits.hh"
// C++ Libraries
//
#include <cmath>
// Local Libraries
//
#include "EventAction.hh"
#include "RunAction.hh"
#include "PrimaryGeneratorAction.hh"
EventAction::EventAction(RunAction* runAction, PrimaryGeneratorAction* primaryGenAction)
: G4UserEventAction(),
fRunAction(runAction),
fPriGenAction(primaryGenAction)
{
G4cout << "...EventAction..." << G4endl;
}
EventAction::~EventAction()
{}
void EventAction::BeginOfEventAction(const G4Event* event)
{
nPhotons = 0.;
cerenkovPhontons = 0;
totalLength = 0.;
//G4cout << "Begin Event: " << cerenkovPhontons << " " << event->GetEventID() << G4endl;
muonOk = 0;
elecOk = 0;
gammOk = 0;
neutOk = 0;
partId = fPriGenAction->primaryId;
fRunAction->histRun->postInject(fPriGenAction->position.x() / cm, fPriGenAction->position.y()/ cm);
if ( partId == "mu-" || partId == "mu+" )
{
muonOk = 1;
fRunAction->histRun->distInject(0);
}
else if ( partId == "e-" || partId == "e+" )
{
elecOk = 1;
fRunAction->histRun->distInject(1);
}
else if ( partId == "gamma" )
{
gammOk = 1;
fRunAction->histRun->distInject(2);
}
else if ( partId == "neutron" )
{
neutOk = 1;
fRunAction->histRun->distInject(3);
}
else
fRunAction->histRun->distInject(4);
}
void EventAction::EndOfEventAction(const G4Event* event)
{
G4cout << "End Event: " << event->GetEventID() << G4endl;
if ( muonOk )
{
fRunAction->histRun->fillCerenPho(0);
fRunAction->histRun->fillCerenPhoPmt(0);
fRunAction->histRun->fillCerenPhoElect(0);
fRunAction->histRun->fillTrackLengthDetec(0);
}
else if ( elecOk )
{
fRunAction->histRun->fillCerenPho(1);
fRunAction->histRun->fillCerenPhoPmt(1);
fRunAction->histRun->fillCerenPhoElect(1);
fRunAction->histRun->fillTrackLengthDetec(1);
}
else if ( gammOk )
{
fRunAction->histRun->fillCerenPho(2);
fRunAction->histRun->fillCerenPhoPmt(2);
fRunAction->histRun->fillCerenPhoElect(2);
fRunAction->histRun->fillTrackLengthDetec(2);
}
else if ( neutOk )
{
fRunAction->histRun->fillCerenPho(3);
fRunAction->histRun->fillCerenPhoPmt(3);
fRunAction->histRun->fillCerenPhoElect(3);
fRunAction->histRun->fillTrackLengthDetec(3);
}
else
{
fRunAction->histRun->fillCerenPho(4);
fRunAction->histRun->fillCerenPhoPmt(4);
fRunAction->histRun->fillCerenPhoElect(4);
fRunAction->histRun->fillTrackLengthDetec(4);
}
fRunAction->histRun->fillCerenPho(5);
fRunAction->histRun->fillCerenPhoPmt(5);
fRunAction->histRun->fillCerenPhoElect(5);
fRunAction->histRun->fillTrackLengthDetec(5);
}
void EventAction::countingCerenkovs(G4int cphoton)
{
cerenkovPhontons += cphoton;
}
void EventAction::countingCerenkovs(G4double trackLength)
{
totalLength = trackLength;
}