ATLAS Offline Software
Loading...
Searching...
No Matches
AnaAlgorithmConfig.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
18#include <AsgTools/AsgTool.h>
19
20//
21// method implementations
22//
23
24namespace EL
25{
26 AnaAlgorithmConfig ::
27 AnaAlgorithmConfig () = default;
28
29
30
31 AnaAlgorithmConfig ::
32 AnaAlgorithmConfig (const std::string& val_typeAndName)
33 : AsgComponentConfig (val_typeAndName)
34 {
35 }
36
37
38
39 AnaAlgorithmConfig ::
40 AnaAlgorithmConfig (const AsgComponentConfig& val_config)
41 : AsgComponentConfig (val_config)
42 {
43 }
44
45
46
47 bool AnaAlgorithmConfig ::
48 useXAODs () const noexcept
49 {
50 return m_useXAODs;
51 }
52
53
54
55 void AnaAlgorithmConfig ::
56 setUseXAODs (bool val_useXAODs) noexcept
57 {
58 m_useXAODs = val_useXAODs;
59 }
60
61
62
63 bool AnaAlgorithmConfig ::
64 isPublicTool () const noexcept
65 {
66 return m_isPublicTool;
67 }
68
69
70
71 void AnaAlgorithmConfig ::
72 setIsPublicTool (bool val_isPublicTool) noexcept
73 {
74 m_isPublicTool = val_isPublicTool;
75 }
76
77
78
79 ::StatusCode AnaAlgorithmConfig ::
80 makeAlgorithm (std::unique_ptr<AnaAlgorithm>& algorithm,
81 const AlgorithmWorkerData& workerData) const
82 {
83 using namespace msgAlgorithmConfig;
84
85 if (m_isPublicTool == false)
86 {
87 ANA_CHECK (makeComponentExpert (algorithm, "new %1% (\"%2%\", nullptr)", true, ""));
88 algorithm->setHistogramWorker (workerData.m_histogramWorker);
89 algorithm->setTreeWorker (workerData.m_treeWorker);
90 algorithm->setFilterWorker (workerData.m_filterWorker);
91 algorithm->setWk (workerData.m_wk);
92 if (workerData.m_evtStore)
93 algorithm->setEvtStore (workerData.m_evtStore);
94 ANA_CHECK (algorithm->sysInitialize());
95 } else
96 {
97 std::unique_ptr<asg::AsgTool> tool;
98 ANA_CHECK (makeComponentExpert (tool, "new %1% (\"%2%\")", true, ""));
99 ANA_CHECK (tool->initialize());
100
101 AnaAlgorithmConfig dummyAlg ("EL::AnaAlgorithm/DummyAlg." + name());
102 ANA_CHECK (dummyAlg.makeAlgorithm (algorithm, workerData));
103 algorithm->addCleanup (std::move (tool));
104 }
105
106 ANA_MSG_DEBUG ("Created component of type " << type());
107 return StatusCode::SUCCESS;
108 }
109}
#define ANA_MSG_DEBUG(xmsg,...)
Macro printing debug messages.
#define ANA_CHECK(EXP)
check whether the given expression was successful
bool m_isPublicTool
the value of isPublicTool
AnaAlgorithmConfig()
standard constructor
bool m_useXAODs
the value of useXAODs
::StatusCode makeAlgorithm(std::unique_ptr< AnaAlgorithm > &algorithm, const AlgorithmWorkerData &workerData) const
make an algorithm from this configuration
const std::string & name() const noexcept
the name of the component
const std::string & type() const noexcept
the type of the component
AsgComponentConfig()=default
standard constructor
std::string algorithm
Definition hcg.cxx:87
This module defines the arguments passed from the BATCH driver to the BATCH worker.
::StatusCode StatusCode
StatusCode definition for legacy code.
all the external components an algorithm needs before initialization (in EventLoop)
IHistogramWorker * m_histogramWorker