ATLAS Offline Software
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 
11 namespace GlobalSim {
12 
14  ISvcLocator *pSvcLocator):
15  AthReentrantAlgorithm(name, pSvcLocator) {
16  }
17 
19 
22 
25 
26 
27  return StatusCode::SUCCESS;
28  }
29 
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 
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
eEmMultTestComparator.h
GlobalSim::eEmMultTestComparator::m_generatedTIPword_ReadKey
SG::ReadHandleKey< TIPword > m_generatedTIPword_ReadKey
Definition: eEmMultTestComparator.h:49
GlobalSim::eEmMultTestComparator::m_expectedTIPword_ReadKey
SG::ReadHandleKey< TIPword > m_expectedTIPword_ReadKey
Definition: eEmMultTestComparator.h:40
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:74
GlobalSim::eEmMultTestComparator::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: eEmMultTestComparator.cxx:31
GlobalSim
AlgTool that to test whether expected the TIP values generated by data supplied by eEmMultTestBench c...
Definition: CommonSelector.cxx:8
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
GlobalSim::eEmMultTestComparator::initialize
virtual StatusCode initialize() override
Definition: eEmMultTestComparator.cxx:18
GlobalSim::eEmMultTestComparator::m_abort_on_mismatch
Gaudi::Property< bool > m_abort_on_mismatch
Definition: eEmMultTestComparator.h:57
GlobalSim::eEmMultTestComparator::eEmMultTestComparator
eEmMultTestComparator(const std::string &name, ISvcLocator *pSvcLocator)
Definition: eEmMultTestComparator.cxx:13