| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

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

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Prescaler.cpp
Go to the documentation of this file.
1 #include "GaudiAlg/Prescaler.h"
2
3 #include "GaudiKernel/MsgStream.h"
4
5 Prescaler::Prescaler(const std::string& name, ISvcLocator* pSvcLocator) :
6 GaudiAlgorithm(name, pSvcLocator) ,
7 m_pass( 0 ),
8 m_seen( 0 )
9 {
10 declareProperty( "PercentPass", m_percentPass=100.0 );
11 m_percentPass.verifier().setBounds( 0.0, 100.0 );
12 }
13
14 Prescaler::~Prescaler( )
15 {
16 }
17
18 StatusCode
19 Prescaler::initialize()
20 {
21 const StatusCode sc = GaudiAlgorithm::initialize();
22 if ( !sc) return sc;
23
24 info() << name( ) << ":Prescaler::Initialize - pass: " << m_percentPass << endmsg;
25
26 return sc;
27 }
28
29 StatusCode
30 Prescaler::execute()
31 {
32 ++m_seen;
33 float fraction = (float(100.0) * (float)(m_pass+1)) / (float)m_seen;
34 if ( fraction > m_percentPass ) {
35 setFilterPassed( false );
36 info() << name() << ":Prescaler::execute - filter failed" << endmsg;
37 } else {
38 info() << name() << ":Prescaler::execute - filter passed" << endmsg;
39 ++m_pass;
40 }
41 return StatusCode::SUCCESS;
42 }
43
44 StatusCode
45 Prescaler::finalize()
46 {
47 info() << name( ) << ":Prescaler::finalize - total events: "
48 << m_seen << ", passed events: " << m_pass << endmsg;
49 return GaudiAlgorithm::finalize();
50 }