ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Database
CoolLumiUtilities
src
FillParamsCondAlg.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 "
FillParamsCondAlg.h
"
13
#include "
StoreGate/ReadCondHandle.h
"
14
#include "
StoreGate/WriteCondHandle.h
"
15
#include "CoralBase/Blob.h"
16
#include "CoolKernel/IObject.h"
17
#include <stdint.h>
18
19
#ifdef __linux__
20
#include <endian.h>
21
static_assert
(__BYTE_ORDER == __LITTLE_ENDIAN,
22
"FillParamsCondAlg assumes little-endian byte ordering."
);
23
#endif
24
25
29
StatusCode
30
FillParamsCondAlg::initialize
()
31
{
32
ATH_CHECK
(
m_fillParamsFolderInputKey
.initialize() );
33
ATH_CHECK
(
m_fillParamsOutputKey
.initialize() );
34
return
StatusCode::SUCCESS;
35
}
36
37
42
StatusCode
43
FillParamsCondAlg::execute
(
const
EventContext& ctx)
const
44
{
45
SG::ReadCondHandle<AthenaAttributeList>
fillParamsFolder
46
(
m_fillParamsFolderInputKey
, ctx);
47
EventIDRange range;
48
ATH_CHECK
( fillParamsFolder.
range
(range) );
49
50
if
((**fillParamsFolder)[
"BCIDmasks"
].isNull()) {
51
ATH_MSG_ERROR
(
"BunchCode is NULL in "
<<
m_fillParamsFolderInputKey
.key() <<
"!"
);
52
return
StatusCode::FAILURE;
53
}
54
55
// Do everything here for now, but should copy this to a vanilla object based on attrList
56
cool::UInt32 nb1 = (**fillParamsFolder)[
"Beam1Bunches"
].data<cool::UInt32>();
57
cool::UInt32 nb2 = (**fillParamsFolder)[
"Beam2Bunches"
].data<cool::UInt32>();
58
cool::UInt32 ncol = (**fillParamsFolder)[
"LuminousBunches"
].data<cool::UInt32>();
59
60
ATH_MSG_DEBUG
(
"Beam1Bunches: "
<< nb1 );
61
ATH_MSG_DEBUG
(
"Beam2Bunches: "
<< nb2 );
62
ATH_MSG_DEBUG
(
"LuminousBunches: "
<< ncol );
63
64
const
coral::Blob& blob = (**fillParamsFolder)[
"BCIDmasks"
].data<coral::Blob>();
65
66
// Verify length
67
if
(
static_cast<
cool::UInt32
>
( blob.size() ) != 2 * (nb1 + nb2 + ncol)) {
68
ATH_MSG_WARNING
(
"BCIDmasks length "
<< blob.size() <<
" != 2 * "
<< (nb1+nb2+ncol) );
69
return
StatusCode::SUCCESS;
70
}
71
72
const
uint16_t* p=
static_cast<
const
uint16_t*
>
(blob.startingAddress());
73
74
auto
fp = std::make_unique<FillParamsCondData>();
75
76
// Decode beam1 list
77
fp->setBeam1Bunches (p, p+nb1);
78
p += nb1;
79
80
// Decode beam2 list
81
fp->setBeam2Bunches (p, p+nb2);
82
p += nb2;
83
84
// Decode luminous list
85
fp->setLuminousBunches (p, p+ncol);
86
p += ncol;
87
88
SG::WriteCondHandle<FillParamsCondData>
fillParamsData
89
(
m_fillParamsOutputKey
, ctx);
90
ATH_CHECK
( fillParamsData.
record
(range, std::move (fp)) );
91
return
StatusCode::SUCCESS;
92
}
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
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
FillParamsCondAlg.h
Conditions algorithm to unpack fill parameters from COOL.
ReadCondHandle.h
WriteCondHandle.h
FillParamsCondAlg::initialize
virtual StatusCode initialize() override final
Gaudi initialize method.
Definition
FillParamsCondAlg.cxx:30
FillParamsCondAlg::m_fillParamsFolderInputKey
SG::ReadCondHandleKey< AthenaAttributeList > m_fillParamsFolderInputKey
Input conditions object.
Definition
FillParamsCondAlg.h:45
FillParamsCondAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Algorithm execute method.
Definition
FillParamsCondAlg.cxx:43
FillParamsCondAlg::m_fillParamsOutputKey
SG::WriteCondHandleKey< FillParamsCondData > m_fillParamsOutputKey
Output conditions object.
Definition
FillParamsCondAlg.h:49
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadCondHandle::range
bool range(EventIDRange &r)
Definition
ReadCondHandle.h:223
SG::WriteCondHandle
Definition
WriteCondHandle.h:26
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