ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonConditions
MuonCondGeneral
MuonCondAlg
src
TgcDigitASDposCondAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TgcDigitASDposCondAlg.h
"
6
#include "
CxxUtils/StringUtils.h
"
7
#include "
StoreGate/ReadCondHandle.h
"
8
#include "
StoreGate/WriteCondHandle.h
"
9
#include "CoralBase/Blob.h"
10
#include <string_view>
11
12
13
namespace
Muon
{
14
StatusCode
TgcDigitASDposCondAlg::initialize
()
15
{
16
ATH_MSG_DEBUG
(
"initialize "
<< name());
17
18
ATH_CHECK
(
m_readKey_ASDpos
.initialize());
19
ATH_CHECK
(
m_writeKey
.initialize());
20
21
return
StatusCode::SUCCESS;
22
}
23
24
StatusCode
TgcDigitASDposCondAlg::execute
(
const
EventContext& ctx)
const
25
{
26
SG::WriteCondHandle
writeHandle{
m_writeKey
, ctx};
27
if
(writeHandle.
isValid
()) {
28
ATH_MSG_DEBUG
(
"CondHandle "
<< writeHandle.
fullKey
() <<
" is already valid."
29
<<
". In theory this should not be called, but may happen"
30
<<
" if multiple concurrent events are being processed out of order."
);
31
return
StatusCode::SUCCESS;
32
}
33
34
SG::ReadCondHandle
readHandle_ASDpos{
m_readKey_ASDpos
, ctx};
35
if
(!readHandle_ASDpos.
isValid
()) {
36
ATH_MSG_ERROR
(
"Null pointer to the read conditions object"
);
37
return
StatusCode::FAILURE;
38
}
39
writeHandle.
addDependency
(readHandle_ASDpos);
40
41
// Fill
42
auto
outputCdo = std::make_unique<TgcDigitASDposData>();
43
constexpr
std::string_view
delimiter
{
";"
};
44
for
(
const
auto
&[channel, attribute] : **readHandle_ASDpos) {
45
const
coral::Blob& blob = attribute[
"bASDPos"
].data<coral::Blob>();
46
const
std::string blobline{
static_cast<
const
char
*
>
(blob.startingAddress())};
47
std::vector<std::string> tokens =
CxxUtils::tokenize
(blobline,
delimiter
);
48
auto
it = std::begin(tokens);
49
uint16_t station =
static_cast<
uint16_t
>
(
CxxUtils::atoi
(*it));
50
++it;
51
uint16_t
eta
=
static_cast<
uint16_t
>
(
CxxUtils::atoi
(*it));
52
++it;
53
uint16_t
phi
= (
CxxUtils::atoi
(*it) == -99) ? 0x1f :
static_cast<
uint16_t
>
(
CxxUtils::atoi
(*it));
54
uint16_t chamberId = (station << 8) + (
eta
<< 5) +
phi
;
55
56
std::vector<float> strip_pos(
TgcDigitASDposData::N_STRIPASDPOS
, 0);
57
//strip_pos initialized to size N_STRIPASDPOS
58
for
(
int
i=0; i <
TgcDigitASDposData::N_STRIPASDPOS
; i++) {
59
++it;
60
strip_pos[i] =
CxxUtils::atof
(*it);
61
}
62
outputCdo->stripAsdPos.emplace(chamberId, std::move(strip_pos));
63
64
std::vector<float> wire_pos(
TgcDigitASDposData::N_WIREASDPOS
, 0);
65
//TgcDigitASDposData initialized to size N_WIREASDPOS
66
for
(
int
i=0; i <
TgcDigitASDposData::N_WIREASDPOS
; i++) {
67
++it;
68
wire_pos[i] =
CxxUtils::atof
(*it);
69
}
70
outputCdo->wireAsdPos.emplace(chamberId, std::move(wire_pos));
71
}
// end of for(attrmap)
72
73
// Record
74
ATH_CHECK
(writeHandle.
record
(std::move(outputCdo)));
75
ATH_MSG_DEBUG
(
"recorded new "
<< writeHandle.
key
() <<
" with range "
<< writeHandle.
getRange
() <<
" into Conditions Store"
);
76
77
return
StatusCode::SUCCESS;
78
}
79
}
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
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_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
StringUtils.h
ReadCondHandle.h
TgcDigitASDposCondAlg.h
WriteCondHandle.h
Muon::TgcDigitASDposCondAlg::m_writeKey
SG::WriteCondHandleKey< TgcDigitASDposData > m_writeKey
Definition
TgcDigitASDposCondAlg.h:24
Muon::TgcDigitASDposCondAlg::m_readKey_ASDpos
SG::ReadCondHandleKey< CondAttrListCollection > m_readKey_ASDpos
Definition
TgcDigitASDposCondAlg.h:23
Muon::TgcDigitASDposCondAlg::initialize
virtual StatusCode initialize() override
Definition
TgcDigitASDposCondAlg.cxx:14
Muon::TgcDigitASDposCondAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
TgcDigitASDposCondAlg.cxx:24
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadCondHandle::isValid
bool isValid()
Definition
ReadCondHandle.h:205
SG::WriteCondHandle
Definition
WriteCondHandle.h:26
SG::WriteCondHandle::key
const std::string & key() const
Definition
WriteCondHandle.h:44
SG::WriteCondHandle::addDependency
void addDependency(const EventIDRange &range)
Definition
WriteCondHandle.h:279
SG::WriteCondHandle::getRange
const EventIDRange & getRange() const
Definition
WriteCondHandle.h:93
SG::WriteCondHandle::record
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
Definition
WriteCondHandle.h:161
SG::WriteCondHandle::isValid
bool isValid() const
Definition
WriteCondHandle.h:252
SG::WriteCondHandle::fullKey
const DataObjID & fullKey() const
Definition
WriteCondHandle.h:45
TgcDigitASDposData::N_STRIPASDPOS
@ N_STRIPASDPOS
Definition
TgcDigitASDposData.h:31
TgcDigitASDposData::N_WIREASDPOS
@ N_WIREASDPOS
Definition
TgcDigitASDposData.h:30
delimiter
static const std::string delimiter("/")
CxxUtils::atof
double atof(std::string_view str)
Converts a string into a double / float.
Definition
Control/CxxUtils/Root/StringUtils.cxx:46
CxxUtils::tokenize
std::vector< std::string > tokenize(std::string_view the_str, std::string_view delimiters)
Splits the string into smaller substrings.
Definition
Control/CxxUtils/Root/StringUtils.cxx:12
CxxUtils::atoi
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
Definition
Control/CxxUtils/Root/StringUtils.cxx:40
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition
TrackSystemController.h:46
Generated on
for ATLAS Offline Software by
1.17.0