ATLAS Offline Software
Loading...
Searching...
No Matches
PU1Suppression.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4// PU1suppression.cxx
5#include "PU1Suppression.h"
6
7#include "GaudiKernel/MsgStream.h"
8#include "GaudiKernel/StatusCode.h"
9#include "PU1SuppPortsIn.h"
10#include "PU1SuppPortsOut.h"
11
12#include "PU1SuppLUT.h" //MED_LUT
13#include <bitset>
14#include <string>
15#include <sstream>
16#include <ios> //std::hex
17#include <iomanip> //std::setfill
18#include <utility> //std::move
19
20namespace GlobalSim {
21
22StatusCode runPU1Suppression(const PU1SuppPortsIn& input,
23 PU1SuppPortsOut& output, MsgStream& msg) {
24
25 // Create our four 64-bit TOBs from the input array
26 std::vector<std::bitset<64>> tobBits(4);
27 for (int i = 0; i < 4; ++i) {
28 tobBits[i] = std::bitset<64>(input.m_I_PU1TobData[i]);
29 }
30
31 // Pass to the core suppression logic with the LUT and rho value
32 const StatusCode runOK = runSimulation(tobBits, MED_LUT, input.m_rho, msg);
33 if (runOK.isFailure()) {
34 msg << MSG::WARNING << "runPU1Suppression: runSimulation failed" << endmsg;
35 return StatusCode::FAILURE;
36 }
37
38 // Store the processed output TOB as a single 256-bit hex string
39 output.m_outputTobs.clear();
40 std::string remadeHex = remakeFullNumberToHex(tobBits, msg);
41
42 // Add in catch to pass on the default TOB back into the event store rather
43 // than empty string
44 if (remadeHex.empty()) {
45 msg << MSG::WARNING
46 << "runPU1Suppression: issue with input TOB - pushing back input TOB"
47 << endmsg;
48 std::stringstream ss;
49 ss << std::hex << std::setfill('0');
50 for (int i = 0; i < 4; ++i) {
51 ss << std::setw(16) << input.m_I_PU1TobData[i];
52 }
53 output.m_outputTobs.push_back(ss.str());
54 return StatusCode::SUCCESS; // After this, downstream gets at least some
55 // TOB back
56 }
57 output.m_outputTobs.push_back(std::move(remadeHex));
58 return StatusCode::SUCCESS;
59}
60} // namespace GlobalSim
#define endmsg
static Double_t ss
Defines the data structure for PU1 Suppression algorithm inputs.
Defines the output structure for PU1 suppression results.
Interface for the PU1 suppression algorithm logic.
AlgTool that to test whether expected the TIP values generated by data supplied by eEmMultTestBench c...
std::string remakeFullNumberToHex(const std::vector< std::bitset< 64 > > &number, MsgStream &msg)
Converts a vector of 4x 64-bit TOBs to a 64-character hex string.
const std::vector< std::vector< et_type > > MED_LUT
Definition PU1SuppLUT.h:21
StatusCode runSimulation(std::vector< std::bitset< 64 > > &entry, const std::vector< std::vector< et_type > > &lut, rho_type rho_data, MsgStream &msg)
Applies LUT-based suppression logic to a vector of TOBs.
Data structure representing a single PU1 suppression input.
Output data structure for PU1 suppression.
MsgStream & msg
Definition testRead.cxx:32