67 std::map<std::string,std::string>::iterator iter = map.begin();
68 while (iter!=map.end())
70 if ((*iter).second == value)
82 for (
unsigned int i=0;
i<hexString.length();
i++)
98 for (
unsigned int i=1;
i<=binString.length();
i++)
105 str = binString.substr(
i-4,4);
117 std::string
temp,binString;
123 for(
unsigned int i = 0;
i<hexString.length();
i++)
125 if (hexString[
i]!=
'0' || hexString[
i]!=
'1' )
133 binString =
hex2bin(hexString);
134 else binString=hexString;
136 unsigned int i=0, len=0;
137 len = binString.length();
142 for(i = 0; i < (len -
offset)/2; i++)
144 digit = binString[i +
offset];
146 binString[i +
offset] = binString[len - 1 -
i];
147 binString[len - 1 -
i] = digit;
153 else return binString;
162 while(i<hexString.length())
164 if(hexString[i] ==
'a') hexString[
i] =
'A';
165 else if(hexString[i] ==
'b') hexString[
i] =
'B';
166 else if(hexString[i] ==
'c') hexString[
i] =
'C';
167 else if(hexString[i] ==
'd') hexString[
i] =
'D';
168 else if(hexString[i] ==
'e') hexString[
i] =
'E';
169 else if(hexString[i] ==
'f') hexString[
i] =
'F';
179 std::string binString =
hex2bin(hexString);
181 binString.erase(0,1);
190 std::ostringstream ossEta;
196 for (
unsigned int i =0;
i<
num;
i++)
198 std::ostringstream ossEtaRange;
199 ossEtaRange << std::hex<< std::setw(16)<<std::setfill(
'0')<<(*op).at(
i).etaRange<<std::dec;
206 ossEta << ossEtaRange.str();
208 if (num>0 &&
i!=num-1) ossEta <<
"_";
220 std::ostringstream ossEta;
228 for (
unsigned int i =0;
i<
num;
i++)
230 std::ostringstream ossEtaRange;
232 ossEtaRange << std::hex <<std::setw(4)<<std::setfill(
'0')<< (*op).at(
i).etaRange<<std::dec;
242 ossEta << ossEtaRange.str();
244 if (num>0 &&
i!=num-1) ossEta <<
"_";
255 std::ostringstream ossPhi;
261 for (
unsigned int i =0;
i<
num;
i++)
263 ossPhi << std::hex<< std::setw(8)<<std::setfill(
'0')<<(*op).at(
i).phiRange<<std::dec;
265 if (num>0 &&
i!=num-1) ossPhi <<
"_";
275 std::ostringstream ossPhi,
count;
277 if ((*op).at(0).phiRange0Word!=0)
279 ossPhi <<
"000000000000000000"<<std::hex<<(*op).at(0).phiRange1Word<<(*op).at(0).phiRange0Word<<std::dec;
283 return (count.str()+
" => X\""+
capitalLetters(ossPhi.str())+
"\",\n");
292 std::ostringstream ossPhi;
298 for (
unsigned int i =0;
i<
num;
i++)
301 ossPhi << std::hex<< std::setw(2)<<std::setfill(
'0')<<(*op).at(
i).phiHigh<<std::dec;
303 ossPhi << std::hex<< std::setw(2)<<std::setfill(
'0')<<(*op).at(
i).phiLow<<std::dec;
305 if (num>0 &&
i!=num-1) ossPhi <<
"_";
316 std::ostringstream deltaEtaRange, dEta,res;
320 deltaEtaRange << std::hex<< std::setw(4)<<std::setfill(
'0')<<(*cp).deltaEtaRange<<std::dec;
328 res<<counter<<
" => X\""<<result<<
"\",\n";
337 std::ostringstream deltaEtaRange, dEta;
338 deltaEtaRange << std::hex<< std::setw(16)<<std::setfill(
'0')<<(*cp).deltaEtaRange<<std::dec;
345 dEta<<counter<<
" => X\""<<result<<
"\",\n";
354 std::ostringstream
dPhi,deltaPhiRange,
result;
358 deltaPhiRange << std::hex<<std::setw(3)<<std::setfill(
'0')<<(*cp).deltaPhiRange<<std::dec;
360 std::string binString =
hex2bin(deltaPhiRange.str());
364 std::string help2 = binString.substr(2,binString.length()-2);
365 std::string help1 = help2.substr(1);
372 result<<help2.substr(0,8);
375 result<<
"00000000000000000000000000000";
379 result<<binString.substr(2,binString.length()-2);
381 dPhi<<counter<<
" => X\""<<
bin2hex(result.str())<<
"\",\n";
405 std::ostringstream
dPhi,deltaPhiRange0,deltaPhiRange1,
temp,
result ;
408 deltaPhiRange0 << std::hex<< std::setw(16)<<std::setfill(
'0')<<(*cp).deltaPhiRange0Word<<std::dec;
415 tempstr[tempstr.length()-1]=
'1';
422 <<
hex2bin(deltaPhiRange0.str());
424 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)
double dPhi(double phi1, double phi2)
std::string buildPhiCalo(const std::vector< L1GtCaloTemplate::ObjectParameter > *op, const unsigned int &num, const unsigned int &counter)
std::string readMapInverse(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)
unsigned int offset(bool)
std::string shiftLeft(std::string hexString)
std::string buildDeltaEtaMuon(const L1GtMuonTemplate::CorrelationParameter *&cp, const 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)