ATLAS Offline Software
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 
24 namespace EL
25 {
28  {
29  }
30 
31 
32 
34  AnaAlgorithmConfig (const std::string& val_typeAndName)
35  : AsgComponentConfig (val_typeAndName)
36  {
37  }
38 
39 
40 
42  AnaAlgorithmConfig (const AsgComponentConfig& val_config)
43  : AsgComponentConfig (val_config)
44  {
45  }
46 
47 
48 
50  useXAODs () const noexcept
51  {
52  return m_useXAODs;
53  }
54 
55 
56 
58  setUseXAODs (bool val_useXAODs) noexcept
59  {
60  m_useXAODs = val_useXAODs;
61  }
62 
63 
64 
66  isPublicTool () const noexcept
67  {
68  return m_isPublicTool;
69  }
70 
71 
72 
74  setIsPublicTool (bool val_isPublicTool) noexcept
75  {
76  m_isPublicTool = val_isPublicTool;
77  }
78 
79 
80 
82  makeAlgorithm (std::unique_ptr<AnaAlgorithm>& algorithm,
83  const AlgorithmWorkerData& workerData) const
84  {
85  using namespace msgAlgorithmConfig;
86 
87  if (m_isPublicTool == false)
88  {
89  ANA_CHECK (makeComponentExpert (algorithm, "new %1% (\"%2%\", nullptr)", true, ""));
90  algorithm->setHistogramWorker (workerData.m_histogramWorker);
91  algorithm->setTreeWorker (workerData.m_treeWorker);
92  algorithm->setFilterWorker (workerData.m_filterWorker);
93  algorithm->setWk (workerData.m_wk);
94  if (workerData.m_evtStore)
95  algorithm->setEvtStore (workerData.m_evtStore);
96  ANA_CHECK (algorithm->sysInitialize());
97  } else
98  {
99  std::unique_ptr<asg::AsgTool> tool;
100  ANA_CHECK (makeComponentExpert (tool, "new %1% (\"%2%\")", true, ""));
101  ANA_CHECK (tool->initialize());
102 
103  AnaAlgorithmConfig dummyAlg ("EL::AnaAlgorithm/DummyAlg." + name());
104  ANA_CHECK (dummyAlg.makeAlgorithm (algorithm, workerData));
105  algorithm->addCleanup (std::move (tool));
106  }
107 
108  ANA_MSG_DEBUG ("Created component of type " << type());
109  return StatusCode::SUCCESS;
110  }
111 }
EL::AlgorithmWorkerData::m_evtStore
asg::SgTEvent * m_evtStore
Definition: AlgorithmWorkerData.h:35
EL::AnaAlgorithmConfig::useXAODs
bool useXAODs() const noexcept
whether we use XAODs
Definition: AnaAlgorithmConfig.cxx:50
algorithm
std::string algorithm
Definition: hcg.cxx:82
EL::AnaAlgorithmConfig::setUseXAODs
void setUseXAODs(bool val_useXAODs) noexcept
set the value of useXAODs
Definition: AnaAlgorithmConfig.cxx:58
EL::AlgorithmWorkerData::m_wk
IWorker * m_wk
Definition: AlgorithmWorkerData.h:39
EL::AlgorithmWorkerData::m_filterWorker
IFilterWorker * m_filterWorker
Definition: AlgorithmWorkerData.h:38
EL::AnaAlgorithmConfig::m_isPublicTool
bool m_isPublicTool
the value of isPublicTool
Definition: AnaAlgorithmConfig.h:131
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
EL::AnaAlgorithmConfig
an object that can create a AnaAlgorithm
Definition: AnaAlgorithmConfig.h:29
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
EL::AnaAlgorithmConfig::m_useXAODs
bool m_useXAODs
the value of useXAODs
Definition: AnaAlgorithmConfig.h:127
EL::AnaAlgorithmConfig::setIsPublicTool
void setIsPublicTool(bool val_isPublicTool) noexcept
set the value of isPublicTool
Definition: AnaAlgorithmConfig.cxx:74
AnaAlgorithm.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
EL::AnaAlgorithmConfig::isPublicTool
bool isPublicTool() const noexcept
whether we are really a public tool
Definition: AnaAlgorithmConfig.cxx:66
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
EL::AnaAlgorithmConfig::makeAlgorithm
::StatusCode makeAlgorithm(std::unique_ptr< AnaAlgorithm > &algorithm, const AlgorithmWorkerData &workerData) const
make an algorithm from this configuration
Definition: AnaAlgorithmConfig.cxx:82
asg::AsgComponentConfig::type
const std::string & type() const noexcept
the type of the component
Definition: AsgComponentConfig.cxx:74
MessageCheck.h
AlgorithmWorkerData.h
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
EL::AlgorithmWorkerData::m_treeWorker
ITreeWorker * m_treeWorker
Definition: AlgorithmWorkerData.h:37
EL::AlgorithmWorkerData
all the external components an algorithm needs before initialization (in EventLoop)
Definition: AlgorithmWorkerData.h:34
EL::AnaAlgorithmConfig::AnaAlgorithmConfig
AnaAlgorithmConfig()
standard constructor
Definition: AnaAlgorithmConfig.cxx:27
EL::AlgorithmWorkerData::m_histogramWorker
IHistogramWorker * m_histogramWorker
Definition: AlgorithmWorkerData.h:36
asg::AsgComponentConfig::name
const std::string & name() const noexcept
the name of the component
Definition: AsgComponentConfig.cxx:90
AsgTool.h
ANA_MSG_DEBUG
#define ANA_MSG_DEBUG(xmsg)
Macro printing debug messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:288
AnaAlgorithmConfig.h