ATLAS Offline Software
Loading...
Searching...
No Matches
LArFlatConditionsAlg.icc
Go to the documentation of this file.
1//dear emacs, this is -*-c++-*-
2
3/*
4 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5*/
6
7template<class T>
8StatusCode LArFlatConditionsAlg<T>::initialize() {
9 // Read Handles
10 ATH_CHECK( m_readKey.initialize() );
11 ATH_CHECK( m_writeKey.initialize() );
12
13 return StatusCode::SUCCESS;
14}
15
16
17template<class T>
18StatusCode LArFlatConditionsAlg<T>::execute(const EventContext& ctx) const {
19
20 SG::WriteCondHandle<T> writeHandle{m_writeKey, ctx};
21
22 if (writeHandle.isValid()) {
23 ATH_MSG_DEBUG("Found valid write handle");
24 return StatusCode::SUCCESS;
25 }
26
27 SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey, ctx};
28 const CondAttrListCollection* attr{*readHandle};
29 if (attr==nullptr) {
30 msg(MSG::ERROR) << "Failed to retrieve CondAttributeListCollection with key " << m_readKey.key() << endmsg;
31 return StatusCode::FAILURE;
32 }
33 writeHandle.addDependency(readHandle);
34
35 std::unique_ptr<T> flat=std::make_unique<T>(attr);
36
37 if(writeHandle.record(std::move(flat)).isFailure()) {
38 ATH_MSG_ERROR("Could not record LArFlatConditions object with "
39 << writeHandle.key()
40 << " with EventRange " << writeHandle.getRange()
41 << " into Conditions Store");
42 return StatusCode::FAILURE;
43 }
44 ATH_MSG_INFO("recorded new " << writeHandle.key() << " with range "
45 << writeHandle.getRange() << " into Conditions Store");
46
47
48 return StatusCode::SUCCESS;
49}
50