ATLAS Offline Software
TrigConfMD5.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "./TrigConfMD5.h"
6 
7 #include <sstream>
8 
9 #include "CxxUtils/MD5.h"
10 
11 namespace TrigConf {
12 
13  uint32_t doTruncatedHash(const std::stringstream& ss) {
14  MD5 md5(ss.str());
15  const std::string truncated_hash_hex = md5.hex_digest().substr(0, 8); // Of 32
16  std::stringstream hex_to_int;
17  uint32_t truncated_hash_int = 0;
18  hex_to_int << std::hex << truncated_hash_hex;
19  hex_to_int >> truncated_hash_int;
20  return truncated_hash_int;
21  }
22 
23  uint32_t truncatedHash(const DataStructure& dataStructure) {
24  std::stringstream ss;
25  dataStructure.printRaw(ss);
26  return doTruncatedHash(ss);
27  }
28 
29 
30  uint32_t truncatedHash(const TrigConf::L1Menu& L1DataStructure, const TrigConf::HLTMenu& HLTDataStructure) {
31  std::stringstream ss1;
32  L1DataStructure.printRaw(ss1);
33  std::stringstream ss2;
34  HLTDataStructure.printRaw(ss2);
35  std::stringstream ss_concatonate;
36  ss_concatonate << ss2.str() << ss1.str();
37  return doTruncatedHash(ss_concatonate);
38  }
39 
40 
41 }
TrigConfMD5.h
TrigConf::doTruncatedHash
uint32_t doTruncatedHash(const std::stringstream &ss)
Definition: TrigConfMD5.cxx:13
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
MD5::hex_digest
std::string hex_digest() const
Definition: MD5.cxx:94
TrigConf::HLTMenu
HLT menu configuration.
Definition: HLTMenu.h:21
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TrigConf::L1Menu
L1 menu configuration.
Definition: L1Menu.h:28
MD5.h
solar's public-domain MD5, wrapped for C++.
TrigConf
Forward iterator to traverse the main components of the trigger configuration.
Definition: Config.h:22
MD5
Definition: MD5.h:20
TrigConf::truncatedHash
uint32_t truncatedHash(const DataStructure &dataStructure)
Function to compute a truncated MD5 hash for a JSON file.
Definition: TrigConfMD5.cxx:23
TrigConf::DataStructure::printRaw
void printRaw(std::ostream &os=std::cout) const
Definition: DataStructure.cxx:265
TrigConf::DataStructure
Base class for Trigger configuration data and wrapper around underlying representation.
Definition: DataStructure.h:37