65 std::map<std::string,std::string>::const_iterator iter = map.begin();
66 while (iter!=map.end())
68 if ((*iter).second == value)
80 for (
unsigned int i=0;
i<hexString.length();
i++)
96 for (
unsigned int i=1;
i<=binString.length();
i++)
103 str = binString.substr(
i-4,4);
121 for(
unsigned int i = 0;
i<hexString.length();
i++)
123 if (hexString[
i]!=
'0' || hexString[
i]!=
'1' )
131 binString =
hex2bin(hexString);
132 else binString=hexString;
134 unsigned int i=0, len=0;
135 len = binString.length();
140 for(i = 0; i < (len -
offset)/2; i++)
142 digit = binString[i +
offset];
144 binString[i +
offset] = binString[len - 1 -
i];
145 binString[len - 1 -
i] = digit;
151 else return binString;
160 while(i<hexString.length())
162 if(hexString[i] ==
'a') hexString[
i] =
'A';
163 else if(hexString[i] ==
'b') hexString[
i] =
'B';
164 else if(hexString[i] ==
'c') hexString[
i] =
'C';
165 else if(hexString[i] ==
'd') hexString[
i] =
'D';
166 else if(hexString[i] ==
'e') hexString[
i] =
'E';
167 else if(hexString[i] ==
'f') hexString[
i] =
'F';
179 binString.erase(0,1);
188 std::ostringstream ossEta;
194 for (
unsigned int i =0;
i<
num;
i++)
196 std::ostringstream ossEtaRange;
197 ossEtaRange << std::hex<< std::setw(16)<<std::setfill(
'0')<<(*op).at(
i).etaRange<<
std::dec;
204 ossEta << ossEtaRange.str();
206 if (num>0 &&
i!=num-1) ossEta <<
"_";
218 std::ostringstream ossEta;
226 for (
unsigned int i =0;
i<
num;
i++)
228 std::ostringstream ossEtaRange;
230 ossEtaRange << std::hex <<std::setw(4)<<std::setfill(
'0')<< (*op).at(
i).etaRange<<
std::dec;
240 ossEta << ossEtaRange.str();
242 if (num>0 &&
i!=num-1) ossEta <<
"_";
253 std::ostringstream ossPhi;
259 for (
unsigned int i =0;
i<
num;
i++)
261 ossPhi << std::hex<< std::setw(8)<<std::setfill(
'0')<<(*op).at(
i).phiRange<<
std::dec;
263 if (num>0 &&
i!=num-1) ossPhi <<
"_";
273 std::ostringstream ossPhi,
count;
275 if ((*op).at(0).phiRange0Word!=0)
277 ossPhi <<
"000000000000000000"<<std::hex<<(*op).at(0).phiRange1Word<<(*op).at(0).phiRange0Word<<
std::dec;
281 return (count.str()+
" => X\""+
capitalLetters(ossPhi.str())+
"\",\n");
290 std::ostringstream ossPhi;
296 for (
unsigned int i =0;
i<
num;
i++)
299 ossPhi << std::hex<< std::setw(2)<<std::setfill(
'0')<<(*op).at(
i).phiHigh<<
std::dec;
301 ossPhi << std::hex<< std::setw(2)<<std::setfill(
'0')<<(*op).at(
i).phiLow<<
std::dec;
303 if (num>0 &&
i!=num-1) ossPhi <<
"_";
314 std::ostringstream deltaEtaRange, dEta,
res;
318 deltaEtaRange << std::hex<< std::setw(4)<<std::setfill(
'0')<<(*cp).deltaEtaRange<<
std::dec;
326 res<<counter<<
" => X\""<<result<<
"\",\n";
335 std::ostringstream deltaEtaRange, dEta;
336 deltaEtaRange << std::hex<< std::setw(16)<<std::setfill(
'0')<<(*cp).deltaEtaRange<<
std::dec;
343 dEta<<counter<<
" => X\""<<result<<
"\",\n";
352 std::ostringstream dPhi,deltaPhiRange,
result;
356 deltaPhiRange << std::hex<<std::setw(3)<<std::setfill(
'0')<<(*cp).deltaPhiRange<<
std::dec;
362 std::string help2 = binString.substr(2,binString.length()-2);
370 result<<help2.substr(0,8);
373 result<<
"00000000000000000000000000000";
377 result<<binString.substr(2,binString.length()-2);
379 dPhi<<counter<<
" => X\""<<
bin2hex(result.str())<<
"\",\n";
403 std::ostringstream dPhi,deltaPhiRange0,deltaPhiRange1,
temp,
result ;
406 deltaPhiRange0 << std::hex<< std::setw(16)<<std::setfill(
'0')<<(*cp).deltaPhiRange0Word<<
std::dec;
413 tempstr[tempstr.length()-1]=
'1';
420 <<
hex2bin(deltaPhiRange0.str());
422 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)