83 #include "Gaudi/Property.h"
84 #include "GaudiKernel/IToolSvc.h"
109 #include "CoralBase/Blob.h"
113 m_em_idhelper(nullptr),
114 m_hec_idhelper(nullptr),
115 m_fcal_idhelper(nullptr),
116 m_online_idhelper(nullptr),
117 m_sem_idhelper(nullptr),
118 m_shec_idhelper(nullptr),
119 m_sonline_idhelper(nullptr),
120 m_scell_idhelper(nullptr)
140 return StatusCode::SUCCESS;
145 const EventContext& ctx = Gaudi::Hive::currentContext();
155 return StatusCode::SUCCESS;
162 const EventContext& ctx = Gaudi::Hive::currentContext();
167 ATH_MSG_WARNING(
"Do not have cabling mapping from key " << m_cablingKey.key() );
173 return StatusCode::FAILURE;
212 return fix18(clCont);
214 return StatusCode::SUCCESS;
226 const LArEM_ID* em_idhelper =
nullptr;
233 SmartIF<IToolSvc> toolSvc{Gaudi::svcLocator()->service(
"ToolSvc")};
241 std::ifstream
infile(
"barrel_dac2ua_oct06.txt") ;
245 return StatusCode::FAILURE;
263 if (
det==1 && samp==1 && reg==0 &&
eta==0 ){
290 return StatusCode::SUCCESS;
308 SmartIF<IToolSvc> toolSvc{Gaudi::svcLocator()->service(
"ToolSvc")};
343 for (;
it!=it_e;++
it)
346 if( (*it).isEmpty() )
continue;
347 if(
cabling->isOnlineConnected(hid)){
368 " Number of entries removed = " <<
n );
373 hid_mod[0] = online_idhelper->
channel_Id(1,1,6,1,33);
374 hid_mod[1] = online_idhelper->
channel_Id(1,1,6,10,12);
375 hid_mod[2] = online_idhelper->
channel_Id(1,1,6,14,12);
378 std::vector<Identifier>::const_iterator
it= fcal_idhelper->
fcal_begin();
379 std::vector<Identifier>::const_iterator it_e= fcal_idhelper->
fcal_end();
386 int phi = fcal_idhelper->
phi(
id);
396 if (!rampP.
isEmpty()) continue ;
437 return StatusCode::SUCCESS;
446 if(m_g4Phys==
"QGSP_EMV"){
447 filename =
"fsampl_1302_qgsp-emv.txt";
450 if( m_g4Phys==
"QGSP_BERT"){
451 filename =
"fsampl_1303_qgsp-bert.txt";
455 return StatusCode::FAILURE;
463 return StatusCode::SUCCESS;
469 return updateEM_DACuAMeV(
"dac2ua_ua2mev_rel13.txt",
cabling );
474 float fsampl_fcal1,fsampl_fcal2,fsampl_fcal3;
475 float fsampl_hec1,fsampl_hec2;
477 if(m_g4Phys==
"QGSP_EMV"){
479 fsampl_hec2=0.021775;
483 fsampl_fcal1=0.01366;
484 fsampl_fcal2=0.00854;
485 fsampl_fcal3=0.01107;
492 if( m_g4Phys==
"QGSP_BERT"){
497 fsampl_fcal1=0.01591;
498 fsampl_fcal2=0.01144;
499 fsampl_fcal3=0.01405;
508 return StatusCode::FAILURE;
523 for (;
it!=it_e;++
it){
526 if( (*it).isEmpty() )
continue;
527 if(!
cabling->isOnlineConnected(hid)){
536 if(m_hec_idhelper->is_lar_hec(
id)){
538 int sam = m_hec_idhelper->sampling(
id);
541 t2.m_fSampl = fsampl_hec1;
544 t2.m_fSampl = fsampl_hec2;
552 if(m_fcal_idhelper->is_lar_fcal(
id)){
554 int sam = m_fcal_idhelper->module(
id);
557 t2.m_fSampl = fsampl_fcal1;
560 t2.m_fSampl = fsampl_fcal2;
563 t2.m_fSampl = fsampl_fcal3;
577 return StatusCode::SUCCESS;
599 return StatusCode::FAILURE;
615 if (
det==1 && samp==1 && reg==0 &&
eta==0 ){
621 id = m_em_idhelper->channel_id(
det,samp,reg,
eta,0);
625 std::string id_str = m_online_idhelper->print_to_string(hid);
645 return StatusCode::SUCCESS;
665 return StatusCode::FAILURE;
675 float dac2ua0, ua2mev0,attenuation,dac2ua,ua2mev;
677 dac2ua0>>ua2mev0>>attenuation>>dac2ua>>ua2mev )
689 if (
det==1 && samp==1 && reg==0 &&
eta==0 ){
695 id = m_em_idhelper->channel_id(
det,samp,reg,
eta,0);
700 std::string id_str = m_online_idhelper->print_to_string(hid);
701 std::string id_str_off = m_em_idhelper->print_to_string(
id);
739 return StatusCode::SUCCESS;
771 for (;
it!=it_e;++
it)
774 if( (*it).isEmpty() )
continue;
777 if(!m_fcal_idhelper->is_lar_fcal(
id))
continue;
779 if(
cabling->isOnlineConnected(hid)){
783 << m_online_idhelper->print_to_string(hid) );
791 " Number of connected and disconnected = " <<nconn<<
" " <<ndisc );
798 std::string
filename(
"FCal_noise_minbias.txt");
805 return StatusCode::FAILURE;
812 for(
int i = 0;
i<11;++
i){
819 float vol,noise_p,noise_h, noise_m,noise_l;
821 while (
infile>>str_id >>vol>>noise_p>>noise_h>>noise_m>>noise_l )
823 const char* ch_id = str_id.c_str();
824 if(ch_id[0] !=
'A') {
830 std::sscanf(ch_id,
"A%d.%d.%d", &
mod,&
phi,&
eta);
843 ATH_MSG_INFO(
" minBiasRMS, old new "<<
t2.m_MinBiasRMS<<
" " <<noise_p);
844 t2.m_MinBiasRMS = noise_p;
865 return StatusCode::SUCCESS;
886 return StatusCode::FAILURE;
905 if (
det==1 && samp==1 && reg==0 &&
eta==0 ){
913 id = m_em_idhelper->channel_id(
det,samp,reg,
eta,0);
917 id = m_hec_idhelper->channel_id(
det,samp,reg,
eta,0);
928 ATH_MSG_INFO(
" online id = "<<m_online_idhelper->print_to_string(hid));
948 return StatusCode::SUCCESS;
983 for (;
it!=it_e;++
it)
986 if( (*it).isEmpty() )
continue;
989 if(!m_fcal_idhelper->is_lar_fcal(
id))
continue;
991 if(
cabling->isOnlineConnected(hid)){
997 << m_online_idhelper->print_to_string(hid) );
1005 " Number of connected and disconnected = " <<nconn<<
" " <<ndisc );
1012 std::string
filename(
"FCal_noise_minbias_adc2mev.txt");
1018 return StatusCode::FAILURE;
1025 for(
int i = 0;
i<27;++
i){
1032 float vol,noise_p,noise_h, noise_m,noise_l;
1033 float ramp_val,ua2MeV_val,dac2uA_val;
1035 while (
infile>>str_id >>vol>>noise_p >> noise_h>>noise_m>>noise_l
1038 const char* ch_id = str_id.c_str();
1040 if(str_id.substr(0,1)!=std::string(
"A")){
1046 sscanf(ch_id,
"A%d.%d.%d", &
mod,&
phi,&
eta);
1087 ua2MeV0.
m_data=ua2MeV_val;
1090 dac2ua0.
m_data = dac2uA_val;
1095 return StatusCode::SUCCESS;
1105 if( m_g4Phys==
"QGSP_BERT"){
1106 filename =
"fsampl_1303_qgsp-bert.txt";
1110 return StatusCode::FAILURE;
1114 return StatusCode::SUCCESS;
1125 ATH_CHECK( update_EM_HEC<LArNoiseMC>(
"noise_em.txt",
"noise_hec.txt",
cabling,
true, 1 ) );
1126 ATH_CHECK( update_EM_HEC<LArAutoCorrMC>(
"",
"autocorr_hec.txt",
cabling,
true, 4 ) );
1128 ATH_CHECK( update_EM_HEC<LArAutoCorrMC>(
"autocorr_em.txt",
"",
cabling,
true,5) );
1129 ATH_CHECK( update_EM_HEC<LArRampMC>(
"ramp_em.txt",
"ramp_hec.txt",
cabling,
true, 1 ) );
1130 ATH_CHECK( update_EM_HEC<LAruA2MeVMC>(
"ua2mev_em.txt",
"ua2mev_hec.txt",
cabling,
false, 1 ) );
1131 ATH_CHECK( update_EM_HEC<LArDAC2uAMC>(
"dac2ua_em.txt",
"dac2ua_hec.txt",
cabling,
false, 1 ) );
1132 ATH_CHECK( update_EM_HEC<LArShape32MC>(
"shape_em.txt",
"shape_hec.txt",
cabling,
true, 64 ) );
1133 ATH_CHECK( update_EM_HEC<LArMphysOverMcalMC>(
"mphys_em.txt",
"",
cabling,
true, 1 ) );
1137 return StatusCode::SUCCESS;
1148 return StatusCode::FAILURE;
1177 std::vector<float> vfl;
1180 for (
int i=0;
i<nvar;++
i)
1194 if (
det==1 && samp==1 && reg==0 &&
eta==0 ){
1210 return StatusCode::SUCCESS;
1220 return StatusCode::FAILURE;
1241 if (
det==1 && samp==1 && reg==0 &&
eta==0 ){
1248 }
else if (
first == 3) {
1250 }
else if (
first == 4) {
1255 for (
int i=0;i<nvar;++i) infile>>
x;
1259 std::vector<float> vfl;
1261 for (
int i=0;
i<nvar;++
i)
1267 <<
first<<
" " <<
det<<
" " <<samp<<
" " <<reg<<
" " <<
eta<<
" " );
1277 return StatusCode::SUCCESS;
1293 ATH_MSG_ERROR (
"for LArNoiseMC, size of vector = "<<
v.size() <<
" differs from one");
1307 for (
unsigned int i =0 ;
i<
obj.m_vAutoCorr.size();++
i)
1308 msg()<<
" " <<
obj.m_vAutoCorr[
i];
1318 ATH_MSG_ERROR(
"for LArAutoCorrMC, size of vector = "<<
v.size()<<
" is less then 4" );
1322 obj.m_vAutoCorr.resize(4);
1323 std::copy_n(
v.begin(), 4,
obj.m_vAutoCorr.begin());
1334 for (
unsigned int i =0 ;
i<
obj.m_vRamp.size();++
i)
1335 msg()<<
" " <<
obj.m_vRamp[
i];
1348 obj.m_vRamp.resize(3);
1350 obj.m_vRamp[1]=
v[0];
1363 for (
unsigned int i =0 ;
i<
obj.m_vShape.size();++
i)
1364 msg()<<
" " <<
obj.m_vShape[
i];
1368 for (
unsigned int i =0 ;
i<
obj.m_vShapeDer.size();++
i)
1369 msg()<<
" " <<
obj.m_vShapeDer[
i];
1378 if (
v.size()!=64 &&
v.size()!=32 )
1380 ATH_MSG_ERROR (
"for LArShape32MC, size of vector = "<<
v.size());
1384 unsigned int size = 32;
1388 for(
unsigned int i=0;
i<
size;++
i){
1390 if(
v.size() == 64 )
obj.m_vShapeDer[
i]=
v[
i+
size];
else obj.m_vShapeDer[
i]=0.;
1413 ATH_MSG_ERROR(
"for LArSingleFloatP, size of vector = "<<
v.size() );
1430 std::unique_ptr<LArMphysOverMcalMC> mphys = std::make_unique<LArMphysOverMcalMC>();
1436 std::string
filename(
"FCal_noise_minbias_adc2mev.txt");
1443 return StatusCode::FAILURE;
1450 for(
int i = 0;
i<27;++
i){
1457 float vol,noise_p,noise_h, noise_m,noise_l;
1458 float ramp_val,ua2MeV_val,dac2uA_val;
1460 while (
infile>>str_id >>vol>>noise_p >> noise_h>>noise_m>>noise_l
1463 const char* ch_id = str_id.c_str();
1465 if(str_id.substr(0,1)!=std::string(
"A")){
1471 sscanf(ch_id,
"A%d.%d.%d", &
mod,&
phi,&
eta);
1493 bool withGain=
false;
1495 std::string hec_filename(
"mphys_hec.txt");
1516 ATH_MSG_ERROR(
" Number of HEC channel added "<<
n <<
" per gain ");
1517 return StatusCode::SUCCESS ;
1538 for(;
it!=it_e;++
it){
1567 for( ;
it!=it_e;++
it){
1571 if(
u.m_data> -990.)
1590 return StatusCode::SUCCESS;
1598 std::vector<float> fcal_autoCorr[3][3] ;
1599 fcal_autoCorr[0][0] = {-0.01, -0.30, -0.09, 0.08};
1600 fcal_autoCorr[0][1] = { 0.01, -0.07, -0.01, 0.03};
1601 fcal_autoCorr[0][2] = { 0.2, 0.2, 0.2, 0.2};
1602 fcal_autoCorr[1][0] = { -0.02, -0.31, -0.06, 0.06};
1603 fcal_autoCorr[1][1] = { 0.0, -0.08, -0.01, 0.02};
1604 fcal_autoCorr[1][2] = { 0.02, 0.01, 0.02, 0.02};
1605 fcal_autoCorr[2][0] = { -0.03, -0.31, -0.05, 0.07};
1606 fcal_autoCorr[2][1] = { 0.01, -0.07, -0.01, 0.02};
1607 fcal_autoCorr[2][2] = { 0.02, 0.02, 0.02, 0.02};
1624 for (;
it!=it_e;++
it)
1628 if( (*it).isEmpty() )
continue;
1631 if(! m_fcal_idhelper->is_lar_fcal(
id))
continue ;
1632 int module = m_fcal_idhelper->module(
id) - 1;
1635 <<
u.m_vAutoCorr[0]<<
" "
1636 <<
u.m_vAutoCorr[1]<<
" "
1637 <<
u.m_vAutoCorr[2]<<
" "
1638 <<
u.m_vAutoCorr[3]<<
" " );
1653 " Number of entries modified = " <<
n );
1656 return StatusCode::SUCCESS;
1674 for (;
it!=it_e;++
it)
1677 if( (*it).isEmpty() )
continue;
1680 if(!m_fcal_idhelper->is_lar_fcal(
id))
continue;
1682 if( !
cabling->isOnlineConnected(hid)){
1684 << m_online_idhelper->print_to_string(hid) );
1697 float ramp_high = ramp0.
m_vRamp[1];
1699 std::vector<float> v_m ;
1701 v_m.push_back(ramp_high*9.96);
1704 std::vector<float> v_l ;
1706 v_l.push_back(ramp_high*9.96*9.67);
1718 return StatusCode::SUCCESS;
1727 ATH_CHECK( update_EM_HEC<LArRampMC>(
"",
"ramp_hec_june2008.txt",
cabling,
true, 1 ) );
1728 return StatusCode::SUCCESS;
1737 ToolHandle<ICaloSuperCellIDTool> scidtool(
"CaloSuperCellIDTool");
1738 if ( scidtool.retrieve().isFailure() ) {
1742 std::set<Identifier> scidset;
1743 std::map<HWIdentifier,int> sslot_schannel_idx;
1744 std::vector<unsigned int> OrderOnlHash_OffID;
1745 std::vector<unsigned int> OrderOffHash_OnlID;
1746 OrderOnlHash_OffID.resize(40000,0);
1747 OrderOffHash_OnlID.resize(40000,0);
1750 unsigned int min_onl_hash = 999999;
1751 unsigned int max_onl_hash = 0;
1752 unsigned int min_off_hash = 999999;
1753 unsigned int max_off_hash = 0;
1754 std::ofstream
hashes(
"AllHashChannels_All.txt");
1755 std::ofstream of(
"AllChannels_EM.txt");
1757 for(
size_t i = 0;
i < channel_size ;
i++) {
1760 if ( ! isEM )
continue;
1761 Identifier SCID = scidtool->offlineToSuperCellID(chid);
1763 scidset.insert(SCID);
1767 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;
1788 sprintf(etaChar,
"%5.4f",
eta);
1789 sprintf(phiChar,
"%5.4f",
phi);
1790 of << std::dec <<
"\t" << feedthrough <<
"\t" << slot;
1791 of <<
"\t" << bar_ec <<
" " << pos_neg <<
"\t\t" << samp <<
"\t";
1792 of << etaChar <<
" " << phiChar <<
"\t0x";
1797 bool secondOutSlot=
false;
1799 if ( (samp==1) && (reg==5) ) secondOutSlot=
true;
1810 if ( secondOutSlot ) {
1813 if ( sslot_schannel_idx.find(sfeb_id) == sslot_schannel_idx.end() )
1814 sslot_schannel_idx[sfeb_id]=0;
1815 else sslot_schannel_idx[sfeb_id]++;
1818 if ( onl_hash > max_onl_hash ) max_onl_hash = onl_hash;
1819 if ( onl_hash < min_onl_hash ) min_onl_hash = onl_hash;
1821 if ( off_hash > max_off_hash ) max_off_hash = off_hash;
1822 if ( off_hash < min_off_hash ) min_off_hash = off_hash;
1828 of <<
" " << onl_hash <<
" " << off_hash;
1836 of <<
"Hash check. Onl : " << min_onl_hash <<
" " << max_onl_hash;
1837 of <<
"; Off : " << min_off_hash <<
" " << max_off_hash << std::endl;;
1841 min_onl_hash = 999999;
1843 min_off_hash = 999999;
1845 std::ofstream of1(
"AllChannels_HEC.txt");
1847 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;
1848 for(
size_t i = 0;
i < channel_size ;
i++) {
1851 Identifier SCID = scidtool->offlineToSuperCellID(chid);
1852 if ( scidset.find(SCID) == scidset.end() )
1853 scidset.insert(SCID);
1874 sprintf(etaChar,
"%5.4f",
eta);
1875 sprintf(phiChar,
"%5.4f",
phi);
1876 of1 << std::dec <<
"\t" << feedthrough <<
"\t" << slot;
1877 of1 <<
"\t" << bar_ec <<
" " << pos_neg <<
"\t\t" << samp <<
"\t";
1878 of1 << etaChar <<
" " << phiChar <<
"\t0x";
1883 if ( sslot_schannel_idx.find(sfeb_id) == sslot_schannel_idx.end() )
1884 sslot_schannel_idx[sfeb_id]=0;
1885 else sslot_schannel_idx[sfeb_id]++;
1886 if ( (feedthrough==6) && (bar_ec==1) && (slot>9) ) {
1892 if ( onl_hash > max_onl_hash ) max_onl_hash = onl_hash;
1893 if ( onl_hash < min_onl_hash ) min_onl_hash = onl_hash;
1895 if ( off_hash > max_off_hash ) max_off_hash = off_hash;
1896 if ( off_hash < min_off_hash ) min_off_hash = off_hash;
1902 of1 <<
" " << onl_hash <<
" " << off_hash;
1910 min_onl_hash = 999999;
1912 min_off_hash = 999999;
1914 std::ofstream of3(
"AllChannels_FCAL.txt");
1916 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;
1917 for(
size_t i = 0;
i < channel_size ;
i++) {
1920 Identifier SCID = scidtool->offlineToSuperCellID(chid);
1921 if ( scidset.find(SCID) == scidset.end() )
1922 scidset.insert(SCID);
1933 of3 << std::dec <<
"\t" << feedthrough <<
"\t" << slot;
1934 of3 <<
"\t" << bar_ec <<
" " << pos_neg <<
"\t\t" << samp <<
"\t";
1938 if ( (feedthrough==6) && (bar_ec==1) && (slot>9) ) {
1941 if ( sslot_schannel_idx.find(sfeb_id) == sslot_schannel_idx.end() )
1942 sslot_schannel_idx[sfeb_id]=0;
1943 else sslot_schannel_idx[sfeb_id]++;
1946 if ( onl_hash > max_onl_hash ) max_onl_hash = onl_hash;
1947 if ( onl_hash < min_onl_hash ) min_onl_hash = onl_hash;
1949 if ( off_hash > max_off_hash ) max_off_hash = off_hash;
1950 if ( off_hash < min_off_hash ) min_off_hash = off_hash;
1956 of3 <<
" " << onl_hash <<
" " << off_hash;
1963 of3 <<
"Hash check. Onl : " << min_onl_hash <<
" " << max_onl_hash;
1964 of3 <<
"; Off : " << min_off_hash <<
" " << max_off_hash << std::endl;;
1970 coral::AttributeListSpecification *spec_onOff =
new coral::AttributeListSpecification();
1971 spec_onOff->extend(
"OnlineHashToOfflineId",
"blob");
1972 spec_onOff->extend<
unsigned>(
"version");
1973 std::unique_ptr<AthenaAttributeList> al_onOff = std::make_unique<AthenaAttributeList>(*spec_onOff);
1975 (*al_onOff)[
"version"].setValue(0U);
1976 blobOnOff.resize(onlHashMax*
sizeof(
uint32_t));
1981 for(
size_t ii=0;ii<onlHashMax;ii++) {
1982 if (OrderOnlHash_OffID[ii] != 0) {
1983 pBlobOnOff[ii]=OrderOnlHash_OffID[ii];
1987 pBlobOnOff[ii]=emptyId;
1990 ATH_MSG_INFO (
"HashMax=" << onlHashMax <<
", connected=" << nConn );
1992 ATH_CHECK(
detStore()->record(std::move(al_onOff),
"/LAR/IdentifierOfl/OnOffIdMap_SC") );
1994 hashes <<
"idx \t Off2OnlId \t Onl2OffId" << std::endl;
1995 for(
size_t ii=0;ii<40000;ii++)
1996 if ( (OrderOffHash_OnlID[ii] != 0) || ( OrderOnlHash_OffID[ii] != 0 ) )
1997 hashes << std::dec << ii << std::hex <<
" \t " << OrderOffHash_OnlID[ii] <<
" \t\t " << OrderOnlHash_OffID[ii] << std::endl;
2000 return StatusCode::SUCCESS;
2011 std::unique_ptr<LArMinBiasMC> minbias = std::make_unique<LArMinBiasMC>();
2012 ATH_CHECK( minbias->setGroupingType(
"Single",
msg()) );
2014 std::unique_ptr<LArMinBiasAverageMC> minbias_av = std::make_unique<LArMinBiasAverageMC>();
2015 ATH_CHECK( minbias_av->setGroupingType(
"Single",
msg()) );
2018 std::unique_ptr<TFile>
fin= std::make_unique<TFile>(
"ntuple_av.root");
2019 TTree *tin=
dynamic_cast<TTree*
>(
fin->Get(
"m_tree"));
2029 TBranch *b_identifier;
2036 tin->SetMakeClass(1);
2037 tin->SetBranchAddress(
"ncell", &
ncell, &b_ncell);
2038 tin->SetBranchAddress(
"identifier",
identifier, &b_identifier);
2039 tin->SetBranchAddress(
"layer",
layer, &b_layer);
2040 tin->SetBranchAddress(
"region", region, &b_region);
2041 tin->SetBranchAddress(
"ieta", ieta, &b_ieta);
2042 tin->SetBranchAddress(
"eta",
eta, &b_eta);
2043 tin->SetBranchAddress(
"average",
average, &b_average);
2044 tin->SetBranchAddress(
"rms",
rms, &b_rms);
2068 return StatusCode::SUCCESS;
2081 std::unique_ptr<LArMinBiasAverageMC> minbias_av = std::make_unique<LArMinBiasAverageMC>();
2082 ATH_CHECK( minbias_av->setGroupingType(
"Single",
msg()) );
2085 std::unique_ptr<TFile>
fin= std::make_unique<TFile>(
m_infile.value().c_str());
2086 TTree *tin=
dynamic_cast<TTree*
>(
fin->Get(
"m_tree"));
2096 TBranch *b_identifier;
2103 tin->SetMakeClass(1);
2104 tin->SetBranchAddress(
"ncell", &
ncell, &b_ncell);
2105 tin->SetBranchAddress(
"identifier",
identifier, &b_identifier);
2106 tin->SetBranchAddress(
"layer",
layer, &b_layer);
2107 tin->SetBranchAddress(
"region", region, &b_region);
2108 tin->SetBranchAddress(
"ieta", ieta, &b_ieta);
2109 tin->SetBranchAddress(
"eta",
eta, &b_eta);
2110 tin->SetBranchAddress(
"average",
average, &b_average);
2111 tin->SetBranchAddress(
"rms",
rms, &b_rms);
2120 float fsampl = larfSampl->
FSAMPL(hid);
2131 return StatusCode::SUCCESS;
2152 for(;
it!=it_e;++
it){
2169 return StatusCode::SUCCESS;
2176 std::string onOffIdKey=
"/LAR/Identifier/OnOffIdMap";
2179 if (
sc.isFailure()) {
2180 ATH_MSG_ERROR(
"Failed to read AthenaAttributeList with key " << onOffIdKey);
2181 return StatusCode::FAILURE;
2184 unsigned nChan=blobOnOff.size()/
sizeof(
uint32_t);
2188 if (nChan!=m_online_idhelper->channelHashMax()) {
2189 ATH_MSG_WARNING(
"Number of channels read from DB (" << nChan <<
") does not match online hash max ("
2190 <<m_online_idhelper->channelHashMax() <<
")");
2191 nChan=
std::min(nChan,
static_cast<unsigned int>(m_online_idhelper->channelHashMax()));
2193 std::vector<std::pair<unsigned int, unsigned int> > swapindex(8, std::make_pair(nChan+10,nChan+10));
2195 for (
unsigned i=0;
i<nChan;++
i) {
2197 if(m_online_idhelper->isEMECchannel(hwid) && m_online_idhelper->pos_neg(hwid) == 1 && m_online_idhelper->feedthrough(hwid) == 7 && m_online_idhelper->slot(hwid) == 11) {
2198 if(m_online_idhelper->channel(hwid)>=96 && m_online_idhelper->channel(hwid)<=103) swapindex[m_online_idhelper->channel(hwid)-96].first=
i;
2199 if(m_online_idhelper->channel(hwid)>=112 && m_online_idhelper->channel(hwid)<=129) swapindex[m_online_idhelper->channel(hwid)-112].second=
i;
2202 for(
unsigned i=0;
i<8; ++
i) {
2205 for(
unsigned i=0;
i<8; ++
i) {
2207 if (swapindex[
i].
first > nChan || swapindex[
i].
second > nChan ) {
2209 return StatusCode::FAILURE;
2211 uint32_t id = pBlobOnOff[swapindex[
i].first];
2212 pBlobOnOff[swapindex[
i].first] = pBlobOnOff[swapindex[
i].second];
2213 pBlobOnOff[swapindex[
i].second] =
id;
2218 return StatusCode::SUCCESS;
2226 ATH_CHECK( update_All<LArShape32MC>(m_infile.value(),
cabling,
true, 32 ) );
2228 return StatusCode::SUCCESS;
2237 coral::AttributeListSpecification* spec_calib =
new coral::AttributeListSpecification();
2238 spec_calib->extend(
"OnlineHashToCalibIds",
"blob");
2239 spec_calib->extend<
unsigned>(
"version");
2240 std::unique_ptr<AthenaAttributeList> al_calib = std::make_unique<AthenaAttributeList>(*spec_calib);
2242 (*al_calib)[
"version"].setValue(0U);
2243 blobCalib.resize(onlHashMax*
sizeof(
uint32_t)*4);
2245 spec_calib->release();
2247 spec_calib =
nullptr;
2250 size_t calibIndex=0;
2254 for (
unsigned i=0;
i<onlHashMax;++
i) {
2257 const std::vector<HWIdentifier>& calibIDs=
cabling->calibSlotLine(hwid);
2258 const size_t nCalibLines=calibIDs.size();
2261 if(nCalibLines > 1) {
2263 return StatusCode::FAILURE;
2265 if(nCalibLines==0) {
2266 pBlobCalib[calibIndex++]=0;
2273 return StatusCode::FAILURE;
2276 pBlobCalib[calibIndex++]=1;
2280 pBlobCalib[calibIndex++]=nCalibLines;
2281 for(
uint32_t iCalib=0;iCalib<nCalibLines;++iCalib)
2282 pBlobCalib[calibIndex++]=calibIDs[iCalib].get_identifier32().get_compact();
2285 blobCalib.resize(calibIndex*
sizeof(
uint32_t));
2289 ATH_CHECK(
detStore()->record(std::move(al_calib),
"/LAR/Identifier/CalibIdMap_EMF"));
2291 return StatusCode::SUCCESS;