Gaudi Framework, version v20r2

Generated: 18 Jul 2008

Prescaler Class Reference

#include <Prescaler.h>

Inheritance diagram for Prescaler:

Inheritance graph
[legend]
Collaboration diagram for Prescaler:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 5 of file Prescaler.h.

Public Member Functions

 Prescaler (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor(s).
 ~Prescaler ()
 Destructor.
StatusCode initialize ()
 standard initialization method
StatusCode execute ()
 standard execution method
StatusCode finalize ()
 standard finalization method

Private Attributes

DoubleProperty m_percentPass
 Percentage of events that should be passed.
int m_pass
 Number of events passed.
int m_seen
 Number of events seen.


Constructor & Destructor Documentation

Prescaler::Prescaler ( const std::string name,
ISvcLocator pSvcLocator 
)

Constructor(s).

Definition at line 6 of file Prescaler.cpp.

References Algorithm::declareProperty(), m_percentPass, and PropertyWithVerifier< TYPE, VERIFIER >::verifier().

00006                                                                     :
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 }

Prescaler::~Prescaler (  ) 

Destructor.

Definition at line 15 of file Prescaler.cpp.

00016 {
00017 }


Member Function Documentation

StatusCode Prescaler::initialize (  )  [virtual]

standard initialization method

See also:
Algorithm

IAlgorithm

Returns:
status code

Reimplemented from GaudiAlgorithm.

Definition at line 20 of file Prescaler.cpp.

References endreq(), GaudiCommon< Algorithm >::info(), GaudiAlgorithm::initialize(), m_percentPass, and Algorithm::name().

00021 {
00022   const StatusCode sc = GaudiAlgorithm::initialize();
00023   if ( !sc) return sc;
00024 
00025   info() << name( ) << ":Prescaler::Initialize - pass: " << m_percentPass << endreq;
00026  
00027  return sc;
00028 }

StatusCode Prescaler::execute (  )  [virtual]

standard execution method

See also:
Algorithm

IAlgorithm

Returns:
status code

Reimplemented from GaudiAlgorithm.

Definition at line 31 of file Prescaler.cpp.

References endreq(), GaudiCommon< Algorithm >::info(), m_pass, m_percentPass, m_seen, Algorithm::name(), Algorithm::setFilterPassed(), and StatusCode::SUCCESS.

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" << endreq;
00038   } else {
00039     info() << name() << ":Prescaler::execute - filter passed" << endreq;
00040     ++m_pass;
00041   }
00042   return StatusCode::SUCCESS;
00043 }

StatusCode Prescaler::finalize (  )  [virtual]

standard finalization method

See also:
Algorithm

IAlgorithm

Returns:
status code

Reimplemented from GaudiAlgorithm.

Definition at line 46 of file Prescaler.cpp.

References endreq(), GaudiAlgorithm::finalize(), GaudiCommon< Algorithm >::info(), m_pass, m_seen, and Algorithm::name().

00047 {
00048   info() << name( ) << ":Prescaler::finalize - total events: "
00049          << m_seen << ", passed events: " << m_pass << endreq;
00050   return GaudiAlgorithm::finalize();
00051 }


Member Data Documentation

DoubleProperty Prescaler::m_percentPass [private]

Percentage of events that should be passed.

Definition at line 37 of file Prescaler.h.

Referenced by execute(), initialize(), and Prescaler().

int Prescaler::m_pass [private]

Number of events passed.

Definition at line 42 of file Prescaler.h.

Referenced by execute(), and finalize().

int Prescaler::m_seen [private]

Number of events seen.

Definition at line 47 of file Prescaler.h.

Referenced by execute(), and finalize().


The documentation for this class was generated from the following files:
Generated at Fri Jul 18 12:09:01 2008 for Gaudi Framework, version v20r2 by Doxygen version 1.5.1 written by Dimitri van Heesch, © 1997-2004