ATLAS Offline Software
Loading...
Searching...
No Matches
eEmMultTestComparator.cxx
Go to the documentation of this file.
1
2/*
3 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
4*/
5
7
8#include <sstream>
9#include <algorithm>
10
11namespace GlobalSim {
12
14 ISvcLocator *pSvcLocator):
15 AthReentrantAlgorithm(name, pSvcLocator) {
16 }
17
19
20 CHECK(m_expectedTIPword_ReadKey.initialize());
22
25
26
27 return StatusCode::SUCCESS;
28 }
29
30 StatusCode
31 eEmMultTestComparator::execute(const EventContext& ctx) const {
32 ATH_MSG_DEBUG("run()");
33
34
35 // read in the expected and the generated TIP
36
37 auto expectedTIP =
39 CHECK(expectedTIP.isValid());
40
41 ATH_MSG_DEBUG("read in the expected TIP word");
42
43
44 auto generatedTIP =
46 CHECK(generatedTIP.isValid());
47
48 ATH_MSG_DEBUG("read in the generated TIP word");
49
50 auto esz = (*expectedTIP).size();
51 auto gsz = (*generatedTIP).size();
52
53 if (esz != gsz) {
54 ATH_MSG_ERROR("expected TIP and generated TIP sizes differ "
55 <<esz << ' ' << gsz);
56 return StatusCode::FAILURE;
57 }
58
59 if (*generatedTIP == *expectedTIP) {
60 ATH_MSG_DEBUG("Test passed");
61 return StatusCode::SUCCESS;
62 }
63
64
65 ATH_MSG_INFO("Expected, generated TIP word mismatch. Event "
66 << ctx.evt());
67
68 for (std::size_t i{0}; i != esz; ++i) {
69 if (generatedTIP->test(i) != expectedTIP->test(i)) {
70 ATH_MSG_INFO("TIP word postion " << i << std::boolalpha
71 << " expected " << expectedTIP->test(i)
72 << " generated " << generatedTIP->test(i));
73 }
74 }
75
76 if (m_abort_on_mismatch) {return StatusCode::FAILURE;}
77
78 return StatusCode::SUCCESS;
79 }
80
81}
82
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
#define CHECK(...)
Evaluate an expression and check for errors.
An algorithm that can be simultaneously executed in multiple threads.
virtual StatusCode initialize() override
eEmMultTestComparator(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode execute(const EventContext &ctx) const override
Gaudi::Property< bool > m_abort_on_mismatch
SG::ReadHandleKey< TIPword > m_generatedTIPword_ReadKey
SG::ReadHandleKey< TIPword > m_expectedTIPword_ReadKey
AlgTool that to test whether expected the TIP values generated by data supplied by eEmMultTestBench c...