ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
GaudiSequencer
src
AthPrescaler.cxx
Go to the documentation of this file.
1
2
3
/*
4
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
// AthPrescaler.cxx
8
// Implementation file for class AthPrescaler
9
// Author: S.Binet<binet@cern.ch>
11
12
#include "
AthPrescaler.h
"
13
14
AthPrescaler::AthPrescaler
(
const
std::string& name, ISvcLocator* pSvcLocator) :
15
AthAlgorithm
( name, pSvcLocator ),
16
m_pass
( 0 ),
17
m_seen
( 0 )
18
{
19
declareProperty
(
"PercentPass"
,
m_percentPass
=100.0,
20
"Percentage of events that should be passed"
);
21
m_percentPass
.verifier().setBounds( 0.0, 100.0 );
22
}
23
24
AthPrescaler::~AthPrescaler
( )
25
{}
26
27
StatusCode
28
AthPrescaler::initialize
()
29
{
30
ATH_MSG_INFO
(
"Initializing "
<< name() <<
"..."
31
<<
endmsg
32
<<
"initialize ==> pass: "
<<
m_percentPass
);
33
return
StatusCode::SUCCESS;
34
}
35
36
StatusCode
37
AthPrescaler::execute
(
const
EventContext& ctx)
38
{
39
++
m_seen
;
40
float
fraction = (float(100.0) * (float)(
m_pass
+1)) / (
float
)
m_seen
;
41
if
( fraction >
m_percentPass
) {
42
setFilterPassed
(
false
, ctx );
43
ATH_MSG_INFO
(
"execute ==> filter failed"
);
44
}
else
{
45
ATH_MSG_INFO
(
"execute ==> filter passed"
);
46
++
m_pass
;
47
}
48
return
StatusCode::SUCCESS;
49
}
50
51
StatusCode
52
AthPrescaler::finalize
()
53
{
54
ATH_MSG_INFO
(
"finalize : "
<<
endmsg
55
<<
" - total events: "
<<
m_seen
<<
endmsg
56
<<
" - passed events: "
<<
m_pass
);
57
58
return
StatusCode::SUCCESS;
59
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
AthPrescaler.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::setFilterPassed
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Definition
AthCommonAlgorithm.h:99
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthPrescaler::execute
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
Definition
AthPrescaler.cxx:37
AthPrescaler::initialize
virtual StatusCode initialize() override
Definition
AthPrescaler.cxx:28
AthPrescaler::AthPrescaler
AthPrescaler(const std::string &name, ISvcLocator *pSvcLocator)
Constructor(s).
Definition
AthPrescaler.cxx:14
AthPrescaler::~AthPrescaler
~AthPrescaler()
Destructor.
Definition
AthPrescaler.cxx:24
AthPrescaler::m_seen
int m_seen
Number of events seen.
Definition
AthPrescaler.h:60
AthPrescaler::finalize
virtual StatusCode finalize() override
Definition
AthPrescaler.cxx:52
AthPrescaler::m_pass
int m_pass
Number of events passed.
Definition
AthPrescaler.h:55
AthPrescaler::m_percentPass
Gaudi::CheckedProperty< double > m_percentPass
Percentage of events that should be passed.
Definition
AthPrescaler.h:50
Generated on
for ATLAS Offline Software by
1.17.0