Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Prescaler.cpp
Go to the documentation of this file.
1 #include "GaudiAlg/Prescaler.h"
2 
4 
5 Prescaler::Prescaler( std::string name, ISvcLocator* pSvcLocator ) : GaudiAlgorithm( std::move( name ), pSvcLocator ) {
6  m_percentPass.verifier().setBounds( 0.0, 100.0 );
7 }
8 
11  if ( !sc ) return sc;
12 
13  info() << name() << ":Prescaler::Initialize - pass: " << m_percentPass << endmsg;
14 
15  return sc;
16 }
17 
19  ++m_seen;
20  float fraction = ( float( 100.0 ) * (float)( m_pass + 1 ) ) / (float)m_seen;
21  if ( fraction > m_percentPass ) {
22  setFilterPassed( false );
23  info() << name() << ":Prescaler::execute - filter failed" << endmsg;
24  } else {
25  info() << name() << ":Prescaler::execute - filter passed" << endmsg;
26  ++m_pass;
27  }
28  return StatusCode::SUCCESS;
29 }
30 
32  info() << name() << ":Prescaler::finalize - total events: " << m_seen << ", passed events: " << m_pass << endmsg;
33  return GaudiAlgorithm::finalize();
34 }
StatusCode initialize() override
Definition: Prescaler.cpp:9
StatusCode execute() override
standard execution method
Definition: Prescaler.cpp:18
int m_seen
Number of events seen.
Definition: Prescaler.h:36
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
Prescaler(std::string name, ISvcLocator *pSvcLocator)
Constructor(s)
Definition: Prescaler.cpp:5
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:635
StatusCode initialize() override
standard initialization method
void setFilterPassed(bool state) const
Set the filter passed flag to the specified state.
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
STL namespace.
int m_pass
Number of events passed.
Definition: Prescaler.h:31
STL class.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
StatusCode finalize() override
standard finalization method
The useful base class for data processing algorithms.
StatusCode finalize() override
Definition: Prescaler.cpp:31
Gaudi::CheckedProperty< double > m_percentPass
Percentage of events that should be passed.
Definition: Prescaler.h:25
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192