Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
geant4-projects
cosmic-rays
Commits
af13ef22
Commit
af13ef22
authored
Jul 24, 2019
by
MARCOS ANTONIO DE OLIVEIRA DEROS
Browse files
print hits at the end of event
parent
89e565e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/B1EventAction.cc
View file @
af13ef22
...
...
@@ -29,9 +29,16 @@
#include "B1EventAction.hh"
#include "B1RunAction.hh"
#include "B1Hits.hh"
#include "G4Event.hh"
#include "G4RunManager.hh"
#include "G4EventManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4VHitsCollection.hh"
#include "G4SDManager.hh"
#include "G4SystemOfUnits.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
...
...
@@ -39,7 +46,7 @@ B1EventAction::B1EventAction(B1RunAction* runAction)
:
G4UserEventAction
(),
fRunAction
(
runAction
),
fEdep
(
0.
)
{}
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
...
...
@@ -48,17 +55,40 @@ B1EventAction::~B1EventAction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void
B1EventAction
::
BeginOfEventAction
(
const
G4Event
*
)
{
void
B1EventAction
::
BeginOfEventAction
(
const
G4Event
*
event
)
{
fEdep
=
0.
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void
B1EventAction
::
EndOfEventAction
(
const
G4Event
*
)
{
void
B1EventAction
::
EndOfEventAction
(
const
G4Event
*
event
)
{
// accumulate statistics in run action
fRunAction
->
AddEdep
(
fEdep
);
static
int
CHCID
=
-
1
;
if
(
CHCID
<
0
)
{
CHCID
=
G4SDManager
::
GetSDMpointer
()
->
GetCollectionID
(
"HitCollection"
);
//Descobrir isso
}
G4HCofThisEvent
*
HCE
=
event
->
GetHCofThisEvent
();
B1HitsCollection
*
HitsCol
=
0
;
if
(
HCE
)
{
HitsCol
=
(
B1HitsCollection
*
)(
HCE
->
GetHC
(
CHCID
));
}
if
(
HitsCol
)
{
int
n_hit
=
HitsCol
->
entries
();
G4cout
<<
"My detector has "
<<
n_hit
<<
"hits"
<<
G4endl
;
for
(
int
i1
=
0
;
i1
<
n_hit
;
i1
++
)
{
B1Hits
*
hit
=
(
*
HitsCol
)[
i1
];
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment