ATLAS Offline Software
CutAlg.cxx
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // CutAlg.cxx
8 // Implementation file for class CutAlg
9 // Author: Karsten Koeneke <karsten.koeneke@cern.ch>
11 
12 // EventUtils includes
13 #include "CutAlg.h"
14 
15 // STL includes
16 
17 // FrameWork includes
18 #include "Gaudi/Property.h"
20 
22 // Public methods:
24 
25 // Constructors
27 CutAlg::CutAlg( const std::string& name,
28  ISvcLocator* pSvcLocator ) :
30  m_cut(""),
31  m_nEventsProcessed(0)
32 {
33  declareProperty("Cut", m_cut="", "The cut expression" );
34 }
35 
36 
37 
38 // Destructor
41 {}
42 
43 
44 
45 // Athena Algorithm's Hooks
48 {
49  ATH_MSG_DEBUG ("Initializing " << name() << "...");
50 
51  // Print out the used configuration
52  ATH_MSG_DEBUG ( " using = " << m_trigDecisionTool );
53  ATH_MSG_DEBUG ( " using = " << m_cut );
54 
55  // Initialize the counters to zero
56  m_nEventsProcessed = 0 ;
57 
58  if (!m_cut.value().empty()) {
59  ATH_CHECK( initializeParser(m_cut.value()) );
60  }
61 
62  ATH_MSG_DEBUG ( "==> done with initialize " << name() << "..." );
63 
64  return StatusCode::SUCCESS;
65 }
66 
67 
68 
70 {
71  ATH_MSG_DEBUG ("Finalizing " << name() << "...");
72 
73  // Release all tools and services
75  return StatusCode::SUCCESS;
76 }
77 
78 
79 
81 {
82  // Increase the event counter
84 
85  // Simple status message at the beginning of each event execute,
86  ATH_MSG_DEBUG ( "==> execute " << name() << " on " << m_nEventsProcessed << ". event..." );
87  ATH_MSG_VERBOSE ( "Dumping event store: " << evtStore()->dump() );
88 
89  // Make the pass/fail decision
90  bool eventPasses = true;
91  if (m_parser) eventPasses = m_parser->evaluateAsBool();
92  this->setFilterPassed( eventPasses );
93  ATH_MSG_DEBUG("Event passes/fails: " << eventPasses );
94 
95  return StatusCode::SUCCESS;
96 }
CutAlg::m_cut
StringProperty m_cut
The cut string.
Definition: CutAlg.h:56
ExpressionParserUserBase< ::AthFilterAlgorithm, 1 >::finalizeParser
StatusCode finalizeParser()
AthFilterAlgorithm::setFilterPassed
virtual void setFilterPassed(bool state) const
Set the filter passed flag to the specified state.
Definition: AthFilterAlgorithm.cxx:99
StackElement.h
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
ExpressionParserUserBase< ::AthFilterAlgorithm, 1 >::m_parser
std::conditional< NUM_PARSER==1, std::unique_ptr< ExpressionParsing::ExpressionParser >, std::array< std::unique_ptr< ExpressionParsing::ExpressionParser >, NUM_PARSER > >::type m_parser
Definition: ExpressionParserUser.h:100
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
ExpressionParserUserWithTrigSupport<::AthFilterAlgorithm >::initializeParser
StatusCode initializeParser(ExpressionParsing::SelectionArg< 1 > selection_string)
Definition: ExpressionParserUserWithTrigSupport.h:25
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
AthFilterAlgorithm
Definition: AthFilterAlgorithm.h:26
CutAlg::~CutAlg
virtual ~CutAlg()
Destructor:
Definition: CutAlg.cxx:40
CutAlg::CutAlg
CutAlg(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Definition: CutAlg.cxx:27
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CutAlg.h
CutAlg::m_nEventsProcessed
unsigned long m_nEventsProcessed
Internal event counter.
Definition: CutAlg.h:59
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
python.ChapPy.dump
def dump(buf, stdout=sys.stdout)
Definition: ChapPy.py:25
ExpressionParserUserWithTrigSupport<::AthFilterAlgorithm >::m_trigDecisionTool
ToolHandle< Trig::TrigDecisionTool > m_trigDecisionTool
The trigger decision tool.
Definition: ExpressionParserUserWithTrigSupport.h:46
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
ExpressionParserUserWithTrigSupport
Definition: ExpressionParserUserWithTrigSupport.h:16
CutAlg::execute
virtual StatusCode execute()
Athena algorithm's execute hook.
Definition: CutAlg.cxx:80
CutAlg::finalize
virtual StatusCode finalize()
Athena algorithm's finalize hook.
Definition: CutAlg.cxx:69
CutAlg::initialize
virtual StatusCode initialize()
Athena algorithm's initalize hook.
Definition: CutAlg.cxx:47