ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetConditions
SCT_ConditionsAlgorithms
src
SCT_ReadoutTestAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
13
14
// Athena includes
15
#include "
SCT_ReadoutTestAlg.h
"
16
17
#include "Identifier/Identifier.h"
18
19
// Constructor
20
SCT_ReadoutTestAlg::SCT_ReadoutTestAlg
(
const
std::string& name, ISvcLocator* pSvcLocator) :
21
AthAlgorithm
(name, pSvcLocator)
22
{
23
}
24
25
// Initialize
26
StatusCode
SCT_ReadoutTestAlg::initialize
() {
27
ATH_MSG_INFO
(
"Calling initialize"
);
28
29
// Retrieve readout tool
30
ATH_CHECK
(
m_readout
.retrieve());
31
32
// Initalise chips configured in job options and add to vector
33
std::vector<std::string>::const_iterator itr{
m_chipConfigs
.begin()};
34
std::vector<std::string>::const_iterator end{
m_chipConfigs
.end()};
35
36
for
(
short
ichip{0}; itr != end; ++itr, ++ichip) {
37
m_chips
.push_back(
initialiseChip
(ichip, *itr));
38
}
39
40
return
StatusCode::SUCCESS;
41
}
42
43
// Execute
44
StatusCode
SCT_ReadoutTestAlg::execute
(
const
EventContext&
/*ctx*/
) {
45
//This method is only used to test the readout tool, and only used within this package,
46
// so the INFO level messages have no impact on performance of the tool when used by clients
47
48
ATH_MSG_INFO
(
"Calling execute"
);
49
50
ATH_MSG_INFO
(
"Chips before readout ..."
);
51
for
(
const
SCT_Chip
& chip:
m_chips
)
ATH_MSG_INFO
(chip);
52
53
// Determin readout for this module
54
ATH_CHECK
(
m_readout
->determineReadout(
Identifier
{m_moduleId},
m_chips
,
m_link0ok
,
m_link1ok
));
55
56
ATH_MSG_INFO
(
"Chips after readout ..."
);
57
for
(
const
SCT_Chip
& chip:
m_chips
)
ATH_MSG_INFO
(chip);
58
59
return
StatusCode::SUCCESS;
60
}
61
62
// Finalize
63
StatusCode
SCT_ReadoutTestAlg::finalize
() {
64
ATH_MSG_INFO
(
"Calling finalize"
);
65
66
return
StatusCode::SUCCESS;
67
}
68
69
// Connvert a binary number to decimal
70
short
SCT_ReadoutTestAlg::bin2dec
(
const
char
*
bin
)
71
{
72
short
b, k, m, n;
73
short
len;
74
short
sum{0};
75
76
len = strlen(
bin
) - 1;
77
for
(k = 0; k <= len; k++) {
78
n = (
bin
[k] -
'0'
);
// char to numeric value
79
if
((n > 1) or (n < 0)) {
80
ATH_MSG_ERROR
(
"ERROR! BINARY has only 1 and 0!"
);
81
return
0;
82
}
83
84
for
(b = 1, m = len; m > k; m--) {
85
// 1 2 4 8 16 32 64 ... place-values, reversed here
86
b *= 2;
87
}
88
89
// sum it up
90
sum = sum + n * b;
91
}
92
return
sum;
93
}
94
95
// Initalise chip from id and config string (all channels are initially good)
96
SCT_Chip
SCT_ReadoutTestAlg::initialiseChip
(
short
id
, std::string configString) {
97
// Opposite convention for LSB
98
std::reverse
(configString.begin(), configString.end());
99
short
config{
bin2dec
(configString.c_str())};
100
const
int
minus1{-1};
101
return
{id, config,
static_cast<
uint32_t
>
(minus1),
static_cast<
uint32_t
>
(minus1),
static_cast<
uint32_t
>
(minus1),
static_cast<
uint32_t
>
(minus1)};
102
}
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:47
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
SCT_ReadoutTestAlg.h
Header file for the SCT_ReadoutTestAlg class in package SCT_ConditionsAlgorithms.
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
SCT_Chip
Class which stores infomration on the SCT chips: id, config, mask.
Definition
SCT_Chip.h:27
SCT_ReadoutTestAlg::m_link1ok
BooleanProperty m_link1ok
Definition
SCT_ReadoutTestAlg.h:56
SCT_ReadoutTestAlg::initialiseChip
SCT_Chip initialiseChip(short id, std::string configString)
Initialise a chip given its id and configuration string.
Definition
SCT_ReadoutTestAlg.cxx:96
SCT_ReadoutTestAlg::finalize
virtual StatusCode finalize() override
Definition
SCT_ReadoutTestAlg.cxx:63
SCT_ReadoutTestAlg::bin2dec
short bin2dec(const char *bin)
Function to convert the configuration string into an int.
Definition
SCT_ReadoutTestAlg.cxx:70
SCT_ReadoutTestAlg::m_readout
ToolHandle< ISCT_ReadoutTool > m_readout
List of chips for that module.
Definition
SCT_ReadoutTestAlg.h:48
SCT_ReadoutTestAlg::m_link0ok
BooleanProperty m_link0ok
Definition
SCT_ReadoutTestAlg.h:55
SCT_ReadoutTestAlg::m_chips
std::vector< SCT_Chip > m_chips
Definition
SCT_ReadoutTestAlg.h:51
SCT_ReadoutTestAlg::initialize
virtual StatusCode initialize() override
Usual framework methods for an Algorithm.
Definition
SCT_ReadoutTestAlg.cxx:26
SCT_ReadoutTestAlg::execute
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
Definition
SCT_ReadoutTestAlg.cxx:44
SCT_ReadoutTestAlg::SCT_ReadoutTestAlg
SCT_ReadoutTestAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
SCT_ReadoutTestAlg.cxx:20
SCT_ReadoutTestAlg::m_chipConfigs
StringArrayProperty m_chipConfigs
Definition
SCT_ReadoutTestAlg.h:53
bin
Definition
BinsDiffFromStripMedian.h:43
Identifier
Definition
IdentifierFieldParser.cxx:14
std::reverse
void reverse(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of reverse for DataVector/List.
Definition
DVL_algorithms.h:280
Generated on
for ATLAS Offline Software by
1.17.0