ATLAS Offline Software
EventDecisionAlg.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 // EventDecisionAlg.cxx
8 // Implementation file for class EventDecisionAlg
9 // Author: Karsten Koeneke <karsten.koeneke@cern.ch>
11 
12 // EventUtils includes
13 #include "EventDecisionAlg.h"
14 
15 // STL includes
16 
17 // FrameWork includes
18 #include "Gaudi/Property.h"
20 
21 
22 // Constructors
25  ISvcLocator* pSvcLocator ) :
26  ::AthFilterAlgorithm( name, pSvcLocator ),
27  m_decSvc("DecisionSvc/DecisionSvc", name),
28  m_streamNames()
29 {
30  declareProperty("DecisionService", m_decSvc, "The handle to the IDecisionSvc" );
31  declareProperty("OutputStreamNames", m_streamNames, "The names of all output streams to check");
32 }
33 
34 
35 // Destructor
38 {}
39 
40 
41 
42 // Athena Algorithm's Hooks
45 {
46  ATH_MSG_DEBUG ("Initializing " << name() << "...");
47 
48  // Print out the used configuration
49  ATH_MSG_DEBUG ( " using = " << m_decSvc );
50  ATH_MSG_DEBUG ( " using = " << m_streamNames );
51 
52  // Retrieve the services
53  ATH_CHECK( m_decSvc.retrieve() );
54 
55  ATH_MSG_DEBUG ( "==> done with initialize " << name() << "..." );
56  return StatusCode::SUCCESS;
57 }
58 
59 
60 
62 {
63  ATH_MSG_DEBUG ("Finalizing " << name() << "...");
64 
65  // Release all tools and services
66  ATH_CHECK( m_decSvc.release() );
67 
68  return StatusCode::SUCCESS;
69 }
70 
71 
72 
74 {
75  // Simple status message at the beginning of each event execute,
76  ATH_MSG_DEBUG ( "==> execute " << name() );
77  ATH_MSG_VERBOSE ( "Dumping event store: " << evtStore()->dump() );
78 
79  // Make the pass/fail decision
80  // Ensure that the even passes if no stream name is given
81  bool eventPasses = true;
82  for ( const std::string& streamName : m_streamNames.value() ){
83  // Ensure that the even passes if no stream name is given
84  eventPasses = false;
85  eventPasses = m_decSvc->isEventAccepted(streamName);
86  if (eventPasses){
87  ATH_MSG_DEBUG("Got an event accept from stream name " << streamName);
88  break;
89  }
90  }
91  this->setFilterPassed( eventPasses );
92  ATH_MSG_DEBUG("Event passes/fails: " << eventPasses );
93 
94  return StatusCode::SUCCESS;
95 }
AthFilterAlgorithm::setFilterPassed
virtual void setFilterPassed(bool state) const
Set the filter passed flag to the specified state.
Definition: AthFilterAlgorithm.cxx:99
EventDecisionAlg::execute
virtual StatusCode execute()
Athena algorithm's execute hook.
Definition: EventDecisionAlg.cxx:73
EventDecisionAlg::initialize
virtual StatusCode initialize()
Athena algorithm's initalize hook.
Definition: EventDecisionAlg.cxx:44
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
EventDecisionAlg::m_decSvc
ServiceHandle< IDecisionSvc > m_decSvc
Definition: EventDecisionAlg.h:58
EventDecisionAlg::~EventDecisionAlg
virtual ~EventDecisionAlg()
Destructor:
Definition: EventDecisionAlg.cxx:37
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
run_Egamma1_LArStrip_Fex.dump
dump
Definition: run_Egamma1_LArStrip_Fex.py:88
EventDecisionAlg.h
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
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
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
EventDecisionAlg::EventDecisionAlg
EventDecisionAlg(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Definition: EventDecisionAlg.cxx:24
IDecisionSvc.h
EventDecisionAlg::finalize
virtual StatusCode finalize()
Athena algorithm's finalize hook.
Definition: EventDecisionAlg.cxx:61
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
AthenaPoolExample_Copy.streamName
string streamName
Definition: AthenaPoolExample_Copy.py:39
EventDecisionAlg::m_streamNames
StringArrayProperty m_streamNames
The names of all output streams to check.
Definition: EventDecisionAlg.h:61