1 //dear emacs, this is -*-c++-*-
 
    4   Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
 
    7 template<class MC_t, class SYM_t>
 
    8 StatusCode LArSymConditionsAlg<MC_t,SYM_t>::initialize() {
 
   11   ATH_CHECK( m_readKey.initialize() );
 
   12   ATH_CHECK( m_mcSymKey.initialize() );
 
   13   ATH_CHECK( m_writeKey.initialize() );
 
   15   return StatusCode::SUCCESS;
 
   19 template<class MC_t, class SYM_t>
 
   20 StatusCode LArSymConditionsAlg<MC_t,SYM_t>::execute() {
 
   22   SG::WriteCondHandle<SYM_t> writeHandle{m_writeKey};
 
   24   if (writeHandle.isValid()) {
 
   25     ATH_MSG_DEBUG("Found valid write handle");
 
   26     return StatusCode::SUCCESS;
 
   29   SG::ReadCondHandle<MC_t> readHandle{m_readKey};
 
   30   const MC_t* mcClass{*readHandle};
 
   31   if (mcClass==nullptr) {
 
   32     ATH_MSG_ERROR("Failed to retrieve input object with key " << m_readKey.key());
 
   33     return StatusCode::FAILURE;
 
   35   writeHandle.addDependency(readHandle);
 
   38   SG::ReadCondHandle<LArMCSym> mcSymHdl{m_mcSymKey};
 
   39   const LArMCSym* mcSym={*mcSymHdl};
 
   41     ATH_MSG_ERROR("Failed to retrieve LArMCSym object with key " << m_mcSymKey.key());
 
   42     return StatusCode::FAILURE;
 
   44   writeHandle.addDependency(mcSymHdl);
 
   47   std::unique_ptr<SYM_t> sym=std::make_unique<SYM_t>(mcSym,mcClass);
 
   49   if(writeHandle.record(std::move(sym)).isFailure()) {
 
   50     ATH_MSG_ERROR("Could not record LArSymCond object with " 
 
   52           << " with EventRange " << writeHandle.getRange()
 
   53           << " into Conditions Store");
 
   54     return StatusCode::FAILURE;
 
   56   ATH_MSG_INFO("recorded new " << writeHandle.key() << " with range " << 
 
   57             writeHandle.getRange() << " into Conditions Store");
 
   60   return StatusCode::SUCCESS;