Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Types | Public Member Functions | Private Attributes | Static Private Attributes | List of all members
GlobalSim::eEmSortSelectCountContainerComparator Class Reference

#include <eEmSortSelectCountContainerComparator.h>

Inheritance diagram for GlobalSim::eEmSortSelectCountContainerComparator:
Collaboration diagram for GlobalSim::eEmSortSelectCountContainerComparator:

Public Types

using GenTobPtr = typename eEmSortSelectCountContainerPortsOut::GenTobPtr
 

Public Member Functions

 eEmSortSelectCountContainerComparator (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual ~eEmSortSelectCountContainerComparator ()=default
 
virtual StatusCode initialize () override
 
virtual StatusCode run (const EventContext &ctx) const override
 
virtual std::string toString () const override
 

Private Attributes

Gaudi::Property< bool > m_enableDump
 
SG::ReadHandleKey< GlobalSim::GepAlgoHypothesisFIFOm_HypoFIFOReadKey
 
SG::ReadHandleKey< GlobalSim::eEmSortSelectCountContainerPortsOutm_portsOutReadKey
 
SG::ReadHandleKey< GlobalSim::eEmSortSelectCountExpectationsm_eEmSortSelectCountExpectationsReadKey
 

Static Private Attributes

constexpr static auto & s_SortOutWidth
 

Detailed Description

Definition at line 24 of file eEmSortSelectCountContainerComparator.h.

Member Typedef Documentation

◆ GenTobPtr

Definition at line 28 of file eEmSortSelectCountContainerComparator.h.

Constructor & Destructor Documentation

◆ eEmSortSelectCountContainerComparator()

GlobalSim::eEmSortSelectCountContainerComparator::eEmSortSelectCountContainerComparator ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 20 of file eEmSortSelectCountContainerComparator.cxx.

22  :
23  base_class(type, name, parent){
24  }

◆ ~eEmSortSelectCountContainerComparator()

virtual GlobalSim::eEmSortSelectCountContainerComparator::~eEmSortSelectCountContainerComparator ( )
virtualdefault

Member Function Documentation

◆ initialize()

StatusCode GlobalSim::eEmSortSelectCountContainerComparator::initialize ( )
overridevirtual

Definition at line 26 of file eEmSortSelectCountContainerComparator.cxx.

26  {
27 
31 
32  return StatusCode::SUCCESS;
33  }

◆ run()

StatusCode GlobalSim::eEmSortSelectCountContainerComparator::run ( const EventContext &  ctx) const
overridevirtual

Definition at line 58 of file eEmSortSelectCountContainerComparator.cxx.

58  {
59  ATH_MSG_DEBUG("run()");
60 
61 
62  // read in input data (a FIFO) for GepAlgoHypothesis from the event store
63 
64  auto fifo =
66  ctx);
67  CHECK(fifo.isValid());
68 
69  ATH_MSG_DEBUG("read in GepAlgoHypothesis fifo ");
70 
71  auto ports_out =
74  ctx);
75  CHECK(ports_out.isValid());
76 
77  auto tcounts = TestCounts();
78  tcounts.nInputPorts = fifo->size();
79  {
80  std::stringstream ss;
81  ss << "eEmTobs from FIFO:\n";
82  for (const auto& i : *fifo) {
83  ss << eEmInputTOBToString(*(i.m_I_eEmTobs)) << '\n';
84  }
85 
86  ATH_MSG_DEBUG(ss.str());
87  }
88 
89  auto expectations =
91 
92  CHECK(expectations.isValid());
93 
94  const auto& exp_tob_bitstr = expectations->m_expected_tob_bits;
95  auto sz = exp_tob_bitstr.size();
96 
97  // break down the bit string into 8 character chunks
98  std::vector<std::bitset<32>> exp_tobs;
99  exp_tobs.reserve(sz/8);
100 
101  std::stringstream ss;
102 
103  for (std::size_t i = 2; i < sz; i += 8) {
104  ss << std::hex
105  << std::string("0x" + std::string(std::cbegin(exp_tob_bitstr)+i,
106  std::cbegin(exp_tob_bitstr)+i+8));
107  unsigned n;
108  ss >> n;
109  exp_tobs.push_back(std::bitset<32>(n));
110  ss.clear();
111 
112  }
113 
114 
115  auto ntobs = exp_tobs.size();
116  if (ntobs != ports_out->m_O_eEmGenTob.size()) {
117  ATH_MSG_ERROR("exp_tobs size " << exp_tobs.size() <<
118  " port tobs size : " << ports_out->m_O_eEmGenTob.size());
119  return StatusCode::FAILURE;
120  }
121 
122  //for some reason the tobs are delivered in reverse order. Fix this.
123  std::reverse(std::begin(exp_tobs), std::end(exp_tobs));
124 
125 
126  {
127 
128  auto fnd_tobs = ports_out->m_O_eEmGenTob;
129 
130  std::size_t idx{0};
131 
132  // compare only sorted TOBS - the the ordering of the unsorted TOBS
133  // may differ in the VHDL code
134  auto ss = std::stringstream();
135  for (;idx != fnd_tobs.size(); ++idx) {
136 
137 
138  const auto& f_tob = fnd_tobs[idx];
139  bool pass{(f_tob->as_bits().to_ulong() == exp_tobs[idx].to_ulong())};
140  ss << '\n' << idx << " found " << f_tob->as_bits() << ' '
141  << std::hex << f_tob->as_bits().to_ulong()
142  << " expected " << exp_tobs[idx] << ' '
143  << exp_tobs[idx].to_ulong()
144  << ' ' << std::boolalpha
145  << pass
146  << '\n';
147  tcounts.nOutputTobs += 1;
148  if (pass) {tcounts.nOutputTobs_pass +=1;}
149  }
150  ATH_MSG_DEBUG(ss.str());
151  }
152 
153 
154  {
155  const auto& mult_bits = ports_out-> m_O_Multiplicity;
156 
157  auto found = mult_bits->to_string();
158  auto exp_str = hexStrToBinStr((*expectations).m_expected_multiplicity_bits);
159  ATH_MSG_DEBUG("\nmultiplicity bits. found: " << found
160  << " expected: "
161  << exp_str);
162 
163  tcounts.nCounts +=1;
164  if (found == exp_str) {
165  tcounts.nCounts_pass +=1;
166  }
167  }
168 
169  if (!tcounts.success()) {
170  ATH_MSG_ERROR ("Count tests fail: " << tcounts);
171  return StatusCode::FAILURE;
172  } else {
173  ATH_MSG_DEBUG ("Count tests succeed: " << tcounts);
174  }
175 
176  return StatusCode::SUCCESS;
177  }

