10#include <nlohmann/json.hpp>
17 const std::string& name, ISvcLocator* svcloc):
29 return StatusCode::FAILURE;
50 std::map<std::string, uint32_t> fullSeeds;
54 auto addHashKeys = [
this, &fullSeeds](
auto keys) {
55 for (
auto& key: keys) {
57 if (
auto h = fullSeeds.extract(key.key())) {
58 salt = std::mt19937(
h.mapped())();
65 if (!fullSeeds.empty()) {
66 for (
const auto& [k, v]: fullSeeds) {
69 return StatusCode::FAILURE;
73 std::set<std::string> associations;
75 using charmap_t = std::map<std::string,std::vector<std::string>>;
77 for (
const auto& [k, vlist]: chars.get<charmap_t>()) {
80 if (!associations.count(key)) {
81 ATH_MSG_ERROR(
"Constituent " << key <<
" is not read from the jet");
82 return StatusCode::FAILURE;
84 for (
const auto& v: vlist) {
86 salt = std::mt19937(
h.mapped())();
88 m_chars[key].emplace_back(salt,v);
95 return StatusCode::FAILURE;
98 return StatusCode::SUCCESS;
107 auto hjetint =
m_jetInts.makeHandles(cxt);
108 uint32_t
number = hnumber(*hnumber);
112 auto getSalt = [
this, event_hash](
const auto& handle) {
113 return this->
m_hashedKeys.at(handle.decorKey()) ^ event_hash;
115 for (
const auto*
jet: *hhash) {
116 uint32_t jet_hash = 0;
117 for (
const auto& assoc: hjetassoc) {
118 const auto& iplc = assoc(*
jet);
119 jet_hash ^= std::mt19937( iplc.size() ^ getSalt(assoc))();
120 if (
m_chars.count(assoc.decorKey())) {
121 for (
const auto& [salt, acc]:
m_chars.at(assoc.decorKey())) {
122 unsigned int count = 0;
123 for (
const auto& lnk: iplc)
count += acc(**lnk);
124 jet_hash ^= std::mt19937(
count ^ salt ^ event_hash)();
128 for (
const auto& hint: hjetint) {
129 jet_hash ^= std::mt19937( hint(*
jet) ^ getSalt(hint))();
131 hhash(*
jet) = event_hash ^ jet_hash;
133 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
Handle class for reading a decoration on an object.
Handle class for adding a decoration to an object.
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)
void renounceArray(SG::VarHandleKeyArray &handlesArray)
Header file for AthHistogramAlgorithm.
An algorithm that can be simultaneously executed in multiple threads.
Gaudi::Property< std::map< std::string, uint32_t > > m_jetVarSeeds
FoldDecoratorAlg(const std::string &name, ISvcLocator *svcloc)
Gaudi::Property< std::string > m_jetCollection
SG::ReadDecorHandleKey< xAOD::EventInfo > m_mcEventNumberKey
SG::ReadDecorHandleKeyArray< JC, int > m_jetInts
Gaudi::Property< uint32_t > m_salt
std::unordered_map< std::string, std::vector< SaltedCReader > > m_chars
SG::ReadDecorHandleKeyArray< JC, IPLV > m_jetAssociations
Gaudi::Property< std::map< std::string, uint32_t > > m_constituentSeeds
Gaudi::Property< std::string > m_constituentChars
std::unordered_map< std::string, uint32_t > m_hashedKeys
SG::WriteDecorHandleKey< JC > m_hashKey
virtual StatusCode initialize() override
virtual StatusCode execute(const EventContext &cxt) const override
Handle class for reading a decoration on an object.
Handle class for adding a decoration to an object.
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
This file contains "getter" functions used for accessing tagger inputs from the EDM.
std::string number(const double &d, const std::string &s)