ATLAS Offline Software
LArFEBTempAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "LArFEBTempAlg.h"
7 
8 LArFEBTempAlg::LArFEBTempAlg(const std::string& name, ISvcLocator* pSvcLocator):AthReentrantAlgorithm(name,pSvcLocator){}
9 
10 // intialize
12 {
15 
16  return StatusCode::SUCCESS;
17 }
18 
19 StatusCode LArFEBTempAlg::execute(const EventContext& ctx ) const
20 {
22 
23  if (writeHandle.isValid()) {
24  ATH_MSG_DEBUG("Found valid write handle");
25  return StatusCode::SUCCESS;
26  }
27 
29  const CondAttrListCollection* cattr = *cHdl;
30  if(!cattr) {
31  ATH_MSG_ERROR("Why do not have FEB TEMP folder ?" << m_foldernameKey.fullKey());
32  return StatusCode::FAILURE;
33  }
34  EventIDRange rangeIn;
35  if(!cHdl.range(rangeIn)) {
36  ATH_MSG_ERROR("Failed to retrieve validity range for " << cHdl.key());
37  return StatusCode::FAILURE;
38  }
39  // Fill LArFEBTempData
40  std::unique_ptr<LArFEBTempData> febTemp=std::make_unique<LArFEBTempData>();
41  LArFEBTempData* p_febTemp = febTemp.get();
42 
44  citr!=cattr->end();++citr) {
45  float temp1=-1;
46  if(! ((*citr).second)["temp1"].isNull()) temp1 = (((*citr).second)["temp1"]).data<float>();
47  float temp2 =-1;
48  if(! ((*citr).second)["temp2"].isNull()) temp2 = (((*citr).second)["temp2"]).data<float>();
49  LArFEBTempData::FEBTemp temp = std::make_pair(temp1,temp2);
50 
51  p_febTemp->m_mapVec[HWIdentifier(Identifier32((*citr).first))] = temp;
52  }
53 
54  const EventIDRange crangeW(rangeIn);
55  if(writeHandle.record(crangeW,febTemp.release()).isFailure()) {
56  ATH_MSG_ERROR("Could not record LArFebConfig object with " << writeHandle.key()
57  << " with EventRange " << crangeW << " into Conditions Store");
58  return StatusCode::FAILURE;
59  }
60 
61  ATH_MSG_INFO("recorded new " << writeHandle.key() << " with range " << crangeW << " into Conditions Store");
62 
63  return StatusCode::SUCCESS;
64 
65 }
66 
67 
LArFEBTempAlg::m_tempKey
SG::WriteCondHandleKey< LArFEBTempData > m_tempKey
Definition: LArFEBTempAlg.h:27
Identifier32
Definition: Identifier32.h:25
CondAttrListCollection::end
const_iterator end() const
Definition: CondAttrListCollection.h:315
LArFEBTempData::FEBTemp
std::pair< float, float > FEBTemp
Definition: LArFEBTempData.h:18
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
LArFEBTempAlg::LArFEBTempAlg
LArFEBTempAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: LArFEBTempAlg.cxx:8
CondAttrListCollection::begin
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
Definition: CondAttrListCollection.h:309
SG::ReadCondHandle::range
bool range(EventIDRange &r)
Definition: ReadCondHandle.h:224
HWIdentifier
Definition: HWIdentifier.h:13
CondAttrListCollection
This class is a collection of AttributeLists where each one is associated with a channel number....
Definition: CondAttrListCollection.h:52
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
LArFEBTempAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition: LArFEBTempAlg.cxx:19
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
LArFEBTempData::m_mapVec
std::map< HWIdentifier, FEBTemp > m_mapVec
Definition: LArFEBTempData.h:26
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
LArFEBTempAlg.h
LArFEBTempData
Definition: LArFEBTempData.h:12
LArFEBTempAlg::initialize
virtual StatusCode initialize() override final
Definition: LArFEBTempAlg.cxx:11
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
CondAttrListCollection::const_iterator
ChanAttrListMap::const_iterator const_iterator
Definition: CondAttrListCollection.h:63
LArFEBTempAlg::m_foldernameKey
SG::ReadCondHandleKey< CondAttrListCollection > m_foldernameKey
Definition: LArFEBTempAlg.h:26
SG::ReadCondHandle::key
const std::string & key() const
Definition: ReadCondHandle.h:59
SG::WriteCondHandle
Definition: WriteCondHandle.h:26
LArOnlineID.h