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 
6  GaudiAlgorithm( std::move(name), pSvcLocator)
7 {
8  m_percentPass.verifier().setBounds( 0.0, 100.0 );
9 }
10 
13 {
15  if ( !sc) return sc;
16 
17  info() << name( ) << ":Prescaler::Initialize - pass: " << m_percentPass << endmsg;
18 
19  return sc;
20 }
21 
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 
39 {
40  info() << name( ) << ":Prescaler::finalize - total events: "
41  << m_seen << ", passed events: " << m_pass << endmsg;
42  return GaudiAlgorithm::finalize();
43 }
StatusCode initialize() override
Definition: Prescaler.cpp:12
StatusCode execute() override
Definition: Prescaler.cpp:23
int m_seen
Number of events seen.
Definition: Prescaler.h:42
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:715
Prescaler(std::string name, ISvcLocator *pSvcLocator)
Constructor(s)
Definition: Prescaler.cpp:5
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
StatusCode initialize() override
standard initialization method
STL namespace.
int m_pass
Number of events passed.
Definition: Prescaler.h:37
STL class.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode finalize() override
standard finalization method
The useful base class for data processing algorithms.
StatusCode finalize() override
Definition: Prescaler.cpp:38
Gaudi::CheckedProperty< double > m_percentPass
Percentage of events that should be passed.
Definition: Prescaler.h:31
void setFilterPassed(bool state) override
Set the filter passed flag to the specified state.
Definition: Algorithm.cpp:749
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244