ATLAS Offline Software
Loading...
Searching...
No Matches
SCT_ConditionsParameterTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
10#include <limits>
11
13
14//c'tor
15SCT_ConditionsParameterTool::SCT_ConditionsParameterTool(const std::string& type, const std::string& name, const IInterface* parent) :
16 base_class(type, name, parent) {
17}
18
19//
20StatusCode
22 ATH_CHECK(m_condKey.initialize());
23
24 return StatusCode::SUCCESS;
25}
26
27//
28StatusCode
30 return StatusCode::SUCCESS;
31}
32
34bool
35SCT_ConditionsParameterTool::available(const SCT_CondParameterData::ParameterIndex iparam, const EventContext& /*ctx*/) const {
37}
38
40float
41SCT_ConditionsParameterTool::value(const IdentifierHash& idHash, const SCT_CondParameterData::ParameterIndex iparam, const EventContext& ctx) const {
42 const SCT_CondParameterData* data{getCondData(ctx)};
43 if (data==nullptr) return invalid(iparam, ctx);
44 return data->getValue(idHash, iparam);
45}
46
48float
49SCT_ConditionsParameterTool::validity(const IdentifierHash& /*idHash*/, const SCT_CondParameterData::ParameterIndex /*iparam*/, const EventContext& /*ctx*/) const {
50 return 1.0;
51}
52
54bool
55SCT_ConditionsParameterTool::isValid(const float parameterValue, const SCT_CondParameterData::ParameterIndex iparam, const EventContext& ctx) const {
56 const SCT_CondParameterData* data{getCondData(ctx)};
57 if (data==nullptr) return invalid(iparam, ctx);
58 return SCT_CondParameterData::isValid(parameterValue, iparam);
59}
60
62float
63SCT_ConditionsParameterTool::invalid(const unsigned int iparam, const EventContext& /*ctx*/) const {
64 float result{0.0};
66 result=std::numeric_limits<float>::quiet_NaN();
67 }
68 return result;
69}
70
72float
73SCT_ConditionsParameterTool::max(const SCT_CondParameterData::ParameterIndex iparam, const EventContext& ctx) const {
74 const SCT_CondParameterData* data{getCondData(ctx)};
75 if (data==nullptr) return invalid(iparam, ctx);
76 return data->max(iparam);
77}
78
80float
81SCT_ConditionsParameterTool::min(const SCT_CondParameterData::ParameterIndex iparam, const EventContext& ctx) const {
82 const SCT_CondParameterData* data{getCondData(ctx)};
83 if (data==nullptr) return invalid(iparam, ctx);
84 return data->min(iparam);
85}
86
88float
89SCT_ConditionsParameterTool::avg(const SCT_CondParameterData::ParameterIndex iparam, const EventContext& ctx) const {
90 const SCT_CondParameterData* data{getCondData(ctx)};
91 if (data==nullptr) return invalid(iparam, ctx);
92 return data->avg(iparam);
93}
94
96float
97SCT_ConditionsParameterTool::sd(const SCT_CondParameterData::ParameterIndex iparam, const EventContext& ctx) const {
98 const SCT_CondParameterData* data{getCondData(ctx)};
99 if (data==nullptr) return invalid(iparam, ctx);
100 return data->sd(iparam);
101}
102
104unsigned int
105SCT_ConditionsParameterTool::n(const SCT_CondParameterData::ParameterIndex iparam, const EventContext& ctx) const {
106 const SCT_CondParameterData* data{getCondData(ctx)};
107 if (data==nullptr) return 0;
108 return data->n(iparam);
109}
110
112void
113SCT_ConditionsParameterTool::getValues(std::vector<float>& userVector, const SCT_CondParameterData::ParameterIndex iparam, const EventContext& ctx) const {
114 const SCT_CondParameterData* data{getCondData(ctx)};
115 if (data!=nullptr) data->getValues(userVector, iparam);
116 //no return value
117}
118
120bool
121SCT_ConditionsParameterTool::filled(const EventContext& ctx) const {
122 const SCT_CondParameterData* data{getCondData(ctx)};
123 return (data!=nullptr);
124}
125
128 if (not condData.isValid()) {
129 ATH_MSG_ERROR("Failed to get " << m_condKey.key());
130 return nullptr;
131 }
132 return *condData;
133}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
header file for SCT conditions tool giving numerical parameters
This is a "hash" representation of an Identifier.
Data object for SCT_ConditionsParameterTool and SCT_ConditionsParameterCondAlg.
static bool isValid(const float parameterValue, const SCT_CondParameterData::ParameterIndex iparam)
Is a given value within acceptable limits?
virtual float sd(const SCT_CondParameterData::ParameterIndex iparam, const EventContext &ctx) const override
Standard deviation.
virtual StatusCode finalize() override
virtual float max(const SCT_CondParameterData::ParameterIndex iparam, const EventContext &ctx) const override
Maximum value read in from the database.
virtual bool available(const SCT_CondParameterData::ParameterIndex iparam, const EventContext &ctx) const override
Is the required parameter available?
virtual float min(const SCT_CondParameterData::ParameterIndex iparam, const EventContext &ctx) const override
Minimum value read in from the database.
const SCT_CondParameterData * getCondData(const EventContext &ctx) const
virtual void getValues(std::vector< float > &userVector, const SCT_CondParameterData::ParameterIndex iparam, const EventContext &ctx) const override
Fill a user-provided vector with the values (hopefully won't be needed?).
virtual float value(const IdentifierHash &idHash, const SCT_CondParameterData::ParameterIndex iparam, const EventContext &ctx) const override
Give the indicated value for a module identifier hash.
virtual float avg(const SCT_CondParameterData::ParameterIndex iparam, const EventContext &ctx) const override
Average value.
virtual float validity(const IdentifierHash &idHash, const SCT_CondParameterData::ParameterIndex iparam, const EventContext &ctx) const override
Measure of how many valid values went to calculate it. Should be 1 but if, say, 3 chip values were va...
virtual StatusCode initialize() override
virtual bool isValid(const float parameterValue, const SCT_CondParameterData::ParameterIndex iparam, const EventContext &ctx) const override
Is a given value within acceptable limits?
virtual float invalid(const unsigned int iparam, const EventContext &ctx) const override
What is the default error value for this parameter?
virtual unsigned int n(const SCT_CondParameterData::ParameterIndex iparam, const EventContext &ctx) const override
Number of values read in.
virtual bool filled(const EventContext &ctx) const override
Report whether the structure was filled.
SG::ReadCondHandleKey< SCT_CondParameterData > m_condKey
SCT_ConditionsParameterTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor necessary for Svc factory.