83#include "Gaudi/Property.h"
84#include "GaudiKernel/IToolSvc.h"
109#include "CoralBase/Blob.h"
140 return StatusCode::SUCCESS;
145 const EventContext& ctx = Gaudi::Hive::currentContext();
153 return fix13(cabling);
155 return StatusCode::SUCCESS;
162 const EventContext& ctx = Gaudi::Hive::currentContext();
167 ATH_MSG_ERROR(
"Do not have cabling mapping from key " << m_cablingKey.key() );
168 return StatusCode::FAILURE;
174 return StatusCode::FAILURE;
179 return fix1(cabling);
181 return fix2(cabling);
183 return fix3(cabling);
185 return fix4(cabling);
187 return fix5(cabling);
189 return fix6(cabling);
191 return fix7(cabling);
193 return fix8(cabling);
195 return fix9(cabling);
197 return fix10(cabling);
199 return fix11(cabling);
201 return fix12(cabling);
203 return fix13(cabling);
205 return fix14(cabling);
211 return fix17(cabling);
213 return fix18(clCont);
215 return StatusCode::SUCCESS;
227 const LArEM_ID* em_idhelper =
nullptr;
234 SmartIF<IToolSvc> toolSvc{Gaudi::svcLocator()->service(
"ToolSvc")};
242 std::ifstream infile(
"barrel_dac2ua_oct06.txt") ;
246 return StatusCode::FAILURE;
250 int det,samp,reg,
eta;
253 while ( infile>>det>>samp>>reg>>
eta>>value )
264 if ( det==1 && samp==1 && reg==0 &&
eta==0 ){
291 return StatusCode::SUCCESS;
309 SmartIF<IToolSvc> toolSvc{Gaudi::svcLocator()->service(
"ToolSvc")};
337 for(
unsigned int gain=0;gain<3;++gain)
344 for (; it!=it_e;++it)
347 if( (*it).isEmpty() )
continue;
348 if(cabling->isOnlineConnected(hid)){
369 " Number of entries removed = " <<n );
374 hid_mod[0] = online_idhelper->
channel_Id(1,1,6,1,33);
375 hid_mod[1] = online_idhelper->
channel_Id(1,1,6,10,12);
376 hid_mod[2] = online_idhelper->
channel_Id(1,1,6,14,12);
379 std::vector<Identifier>::const_iterator it= fcal_idhelper->
fcal_begin();
380 std::vector<Identifier>::const_iterator it_e= fcal_idhelper->
fcal_end();
385 int pn = fcal_idhelper->
pos_neg(
id);
387 int phi = fcal_idhelper->
phi(
id);
390 int module = fcal_idhelper->module(
id)-1;
394 for(
unsigned int gain = 0;gain<3;++gain){
397 if (!rampP.
isEmpty()) continue ;
413 shape->
setPdata(hid,shape_std,gain);
416 noise->setPdata(hid,noise_std,gain);
421 ua2mev->
setPdata(hid,ua2mev_std,gain);
424 dac2ua->
setPdata(hid,dac2ua_std,gain);
427 fsampl->
setPdata(hid,fsampl_std,gain);
430 minbias->
setPdata(hid,minbias_std,gain);
438 return StatusCode::SUCCESS;
444 std::string filename ;
447 if(m_g4Phys==
"QGSP_EMV"){
448 filename =
"fsampl_1302_qgsp-emv.txt";
451 if( m_g4Phys==
"QGSP_BERT"){
452 filename =
"fsampl_1303_qgsp-bert.txt";
456 return StatusCode::FAILURE;
462 ATH_CHECK( updateEMfSampl(filename, cabling ) );
464 return StatusCode::SUCCESS;
470 return updateEM_DACuAMeV(
"dac2ua_ua2mev_rel13.txt", cabling );
475 float fsampl_fcal1,fsampl_fcal2,fsampl_fcal3;
476 float fsampl_hec1,fsampl_hec2;
478 if(m_g4Phys==
"QGSP_EMV"){
480 fsampl_hec2=0.021775;
484 fsampl_fcal1=0.01366;
485 fsampl_fcal2=0.00854;
486 fsampl_fcal3=0.01107;
493 if( m_g4Phys==
"QGSP_BERT"){
498 fsampl_fcal1=0.01591;
499 fsampl_fcal2=0.01144;
500 fsampl_fcal3=0.01405;
509 return StatusCode::FAILURE;
524 for (;
it!=it_e;++
it){
527 if( (*it).isEmpty() )
continue;
528 if(!
cabling->isOnlineConnected(hid)){
537 if(m_hec_idhelper->is_lar_hec(
id)){
539 int sam = m_hec_idhelper->sampling(
id);
542 t2.m_fSampl = fsampl_hec1;
545 t2.m_fSampl = fsampl_hec2;
553 if(m_fcal_idhelper->is_lar_fcal(
id)){
555 int sam = m_fcal_idhelper->module(
id);
558 t2.m_fSampl = fsampl_fcal1;
561 t2.m_fSampl = fsampl_fcal2;
564 t2.m_fSampl = fsampl_fcal3;
578 return StatusCode::SUCCESS;
590 ATH_CHECK( detStore()->retrieve(fsampl_c) );
596 std::ifstream infile( filename.c_str() );
600 return StatusCode::FAILURE;
602 int det,samp,reg,
eta;
605 while ( infile>>det>>samp>>reg>>
eta>>value )
616 if ( det==1 && samp==1 && reg==0 &&
eta==0 ){
622 id = m_em_idhelper->channel_id(det,samp,reg,
eta,0);
626 std::string id_str = m_online_idhelper->print_to_string(hid);
639 t2.m_fSampl = value ;
646 return StatusCode::SUCCESS;
666 return StatusCode::FAILURE;
676 float dac2ua0, ua2mev0,attenuation,dac2ua,ua2mev;
677 while ( infile>>det>>samp>>reg>>
eta>>
678 dac2ua0>>ua2mev0>>attenuation>>dac2ua>>ua2mev )
690 if ( det==1 && samp==1 && reg==0 &&
eta==0 ){
696 id = m_em_idhelper->channel_id(det,samp,reg,
eta,0);
701 std::string id_str = m_online_idhelper->print_to_string(hid);
702 std::string id_str_off = m_em_idhelper->print_to_string(
id);
740 return StatusCode::SUCCESS;
750 ATH_CHECK( updateMinBias(
"mbrms_em_rel12.txt", cabling) );
751 ATH_CHECK( updateMinBias(
"mbrms_hec_rel12.txt", cabling) );
766 for(
unsigned int gain=0;
gain<3;++
gain)
772 for (;
it!=it_e;++
it)
775 if( (*it).isEmpty() )
continue;
778 if(!m_fcal_idhelper->is_lar_fcal(
id))
continue;
780 if(
cabling->isOnlineConnected(hid)){
784 << m_online_idhelper->print_to_string(hid) );
792 " Number of connected and disconnected = " <<nconn<<
" " <<ndisc );
799 std::string
filename(
"FCal_noise_minbias.txt");
806 return StatusCode::FAILURE;
813 for(
int i = 0;
i<11;++
i){
820 float vol,noise_p,noise_h, noise_m,noise_l;
822 while ( infile>>str_id >>vol>>noise_p>>noise_h>>noise_m>>noise_l )
824 const char* ch_id = str_id.c_str();
825 if(ch_id[0] !=
'A') {
831 std::sscanf(ch_id,
"A%d.%d.%d", &mod,&
phi,&
eta);
844 ATH_MSG_INFO(
" minBiasRMS, old new "<<
t2.m_MinBiasRMS<<
" " <<noise_p);
845 t2.m_MinBiasRMS = noise_p;
866 return StatusCode::SUCCESS;
871 ATH_MSG_INFO (
" in updateMinBias(), filename = "<<filename );
887 return StatusCode::FAILURE;
895 while ( infile>>lar>>tp>>det>>samp>>reg>>
eta>>
phi>>value )
906 if ( det==1 && samp==1 && reg==0 &&
eta==0 ){
914 id = m_em_idhelper->channel_id(det,samp,reg,
eta,0);
918 id = m_hec_idhelper->channel_id(det,samp,reg,
eta,0);
929 ATH_MSG_INFO(
" online id = "<<m_online_idhelper->print_to_string(hid));
949 return StatusCode::SUCCESS;
978 for(
unsigned int gain=0;
gain<3;++
gain)
984 for (;
it!=it_e;++
it)
987 if( (*it).isEmpty() )
continue;
990 if(!m_fcal_idhelper->is_lar_fcal(
id))
continue;
992 if(
cabling->isOnlineConnected(hid)){
998 << m_online_idhelper->print_to_string(hid) );
1006 " Number of connected and disconnected = " <<nconn<<
" " <<ndisc );
1013 std::string
filename(
"FCal_noise_minbias_adc2mev.txt");
1019 return StatusCode::FAILURE;
1026 for(
int i = 0;
i<27;++
i){
1033 float vol,noise_p,noise_h, noise_m,noise_l;
1034 float ramp_val,ua2MeV_val,dac2uA_val;
1036 while ( infile>>str_id >>vol>>noise_p >> noise_h>>noise_m>>noise_l
1037 >>channel_type>> ramp_val>>ua2MeV_val>>dac2uA_val )
1039 const char* ch_id = str_id.c_str();
1041 if(str_id.substr(0,1)!=std::string(
"A")){
1047 sscanf(ch_id,
"A%d.%d.%d", &mod,&
phi,&
eta);
1088 ua2MeV0.
m_data=ua2MeV_val;
1091 dac2ua0.
m_data = dac2uA_val;
1096 return StatusCode::SUCCESS;
1106 if( m_g4Phys==
"QGSP_BERT"){
1107 filename =
"fsampl_1303_qgsp-bert.txt";
1111 return StatusCode::FAILURE;
1114 ATH_CHECK( updateEMfSampl(filename, cabling ) );
1115 return StatusCode::SUCCESS;
1126 ATH_CHECK( update_EM_HEC<LArNoiseMC>(
"noise_em.txt",
"noise_hec.txt", cabling,
true, 1 ) );
1127 ATH_CHECK( update_EM_HEC<LArAutoCorrMC>(
"",
"autocorr_hec.txt", cabling,
true, 4 ) );
1129 ATH_CHECK( update_EM_HEC<LArAutoCorrMC>(
"autocorr_em.txt",
"", cabling,
true,5) );
1130 ATH_CHECK( update_EM_HEC<LArRampMC>(
"ramp_em.txt",
"ramp_hec.txt", cabling,
true, 1 ) );
1131 ATH_CHECK( update_EM_HEC<LAruA2MeVMC>(
"ua2mev_em.txt",
"ua2mev_hec.txt", cabling,
false, 1 ) );
1132 ATH_CHECK( update_EM_HEC<LArDAC2uAMC>(
"dac2ua_em.txt",
"dac2ua_hec.txt", cabling,
false, 1 ) );
1133 ATH_CHECK( update_EM_HEC<LArShape32MC>(
"shape_em.txt",
"shape_hec.txt", cabling,
true, 64 ) );
1134 ATH_CHECK( update_EM_HEC<LArMphysOverMcalMC>(
"mphys_em.txt",
"", cabling,
true, 1 ) );
1138 return StatusCode::SUCCESS;
1144 std::ifstream infile(filename.c_str() ) ;
1146 if(! infile.good() )
1149 return StatusCode::FAILURE;
1159 infile.getline(s,200);
1165 while ( infile>>first )
1169 infile>>samp>>reg>>
eta;
1177 if(withGain) infile>>gain ;
1178 std::vector<float> vfl;
1181 for (
int i=0;i<nvar;++i)
1195 if ( det==1 && samp==1 && reg==0 &&
eta==0 ){
1207 if (gain >= 0 && gain < 3)
1211 return StatusCode::SUCCESS;
1216 std::ifstream infile(filename.c_str() ) ;
1218 if(! infile.good() )
1221 return StatusCode::FAILURE;
1231 infile.getline(s,200);
1234 int det=0,samp=0,reg=0,
eta=0;
1236 while ( infile>>first>>samp>>reg>>
eta ) {
1242 if ( det==1 && samp==1 && reg==0 &&
eta==0 ){
1249 }
else if (first == 3) {
1251 }
else if (first == 4) {
1255 if(withGain) infile>>gain ;
1256 for (
int i=0;i<nvar;++i) infile>>
x;
1259 if(withGain) infile>>gain ;
1260 std::vector<float> vfl;
1262 for (
int i=0;i<nvar;++i)
1268 <<first<<
" " <<det<<
" " <<samp<<
" " <<reg<<
" " <<
eta<<
" " );
1272 if (gain >= 0 && gain < 3)
m_cache[gain].push_back(
ROW_t(hid,vfl));
1278 return StatusCode::SUCCESS;
1294 ATH_MSG_ERROR (
"for LArNoiseMC, size of vector = "<< v.size() <<
" differs from one");
1307 msg()<<MSG::DEBUG<<
" LArAutoCorrMC" << s ;
1308 for (
unsigned int i =0 ; i<obj.m_vAutoCorr.size();++i)
1309 msg()<<
" " << obj.m_vAutoCorr[i];
1319 ATH_MSG_ERROR(
"for LArAutoCorrMC, size of vector = "<< v.size()<<
" is less then 4" );
1323 obj.m_vAutoCorr.resize(4);
1324 std::copy_n(v.begin(), 4, obj.m_vAutoCorr.begin());
1334 msg()<<MSG::DEBUG<<
" LArRampMC" << s ;
1335 for (
unsigned int i =0 ; i<obj.m_vRamp.size();++i)
1336 msg()<<
" " << obj.m_vRamp[i];
1346 ATH_MSG_ERROR (
"for LArRampMC, size of vector = "<< v.size());
1349 obj.m_vRamp.resize(3);
1351 obj.m_vRamp[1]=v[0];
1363 msg()<<MSG::DEBUG<<
" LArShape" << s ;
1364 for (
unsigned int i =0 ; i<obj.m_vShape.size();++i)
1365 msg()<<
" " << obj.m_vShape[i];
1368 msg()<<MSG::DEBUG<<
" LArShapeDer" << s ;
1369 for (
unsigned int i =0 ; i<obj.m_vShapeDer.size();++i)
1370 msg()<<
" " << obj.m_vShapeDer[i];
1379 if (v.size()!=64 && v.size()!=32 )
1381 ATH_MSG_ERROR (
"for LArShape32MC, size of vector = "<< v.size());
1385 unsigned int size = 32;
1386 obj.m_vShape.resize(size);
1387 obj.m_vShapeDer.resize(size);
1389 for(
unsigned int i=0;i<size;++i){
1390 obj.m_vShape[i]=v[i];
1391 if(v.size() == 64 ) obj.m_vShapeDer[i]=v[i+size];
else obj.m_vShapeDer[i]=0.;
1414 ATH_MSG_ERROR(
"for LArSingleFloatP, size of vector = "<< v.size() );
1431 std::unique_ptr<LArMphysOverMcalMC> mphys = std::make_unique<LArMphysOverMcalMC>();
1437 std::string filename(
"FCal_noise_minbias_adc2mev.txt");
1439 std::ifstream infile(filename.c_str() ) ;
1441 if(! infile.good() )
1444 return StatusCode::FAILURE;
1451 for(
int i = 0;i<27;++i){
1452 infile.getline(s,200);
1458 float vol,noise_p,noise_h, noise_m,noise_l;
1459 float ramp_val,ua2MeV_val,dac2uA_val;
1460 std::string channel_type;
1461 while ( infile>>str_id >>vol>>noise_p >> noise_h>>noise_m>>noise_l
1462 >>channel_type>> ramp_val>>ua2MeV_val>>dac2uA_val )
1464 const char* ch_id = str_id.c_str();
1466 if(str_id.substr(0,1)!=std::string(
"A")){
1472 sscanf(ch_id,
"A%d.%d.%d", &mod,&
phi,&
eta);
1486 mphys->setPdata(hid,t,0);
1487 mphys->setPdata(hid,t,1);
1488 mphys->setPdata(hid,t,2);
1491 ATH_MSG_INFO(
" MphysOverMcal added "<<n<<
" FCAL channels");
1494 bool withGain=
false;
1496 std::string hec_filename(
"mphys_hec.txt");
1506 mphys->setPdata(hid,t,0);
1507 mphys->setPdata(hid,t,1);
1508 mphys->setPdata(hid,t,2);
1517 ATH_MSG_ERROR(
" Number of HEC channel added "<<n <<
" per gain ");
1518 return StatusCode::SUCCESS ;
1527 ATH_CHECK( detStore()->retrieve(dac2ua_c) );
1531 ATH_CHECK( detStore()->retrieve(ua2mev_c) );
1539 for(;it!=it_e;++it){
1568 for( ;
it!=it_e;++
it){
1572 if(
u.m_data> -990.)
1591 return StatusCode::SUCCESS;
1599 std::vector<float> fcal_autoCorr[3][3] ;
1600 fcal_autoCorr[0][0] = {-0.01, -0.30, -0.09, 0.08};
1601 fcal_autoCorr[0][1] = { 0.01, -0.07, -0.01, 0.03};
1602 fcal_autoCorr[0][2] = { 0.2, 0.2, 0.2, 0.2};
1603 fcal_autoCorr[1][0] = { -0.02, -0.31, -0.06, 0.06};
1604 fcal_autoCorr[1][1] = { 0.0, -0.08, -0.01, 0.02};
1605 fcal_autoCorr[1][2] = { 0.02, 0.01, 0.02, 0.02};
1606 fcal_autoCorr[2][0] = { -0.03, -0.31, -0.05, 0.07};
1607 fcal_autoCorr[2][1] = { 0.01, -0.07, -0.01, 0.02};
1608 fcal_autoCorr[2][2] = { 0.02, 0.02, 0.02, 0.02};
1618 for(
unsigned int gain=0;
gain<3;++
gain)
1625 for (;
it!=it_e;++
it)
1629 if( (*it).isEmpty() )
continue;
1632 if(! m_fcal_idhelper->is_lar_fcal(
id)) continue ;
1633 int module = m_fcal_idhelper->module(
id) - 1;
1636 <<
u.m_vAutoCorr[0]<<
" "
1637 <<
u.m_vAutoCorr[1]<<
" "
1638 <<
u.m_vAutoCorr[2]<<
" "
1639 <<
u.m_vAutoCorr[3]<<
" " );
1654 " Number of entries modified = " <<n );
1657 return StatusCode::SUCCESS;
1675 for (;
it!=it_e;++
it)
1678 if( (*it).isEmpty() )
continue;
1681 if(!m_fcal_idhelper->is_lar_fcal(
id))
continue;
1683 if( !
cabling->isOnlineConnected(hid)){
1685 << m_online_idhelper->print_to_string(hid) );
1698 float ramp_high = ramp0.
m_vRamp[1];
1700 ramp1.
m_vRamp.assign ({0, ramp_high*9.96f});
1701 ramp2.
m_vRamp.assign ({0, ramp_high*9.96f*9.67f});
1712 return StatusCode::SUCCESS;
1721 ATH_CHECK( update_EM_HEC<LArRampMC>(
"",
"ramp_hec_june2008.txt", cabling,
true, 1 ) );
1722 return StatusCode::SUCCESS;
1731 ToolHandle<ICaloSuperCellIDTool> scidtool(
"CaloSuperCellIDTool");
1732 if ( scidtool.retrieve().isFailure() ) {
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);
1743 Identifier::size_type channel_size =
m_em_idhelper->channel_hash_max();
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");
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);
1759 HWIdentifier hwid = cabling->createSignalChannelID(chid);
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;
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";
1791 bool secondOutSlot=
false;
1793 if ( (samp==1) && (reg==5) ) secondOutSlot=
true;
1794 if ( (samp==2) && (reg==1) && (
m_em_idhelper->eta( chid )>=39 ) )
1796 if ( (samp==3) && (reg==0) && (
m_em_idhelper->eta( chid )>=18 ) )
1804 if ( secondOutSlot ) {
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]++;
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;
1822 of <<
" " << onl_hash <<
" " << off_hash;
1830 of <<
"Hash check. Onl : " << min_onl_hash <<
" " << max_onl_hash;
1831 of <<
"; Off : " << min_off_hash <<
" " << max_off_hash << std::endl;;
1835 min_onl_hash = 999999;
1837 min_off_hash = 999999;
1839 std::ofstream of1(
"AllChannels_HEC.txt");
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);
1849 HWIdentifier hwid = cabling->createSignalChannelID(chid);
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";
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) ) {
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;
1896 of1 <<
" " << onl_hash <<
" " << off_hash;
1904 min_onl_hash = 999999;
1906 min_off_hash = 999999;
1908 std::ofstream of3(
"AllChannels_FCAL.txt");
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);
1918 HWIdentifier hwid = cabling->createSignalChannelID(chid);
1927 of3 << std::dec <<
"\t" << feedthrough <<
"\t" << slot;
1928 of3 <<
"\t" << bar_ec <<
" " << pos_neg <<
"\t\t" << samp <<
"\t";
1932 if ( (feedthrough==6) && (bar_ec==1) && (slot>9) ) {
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]++;
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;
1950 of3 <<
" " << onl_hash <<
" " << off_hash;
1957 of3 <<
"Hash check. Onl : " << min_onl_hash <<
" " << max_onl_hash;
1958 of3 <<
"; Off : " << min_off_hash <<
" " << max_off_hash << std::endl;;
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));
1971 uint32_t* pBlobOnOff=
static_cast<uint32_t*
>(blobOnOff.startingAddress());
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];
1981 pBlobOnOff[ii]=emptyId;
1984 ATH_MSG_INFO (
"HashMax=" << onlHashMax <<
", connected=" << nConn );
1986 ATH_CHECK(
detStore()->record(std::move(al_onOff),
"/LAR/IdentifierOfl/OnOffIdMap_SC") );
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;
1994 return StatusCode::SUCCESS;
2004 std::unique_ptr<LArMinBiasMC> minbias = std::make_unique<LArMinBiasMC>();
2005 ATH_CHECK( minbias->setGroupingType(
"Single",
msg()) );
2007 std::unique_ptr<LArMinBiasAverageMC> minbias_av = std::make_unique<LArMinBiasAverageMC>();
2008 ATH_CHECK( minbias_av->setGroupingType(
"Single",
msg()) );
2011 std::unique_ptr<TFile> fin= std::make_unique<TFile>(
"ntuple_av.root");
2012 TTree *tin=
dynamic_cast<TTree*
>(fin->Get(
"m_tree"));
2015 return StatusCode::FAILURE;
2017 const int nindex=1833;
2019 int identifier[nindex];
2024 double average[nindex];
2027 TBranch *b_identifier;
2034 tin->SetMakeClass(1);
2035 tin->SetBranchAddress(
"ncell", &ncell, &b_ncell);
2036 tin->SetBranchAddress(
"identifier", identifier, &b_identifier);
2037 tin->SetBranchAddress(
"layer", layer, &b_layer);
2038 tin->SetBranchAddress(
"region", region, &b_region);
2039 tin->SetBranchAddress(
"ieta", ieta, &b_ieta);
2040 tin->SetBranchAddress(
"eta",
eta, &b_eta);
2041 tin->SetBranchAddress(
"average", average, &b_average);
2042 tin->SetBranchAddress(
"rms", rms, &b_rms);
2045 if(ncell>nindex) ncell=nindex;
2046 for(
int icell=0; icell<ncell; ++icell) {
2052 minbias->set(hid, rms[icell]);
2053 minbias_av->set(hid, average[icell]);
2057 ATH_MSG_INFO(
" number of channels in intuple ="<<ncell);
2059 ATH_MSG_INFO (
"Stored container " << minbias->totalNumberOfConditions() <<
" conditions, key LArMinBias " );
2063 ATH_MSG_INFO (
"Stored container " << minbias_av->totalNumberOfConditions() <<
" conditions, key LArMinBiasAverage " );
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"));
2089 return StatusCode::FAILURE;
2092 std::vector<int> identifier(2862);
2093 std::vector<int> layer(2862);
2094 std::vector<int> region(2862);
2095 std::vector<int> ieta(2862);
2096 std::vector<float>
eta(2862);
2097 std::vector<double> average(2862);
2098 std::vector<double> rms(2862);
2100 TBranch *b_identifier;
2107 tin->SetMakeClass(1);
2108 tin->SetBranchAddress(
"ncell", &ncell, &b_ncell);
2109 tin->SetBranchAddress(
"identifier", identifier.data(), &b_identifier);
2110 tin->SetBranchAddress(
"layer", layer.data(), &b_layer);
2111 tin->SetBranchAddress(
"region", region.data(), &b_region);
2112 tin->SetBranchAddress(
"ieta", ieta.data(), &b_ieta);
2113 tin->SetBranchAddress(
"eta",
eta.data(), &b_eta);
2114 tin->SetBranchAddress(
"average", average.data(), &b_average);
2115 tin->SetBranchAddress(
"rms", rms.data(), &b_rms);
2119 for(
int icell=0; icell<ncell; ++icell) {
2124 float fsampl = larfSampl->
FSAMPL(hid);
2125 minbias_av->set(hid, 6.31*average[icell]/fsampl);
2129 ATH_MSG_INFO(
" number of channels in intuple ="<<ncell);
2131 ATH_MSG_INFO (
"Stored container " << minbias_av->totalNumberOfConditions() <<
" conditions, key LArPileupAverage " );
2135 return StatusCode::SUCCESS;
2146 ATH_CHECK( detStore()->retrieve(minbias_c,
"LArPileupAverage") );
2156 for(;it!=it_e;++it){
2160 ATH_MSG_INFO(
" Old pileup = "<< u.m_MinBiasAverage<<
" " );
2168 ATH_MSG_INFO(
" New Pileup = "<< t3.m_MinBiasAverage<<
" " );
2173 return StatusCode::SUCCESS;
2180 std::string onOffIdKey=
"/LAR/Identifier/OnOffIdMap";
2182 StatusCode
sc=
detStore()->retrieve(attrOnOff,onOffIdKey);
2183 if (
sc.isFailure()) {
2184 ATH_MSG_ERROR(
"Failed to read AthenaAttributeList with key " << onOffIdKey);
2185 return StatusCode::FAILURE;
2187 const coral::Blob& blobOnOff=(*attrOnOff)[
"OnlineHashToOfflineId"].data<coral::Blob>();
2188 unsigned nChan=blobOnOff.size()/
sizeof(
uint32_t);
2192 if (nChan!=m_online_idhelper->channelHashMax()) {
2193 ATH_MSG_WARNING(
"Number of channels read from DB (" << nChan <<
") does not match online hash max ("
2194 <<m_online_idhelper->channelHashMax() <<
")");
2195 nChan=std::min(nChan,
static_cast<unsigned int>(m_online_idhelper->channelHashMax()));
2197 std::vector<std::pair<unsigned int, unsigned int> > swapindex(8, std::make_pair(nChan+10,nChan+10));
2199 for (
unsigned i=0;
i<nChan;++
i) {
2201 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) {
2202 if(m_online_idhelper->channel(hwid)>=96 && m_online_idhelper->channel(hwid)<=103) swapindex[m_online_idhelper->channel(hwid)-96].first=
i;
2203 if(m_online_idhelper->channel(hwid)>=112 && m_online_idhelper->channel(hwid)<=129) swapindex[m_online_idhelper->channel(hwid)-112].second=
i;
2206 for(
unsigned i=0;
i<8; ++
i) {
2209 for(
unsigned i=0;
i<8; ++
i) {
2211 if (swapindex[i].first > nChan || swapindex[i].second > nChan ) {
2212 ATH_MSG_ERROR(
"Problem in swapindex: "<< i <<
" : " << swapindex[i].first <<
" " << swapindex[i].second);
2213 return StatusCode::FAILURE;
2215 uint32_t id = pBlobOnOff[swapindex[
i].first];
2216 pBlobOnOff[swapindex[
i].first] = pBlobOnOff[swapindex[
i].second];
2217 pBlobOnOff[swapindex[
i].second] =
id;
2222 return StatusCode::SUCCESS;
2230 ATH_CHECK( update_All<LArShape32MC>(m_infile.value(), cabling,
true, 32 ) );
2232 return StatusCode::SUCCESS;
2241 coral::AttributeListSpecification* spec_calib =
new coral::AttributeListSpecification();
2242 spec_calib->extend(
"OnlineHashToCalibIds",
"blob");
2243 spec_calib->extend<
unsigned>(
"version");
2244 std::unique_ptr<AthenaAttributeList> al_calib = std::make_unique<AthenaAttributeList>(*spec_calib);
2245 coral::Blob& blobCalib=(*al_calib)[
"OnlineHashToCalibIds"].data<coral::Blob>();
2246 (*al_calib)[
"version"].setValue(0U);
2247 blobCalib.resize(onlHashMax*
sizeof(uint32_t)*4);
2249 spec_calib->release();
2251 spec_calib =
nullptr;
2253 uint32_t* pBlobCalib=
static_cast<uint32_t*
>(blobCalib.startingAddress());
2254 size_t calibIndex=0;
2258 for (
unsigned i=0;i<onlHashMax;++i) {
2261 const std::vector<HWIdentifier>& calibIDs=cabling->calibSlotLine(hwid);
2262 const size_t nCalibLines=calibIDs.size();
2265 if(nCalibLines > 1) {
2267 return StatusCode::FAILURE;
2269 if(nCalibLines==0) {
2270 pBlobCalib[calibIndex++]=0;
2277 return StatusCode::FAILURE;
2280 pBlobCalib[calibIndex++]=1;
2284 pBlobCalib[calibIndex++]=nCalibLines;
2285 for(uint32_t iCalib=0;iCalib<nCalibLines;++iCalib)
2286 pBlobCalib[calibIndex++]=calibIDs[iCalib].get_identifier32().get_compact();
2289 blobCalib.resize(calibIndex*
sizeof(uint32_t));
2293 ATH_CHECK(
detStore()->record(std::move(al_calib),
"/LAR/Identifier/CalibIdMap_EMF"));
2295 return StatusCode::SUCCESS;
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
Helper class for offline supercell identifiers.
StatusCode FixLArElecCalib::stop ATLAS_NOT_THREAD_SAFE()
Install fatal handler with default options.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
const ServiceHandle< StoreGateSvc > & detStore() const
An AttributeList represents a logical row of attributes in a metadata table.
std::string print_to_string(Identifier id, const IdContext *context=0) const
or provide the printout in string form
StatusCode fix13(const LArOnOffIdMapping *cabling)
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
StatusCode fix12(const LArOnOffIdMapping *cabling)
void set_object(LArNoiseMC::LArCondObj &obj, const std::vector< float > &v)
StatusCode ReadFile(const std::string &filename, const LArOnOffIdMapping *cabling, bool EM, bool withGain, int nvar)
const LArOnline_SuperCellID * m_sonline_idhelper
virtual StatusCode initialize() override
StatusCode fix2(const LArOnOffIdMapping *cabling)
const LArEM_SuperCell_ID * m_sem_idhelper
StatusCode fix1(const LArOnOffIdMapping *cabling)
virtual StatusCode execute() override
StatusCode fix18(const LArCalibLineMapping *clmap)
SG::ReadCondHandleKey< LArCalibLineMapping > m_CLKey
const LArHEC_ID * m_hec_idhelper
IntegerProperty m_fixFlag
const LArOnlineID * m_online_idhelper
const LArFCAL_ID * m_fcal_idhelper
const CaloCell_SuperCell_ID * m_scell_idhelper
const LArEM_ID * m_em_idhelper
std::pair< HWIdentifier, std::vector< float > > ROW_t
void print_object(const std::string &msg, const LArNoiseMC::LArCondObj &obj)
StatusCode fix14(const LArOnOffIdMapping *cabling)
StatusCode addMphysOverMcal(const LArOnOffIdMapping *cabling)
const LArHEC_SuperCell_ID * m_shec_idhelper
StatusCode ReadFileAll(const std::string &filename, const LArOnOffIdMapping *cabling, bool withGain, int nvar)
FixLArElecCalib(const std::string &name, ISvcLocator *pSvcLocator)
virtual const float & FSAMPL(const HWIdentifier &id) const =0
value_type get_compact() const
Get the compact id.
This is a "hash" representation of an Identifier.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
Implementation of the interface ILArAutoCorr for MC Derives from LArAutoCorrComplete,...
std::vector< float > m_vAutoCorr
void setPdata(const HWIdentifier id, const T &payload, unsigned int gain=0)
put payload in persistent data
ConstReference get(const HWIdentifier id, unsigned int gain=0) const
get data with online identifier
ConstConditionsMapIterator begin(unsigned int gain) const
get iterator for all channels for a gain
ConstConditionsMapIterator end(unsigned int gain) const
end of all channels for this gain
LArSingleFloatP LArCondObj
ConditionsMap::iterator ConditionsMapIterator
Implementation of the interface ILArDAC2uA for MC Derives from LArDAC2uAComplete, and implements the ...
Identifier channel_id(const ExpandedIdentifier &exp_id) const
Build a cell identifier from an expanded identifier.
Helper class for LArEM offline identifiers.
id_iterator fcal_end() const
end iterator over full set of Fcal Identifiers for channels
id_iterator fcal_begin() const
begin iterator over full set of Fcal Identifiers for channels
int phi(const Identifier id) const
phi [0,15]
int pos_neg(const Identifier id) const
pos_neg : +/- 2 (A/C side)
Helper class for LArFCAL offline identifiers.
Implementation of the interface ILArMinBiasAverage for MC Derives from LArMinBiasAverageComplete,...
Implementation of the interface ILArMinBias for MC Derives from LArMinBiasComplete,...
Implementation of the interface ILArNoise for MC Derives from LArNoiseComplete, and implements the ph...
HWIdentifier channel_Id(int barrel_ec, int pos_neg, int feedthrough, int slot, int channel) const
create channel identifier from fields
Implementation of the interface ILArRamp for MC Derives from LArRampComplete, and implements the phi-...
std::vector< float > m_vRamp
This class implements the ILArShape interface.
Implementation of the interface ILArfSampl for MC Derives from LArfSamplComplete, and implements the ...
Implementation of the interface ILAruA2MeV for MC Derives from LAruA2MeVComplete, and implements the ...
std::vector< ALFA_RawDataContainer_p1 > t2
std::vector< ALFA_RawDataCollection_p1 > t1
std::vector< LUCID_RawData_p1 > t3
@ u
Enums for curvilinear frames.
retrieve(aClass, aKey=None)