ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LumiBlock
LumiBlockComps
src
LBDurationCondAlg.cxx
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration.
3
*/
10
11
12
#include "
LBDurationCondAlg.h
"
13
#include "CoolKernel/IObject.h"
14
#include "GaudiKernel/SystemOfUnits.h"
15
#include "
AthenaKernel/IOVInfiniteRange.h
"
16
17
using
Gaudi::Units::second;
18
using
Gaudi::Units::nanosecond;
19
20
24
StatusCode
25
LBDurationCondAlg::initialize
()
26
{
27
ATH_CHECK
(
m_lblbFolderInputKey
.initialize(!
m_lblbFolderInputKey
.empty()) );
28
ATH_CHECK
(
m_lbDurationOutputKey
.initialize() );
29
return
StatusCode::SUCCESS;
30
}
31
32
37
StatusCode
38
LBDurationCondAlg::execute
(
const
EventContext& ctx)
const
39
{
40
41
SG::WriteCondHandle<LBDurationCondData>
lbDurationCondData
42
(
m_lbDurationOutputKey
, ctx);
43
44
if
(
m_lblbFolderInputKey
.empty()) {
45
const
EventIDRange fullRange=
IOVInfiniteRange::infiniteRunLB
();
46
lbDurationCondData.
addDependency
(fullRange);
47
auto
lbdur = std::make_unique<LBDurationCondData> (
m_default
);
48
ATH_CHECK
( lbDurationCondData.
record
(std::move (lbdur)) );
49
}
else
{
50
51
SG::ReadCondHandle<AthenaAttributeList>
lblbFolder
52
(
m_lblbFolderInputKey
, ctx);
53
lbDurationCondData.
addDependency
(lblbFolder);
54
55
if
(lblbFolder.
isValid
()) {
56
if
((**lblbFolder)[
"StartTime"
].isNull()) {
57
ATH_MSG_ERROR
(
"StartTime is NULL in "
<<
m_lblbFolderInputKey
.key() <<
"!"
);
58
return
StatusCode::FAILURE;
59
}
60
61
if
((**lblbFolder)[
"EndTime"
].isNull()) {
62
ATH_MSG_ERROR
(
"EndTime is NULL in "
<<
m_lblbFolderInputKey
.key() <<
"!"
);
63
return
StatusCode::FAILURE;
64
}
65
66
// Times in nanoseconds.
67
cool::UInt63 startTime = (**lblbFolder)[
"StartTime"
].data<cool::UInt63>();
68
cool::UInt63 endTime = (**lblbFolder)[
"EndTime"
].data<cool::UInt63>();
69
70
// Convert to seconds.
71
double
duration = (endTime-startTime) * (nanosecond / second);
72
73
auto
lbdur = std::make_unique<LBDurationCondData> (duration);
74
75
76
ATH_CHECK
( lbDurationCondData.
record
(std::move (lbdur)) );
77
}
else
{
78
auto
lbdur = std::make_unique<LBDurationCondData> (
m_default
);
79
ATH_CHECK
( lbDurationCondData.
record
(std::move (lbdur)) );
80
}
81
}
82
return
StatusCode::SUCCESS;
83
}
84
85
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
IOVInfiniteRange.h
LBDurationCondAlg.h
Produce LBDurationCondData from /TRIGGER/LUMI/LBLB.
IOVInfiniteRange::infiniteRunLB
static EventIDRange infiniteRunLB()
Produces an EventIDRange that is infinite in RunLumi and invalid in Time.
Definition
IOVInfiniteRange.h:39
LBDurationCondAlg::m_lblbFolderInputKey
SG::ReadCondHandleKey< AthenaAttributeList > m_lblbFolderInputKey
Input COOL folder.
Definition
LBDurationCondAlg.h:45
LBDurationCondAlg::m_default
const float m_default
Definition
LBDurationCondAlg.h:52
LBDurationCondAlg::initialize
virtual StatusCode initialize() override
Gaudi initialize method.
Definition
LBDurationCondAlg.cxx:25
LBDurationCondAlg::m_lbDurationOutputKey
SG::WriteCondHandleKey< LBDurationCondData > m_lbDurationOutputKey
Output conditions object.
Definition
LBDurationCondAlg.h:50
LBDurationCondAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Algorithm execute method.
Definition
LBDurationCondAlg.cxx:38
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadCondHandle::isValid
bool isValid()
Definition
ReadCondHandle.h:205
SG::WriteCondHandle
Definition
WriteCondHandle.h:26
SG::WriteCondHandle::addDependency
void addDependency(const EventIDRange &range)
Definition
WriteCondHandle.h:279
SG::WriteCondHandle::record
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
Definition
WriteCondHandle.h:161
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Generated on
for ATLAS Offline Software by
1.17.0