ATLAS Offline Software
AnaReentrantAlgorithm.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 
9 //
10 // includes
11 //
12 
14 
16 #include <stdexcept>
17 
18 #ifdef XAOD_STANDALONE
20 #endif
21 
22 //
23 // method implementations
24 //
25 
26 namespace EL
27 {
29  AnaReentrantAlgorithm (const std::string& name,
30  [[maybe_unused]] ISvcLocator *pSvcLocator)
31 #ifdef XAOD_STANDALONE
32  : AsgComponent (name)
33 #else
34  : AthReentrantAlgorithm (name, pSvcLocator)
35 #endif
36  {
37  ANA_MSG_DEBUG ("AnaReentrantAlgorithm: " << name);
38  }
39 
40 
41 
43  ~AnaReentrantAlgorithm () noexcept
44  {}
45 
46 
47 
48 #ifdef XAOD_STANDALONE
50  filterPassed() const
51  {
52  return filterWorker()->filterPassed();
53  }
54 
55 
56 
58  setFilterPassed (bool val_filterPassed)
59  {
60  filterWorker()->setFilterPassed (val_filterPassed);
61  }
62 
63 
64 
65  IFilterWorker *AnaReentrantAlgorithm ::
66  filterWorker () const
67  {
68  if (!m_filterWorker)
69  throw std::logic_error ("no filter worker set on algorithm " + name());
70  return m_filterWorker;
71  }
72 
73 
74 
75  IWorker *AnaReentrantAlgorithm ::
76  wk () const
77  {
78  if (!m_wk)
79  throw std::logic_error ("no worker set on algorithm " + name());
80  return m_wk;
81  }
82 #endif
83 
84 
85 
87  initialize ()
88  {
89  return StatusCode::SUCCESS;
90  }
91 
92 
93 
95  execute (const EventContext& /*ctx*/) const
96  {
97  return StatusCode::SUCCESS;
98  }
99 
100 
101 
103  finalize ()
104  {
105  return StatusCode::SUCCESS;
106  }
107 
108 
109 
110 #ifdef XAOD_STANDALONE
113  {
114  return initialize ();
115  }
116 
117 
118 
120  sysExecute (const EventContext& ctx)
121  {
122  return execute (ctx);
123  }
124 
125 
126 
127  ::StatusCode AnaReentrantAlgorithm ::
128  sysFinalize ()
129  {
130  return finalize ();
131  }
132 
133 
134 
136  evtStore () const
137  {
138  if (!m_evtStore)
139  throw std::logic_error ("no evtStore set on algorithm " + name());
140  return m_evtStore;
141  }
142 
143 
144 
145  void AnaReentrantAlgorithm ::
146  setEvtStore (asg::SgTEvent *val_evtStore)
147  {
148  if (m_evtStore)
149  throw std::logic_error ("set evtStore twice on algorithm " + name());
150  m_evtStore = val_evtStore;
151  }
152 
153 
154 
155  void AnaReentrantAlgorithm ::
156  setFilterWorker (IFilterWorker *val_filterWorker)
157  {
158  if (m_filterWorker)
159  throw std::logic_error ("set filter worker twice on algorithm " + name());
160  m_filterWorker = val_filterWorker;
161  }
162 
163 
164 
165  void AnaReentrantAlgorithm ::
166  setWk (IWorker *val_wk)
167  {
168  if (m_wk)
169  throw std::logic_error ("set wk twice on algorithm " + name());
170  m_wk = val_wk;
171  }
172 #endif
173 }
EL::AnaReentrantAlgorithm::finalize
virtual ::StatusCode finalize()
finalize this algorithm
Definition: AnaReentrantAlgorithm.cxx:103
EL::AnaReentrantAlgorithm::execute
virtual ::StatusCode execute(const EventContext &ctx) const
execute this algorithm
Definition: AnaReentrantAlgorithm.cxx:95
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthReentrantAlgorithm::filterPassed
virtual bool filterPassed(const EventContext &ctx) const
Definition: AthReentrantAlgorithm.h:135
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
EL::AnaReentrantAlgorithm::~AnaReentrantAlgorithm
virtual ~AnaReentrantAlgorithm() noexcept
standard (virtual) destructor
Definition: AnaReentrantAlgorithm.cxx:43
EL::AnaReentrantAlgorithm::initialize
virtual ::StatusCode initialize()
initialize this algorithm
Definition: AnaReentrantAlgorithm.cxx:87
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MessageCheck.h
macros for messaging and checking status codes
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
AthReentrantAlgorithm::sysExecute
virtual StatusCode sysExecute(const EventContext &ctx) override
Execute an algorithm.
Definition: AthReentrantAlgorithm.cxx:67
IFilterWorker.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
AthReentrantAlgorithm::sysInitialize
virtual StatusCode sysInitialize() override
Override sysInitialize.
Definition: AthReentrantAlgorithm.cxx:96
EL::AnaReentrantAlgorithm::AnaReentrantAlgorithm
AnaReentrantAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
Definition: AnaReentrantAlgorithm.cxx:29
asg::SgTEvent
Wrapper for TEvent to make it look like StoreGate.
Definition: SgTEvent.h:44
AnaReentrantAlgorithm.h
AthReentrantAlgorithm::setFilterPassed
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Definition: AthReentrantAlgorithm.h:139
ANA_MSG_DEBUG
#define ANA_MSG_DEBUG(xmsg)
Macro printing debug messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:288