ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
G4Utilities
G4UserActions
src
ScoringVolumeTrackKiller.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
ScoringVolumeTrackKiller.h
"
6
7
#include <string>
8
#include <iostream>
9
10
#include "G4Step.hh"
11
#include "G4TrackVector.hh"
12
13
#include "GaudiKernel/Bootstrap.h"
14
#include "GaudiKernel/ISvcLocator.h"
15
#include "GaudiKernel/IMessageSvc.h"
16
17
namespace
G4UA
18
{
19
20
//---------------------------------------------------------------------------
21
ScoringVolumeTrackKiller::ScoringVolumeTrackKiller
()
22
:
AthMessaging
(
Gaudi
::svcLocator()->service< IMessageSvc >(
"MessageSvc"
),
23
"ScoringVolumeTrackKiller"
)
24
,
m_killCount
(0)
25
{}
26
27
//---------------------------------------------------------------------------
28
void
ScoringVolumeTrackKiller::EndOfEventAction
(
const
G4Event*)
29
{
30
ATH_MSG_INFO
(
m_killCount
<<
" tracks killed in this event "
);
31
m_killCount
= 0;
32
}
33
34
//---------------------------------------------------------------------------
35
void
ScoringVolumeTrackKiller::UserSteppingAction
(
const
G4Step* aStep)
36
{
37
G4StepPoint* preStep = aStep->GetPreStepPoint();
38
const
G4VTouchable* preTouchable = preStep->GetTouchable();
39
G4StepPoint* postStep = aStep->GetPostStepPoint();
40
const
G4VTouchable* postTouchable = postStep->GetTouchable();
41
int
preDepth = preTouchable->GetHistoryDepth();
42
int
postDepth = postTouchable->GetHistoryDepth();
43
44
std::string preName;
45
bool
preInStation =
false
;
46
for
(
int
i = 0; i < preDepth+1; i++) {
47
preName = preTouchable->GetVolume(i)->GetName();
48
if
(preName.find(
"station"
) != std::string::npos ||
49
preName.find(
"av_"
) != std::string::npos) {
50
51
preInStation =
true
;
52
break
;
53
}
54
}
55
std::string postName;
56
bool
postOutofStation =
true
;
57
bool
outOfMother =
false
;
58
for
(
int
i = 0; i < postDepth+1; i++) {
59
if
(postTouchable->GetVolume(i) != 0) {
60
postName = postTouchable->GetVolume(i)->GetName();
61
}
else
{
62
outOfMother =
true
;
63
break
;
64
}
65
if
(postName.find(
"station"
) != std::string::npos ||
66
postName.find(
"av_"
) != std::string::npos) {
67
68
postOutofStation =
false
;
69
break
;
70
}
71
}
72
if
( (preInStation && postOutofStation) || outOfMother ) {
73
aStep->GetTrack()->SetTrackStatus(fStopAndKill);
74
m_killCount
++;
75
}
76
}
77
78
}
// namespace G4UA
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
ScoringVolumeTrackKiller.h
AthMessaging::AthMessaging
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
Definition
AthMessaging.cxx:13
G4UA::ScoringVolumeTrackKiller::UserSteppingAction
virtual void UserSteppingAction(const G4Step *) override
Definition
ScoringVolumeTrackKiller.cxx:35
G4UA::ScoringVolumeTrackKiller::ScoringVolumeTrackKiller
ScoringVolumeTrackKiller()
Definition
ScoringVolumeTrackKiller.cxx:21
G4UA::ScoringVolumeTrackKiller::EndOfEventAction
virtual void EndOfEventAction(const G4Event *) override
Definition
ScoringVolumeTrackKiller.cxx:28
G4UA::ScoringVolumeTrackKiller::m_killCount
unsigned long m_killCount
Definition
ScoringVolumeTrackKiller.h:24
G4UA
for nSW
Definition
CalibrationDefaultProcessing.h:19
Gaudi
=============================================================================
Definition
CaloGPUClusterAndCellDataMonitorOptions.h:273
Generated on
for ATLAS Offline Software by
1.17.0