ATLAS Offline Software
AthPrescaler.cxx
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // AthPrescaler.cxx
8 // Implementation file for class AthPrescaler
9 // Author: S.Binet<binet@cern.ch>
11 
12 #include "AthPrescaler.h"
13 
14 AthPrescaler::AthPrescaler(const std::string& name, ISvcLocator* pSvcLocator) :
15  AthAlgorithm( name, pSvcLocator ),
16  m_pass( 0 ),
17  m_seen( 0 )
18 {
19  declareProperty( "PercentPass", m_percentPass=100.0,
20  "Percentage of events that should be passed" );
21  m_percentPass.verifier().setBounds( 0.0, 100.0 );
22 }
23 
25 {}
26 
29 {
30  ATH_MSG_INFO ("Initializing " << name() << "..."
31  << endmsg
32  << "initialize ==> pass: " << m_percentPass);
33  return StatusCode::SUCCESS;
34 }
35 
38 {
39  ++m_seen;
40  float fraction = (float(100.0) * (float)(m_pass+1)) / (float)m_seen;
41  if ( fraction > m_percentPass ) {
42  setFilterPassed( false );
43  ATH_MSG_INFO ("execute ==> filter failed");
44  } else {
45  ATH_MSG_INFO ("execute ==> filter passed");
46  ++m_pass;
47  }
48  return StatusCode::SUCCESS;
49 }
50 
53 {
54  ATH_MSG_INFO ("finalize : " << endmsg
55  << " - total events: " << m_seen << endmsg
56  << " - passed events: " << m_pass);
57 
58  return StatusCode::SUCCESS;
59 }
AthPrescaler::execute
StatusCode execute()
Definition: AthPrescaler.cxx:37
AthPrescaler.h
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthPrescaler::~AthPrescaler
~AthPrescaler()
Destructor.
Definition: AthPrescaler.cxx:24
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
AthPrescaler::finalize
StatusCode finalize()
Definition: AthPrescaler.cxx:52
AthPrescaler::m_seen
int m_seen
Number of events seen.
Definition: AthPrescaler.h:60
AthPrescaler::AthPrescaler
AthPrescaler(const std::string &name, ISvcLocator *pSvcLocator)
Constructor(s)
Definition: AthPrescaler.cxx:14
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgorithm
Definition: AthAlgorithm.h:47
AthPrescaler::initialize
StatusCode initialize()
Definition: AthPrescaler.cxx:28
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
AthPrescaler::m_pass
int m_pass
Number of events passed.
Definition: AthPrescaler.h:55
AthPrescaler::m_percentPass
Gaudi::CheckedProperty< double > m_percentPass
Percentage of events that should be passed.
Definition: AthPrescaler.h:50
readCCLHist.float
float
Definition: readCCLHist.py:83