| The Gaudi Framework v27r1

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

- File List
- File Members

Prescaler.cpp
Go to the documentation of this file.
1 #include "GaudiAlg/Prescaler.h"
2
3 #include "GaudiKernel/MsgStream.h"
4
5 Prescaler::Prescaler(std::string name, ISvcLocator* pSvcLocator) :
6 GaudiAlgorithm( std::move(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 StatusCode
15 Prescaler::initialize()
16 {
17 const StatusCode sc = GaudiAlgorithm::initialize();
18 if ( !sc) return sc;
19
20 info() << name( ) << ":Prescaler::Initialize - pass: " << m_percentPass << endmsg;
21
22 return sc;
23 }
24
25 StatusCode
26 Prescaler::execute()
27 {
28 ++m_seen;
29 float fraction = (float(100.0) * (float)(m_pass+1)) / (float)m_seen;
30 if ( fraction > m_percentPass ) {
31 setFilterPassed( false );
32 info() << name() << ":Prescaler::execute - filter failed" << endmsg;
33 } else {
34 info() << name() << ":Prescaler::execute - filter passed" << endmsg;
35 ++m_pass;
36 }
37 return StatusCode::SUCCESS;
38 }
39
40 StatusCode
41 Prescaler::finalize()
42 {
43 info() << name( ) << ":Prescaler::finalize - total events: "
44 << m_seen << ", passed events: " << m_pass << endmsg;
45 return GaudiAlgorithm::finalize();
46 }
Prescaler::initialize
StatusCode initialize() override
Definition: Prescaler.cpp:15
Prescaler::execute
StatusCode execute() override
Definition: Prescaler.cpp:26
Prescaler::m_seen
int m_seen
Number of events seen.
Definition: Prescaler.h:43
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
Prescaler::Prescaler
Prescaler(std::string name, ISvcLocator *pSvcLocator)
Constructor(s)
Definition: Prescaler.cpp:5
Prescaler::m_percentPass
DoubleProperty m_percentPass
Percentage of events that should be passed.
Definition: Prescaler.h:33
MsgStream.h
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:124
GaudiAlgorithm::initialize
StatusCode initialize() override
standard initialization method
Definition: GaudiAlgorithm.cpp:48
BoundedVerifier::setBounds
void setBounds(const T &lower, const T &upper)
Set both bounds (lower and upper) at the same time.
Definition: PropertyVerifier.h:107
std
STL namespace.
GaudiAlgorithm::declareProperty
Property * declareProperty(const std::string &name, DataObjectHandle< T > &hndl, const std::string &doc="none") const
Definition: GaudiAlgorithm.h:695
merge_files.sc
int sc
Definition: merge_files.py:167
Prescaler::m_pass
int m_pass
Number of events passed.
Definition: Prescaler.h:38
std::string
STL class.
Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:820
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
GaudiAlgorithm::finalize
StatusCode finalize() override
standard finalization method
Definition: GaudiAlgorithm.cpp:62
GaudiAlgorithm
The useful base class for data processing algorithms.
Definition: GaudiAlgorithm.h:93
PropertyWithVerifier::verifier
VERIFIER & verifier()
Definition: Property.h:401
Prescaler.h
Prescaler::finalize
StatusCode finalize() override
Definition: Prescaler.cpp:41
Algorithm::setFilterPassed
void setFilterPassed(bool state) override
Set the filter passed flag to the specified state.
Definition: Algorithm.cpp:861
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244