ATLAS Offline Software
CondAlgZ.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "CondAlgZ.h"
8 
9 #include <thread>
10 #include <chrono>
11 #include <memory>
12 
13 CondAlgZ::CondAlgZ( const std::string& name,
14  ISvcLocator* pSvcLocator ) :
15  ::AthAlgorithm( name, pSvcLocator )
16 {
17 }
18 
20 
22  ATH_MSG_DEBUG("initialize " << name());
23 
27 
29 
30  return StatusCode::SUCCESS;
31 }
32 
34  ATH_MSG_DEBUG("execute " << name());
35 
36  EventIDBase now(getContext().eventID());
37 
41 
42  const CondDataObj *cdo1 = *rch1;
43  const CondDataObjY *cdo2 = *rch2;
44  const CondDataObjY *cdo3 = *rch3;
45 
46  ATH_MSG_DEBUG(" rh1: " << cdo1->val() << " rh2: " << cdo2->val()
47  << " rh3: " << cdo3->val());
48 
50 
51  // do we have a valid m_wch for current time?
52  if ( !wch.isValid(now) ) {
53 
54  ATH_MSG_DEBUG(" CondHandle " << wch.key()
55  << " not valid.");
56 
57  wch.addDependency(rch1);
58  wch.addDependency(rch2,rch3);
59 
60  float val = rch1->val() + rch2->val() + rch3->val();
61 
62 
63  if (wch.record( std::make_unique<CondDataObjZ>
64  ( CondDataObjZ(val) ) ).isFailure()) {
65  ATH_MSG_ERROR("could not record CondDataObjZ " << wch.key()
66  << " val: " << val
67  << " with EventRange " << wch.getRange() );
68  return StatusCode::FAILURE;
69  }
70  ATH_MSG_INFO("recorded new CDO " << wch.key() << " = " << val
71  << " with range " << wch.getRange() );
72  }
73 
74  return StatusCode::SUCCESS;
75 
76 }
77 
CondAlgZ::m_wch
SG::WriteCondHandleKey< CondDataObjZ > m_wch
Definition: CondAlgZ.h:38
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CondDataObjZ
Definition: CondDataObjZ.h:8
IASCIICondDbSvc.h
SG::WriteCondHandle::getRange
const EventIDRange & getRange() const
Definition: WriteCondHandle.h:89
CondDataObjY::val
void val(float f)
Definition: CondDataObjY.h:16
SG::WriteCondHandle::record
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
Definition: WriteCondHandle.h:157
CondAlgZ::m_rchk2
SG::ReadCondHandleKey< CondDataObjY > m_rchk2
Definition: CondAlgZ.h:35
CondAlgZ::initialize
virtual StatusCode initialize() override
Definition: CondAlgZ.cxx:21
CondDataObjY
Definition: CondDataObjY.h:8
python.handimod.now
now
Definition: handimod.py:675
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
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
WriteCondHandle.h
CondAlgZ::CondAlgZ
CondAlgZ(const std::string &name, ISvcLocator *pSvcLocator)
Definition: CondAlgZ.cxx:13
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CondDataObj
Definition: CondDataObj.h:8
CondAlgZ::m_rchk3
SG::ReadCondHandleKey< CondDataObjY > m_rchk3
Definition: CondAlgZ.h:36
CondAlgZ::execute
virtual StatusCode execute() override
Definition: CondAlgZ.cxx:33
AthAlgorithm
Definition: AthAlgorithm.h:47
CondAlgZ.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
SG::WriteCondHandle::key
const std::string & key() const
Definition: WriteCondHandle.h:40
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
CondAlgZ::m_rchk1
SG::ReadCondHandleKey< CondDataObj > m_rchk1
Definition: CondAlgZ.h:34
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
SG::WriteCondHandle::isValid
bool isValid() const
Definition: WriteCondHandle.h:248
CondDataObj::val
void val(int i)
Definition: CondDataObj.h:16
SG::WriteCondHandle
Definition: WriteCondHandle.h:26
CondAlgZ::~CondAlgZ
virtual ~CondAlgZ()
Definition: CondAlgZ.cxx:19
SG::WriteCondHandle::addDependency
void addDependency(const EventIDRange &range)
Definition: WriteCondHandle.h:275