| The Gaudi Framework v30r0 (c919700c)

- 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 ) : GaudiAlgorithm( std::move( name ), pSvcLocator )
6 {
7 m_percentPass.verifier().setBounds( 0.0, 100.0 );
8 }
9
10 StatusCode Prescaler::initialize()
11 {
12 const StatusCode sc = GaudiAlgorithm::initialize();
13 if ( !sc ) return sc;
14
15 info() << name() << ":Prescaler::Initialize - pass: " << m_percentPass << endmsg;
16
17 return sc;
18 }
19
20 StatusCode Prescaler::execute()
21 {
22 ++m_seen;
23 float fraction = ( float( 100.0 ) * (float)( m_pass + 1 ) ) / (float)m_seen;
24 if ( fraction > m_percentPass ) {
25 setFilterPassed( false );
26 info() << name() << ":Prescaler::execute - filter failed" << endmsg;
27 } else {
28 info() << name() << ":Prescaler::execute - filter passed" << endmsg;
29 ++m_pass;
30 }
31 return StatusCode::SUCCESS;
32 }
33
34 StatusCode Prescaler::finalize()
35 {
36 info() << name() << ":Prescaler::finalize - total events: " << m_seen << ", passed events: " << m_pass << endmsg;
37 return GaudiAlgorithm::finalize();
38 }
Prescaler::initialize
StatusCode initialize() override
Definition: Prescaler.cpp:10
Prescaler::execute
StatusCode execute() override
Definition: Prescaler.cpp:20
StatusCode::SUCCESS
Definition: StatusCode.h:29
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:737
Algorithm::setFilterPassed
void setFilterPassed(bool state) const override
Set the filter passed flag to the specified state.
Definition: Algorithm.cpp:774
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:32
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:112
GaudiAlgorithm::initialize
StatusCode initialize() override
standard initialization method
Definition: GaudiAlgorithm.cpp:43
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:59
GaudiAlgorithm
The useful base class for data processing algorithms.
Definition: GaudiAlgorithm.h:94
Prescaler.h
Prescaler::finalize
StatusCode finalize() override
Definition: Prescaler.cpp:34
Prescaler::m_percentPass
Gaudi::CheckedProperty< double > m_percentPass
Percentage of events that should be passed.
Definition: Prescaler.h:31
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209