ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigHypothesis
TrigHLTJetHypoUnitTests
exerciser
JetHypoExerciserAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrigHLTJetHypoUnitTests/JetHypoExerciserAlg.h
"
6
#include "
TrigHLTJetHypo/ITrigJetHypoToolHelper.h
"
7
#include "
TrigHLTJetHypo/TrigHLTJetHypoUtils/HypoJetDefs.h
"
8
#include "
TrigHLTJetHypoUnitTests/../src/TLorentzVectorFactory.h
"
9
#include "
TrigHLTJetHypoUnitTests/../src/TLorentzVectorAsIJet.h
"
10
#include "
TrigHLTJetHypo/../src/DebugInfoCollector.h
"
11
#include "
TrigHLTJetHypo/../src/xAODJetCollector.h
"
12
#include "
TrigHLTJetHypo/TrigHLTJetHypoUtils/lineSplitter.h
"
13
14
#include <fstream>
15
#include <sstream>
16
17
std::ostream&
operator<<
( std::ostream& s, std::pair<double, double > p )
18
{
19
s << p.first <<
" "
<< p.second;
20
return
s;
21
}
22
23
JetHypoExerciserAlg::JetHypoExerciserAlg
(
const
std::string& name,
24
ISvcLocator* pSvcLocator) :
25
AthAlgorithm
(name, pSvcLocator){
26
}
27
28
JetHypoExerciserAlg::~JetHypoExerciserAlg
(){}
29
30
31
StatusCode
JetHypoExerciserAlg::initialize
() {
32
33
ATH_MSG_INFO
(
"initialize()"
);
34
35
36
ATH_MSG_INFO
37
(
" "
<<
m_helper
.propertyName()
38
<<
" = "
<<
m_helper
.type());
39
40
if
(
m_helper
.retrieve().isFailure() ) {
41
ATH_MSG_FATAL
42
(
m_helper
.propertyName() <<
": Failed to retrieve tool "
43
<<
m_helper
.type());
44
return
StatusCode::FAILURE;
45
}
else
{
46
ATH_MSG_INFO
47
(
m_helper
.propertyName() <<
": Retrieved tool "
48
<<
m_helper
.type());
49
}
50
51
DebugInfoCollector
collector(name());
52
CHECK
(
m_helper
->getDescription(collector));
53
auto
s = collector.
toString
();
54
s +=
'\n'
+
m_generator
->toString();
55
56
for
(
const
auto
& l :
lineSplitter
(s)){
57
ATH_MSG_INFO
(l);
58
}
59
60
if
(
m_visitDebug
){
61
std::ofstream outfile;
62
outfile.open(
m_logname
);
63
outfile << s;
64
}
65
66
return
StatusCode::SUCCESS;
67
}
68
69
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
70
71
StatusCode
JetHypoExerciserAlg::execute
(
const
EventContext&
/*ctx*/
) {
72
73
// Part 1: print where you are
74
ATH_MSG_INFO
(
"execute()"
);
75
++
m_ncall
;
76
77
// make a HypoJet, add to vector and send to helper tool
78
79
HypoJetVector
jv =
m_generator
->get();
80
81
std::unique_ptr<ITrigJetHypoInfoCollector> debugInfoCollector(
nullptr
);
82
if
(
m_visitDebug
){
83
auto
collectorName = name() +
"debugInfoCollector"
;
84
debugInfoCollector.reset(
new
DebugInfoCollector
(collectorName));
85
}
86
87
xAODJetCollector
jetCollector;
88
89
ATH_MSG_INFO
(
"Event pass "
90
<<
m_helper
->pass(jv, jetCollector, debugInfoCollector));
91
92
std::stringstream
ss
;
93
ss
<<
"========= ncall: "
<<
m_ncall
<<
"==========\n"
;
94
if
(
m_visitDebug
)
ss
<< debugInfoCollector->toString() +
'\n'
;
95
auto
s =
ss
.str();
96
std::ofstream outfile;
97
outfile.open(
m_logname
, std::ios_base::app);
98
outfile << s;
99
return
StatusCode::SUCCESS;
100
}
101
102
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
103
104
StatusCode
JetHypoExerciserAlg::finalize
() {
105
106
// Part 1: print where you are
107
ATH_MSG_INFO
(
"finalize()"
);
108
109
return
StatusCode::SUCCESS;
110
}
111
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
DebugInfoCollector.h
HypoJetDefs.h
HypoJetVector
std::vector< pHypoJet > HypoJetVector
Definition
HypoJetDefs.h:27
ITrigJetHypoToolHelper.h
operator<<
std::ostream & operator<<(std::ostream &s, std::pair< double, double > p)
Definition
JetHypoExerciserAlg.cxx:17
JetHypoExerciserAlg.h
ss
static Double_t ss
Definition
LArPhysWaveHECTool.cxx:37
TLorentzVectorAsIJet.h
TLorentzVectorFactory.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
DebugInfoCollector
Definition
DebugInfoCollector.h:13
DebugInfoCollector::toString
virtual std::string toString() const override
Definition
DebugInfoCollector.cxx:70
JetHypoExerciserAlg::m_visitDebug
Gaudi::Property< bool > m_visitDebug
Definition
JetHypoExerciserAlg.h:38
JetHypoExerciserAlg::execute
StatusCode execute(const EventContext &ctx)
Execute method.
Definition
JetHypoExerciserAlg.cxx:71
JetHypoExerciserAlg::initialize
StatusCode initialize()
Definition
JetHypoExerciserAlg.cxx:31
JetHypoExerciserAlg::m_ncall
std::size_t m_ncall
Definition
JetHypoExerciserAlg.h:43
JetHypoExerciserAlg::JetHypoExerciserAlg
JetHypoExerciserAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
JetHypoExerciserAlg.cxx:23
JetHypoExerciserAlg::finalize
StatusCode finalize()
Definition
JetHypoExerciserAlg.cxx:104
JetHypoExerciserAlg::m_logname
Gaudi::Property< std::string > m_logname
Definition
JetHypoExerciserAlg.h:41
JetHypoExerciserAlg::~JetHypoExerciserAlg
virtual ~JetHypoExerciserAlg()
Definition
JetHypoExerciserAlg.cxx:28
JetHypoExerciserAlg::m_helper
ToolHandle< ITrigJetHypoToolHelper > m_helper
Definition
JetHypoExerciserAlg.h:30
JetHypoExerciserAlg::m_generator
ToolHandle< IHypoJetVectorGenerator > m_generator
Definition
JetHypoExerciserAlg.h:33
xAODJetCollector
Definition
xAODJetCollector.h:20
lineSplitter
std::vector< std::string > lineSplitter(const std::string &s, char delimiter)
Definition
lineSplitter.cxx:8
lineSplitter.h
xAODJetCollector.h
Generated on
for ATLAS Offline Software by
1.17.0