ATLAS Offline Software
Simulation
G4Extensions
G4CosmicFilter
src
G4CosmicAndFilter.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 "
G4CosmicFilter/G4CosmicAndFilter.h
"
6
#include "
MCTruth/TrackHelper.h
"
7
#include "
TrackRecord/TrackRecordCollection.h
"
8
#include "G4RunManager.hh"
9
#include "G4Event.hh"
10
11
#include "
StoreGate/ReadHandle.h
"
12
13
#include "GaudiKernel/Bootstrap.h"
14
#include "GaudiKernel/ISvcLocator.h"
15
#include "GaudiKernel/IMessageSvc.h"
16
17
namespace
G4UA
18
{
19
20
G4CosmicAndFilter::G4CosmicAndFilter
(
const
Config
&
config
)
21
:
AthMessaging
(
Gaudi
::svcLocator()->service< IMessageSvc >(
"MessageSvc"
),
"G4CosmicAndFilter"
),
22
m_config(
config
), m_report()
23
{
24
}
25
26
void
G4CosmicAndFilter::EndOfEventAction
(
const
G4Event*)
27
{
28
29
m_report
.
ntot
++;
30
int
counter
(0);
31
SG::ReadHandle <TrackRecordCollection>
coll(
m_config
.
collectionName
);
32
if
(! coll.
isValid
())
33
{
34
ATH_MSG_WARNING
(
"Cannot retrieve TrackRecordCollection "
<<
m_config
.
collectionName
);
35
}
36
else
37
{
38
counter
= coll->
size
();
39
}
40
41
if
(
counter
==0)
42
{
43
ATH_MSG_INFO
(
"aborting event due to failing AND filter"
);
44
G4RunManager::GetRunManager()->AbortEvent();
45
return
;
46
}
47
48
SG::ReadHandle <TrackRecordCollection>
coll2(
m_config
.
collectionName2
);
49
if
(! coll2.
isValid
())
50
{
51
ATH_MSG_INFO
(
"Cannot retrieve TrackRecordCollection "
<<
m_config
.
collectionName2
);
52
}
53
else
54
{
55
counter
= coll2->
size
();
56
}
57
58
if
(
counter
==0)
59
{
60
ATH_MSG_INFO
(
"aborting event due to failing AND filter"
);
61
G4RunManager::GetRunManager()->AbortEvent();
62
return
;
63
}
64
65
m_report
.
npass
++;
66
return
;
67
68
}
69
70
}
// namespace G4UA
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition:
AthMsgStreamMacros.h:31
G4UA
for nSW
Definition:
CalibrationDefaultProcessing.h:19
SG::ReadHandle
Definition:
StoreGate/StoreGate/ReadHandle.h:70
TrackHelper.h
config
Definition:
PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
G4UA::G4CosmicAndFilter::Config
Definition:
G4CosmicAndFilter.h:25
G4UA::G4CosmicAndFilter::EndOfEventAction
virtual void EndOfEventAction(const G4Event *) override
Definition:
G4CosmicAndFilter.cxx:26
G4UA::G4CosmicAndFilter::Config::collectionName
std::string collectionName
Definition:
G4CosmicAndFilter.h:26
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition:
AthMessaging.h:55
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
G4UA::G4CosmicAndFilter::m_report
Report m_report
Definition:
G4CosmicAndFilter.h:50
G4UA::G4CosmicAndFilter::Config::collectionName2
std::string collectionName2
Definition:
G4CosmicAndFilter.h:27
G4UA::G4CosmicAndFilter::G4CosmicAndFilter
G4CosmicAndFilter(const Config &config)
Definition:
G4CosmicAndFilter.cxx:20
TrackRecordCollection.h
G4CosmicAndFilter.h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition:
AthMsgStreamMacros.h:32
G4UA::G4CosmicAndFilter::m_config
Config m_config
Definition:
G4CosmicAndFilter.h:49
Gaudi
=============================================================================
Definition:
CaloGPUClusterAndCellDataMonitorOptions.h:273
AtlasHitsVector::size
size_type size() const
Definition:
AtlasHitsVector.h:143
ReadHandle.h
Handle class for reading from StoreGate.
test_pyathena.counter
counter
Definition:
test_pyathena.py:15
G4UA::G4CosmicAndFilter::Report::ntot
int ntot
Definition:
G4CosmicAndFilter.h:32
G4UA::G4CosmicAndFilter::Report::npass
int npass
Definition:
G4CosmicAndFilter.h:33
Generated on Thu Jul 4 2024 21:16:04 for ATLAS Offline Software by
1.8.18