1726 {
1727
1729
1730
1731 ToolHandle<ICaloSuperCellIDTool> scidtool("CaloSuperCellIDTool");
1732 if ( scidtool.retrieve().isFailure() ) {
1734 }
1735
1736 std::set<Identifier> scidset;
1737 std::map<HWIdentifier,int> sslot_schannel_idx;
1738 std::vector<unsigned int> OrderOnlHash_OffID;
1739 std::vector<unsigned int> OrderOffHash_OnlID;
1740 OrderOnlHash_OffID.resize(40000,0);
1741 OrderOffHash_OnlID.resize(40000,0);
1742
1744 unsigned int min_onl_hash = 999999;
1745 unsigned int max_onl_hash = 0;
1746 unsigned int min_off_hash = 999999;
1747 unsigned int max_off_hash = 0;
1748 std::ofstream
hashes(
"AllHashChannels_All.txt");
1749 std::ofstream of("AllChannels_EM.txt");
1750
1751 for(
size_t i = 0;
i < channel_size ;
i++) {
1754 if ( ! isEM ) continue;
1755 Identifier SCID = scidtool->offlineToSuperCellID(chid);
1756 if ( scidset.find(SCID) == scidset.end() && (
m_scell_idhelper->calo_cell_hash( SCID ).value() < 99999) )
1757 scidset.insert(SCID);
1758 else continue;
1759 HWIdentifier hwid =
cabling->createSignalChannelID(chid);
1760 if ( i == 0 ){
1761 of << "Off ID\t\tSCID\t\tOnl ID\t\tFT\tslot\tB-E pos_neg\tSamp\teta\tphi\tFEB_ID\t\tSHWID\t" << std::endl;
1762 }
1768 IdentifierHash regHash =
m_em_idhelper->region_hash( regId );
1780 char etaChar[10];
1781 char phiChar[10];
1782 sprintf(etaChar,
"%5.4f",
eta);
1783 sprintf(phiChar,
"%5.4f",
phi);
1784 of << std::dec << "\t" << feedthrough << "\t" << slot;
1785 of << "\t" << bar_ec << " " << pos_neg << "\t\t" << samp << "\t";
1786 of << etaChar << " " << phiChar << "\t0x";
1788 int sslot=1;
1791 bool secondOutSlot=false;
1792 if ( OutSlot ) {
1793 if ( (samp==1) && (reg==5) ) secondOutSlot=true;
1794 if ( (samp==2) && (reg==1) && (
m_em_idhelper->eta( chid )>=39 ) )
1795 secondOutSlot=true;
1796 if ( (samp==3) && (reg==0) && (
m_em_idhelper->eta( chid )>=18 ) )
1797 secondOutSlot=true;
1798 }
1800
1801 if ( InSlot ) {
1803 }
1804 if ( secondOutSlot ) {
1806 }
1807 if ( sslot_schannel_idx.find(sfeb_id) == sslot_schannel_idx.end() )
1808 sslot_schannel_idx[sfeb_id]=0;
1809 else sslot_schannel_idx[sfeb_id]++;
1810 HWIdentifier shwid =
m_sonline_idhelper->channel_Id(sfeb_id,sslot_schannel_idx[sfeb_id]);
1812 if ( onl_hash > max_onl_hash ) max_onl_hash = onl_hash;
1813 if ( onl_hash < min_onl_hash ) min_onl_hash = onl_hash;
1815 if ( off_hash > max_off_hash ) max_off_hash = off_hash;
1816 if ( off_hash < min_off_hash ) min_off_hash = off_hash;
1817 of << std::hex;
1821 of << std::dec;
1822 of << " " << onl_hash << " " << off_hash;
1823 of << std::endl;
1824
1829 }
1830 of << "Hash check. Onl : " << min_onl_hash << " " << max_onl_hash;
1831 of << "; Off : " << min_off_hash << " " << max_off_hash << std::endl;;
1832 of.close();
1833
1835 min_onl_hash = 999999;
1836 max_onl_hash = 0;
1837 min_off_hash = 999999;
1838 max_off_hash = 0;
1839 std::ofstream of1("AllChannels_HEC.txt");
1840
1841 of1 << "Off ID\t\tSCID\t\tOnl ID\t\tFT\tslot\tB-E pos_neg\tSamp\teta\tphi\tFEB_ID\t\tSHWID\t" << std::endl;
1842 for(
size_t i = 0;
i < channel_size ;
i++) {
1845 Identifier SCID = scidtool->offlineToSuperCellID(chid);
1846 if ( scidset.find(SCID) == scidset.end() )
1847 scidset.insert(SCID);
1848 else continue;
1849 HWIdentifier hwid =
cabling->createSignalChannelID(chid);
1866 char etaChar[10];
1867 char phiChar[10];
1868 sprintf(etaChar,
"%5.4f",
eta);
1869 sprintf(phiChar,
"%5.4f",
phi);
1870 of1 << std::dec << "\t" << feedthrough << "\t" << slot;
1871 of1 << "\t" << bar_ec << " " << pos_neg << "\t\t" << samp << "\t";
1872 of1 << etaChar << " " << phiChar << "\t0x";
1874 int sslot=1;
1875 int subtract=0;
1877 if ( sslot_schannel_idx.find(sfeb_id) == sslot_schannel_idx.end() )
1878 sslot_schannel_idx[sfeb_id]=0;
1879 else sslot_schannel_idx[sfeb_id]++;
1880 if ( (feedthrough==6) && (bar_ec==1) && (slot>9) ) {
1882 subtract=192;
1883 }
1884 HWIdentifier shwid =
m_sonline_idhelper->channel_Id(sfeb_id,sslot_schannel_idx[sfeb_id]-subtract);
1886 if ( onl_hash > max_onl_hash ) max_onl_hash = onl_hash;
1887 if ( onl_hash < min_onl_hash ) min_onl_hash = onl_hash;
1889 if ( off_hash > max_off_hash ) max_off_hash = off_hash;
1890 if ( off_hash < min_off_hash ) min_off_hash = off_hash;
1891 of1 << std::hex;
1895 of1 << std::dec;
1896 of1 << " " << onl_hash << " " << off_hash;
1897 of1 << std::endl;
1898
1901 }
1902
1904 min_onl_hash = 999999;
1905 max_onl_hash = 0;
1906 min_off_hash = 999999;
1907 max_off_hash = 0;
1908 std::ofstream of3("AllChannels_FCAL.txt");
1909
1910 of3 << "Off ID\t\tSCID\t\tOnl ID\t\tFT\tslot\tB-E pos_neg\tSamp\teta\tphi\tFEB_ID\t\tSHWID\t" << std::endl;
1911 for(
size_t i = 0;
i < channel_size ;
i++) {
1914 Identifier SCID = scidtool->offlineToSuperCellID(chid);
1915 if ( scidset.find(SCID) == scidset.end() )
1916 scidset.insert(SCID);
1917 else continue;
1918 HWIdentifier hwid =
cabling->createSignalChannelID(chid);
1922 int samp = 0;
1927 of3 << std::dec << "\t" << feedthrough << "\t" << slot;
1928 of3 << "\t" << bar_ec << " " << pos_neg << "\t\t" << samp << "\t";
1930 int sslot=1;
1932 if ( (feedthrough==6) && (bar_ec==1) && (slot>9) ) {
1934 }
1935 if ( sslot_schannel_idx.find(sfeb_id) == sslot_schannel_idx.end() )
1936 sslot_schannel_idx[sfeb_id]=0;
1937 else sslot_schannel_idx[sfeb_id]++;
1938 HWIdentifier shwid =
m_sonline_idhelper->channel_Id(sfeb_id,sslot_schannel_idx[sfeb_id]);
1940 if ( onl_hash > max_onl_hash ) max_onl_hash = onl_hash;
1941 if ( onl_hash < min_onl_hash ) min_onl_hash = onl_hash;
1943 if ( off_hash > max_off_hash ) max_off_hash = off_hash;
1944 if ( off_hash < min_off_hash ) min_off_hash = off_hash;
1945 of3 << std::hex;
1949 of3 << std::dec;
1950 of3 << " " << onl_hash << " " << off_hash;
1951 of3 << std::endl;
1952
1955 }
1956
1957 of3 << "Hash check. Onl : " << min_onl_hash << " " << max_onl_hash;
1958 of3 << "; Off : " << min_off_hash << " " << max_off_hash << std::endl;;
1959 of3.close();
1960
1961
1962
1964 coral::AttributeListSpecification *spec_onOff = new coral::AttributeListSpecification();
1965 spec_onOff->extend("OnlineHashToOfflineId", "blob");
1966 spec_onOff->extend<unsigned>("version");
1967 std::unique_ptr<AthenaAttributeList> al_onOff = std::make_unique<AthenaAttributeList>(*spec_onOff);
1968 coral::Blob& blobOnOff=(*al_onOff)["OnlineHashToOfflineId"].data<coral::Blob>();
1969 (*al_onOff)["version"].setValue(0U);
1970 blobOnOff.resize(onlHashMax*sizeof(uint32_t));
1972 unsigned nConn=0;
1973
1974 const uint32_t emptyId=Identifier().get_identifier32().get_compact();
1975 for(size_t ii=0;ii<onlHashMax;ii++) {
1976 if (OrderOnlHash_OffID[ii] != 0) {
1977 pBlobOnOff[ii]=OrderOnlHash_OffID[ii];
1978 nConn++;
1979 }
1980 else
1981 pBlobOnOff[ii]=emptyId;
1982 }
1983
1984 ATH_MSG_INFO (
"HashMax=" << onlHashMax <<
", connected=" << nConn );
1985
1986 ATH_CHECK(
detStore()->record(std::move(al_onOff),
"/LAR/IdentifierOfl/OnOffIdMap_SC") );
1987
1988 hashes <<
"idx \t Off2OnlId \t Onl2OffId" << std::endl;
1989 for(size_t ii=0;ii<40000;ii++)
1990 if ( (OrderOffHash_OnlID[ii] != 0) || ( OrderOnlHash_OffID[ii] != 0 ) )
1991 hashes << std::dec << ii << std::hex <<
" \t " << OrderOffHash_OnlID[ii] <<
" \t\t " << OrderOnlHash_OffID[ii] << std::endl;
1993
1994 return StatusCode::SUCCESS;
1995}
value_type get_compact() const
Get the compact id.
unsigned long long size_type
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.