ATLAS Offline Software
DecisionSvc.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 #ifndef ATHENASERVICES_DECISIONSVC_H
5 #define ATHENASERVICES_DECISIONSVC_H
6 
7 // STL includes
8 #include <string>
9 #include <vector>
10 #include <map>
11 
12 // FrameWork includes
13 #include "GaudiKernel/ISvcLocator.h"
14 #include "GaudiKernel/IAlgExecStateSvc.h"
15 
16 // Athena includes
21 #include "StoreGate/StoreGateSvc.h"
22 
23 
30 class DecisionSvc : public extends<AthService, IDecisionSvc>
31 {
32 
33 public:
34 
36  DecisionSvc(const std::string& name, ISvcLocator* pSvcLocator );
37 
39  virtual ~DecisionSvc();
40 
42 
43  virtual StatusCode initialize() override;
44  virtual StatusCode start() override;
45  virtual StatusCode finalize() override;
47 
48 
50  // Non-const methods:
52 
53 public:
55  virtual StatusCode addStream(const std::string& stream) override;
57  virtual StatusCode addAcceptAlg(const std::string& name,const std::string& stream) override;
59  virtual StatusCode addRequireAlg(const std::string& name,const std::string& stream) override;
61  virtual StatusCode addVetoAlg(const std::string& name,const std::string& stream) override;
62 
63 
65  virtual const std::vector<std::string> getAcceptAlgs(const std::string& stream) const override;
67  virtual const std::vector<std::string> getRequireAlgs(const std::string& stream) const override;
69  virtual const std::vector<std::string> getVetoAlgs(const std::string& stream) const override;
71  virtual const std::vector<std::string> getStreams() const override;
72 
73 private:
75 
76 
78  // Const methods:
80 
81 public:
83  virtual bool isEventAccepted(const std::string& stream ) const override;
84  virtual bool isEventAccepted(const std::string& stream, const EventContext& ) const override;
85 
86 private:
87 
89  std::map<std::string, std::vector<std::string> > m_stream_accept;
90  std::map<std::string, std::vector<std::string> > m_stream_require;
91  std::map<std::string, std::vector<std::string> > m_stream_veto;
92 
93  std::vector<std::string> m_streamNames;
94 
95  Gaudi::Property<bool> m_calcStats{this, "CalcStats", false};
96  bool m_frozen{false};
100 
101  StatusCode DeclareToCutFlowSvc ATLAS_NOT_THREAD_SAFE ();
102  StatusCode fillMap(std::map<std::string, std::vector<std::string> >& streamsModeMap,
103  const std::string& name,
104  const std::string& stream);
105 };
106 
107 #endif //> !ATHENASERVICES_DECISIONSVC_H
DecisionSvc::m_stream_accept
std::map< std::string, std::vector< std::string > > m_stream_accept
Maps of streams – algorithm names' vectors.
Definition: DecisionSvc.h:89
DecisionSvc::m_streamNames
std::vector< std::string > m_streamNames
Definition: DecisionSvc.h:93
DecisionSvc::getVetoAlgs
virtual const std::vector< std::string > getVetoAlgs(const std::string &stream) const override
Return list of VetoAlg names.
Definition: DecisionSvc.cxx:220
DecisionSvc::~DecisionSvc
virtual ~DecisionSvc()
Destructor.
Definition: DecisionSvc.cxx:25
DecisionSvc::DecisionSvc
DecisionSvc(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition: DecisionSvc.cxx:12
DecisionSvc::m_stream_veto
std::map< std::string, std::vector< std::string > > m_stream_veto
Definition: DecisionSvc.h:91
DecisionSvc::m_evtStore
ServiceHandle< StoreGateSvc > m_evtStore
Definition: DecisionSvc.h:97
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
DecisionSvc::m_frozen
bool m_frozen
Definition: DecisionSvc.h:96
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
DecisionSvc::m_algstateSvc
ServiceHandle< IAlgExecStateSvc > m_algstateSvc
Definition: DecisionSvc.h:99
DecisionSvc::getRequireAlgs
virtual const std::vector< std::string > getRequireAlgs(const std::string &stream) const override
Return list of RequireAlg names.
Definition: DecisionSvc.cxx:211
DecisionSvc::initialize
virtual StatusCode initialize() override
Gaudi Service Implementation.
Definition: DecisionSvc.cxx:30
DecisionSvc::addRequireAlg
virtual StatusCode addRequireAlg(const std::string &name, const std::string &stream) override
Add an algorithm to the list of RequireAlgs of a stream.
Definition: DecisionSvc.cxx:173
IDecisionSvc.h
DecisionSvc::ATLAS_NOT_THREAD_SAFE
StatusCode DeclareToCutFlowSvc ATLAS_NOT_THREAD_SAFE()
DecisionSvc::finalize
virtual StatusCode finalize() override
Definition: DecisionSvc.cxx:57
DecisionSvc::isEventAccepted
virtual bool isEventAccepted(const std::string &stream) const override
Test whether this event should be output.
Definition: DecisionSvc.cxx:235
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
DecisionSvc::interpretAlgMap
StatusCode interpretAlgMap()
Definition: DecisionSvc.cxx:64
ICutFlowSvc.h
DecisionSvc::addStream
virtual StatusCode addStream(const std::string &stream) override
Add a stream.
Definition: DecisionSvc.cxx:98
DecisionSvc::start
virtual StatusCode start() override
Definition: DecisionSvc.cxx:334
DecisionSvc::m_calcStats
Gaudi::Property< bool > m_calcStats
Definition: DecisionSvc.h:95
DecisionSvc::addAcceptAlg
virtual StatusCode addAcceptAlg(const std::string &name, const std::string &stream) override
Add an algorithm to the list of AcceptAlgs of a stream.
Definition: DecisionSvc.cxx:163
DecisionSvc
This implementes the methods for IDecisionSvc.
Definition: DecisionSvc.h:31
DecisionSvc::m_cutflowSvc
ServiceHandle< ICutFlowSvc > m_cutflowSvc
Definition: DecisionSvc.h:98
DecisionSvc::fillMap
StatusCode fillMap(std::map< std::string, std::vector< std::string > > &streamsModeMap, const std::string &name, const std::string &stream)
Definition: DecisionSvc.cxx:121
DecisionSvc::getStreams
virtual const std::vector< std::string > getStreams() const override
Return list of Streams.
Definition: DecisionSvc.cxx:195
AthService.h
DecisionSvc::addVetoAlg
virtual StatusCode addVetoAlg(const std::string &name, const std::string &stream) override
Add an algorithm to the list of VetoAlgs of a stream.
Definition: DecisionSvc.cxx:184
checker_macros.h
Define macros for attributes used to control the static checker.
DecisionSvc::getAcceptAlgs
virtual const std::vector< std::string > getAcceptAlgs(const std::string &stream) const override
Return list of AcceptAlg names.
Definition: DecisionSvc.cxx:202
StoreGateSvc.h
DecisionSvc::m_stream_require
std::map< std::string, std::vector< std::string > > m_stream_require
Definition: DecisionSvc.h:90
ServiceHandle< StoreGateSvc >