1 //Dear emacs, this is -*- c++ -*-
 
    4   Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 
    7 template<class T, class T1>
 
    8 StatusCode LArConditionsMergerAlg<T,T1>::initialize() {
 
   10   ATH_CHECK(m_readKeys.initialize(!m_readKeys.empty()));
 
   11   //ATH_CHECK(m_detStoreKeys.initialize(!m_detStoreKeys.empty()));
 
   13  return StatusCode::SUCCESS;
 
   17 template<class T, class T1>
 
   18 StatusCode LArConditionsMergerAlg<T,T1>::execute() {
 
   20   if (m_readKeys.empty()) {
 
   21      if(m_detStoreKeys.empty()) return StatusCode::FAILURE;
 
   23      std::unique_ptr<T1> out=std::make_unique<T1>();
 
   24      ATH_CHECK(out->setGroupingType(m_groupingType,msg()));
 
   25      ATH_CHECK(out->initialize());
 
   27      for (const auto & key : m_detStoreKeys){
 
   28          //SG::ReadHandle<T1> calContainer(key);
 
   29          const T1* t1Container = nullptr;
 
   30          StatusCode sc = detStore()->retrieve(t1Container,key);
 
   31          // Check that this container is present
 
   32          if (sc.isFailure() || !t1Container) {
 
   33             ATH_MSG_WARNING("No container found in storegate  "<< key);
 
   35             const T1 obj=*t1Container;
 
   36             bool stat=out->merge(obj);
 
   38                ATH_MSG_ERROR("Channels were overwritten while merging " << key);
 
   43      ATH_CHECK(detStore()->record(std::move(out),m_writeKey));
 
   46      std::unique_ptr<T> out=std::make_unique<T>();
 
   47      ATH_CHECK(out->setGroupingType(m_groupingType,msg()));
 
   48      ATH_CHECK(out->initialize());
 
   50      for (const auto & key : m_readKeys) {
 
   51        SG::ReadCondHandle<T> handle{key};
 
   53        bool stat=out->merge(*obj);
 
   55          ATH_MSG_ERROR("Channels were overwritten while merging " << key);
 
   59      ATH_CHECK(detStore()->record(std::move(out),m_writeKey));
 
   62   return StatusCode::SUCCESS;