62 std::map<std::string, std::string>::const_iterator iter = map.begin();
63 while (iter != map.end()) {
64 if ((*iter).second == value)
73 for (
unsigned int i = 0;
i < hexString.length();
i++) {
85 for (
unsigned int i = 1;
i <= binString.length();
i++) {
90 str = binString.substr(
i - 4, 4);
103 bool hexInput =
false;
106 for (
unsigned int i = 0;
i < hexString.length();
i++) {
107 if (hexString[
i] !=
'0' || hexString[
i] !=
'1') {
114 binString =
hex2bin(hexString);
116 binString = hexString;
118 unsigned int i = 0, len = 0;
119 len = binString.length();
124 for (i = 0; i < (len -
offset) / 2; i++) {
125 digit = binString[i +
offset];
127 binString[i +
offset] = binString[len - 1 -
i];
128 binString[len - 1 -
i] = digit;
139 while (i < hexString.length()) {
140 if (hexString[i] ==
'a')
142 else if (hexString[i] ==
'b')
144 else if (hexString[i] ==
'c')
146 else if (hexString[i] ==
'd')
148 else if (hexString[i] ==
'e')
150 else if (hexString[i] ==
'f')
161 binString.erase(0, 1);
168 const unsigned int &
num,
170 std::ostringstream ossEta;
172 ossEta << counter <<
" => X\"";
174 for (
unsigned int i = 0;
i <
num;
i++) {
175 std::ostringstream ossEtaRange;
176 ossEtaRange << std::hex << std::setw(16) << std::setfill(
'0') << (*op).at(
i).etaRange <<
std::dec;
183 ossEta << ossEtaRange.str();
185 if (num > 0 &&
i != num - 1)
194 const unsigned int &
num,
196 std::ostringstream ossEta;
198 ossEta << counter <<
" => X\"";
202 for (
unsigned int i = 0;
i <
num;
i++) {
203 std::ostringstream ossEtaRange;
205 ossEtaRange << std::hex << std::setw(4) << std::setfill(
'0') << (*op).at(
i).etaRange <<
std::dec;
215 ossEta << ossEtaRange.str();
217 if (num > 0 &&
i != num - 1)
226 const unsigned int &
num,
228 std::ostringstream ossPhi;
230 ossPhi << counter <<
" => X\"";
232 for (
unsigned int i = 0;
i <
num;
i++) {
233 ossPhi << std::hex << std::setw(8) << std::setfill(
'0') << (*op).at(
i).phiRange <<
std::dec;
235 if (num > 0 &&
i != num - 1)
244 const unsigned int &
num,
246 std::ostringstream ossPhi,
count;
248 if ((*op).at(0).phiRange0Word != 0) {
249 ossPhi <<
"000000000000000000" << std::hex << (*op).at(0).phiRange1Word << (*op).at(0).phiRange0Word <<
std::dec;
253 return (count.str() +
" => X\"" +
capitalLetters(ossPhi.str()) +
"\",\n");
260 const unsigned int &
num,
263 std::ostringstream ossPhi;
265 ossPhi << counter <<
" => X\"";
267 for (
unsigned int i = 0;
i <
num;
i++) {
269 ossPhi << std::hex << std::setw(2) << std::setfill(
'0') << (*op).at(
i).phiHigh <<
std::dec;
271 ossPhi << std::hex << std::setw(2) << std::setfill(
'0') << (*op).at(
i).phiLow <<
std::dec;
273 if (num > 0 &&
i != num - 1)
283 std::ostringstream deltaEtaRange,
dEta,
res;
287 deltaEtaRange << std::hex << std::setw(4) << std::setfill(
'0') << (*cp).deltaEtaRange <<
std::dec;
295 res << counter <<
" => X\"" << result <<
"\",\n";
302 std::ostringstream deltaEtaRange,
dEta;
303 deltaEtaRange << std::hex << std::setw(16) << std::setfill(
'0') << (*cp).deltaEtaRange <<
std::dec;
310 dEta << counter <<
" => X\"" << result <<
"\",\n";
317 std::ostringstream
dPhi, deltaPhiRange,
result;
321 deltaPhiRange << std::hex << std::setw(3) << std::setfill(
'0') << (*cp).deltaPhiRange <<
std::dec;
327 std::string help2 = binString.substr(2, binString.length() - 2);
335 result << help2.substr(0, 8);
338 result <<
"00000000000000000000000000000";
342 result << binString.substr(2, binString.length() - 2);
344 dPhi << counter <<
" => X\"" <<
bin2hex(result.str()) <<
"\",\n";
367 std::ostringstream
dPhi, deltaPhiRange0, deltaPhiRange1,
temp,
result;
370 deltaPhiRange0 << std::hex << std::setw(16) << std::setfill(
'0') << (*cp).deltaPhiRange0Word <<
std::dec;
375 tempstr = temp.str();
377 tempstr[tempstr.length() - 1] =
'1';
384 dPhi << counter <<
" => X\"" <<
bin2hex(result.str()) <<
"\",\n";
std::string buildEtaCalo(const std::vector< L1GtCaloTemplate::ObjectParameter > *op, const unsigned int &num, const unsigned int &counter)
std::string buildDeltaEtaCalo(const L1GtCaloTemplate::CorrelationParameter *&cp, const unsigned int &counter)
std::string capitalLetters(std::string hexString)
std::map< std::string, std::string > hex2binMap_
std::string buildDeltaPhiCalo(const L1GtCaloTemplate::CorrelationParameter *&cp, const unsigned int &counter)
std::string hex2bin(std::string hexString)
std::string buildPhiCalo(const std::vector< L1GtCaloTemplate::ObjectParameter > *op, const unsigned int &num, const unsigned int &counter)
std::string readMapInverse(const std::map< std::string, std::string > &map, std::string value)
std::string buildDeltaPhiMuon(const L1GtMuonTemplate::CorrelationParameter *&cp, const unsigned int &counter)
typedef for correlation parameters
std::string mirror(unsigned int offset, std::string hexString, bool hexOutput=true)
std::string shiftLeft(std::string hexString)
std::string buildDeltaEtaMuon(const L1GtMuonTemplate::CorrelationParameter *&cp, const unsigned int &counter)
static std::atomic< unsigned int > counter
std::string buildPhiEnergySum(const std::vector< L1GtEnergySumTemplate::ObjectParameter > *op, const unsigned int &num, const unsigned int &counter)
L1GtVhdlWriterBitManager()
std::string buildEtaMuon(const std::vector< L1GtMuonTemplate::ObjectParameter > *op, const unsigned int &num, const unsigned int &counter)
std::string buildPhiMuon(const std::vector< L1GtMuonTemplate::ObjectParameter > *op, const unsigned int &num, const unsigned int &counter, bool high)
std::string bin2hex(std::string binString)