Loading [MathJax]/jax/output/SVG/config.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
hexStrToBinStr.cxx
Go to the documentation of this file.
1 
2 /*
3  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
4 */
5 
6 #include "hexStrToBinStr.h"
7 #include <string>
8 #include <stdexcept>
9 
10 namespace GlobalSim {
11 
12  std::string hexStrToBinStr(std::string s) {
13  if (s[0] == '0' and std::tolower(s[1]) == 'x' and s.size()>2) {
14  s.assign(std::begin(s)+2, std::end(s));
15  }
16  std::string alpha{"abcdef"};
17  std::string result;
18  for (auto c : s){
19  c = std::tolower(c);
20  int num;
21  if (std::isdigit(c)) {
22  num = int(c) - int('0');
23  } else if (alpha.find(c) != std::string::npos){
24  num = int(c) - int('a') + 10;
25  } else {
26  throw std::out_of_range("not hex character");
27  }
28 
29  short mask{8};
30  for (int j = 3; j != -1; --j) {
31  result += (mask & num) ? '1' : '0';
32  mask = mask >> 1;
33  }
34  }
35 
36  return result;
37  }
38 }
add-xsec-uncert-quadrature-N.alpha
alpha
Definition: add-xsec-uncert-quadrature-N.py:110
get_generator_info.result
result
Definition: get_generator_info.py:21
GlobalSim::hexStrToBinStr
std::string hexStrToBinStr(std::string s)
Definition: hexStrToBinStr.cxx:12
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
hexStrToBinStr.h
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
GlobalSim
AlgTool to obtain a selection of eFex RoIs read in from the event store.
Definition: dump.h:8
tolower
void tolower(std::string &s)
Definition: AthenaSummarySvc.cxx:111
trigbs_pickEvents.num
num
Definition: trigbs_pickEvents.py:76
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
python.SystemOfUnits.s
float s
Definition: SystemOfUnits.py:146
python.compressB64.c
def c
Definition: compressB64.py:93