◆ toString()

std::string GlobalSim::eEmSortSelectCountContainerComparator::toString ( ) const
overridevirtual

Definition at line 180 of file eEmSortSelectCountContainerComparator.cxx.

180  {
181 
182  std::stringstream ss;
183  ss << "eEmSortSelectCountContainerComparator.name: " << name() << '\n'
184  << m_HypoFIFOReadKey << '\n'
186  << '\n';
187  return ss.str();
188  }

Member Data Documentation

◆ m_eEmSortSelectCountExpectationsReadKey

SG::ReadHandleKey<GlobalSim::eEmSortSelectCountExpectations> GlobalSim::eEmSortSelectCountContainerComparator::m_eEmSortSelectCountExpectationsReadKey
private
Initial value:
{
this,
"eEmSortSelectCountExpectationsReadKey",
"eEmSortSelectCountExpectations",
"key to read in eEmSortSelectCount regression test expectations"}

Definition at line 71 of file eEmSortSelectCountContainerComparator.h.

◆ m_enableDump

Gaudi::Property<bool> GlobalSim::eEmSortSelectCountContainerComparator::m_enableDump
private
Initial value:
{this,
"enableDump",
{false},
"flag to enable dumps"}

Definition at line 46 of file eEmSortSelectCountContainerComparator.h.

◆ m_HypoFIFOReadKey

SG::ReadHandleKey<GlobalSim::GepAlgoHypothesisFIFO> GlobalSim::eEmSortSelectCountContainerComparator::m_HypoFIFOReadKey
private
Initial value:
{
this,
"HypoFIFOReadKey",
"hypoFIFO",
"key to read input port data for the hypo block"}

Definition at line 53 of file eEmSortSelectCountContainerComparator.h.

◆ m_portsOutReadKey

SG::ReadHandleKey<GlobalSim::eEmSortSelectCountContainerPortsOut> GlobalSim::eEmSortSelectCountContainerComparator::m_portsOutReadKey
private
Initial value:
{
this,
"PortsOutKey",
"eEmSortSelectCount",
"key to read in output ports data"}

Definition at line 62 of file eEmSortSelectCountContainerComparator.h.

◆ s_SortOutWidth

constexpr static auto& GlobalSim::eEmSortSelectCountContainerComparator::s_SortOutWidth
staticconstexprprivate

The documentation for this class was generated from the following files:
fitman.sz
sz
Definition: fitman.py:527
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
GlobalSim::eEmInputTOBToString
std::string eEmInputTOBToString(const std::bitset< 72 > &bs)
Definition: GepAlgoHypothesisPortsIn.cxx:9
python.ext.silence.fifo
def fifo()
Definition: silence.py:37
GlobalSim::hexStrToBinStr
std::string hexStrToBinStr(std::string s)
Definition: hexStrToBinStr.cxx:12
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
DeMoUpdate.reverse
reverse
Definition: DeMoUpdate.py:563
GlobalSim::eEmSortSelectCountContainerComparator::m_portsOutReadKey
SG::ReadHandleKey< GlobalSim::eEmSortSelectCountContainerPortsOut > m_portsOutReadKey
Definition: eEmSortSelectCountContainerComparator.h:62
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
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
GlobalSim::eEmSortSelectCountContainerPortsOut::SortOutWidth
constexpr static std::size_t SortOutWidth
Definition: eEmSortSelectCountContainerPortsOut.h:34
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
checkTriggerxAOD.found
found
Definition: checkTriggerxAOD.py:328
GlobalSim::eEmSortSelectCountContainerComparator::m_eEmSortSelectCountExpectationsReadKey
SG::ReadHandleKey< GlobalSim::eEmSortSelectCountExpectations > m_eEmSortSelectCountExpectationsReadKey
Definition: eEmSortSelectCountContainerComparator.h:71
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
GlobalSim::eEmSortSelectCountContainerComparator::m_HypoFIFOReadKey
SG::ReadHandleKey< GlobalSim::GepAlgoHypothesisFIFO > m_HypoFIFOReadKey
Definition: eEmSortSelectCountContainerComparator.h:53