| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

Prescaler.cpp
Go to the documentation of this file.
1 #include "GaudiAlg/Prescaler.h"
2
3 #include "GaudiKernel/MsgStream.h"
4
5 Prescaler::Prescaler(std::string name, ISvcLocator* pSvcLocator) :
6 GaudiAlgorithm( std::move(name), pSvcLocator)
7 {
8 m_percentPass.verifier().setBounds( 0.0, 100.0 );
9 }
10
11 StatusCode
12 Prescaler::initialize()
13 {
14 const StatusCode sc = GaudiAlgorithm::initialize();
15 if ( !sc) return sc;
16
17 info() << name( ) << ":Prescaler::Initialize - pass: " << m_percentPass << endmsg;
18
19 return sc;
20 }
21
22 StatusCode
23 Prescaler::execute()
24 {
25 ++m_seen;
26 float fraction = (float(100.0) * (float)(m_pass+1)) / (float)m_seen;
27 if ( fraction > m_percentPass ) {
28 setFilterPassed( false );
29 info() << name() << ":Prescaler::execute - filter failed" << endmsg;
30 } else {
31 info() << name() << ":Prescaler::execute - filter passed" << endmsg;
32 ++m_pass;
33 }
34 return StatusCode::SUCCESS;
35 }
36
37 StatusCode
38 Prescaler::finalize()
39 {
40 info() << name( ) << ":Prescaler::finalize - total events: "
41 << m_seen << ", passed events: " << m_pass << endmsg;
42 return GaudiAlgorithm::finalize();
43 }
Prescaler::initialize
StatusCode initialize() override
Definition: Prescaler.cpp:12
Prescaler::execute
StatusCode execute() override
Definition: Prescaler.cpp:23
StatusCode::SUCCESS
Definition: StatusCode.h:30
Prescaler::m_seen
int m_seen
Number of events seen.
Definition: Prescaler.h:42
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:715
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
Prescaler::Prescaler
Prescaler(std::string name, ISvcLocator *pSvcLocator)
Constructor(s)
Definition: Prescaler.cpp:5
MsgStream.h
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:123
GaudiAlgorithm::initialize
StatusCode initialize() override
standard initialization method
Definition: GaudiAlgorithm.cpp:44
std
STL namespace.
Prescaler::m_pass
int m_pass
Number of events passed.
Definition: Prescaler.h:37
std::string
STL class.
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
GaudiAlgorithm::finalize
StatusCode finalize() override
standard finalization method
Definition: GaudiAlgorithm.cpp:58
GaudiAlgorithm
The useful base class for data processing algorithms.
Definition: GaudiAlgorithm.h:94
Prescaler.h
Prescaler::finalize
StatusCode finalize() override
Definition: Prescaler.cpp:38
Prescaler::m_percentPass
Gaudi::CheckedProperty< double > m_percentPass
Percentage of events that should be passed.
Definition: Prescaler.h:31
Algorithm::setFilterPassed
void setFilterPassed(bool state) override
Set the filter passed flag to the specified state.
Definition: Algorithm.cpp:749
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244