29 for (
const auto &part :
number) {
35 const std::vector<std::bitset<64>> &
number) {
44 <<
"remakeFullNumberToHex: TOB vector does not contain 4 elements"
49 ss << std::hex << std::setfill(
'0');
50 for (
const auto &part :
number) {
58 std::vector<std::bitset<64>> &line, MsgStream &
msg) {
60 msg << MSG::DEBUG <<
"writeFullNumberOut: hex result: " << remadeBinaryString
62 outFile << remadeBinaryString << std::endl;
68 unsigned long long tob_data_ull = tob_data.to_ullong();
69 et_value = (tob_data_ull >> 19) & 0xFFFF;
70 phi_value = tob_data_ull & 0xFF;
71 eta_value = (tob_data_ull >> 8) & 0x7FF;
73 (tob_data_ull >> 36) & 0xFFFFFFF;
78 const std::bitset<16>& thresholdEt) {
80 for (
int i=0; i < 16; ++i) {
81 int diff = (int)
tobEt[i] - (
int)thresholdEt[i] - borrow;
82 borrow = (
diff < 0) ? 1 : 0;
88 if (
eta >= 0 &&
eta <= 2047) {
93 throw std::out_of_range(
"eta is out of the valid range (0 to 2047)");
103 throw std::out_of_range(
"rho is out of the valid range (0 to 1023)");
108 const std::vector<std::vector<et_type>> &lut,
110 if (entry.size() != 4) {
111 msg << MSG::ERROR <<
"runSimulation: entry must contain exactly 4 TOBs"
113 return StatusCode::FAILURE;
116 for (
int i = 0; i < 4; ++i) {
117 auto &tob = entry[i];
132 }
catch (
const std::out_of_range &e) {
133 msg << MSG::ERROR <<
"runSimulation: index conversion failed for TOB "
134 << i <<
": " << e.what() <<
endmsg;
138 if (rho_index >= lut.size() || eta_index >= lut[rho_index].size()) {
140 <<
"runSimulation: Index out of range for MED_LUT: rho=" << rho_index
141 <<
", eta=" << eta_index <<
endmsg;
145 int threshold = lut[rho_index][eta_index];
146 std::bitset<16> etBits(et_data);
147 std::bitset<16> thresholdBits(
static_cast<uint16_t
>(
threshold));
149 msg << MSG::VERBOSE <<
"runSimulation TOB[" << i <<
"]: ET=" << et_data
154 msg << MSG::DEBUG <<
"runSimulation TOB[" << i <<
"] passes (bit 55 set)"
158 msg << MSG::DEBUG <<
"runSimulation TOB[" << i
159 <<
"] does not pass (bit 55 cleared)" <<
endmsg;
162 return StatusCode::SUCCESS;
Scalar eta() const
pseudorapidity method
uint16_t tobEt(const T *tob)
void diff(const Jet &rJet1, const Jet &rJet2, std::map< std::string, double > varDiff)
Difference between jets - Non-Class function required by trigger.
AlgTool that to test whether expected the TIP values generated by data supplied by eEmMultTestBench c...
std::string remakeFullNumberToBinary(const std::vector< std::bitset< 64 > > &number)
Converts a vector of 4x 64-bit TOBs to a 256-bit binary string.
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.
int rsvd_type
Integer for reserved data field.
eta_index_type Eta_to_index_Converter(eta_type eta)
Converts a raw eta value to its LUT index.
uint16_t rho_type
16-bit type for pileup energy density
void printFullNumber(const std::vector< std::bitset< 64 > > &number, MsgStream &msg)
Prints a full 256-bit number (4x 64-bit).
int eta_type
Signed integer for pseudorapidity.
bool compareThresholdEt(const std::bitset< 16 > &tobEt, const std::bitset< 16 > &thresholdEt)
std::size_t rho_index_type
Index derived from rho value.
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.
std::size_t eta_index_type
Index derived from eta value.
void readInputTOB(const std::bitset< 64 > tob_data, et_type &et_value, eta_type &eta_value, phi_type &phi_value, rsvd_type &rsvd_data)
Extracts ET, eta, phi, and reserved bits from a 64-bit TOB.
void writeFullNumberOut(std::ostream &outFile, std::vector< std::bitset< 64 > > &line, MsgStream &msg)
Writes a vector of TOBs as a hex string to an output stream.
uint16_t et_type
16-bit type for transverse energy
rho_index_type Rho_to_index_Converter(rho_type rho)
Converts a raw rho value to its LUT index.
uint8_t phi_type
8-bit type for azimuthal angle
std::string number(const double &d, const std::string &s)