ATLAS Offline Software
FillParamsCondAlg.cxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration.
3  */
12 #include "FillParamsCondAlg.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 
31 {
34  return StatusCode::SUCCESS;
35 }
36 
37 
43 FillParamsCondAlg::execute (const EventContext& ctx) const
44 {
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 
89  (m_fillParamsOutputKey, ctx);
90  ATH_CHECK( fillParamsData.record (range, std::move (fp)) );
91  return StatusCode::SUCCESS;
92 }
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
python.subdetectors.tile.Blob
Blob
Definition: tile.py:17
FillParamsCondAlg::initialize
virtual StatusCode initialize() override final
Gaudi initialize method.
Definition: FillParamsCondAlg.cxx:30
SG::ReadCondHandle::range
bool range(EventIDRange &r)
Definition: ReadCondHandle.h:223
FillParamsCondAlg.h
Conditions algorithm to unpack fill parameters from COOL.
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
SG::WriteCondHandle::record
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
Definition: WriteCondHandle.h:157
ReadCondHandle.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
trigmenu_modify_prescale_json.fp
fp
Definition: trigmenu_modify_prescale_json.py:53
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
FillParamsCondAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Algorithm execute method.
Definition: FillParamsCondAlg.cxx:43
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
FillParamsCondAlg::m_fillParamsFolderInputKey
SG::ReadCondHandleKey< AthenaAttributeList > m_fillParamsFolderInputKey
Input conditions object.
Definition: FillParamsCondAlg.h:46
FillParamsCondAlg::m_fillParamsOutputKey
SG::WriteCondHandleKey< FillParamsCondData > m_fillParamsOutputKey
Output conditions object.
Definition: FillParamsCondAlg.h:50
SG::WriteCondHandle
Definition: WriteCondHandle.h:26
CaloCondBlobAlgs_fillNoiseFromASCII.blob
blob
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:96