ATLAS Offline Software
Loading...
Searching...
No Matches
hexTOB2bitsetTOB.cxx
Go to the documentation of this file.
1// Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2
3#include "hexTOB2bitsetTOB.h"
4#include <algorithm>
5
6namespace GlobalSim {
7
8 std::bitset<72> hexTOB2bitsetTOB(std::string s) {
9
10 auto bit_tob = std::bitset<72>();
11 auto bs = std::bitset<4>();
12
13 std::size_t ind{s.size()*4};
14
15 // ensure s is lower case
16 std::transform(s.begin(), s.end(), s.begin(),
17 [](unsigned char c){return std::tolower(c);});
18
19 for(const char& c : s) {
20 bs = (c >= 'a') ? (c - 'a' + 10) : (c-'0');
21 for (int j = 3; j != -1; --j) {
22 bit_tob[--ind] = bs[j];
23 }
24 if (ind == 0) {break;}
25 }
26 return bit_tob;
27 }
28
29}
AlgTool that to test whether expected the TIP values generated by data supplied by eEmMultTestBench c...
std::bitset< 72 > hexTOB2bitsetTOB(std::string s)