ATLAS Offline Software
JetToolRunner.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // JetToolRunner.cxx
6 
7 #include "JetRec/JetToolRunner.h"
8 #include <iomanip>
10 
11 using std::string;
12 using std::setw;
13 using std::setprecision;
14 using std::fixed;
15 
16 //**********************************************************************
17 
18 JetToolRunner::JetToolRunner(const std::string& myname):
19  AsgTool(myname){
20 }
21 
22 //**********************************************************************
23 
25  StatusCode sc;
26  ATH_MSG_INFO("Initializing " << name() << "...");
27  ATH_MSG_INFO("Retrieving tools...");
28  sc = m_evstools.retrieve();
29  if ( ! sc.isSuccess() ) {
30  ATH_MSG_ERROR("Eventshape tool retrieval failed.");
31  }
32  sc = m_exetools.retrieve();
33  if ( ! sc.isSuccess() ) {
34  ATH_MSG_ERROR("Execute tool retrieval failed.");
35  }
36  ATH_MSG_INFO("Tool retrieval completed.");
37  unsigned int ntool = m_exetools.size();
38  ATH_MSG_INFO(" Tool count: " << ntool);
39  for ( unsigned int itool=0; itool<ntool; ++itool ) {
40  ATH_MSG_INFO(" " << m_exetools[itool]->name());
41  m_exetools[itool]->print();
42  }
43  unsigned int nevstool = m_evstools.size();
44  ATH_MSG_INFO(" Tool count: " << nevstool);
45  for ( unsigned int itool=0; itool<nevstool; ++itool ) {
46  ATH_MSG_INFO(" " << m_evstools[itool]->name());
47  m_evstools[itool]->print();
48  }
49  return StatusCode::SUCCESS;
50 }
51 
52 //**********************************************************************
53 
55  ATH_MSG_INFO ("Finalizing " << name() << "...");
56  return StatusCode::SUCCESS;
57 }
58 
59 //**********************************************************************
60 
61 int JetToolRunner::execute() const {
62  ATH_MSG_VERBOSE("Executing " << name() << "...");
63  string line = "---------------------------------------------------";
64  // Loop over event shape tools.
65  unsigned int nevstool = m_evstools.size();
66  ATH_MSG_DEBUG("Looping over " << nevstool << " event shape tools.");
67  if ( nevstool ) ATH_MSG_DEBUG(line);
68  for ( unsigned int itool=0; itool<nevstool; ++itool ) {
69  ToolHandle<IEventShapeTool> htool = m_evstools[itool];
70  ATH_MSG_DEBUG("Executing tool " << htool->name());
71  ATH_MSG_VERBOSE("Retrieving tool with IEventShapeTool interface.");
72  StatusCode sc = htool->fillEventShape();
73  if ( ! sc.isSuccess() ) ATH_MSG_INFO("Events shape tool returned error.");
74  else ATH_MSG_DEBUG("Tool execution succeeded");
76  }
77  // Loop over execute tools.
78  unsigned int ntool = m_exetools.size();
79  ATH_MSG_DEBUG("Looping over " << ntool << " jet execute tools.");
80  if ( ntool ) ATH_MSG_DEBUG(line);
81  for ( unsigned int itool=0; itool<ntool; ++itool ) {
82  ToolHandle<IJetExecuteTool> htool = m_exetools[itool];
83  ATH_MSG_DEBUG("Executing tool " << htool->name());
84  ATH_MSG_VERBOSE("Retrieving tool with IJetExecuteTool interface.");
85  int jstat = htool->execute();
86  if ( jstat != 0 ) ATH_MSG_INFO("Tool returned error " << jstat);
87  else ATH_MSG_DEBUG("Tool execution succeeded");
89  }
90 
91  return 0;
92 }
93 
94 //**********************************************************************
95 
96 void JetToolRunner::print() const {
97  ATH_MSG_INFO("Properties for JetToolRunner " << name());
98  ATH_MSG_INFO(" Event Shape tool list has " << m_evstools.size() << " entries:");
99  for ( ToolHandleArray<IEventShapeTool>::const_iterator itoo=m_evstools.begin();
100  itoo!=m_evstools.end(); ++itoo ) {
101  ToolHandle<IEventShapeTool> htool = *itoo;
102  ATH_MSG_INFO(" " << htool->name());
103  }
104  ATH_MSG_INFO(" Execute tool list has " << m_exetools.size() << " entries:");
105  for ( ToolHandleArray<IJetExecuteTool>::const_iterator itoo=m_exetools.begin();
106  itoo!=m_exetools.end(); ++itoo ) {
107  ToolHandle<IJetExecuteTool> htool = *itoo;
108  ATH_MSG_INFO(" " << htool->name());
109  }
110 }
111 
112 //**********************************************************************
checkFileSG.line
line
Definition: checkFileSG.py:75
JetToolRunner::finalize
StatusCode finalize()
Definition: JetToolRunner.cxx:54
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
JetToolRunner::JetToolRunner
JetToolRunner(const std::string &myname)
Definition: JetToolRunner.cxx:18
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
JetToolRunner::initialize
StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: JetToolRunner.cxx:24
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
JetToolRunner.h
IJetExecuteTool.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
JetToolRunner::m_evstools
ToolHandleArray< IEventShapeTool > m_evstools
Definition: JetToolRunner.h:49
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
JetToolRunner::print
void print() const
Print the state of the tool.
Definition: JetToolRunner.cxx:96
JetToolRunner::m_exetools
ToolHandleArray< IJetExecuteTool > m_exetools
Definition: JetToolRunner.h:50
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
JetToolRunner::execute
int execute() const
Method to be called for each event.
Definition: JetToolRunner.cxx:61