1730 {
1731
1733
1734
1735 ToolHandle<ICaloSuperCellIDTool> scidtool("CaloSuperCellIDTool");
1736 if ( scidtool.retrieve().isFailure() ) {
1738 }
1739
1740 std::set<Identifier> scidset;
1741 std::map<HWIdentifier,int> sslot_schannel_idx;
1742 std::vector<unsigned int> OrderOnlHash_OffID;
1743 std::vector<unsigned int> OrderOffHash_OnlID;
1744 OrderOnlHash_OffID.resize(40000,0);
1745 OrderOffHash_OnlID.resize(40000,0);
1746
1748 unsigned int min_onl_hash = 999999;
1749 unsigned int max_onl_hash = 0;
1750 unsigned int min_off_hash = 999999;
1751 unsigned int max_off_hash = 0;
1752 std::ofstream
hashes(
"AllHashChannels_All.txt");
1753 std::ofstream of("AllChannels_EM.txt");
1754
1755 for(
size_t i = 0;
i < channel_size ;
i++) {
1758 if ( ! isEM ) continue;
1759 Identifier SCID = scidtool->offlineToSuperCellID(chid);
1760 if ( scidset.find(SCID) == scidset.end() && (
m_scell_idhelper->calo_cell_hash( SCID ).value() < 99999) )
1761 scidset.insert(SCID);
1762 else continue;
1763 HWIdentifier hwid =
cabling->createSignalChannelID(chid);
1764 if ( i == 0 ){
1765 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;
1766 }
1772 IdentifierHash regHash =
m_em_idhelper->region_hash( regId );
1784 char etaChar[10];
1785 char phiChar[10];
1786 sprintf(etaChar,
"%5.4f",
eta);
1787 sprintf(phiChar,
"%5.4f",
phi);
1788 of << std::dec << "\t" << feedthrough << "\t" << slot;
1789 of << "\t" << bar_ec << " " << pos_neg << "\t\t" << samp << "\t";
1790 of << etaChar << " " << phiChar << "\t0x";
1792 int sslot=1;
1795 bool secondOutSlot=false;
1796 if ( OutSlot ) {
1797 if ( (samp==1) && (reg==5) ) secondOutSlot=true;
1798 if ( (samp==2) && (reg==1) && (
m_em_idhelper->eta( chid )>=39 ) )
1799 secondOutSlot=true;
1800 if ( (samp==3) && (reg==0) && (
m_em_idhelper->eta( chid )>=18 ) )
1801 secondOutSlot=true;
1802 }
1804
1805 if ( InSlot ) {
1807 }
1808 if ( secondOutSlot ) {
1810 }
1811 if ( sslot_schannel_idx.find(sfeb_id) == sslot_schannel_idx.end() )
1812 sslot_schannel_idx[sfeb_id]=0;
1813 else sslot_schannel_idx[sfeb_id]++;
1814 HWIdentifier shwid =
m_sonline_idhelper->channel_Id(sfeb_id,sslot_schannel_idx[sfeb_id]);
1816 if ( onl_hash > max_onl_hash ) max_onl_hash = onl_hash;
1817 if ( onl_hash < min_onl_hash ) min_onl_hash = onl_hash;
1819 if ( off_hash > max_off_hash ) max_off_hash = off_hash;
1820 if ( off_hash < min_off_hash ) min_off_hash = off_hash;
1821 of << std::hex;
1825 of << std::dec;
1826 of << " " << onl_hash << " " << off_hash;
1827 of << std::endl;
1828
1833 }
1834 of << "Hash check. Onl : " << min_onl_hash << " " << max_onl_hash;
1835 of << "; Off : " << min_off_hash << " " << max_off_hash << std::endl;;
1836 of.close();
1837
1839 min_onl_hash = 999999;
1840 max_onl_hash = 0;
1841 min_off_hash = 999999;
1842 max_off_hash = 0;
1843 std::ofstream of1("AllChannels_HEC.txt");
1844
1845 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;
1846 for(
size_t i = 0;
i < channel_size ;
i++) {
1849 Identifier SCID = scidtool->offlineToSuperCellID(chid);
1850 if ( scidset.find(SCID) == scidset.end() )
1851 scidset.insert(SCID);
1852 else continue;
1853 HWIdentifier hwid =
cabling->createSignalChannelID(chid);
1870 char etaChar[10];
1871 char phiChar[10];
1872 sprintf(etaChar,
"%5.4f",
eta);
1873 sprintf(phiChar,
"%5.4f",
phi);
1874 of1 << std::dec << "\t" << feedthrough << "\t" << slot;
1875 of1 << "\t" << bar_ec << " " << pos_neg << "\t\t" << samp << "\t";
1876 of1 << etaChar << " " << phiChar << "\t0x";
1878 int sslot=1;
1879 int subtract=0;
1881 if ( sslot_schannel_idx.find(sfeb_id) == sslot_schannel_idx.end() )
1882 sslot_schannel_idx[sfeb_id]=0;
1883 else sslot_schannel_idx[sfeb_id]++;
1884 if ( (feedthrough==6) && (bar_ec==1) && (slot>9) ) {
1886 subtract=192;
1887 }
1888 HWIdentifier shwid =
m_sonline_idhelper->channel_Id(sfeb_id,sslot_schannel_idx[sfeb_id]-subtract);
1890 if ( onl_hash > max_onl_hash ) max_onl_hash = onl_hash;
1891 if ( onl_hash < min_onl_hash ) min_onl_hash = onl_hash;
1893 if ( off_hash > max_off_hash ) max_off_hash = off_hash;
1894 if ( off_hash < min_off_hash ) min_off_hash = off_hash;
1895 of1 << std::hex;
1899 of1 << std::dec;
1900 of1 << " " << onl_hash << " " << off_hash;
1901 of1 << std::endl;
1902
1905 }
1906
1908 min_onl_hash = 999999;
1909 max_onl_hash = 0;
1910 min_off_hash = 999999;
1911 max_off_hash = 0;
1912 std::ofstream of3("AllChannels_FCAL.txt");
1913
1914 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;
1915 for(
size_t i = 0;
i < channel_size ;
i++) {
1918 Identifier SCID = scidtool->offlineToSuperCellID(chid);
1919 if ( scidset.find(SCID) == scidset.end() )
1920 scidset.insert(SCID);
1921 else continue;
1922 HWIdentifier hwid =
cabling->createSignalChannelID(chid);
1926 int samp = 0;
1931 of3 << std::dec << "\t" << feedthrough << "\t" << slot;
1932 of3 << "\t" << bar_ec << " " << pos_neg << "\t\t" << samp << "\t";
1934 int sslot=1;
1936 if ( (feedthrough==6) && (bar_ec==1) && (slot>9) ) {
1938 }
1939 if ( sslot_schannel_idx.find(sfeb_id) == sslot_schannel_idx.end() )
1940 sslot_schannel_idx[sfeb_id]=0;
1941 else sslot_schannel_idx[sfeb_id]++;
1942 HWIdentifier shwid =
m_sonline_idhelper->channel_Id(sfeb_id,sslot_schannel_idx[sfeb_id]);
1944 if ( onl_hash > max_onl_hash ) max_onl_hash = onl_hash;
1945 if ( onl_hash < min_onl_hash ) min_onl_hash = onl_hash;
1947 if ( off_hash > max_off_hash ) max_off_hash = off_hash;
1948 if ( off_hash < min_off_hash ) min_off_hash = off_hash;
1949 of3 << std::hex;
1953 of3 << std::dec;
1954 of3 << " " << onl_hash << " " << off_hash;
1955 of3 << std::endl;
1956
1959 }
1960
1961 of3 << "Hash check. Onl : " << min_onl_hash << " " << max_onl_hash;
1962 of3 << "; Off : " << min_off_hash << " " << max_off_hash << std::endl;;
1963 of3.close();
1964
1965
1966
1968 coral::AttributeListSpecification *spec_onOff = new coral::AttributeListSpecification();
1969 spec_onOff->extend("OnlineHashToOfflineId", "blob");
1970 spec_onOff->extend<unsigned>("version");
1971 std::unique_ptr<AthenaAttributeList> al_onOff = std::make_unique<AthenaAttributeList>(*spec_onOff);
1972 coral::Blob& blobOnOff=(*al_onOff)["OnlineHashToOfflineId"].data<coral::Blob>();
1973 (*al_onOff)["version"].setValue(0U);
1974 blobOnOff.resize(onlHashMax*sizeof(uint32_t));
1976 unsigned nConn=0;
1977
1978 const uint32_t emptyId=Identifier().get_identifier32().get_compact();
1979 for(size_t ii=0;ii<onlHashMax;ii++) {
1980 if (OrderOnlHash_OffID[ii] != 0) {
1981 pBlobOnOff[ii]=OrderOnlHash_OffID[ii];
1982 nConn++;
1983 }
1984 else
1985 pBlobOnOff[ii]=emptyId;
1986 }
1987
1988 ATH_MSG_INFO (
"HashMax=" << onlHashMax <<
", connected=" << nConn );
1989
1990 ATH_CHECK(
detStore()->record(std::move(al_onOff),
"/LAR/IdentifierOfl/OnOffIdMap_SC") );
1991
1992 hashes <<
"idx \t Off2OnlId \t Onl2OffId" << std::endl;
1993 for(size_t ii=0;ii<40000;ii++)
1994 if ( (OrderOffHash_OnlID[ii] != 0) || ( OrderOnlHash_OffID[ii] != 0 ) )
1995 hashes << std::dec << ii << std::hex <<
" \t " << OrderOffHash_OnlID[ii] <<
" \t\t " << OrderOnlHash_OffID[ii] << std::endl;
1997
1998 return StatusCode::SUCCESS;
1999}
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.