| # Gaudi Framework, version v23r1 |

Home |  | Generated: Wed Feb 29 2012

# Prescaler.cpp

Go to the documentation of this file.

    00001 #include "GaudiAlg/Prescaler.h"
    00002
    00003 #include "GaudiKernel/MsgStream.h"
    00004 #include "GaudiKernel/AlgFactory.h"
    00005
    00006 Prescaler::Prescaler(const std::string& name, ISvcLocator* pSvcLocator) :
    00007   GaudiAlgorithm(name, pSvcLocator) ,
    00008   m_pass( 0 ),
    00009   m_seen( 0 )
    00010 {
    00011   declareProperty( "PercentPass", m_percentPass=100.0 );
    00012   m_percentPass.verifier().setBounds( 0.0, 100.0 );
    00013 }
    00014
    00015 Prescaler::~Prescaler( )
    00016 {
    00017 }
    00018
    00019 StatusCode
    00020 Prescaler::initialize()
    00021 {
    00022   const StatusCode sc = GaudiAlgorithm::initialize();
    00023   if ( !sc) return sc;
    00024
    00025   info() << name( ) << ":Prescaler::Initialize - pass: " << m_percentPass << endmsg;
    00026
    00027  return sc;
    00028 }
    00029
    00030 StatusCode
    00031 Prescaler::execute()
    00032 {
    00033   ++m_seen;
    00034   float fraction = (float(100.0) * (float)(m_pass+1)) / (float)m_seen;
    00035   if ( fraction > m_percentPass ) {
    00036     setFilterPassed( false );
    00037     info() << name() << ":Prescaler::execute - filter failed" << endmsg;
    00038   } else {
    00039     info() << name() << ":Prescaler::execute - filter passed" << endmsg;
    00040     ++m_pass;
    00041   }
    00042   return StatusCode::SUCCESS;
    00043 }
    00044
    00045 StatusCode
    00046 Prescaler::finalize()
    00047 {
    00048   info() << name( ) << ":Prescaler::finalize - total events: "
    00049          << m_seen << ", passed events: " << m_pass << endmsg;
    00050   return GaudiAlgorithm::finalize();
    00051 }

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines