ATLAS Offline Software
SCT_ConditionsParameterTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
10 #include <limits>
11 
13 
14 //c'tor
15 SCT_ConditionsParameterTool::SCT_ConditionsParameterTool(const std::string& type, const std::string& name, const IInterface* parent) :
16  base_class(type, name, parent) {
17 }
18 
19 //
23 
24  return StatusCode::SUCCESS;
25 }
26 
27 //
30  return StatusCode::SUCCESS;
31 }
32 
34 bool
35 SCT_ConditionsParameterTool::available(const SCT_CondParameterData::ParameterIndex iparam, const EventContext& /*ctx*/) const {
36  return (iparam==SCT_CondParameterData::AVG_THRESHOLD);
37 }
38 
39 bool
41  const EventContext& ctx{Gaudi::Hive::currentContext()};
42  return available(iparam, ctx);
43 }
44 
46 float
47 SCT_ConditionsParameterTool::value(const IdentifierHash& idHash, const SCT_CondParameterData::ParameterIndex iparam, const EventContext& ctx) const {
49  if (data==nullptr) return invalid(iparam);
50  return data->getValue(idHash, iparam);
51 }
52 
53 float
55  const EventContext& ctx{Gaudi::Hive::currentContext()};
56  return value(idHash, iparam, ctx);
57 }
58 
60 float
61 SCT_ConditionsParameterTool::validity(const IdentifierHash& /*idHash*/, const SCT_CondParameterData::ParameterIndex /*iparam*/, const EventContext& /*ctx*/) const {
62  return 1.0;
63 }
64 
65 float
67  const EventContext& ctx{Gaudi::Hive::currentContext()};
68  return validity(idHash, iparam, ctx);
69 }
70 
72 bool
73 SCT_ConditionsParameterTool::isValid(const float parameterValue, const SCT_CondParameterData::ParameterIndex iparam, const EventContext& ctx) const {
75  if (data==nullptr) return invalid(iparam);
76  return SCT_CondParameterData::isValid(parameterValue, iparam);
77 }
78 
79 bool
80 SCT_ConditionsParameterTool::isValid(const float parameterValue, const SCT_CondParameterData::ParameterIndex iparam) const {
81  const EventContext& ctx{Gaudi::Hive::currentContext()};
82  return isValid(parameterValue, iparam, ctx);
83 }
84 
86 float
87 SCT_ConditionsParameterTool::invalid(const unsigned int iparam, const EventContext& /*ctx*/) const {
88  float result{0.0};
90  result=std::numeric_limits<float>::quiet_NaN();
91  }
92  return result;
93 }
94 
95 float
96 SCT_ConditionsParameterTool::invalid(const unsigned int iparam) const {
97  const EventContext& ctx{Gaudi::Hive::currentContext()};
98  return invalid(iparam, ctx);
99 }
100 
102 float
103 SCT_ConditionsParameterTool::max(const SCT_CondParameterData::ParameterIndex iparam, const EventContext& ctx) const {
105  if (data==nullptr) return invalid(iparam);
106  return data->max(iparam);
107 }
108 
109 float
111  const EventContext& ctx{Gaudi::Hive::currentContext()};
112  return max(iparam, ctx);
113 }
114 
116 float
117 SCT_ConditionsParameterTool::min(const SCT_CondParameterData::ParameterIndex iparam, const EventContext& ctx) const {
119  if (data==nullptr) return invalid(iparam);
120  return data->min(iparam);
121 }
122 
123 float
125  const EventContext& ctx{Gaudi::Hive::currentContext()};
126  return min(iparam, ctx);
127 }
128 
130 float
131 SCT_ConditionsParameterTool::avg(const SCT_CondParameterData::ParameterIndex iparam, const EventContext& ctx) const {
133  if (data==nullptr) return invalid(iparam);
134  return data->avg(iparam);
135 }
136 
137 float
139  const EventContext& ctx{Gaudi::Hive::currentContext()};
140  return avg(iparam, ctx);
141 }
142 
144 float
145 SCT_ConditionsParameterTool::sd(const SCT_CondParameterData::ParameterIndex iparam, const EventContext& ctx) const {
147  if (data==nullptr) return invalid(iparam);
148  return data->sd(iparam);
149 }
150 
151 float
153  const EventContext& ctx{Gaudi::Hive::currentContext()};
154  return sd(iparam, ctx);
155 }
156 
158 unsigned int
159 SCT_ConditionsParameterTool::n(const SCT_CondParameterData::ParameterIndex iparam, const EventContext& ctx) const {
161  if (data==nullptr) return 0;
162  return data->n(iparam);
163 }
164 
165 unsigned int
167  const EventContext& ctx{Gaudi::Hive::currentContext()};
168  return n(iparam, ctx);
169 }
170 
172 void
173 SCT_ConditionsParameterTool::getValues(std::vector<float>& userVector, const SCT_CondParameterData::ParameterIndex iparam, const EventContext& ctx) const {
175  if (data!=nullptr) data->getValues(userVector, iparam);
176  //no return value
177 }
178 
179 void
180 SCT_ConditionsParameterTool::getValues(std::vector<float>& userVector, const SCT_CondParameterData::ParameterIndex iparam) const {
181  const EventContext& ctx{Gaudi::Hive::currentContext()};
182  getValues(userVector, iparam, ctx);
183 }
184 
186 bool
187 SCT_ConditionsParameterTool::filled(const EventContext& ctx) const {
189  return (data!=nullptr);
190 }
191 
192 bool
194  const EventContext& ctx{Gaudi::Hive::currentContext()};
195  return filled(ctx);
196 }
197 
200  if (not condData.isValid()) {
201  ATH_MSG_ERROR("Failed to get " << m_condKey.key());
202  return nullptr;
203  }
204  return *condData;
205 }
SCT_ConditionsParameterTool::filled
virtual bool filled() const override
Definition: SCT_ConditionsParameterTool.cxx:193
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
SCT_ConditionsParameterTool::value
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.
Definition: SCT_ConditionsParameterTool.cxx:47
get_generator_info.result
result
Definition: get_generator_info.py:21
SCT_ConditionsParameterTool::n
virtual unsigned int n(const SCT_CondParameterData::ParameterIndex iparam, const EventContext &ctx) const override
Number of values read in.
Definition: SCT_ConditionsParameterTool.cxx:159
SCT_CondParameterData
Data object for SCT_ConditionsParameterTool and SCT_ConditionsParameterCondAlg.
Definition: SCT_CondParameterData.h:32
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
SCT_ConditionsParameterTool::finalize
virtual StatusCode finalize() override
Definition: SCT_ConditionsParameterTool.cxx:29
SCT_ConditionsParameterTool::SCT_ConditionsParameterTool
SCT_ConditionsParameterTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor necessary for Svc factory.
Definition: SCT_ConditionsParameterTool.cxx:15
SCT_CondParameterData::ParameterIndex
ParameterIndex
Parameters.
Definition: SCT_CondParameterData.h:35
SCT_ConditionsParameterTool::isValid
virtual bool isValid(const float parameterValue, const SCT_CondParameterData::ParameterIndex iparam, const EventContext &ctx) const override
Is a given value within acceptable limits?
Definition: SCT_ConditionsParameterTool.cxx:73
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
SCT_ConditionsParameterTool::invalid
virtual float invalid(const unsigned int iparam, const EventContext &ctx) const override
What is the default error value for this parameter?
Definition: SCT_ConditionsParameterTool.cxx:87
SCT_ConditionsParameterTool::validity
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...
Definition: SCT_ConditionsParameterTool.cxx:61
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SCT_ConditionsParameterTool::getCondData
const SCT_CondParameterData * getCondData(const EventContext &ctx) const
Definition: SCT_ConditionsParameterTool.cxx:198
SCT_ConditionsParameterTool::m_condKey
SG::ReadCondHandleKey< SCT_CondParameterData > m_condKey
Definition: SCT_ConditionsParameterTool.h:93
SCT_ConditionsParameterTool::getValues
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?)
Definition: SCT_ConditionsParameterTool.cxx:173
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
SCT_ConditionsParameterTool::sd
virtual float sd(const SCT_CondParameterData::ParameterIndex iparam, const EventContext &ctx) const override
Standard deviation.
Definition: SCT_ConditionsParameterTool.cxx:145
SCT_ConditionsParameterTool::max
virtual float max(const SCT_CondParameterData::ParameterIndex iparam, const EventContext &ctx) const override
Maximum value read in from the database.
Definition: SCT_ConditionsParameterTool.cxx:103
SCT_CondParameterData::AVG_THRESHOLD
@ AVG_THRESHOLD
Definition: SCT_CondParameterData.h:35
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SCT_ConditionsParameterTool::min
virtual float min(const SCT_CondParameterData::ParameterIndex iparam, const EventContext &ctx) const override
Minimum value read in from the database.
Definition: SCT_ConditionsParameterTool.cxx:117
SCT_ConditionsParameterTool::initialize
virtual StatusCode initialize() override
Definition: SCT_ConditionsParameterTool.cxx:21
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
SCT_CondParameterData::isValid
static bool isValid(const float parameterValue, const SCT_CondParameterData::ParameterIndex iparam)
Is a given value within acceptable limits?
Definition: SCT_CondParameterData.cxx:53
SCT_ConditionsParameterTool.h
SCT_ConditionsParameterTool::available
virtual bool available(const SCT_CondParameterData::ParameterIndex iparam, const EventContext &ctx) const override
Is the required parameter available?
Definition: SCT_ConditionsParameterTool.cxx:35
SCT_ConditionsParameterTool::avg
virtual float avg(const SCT_CondParameterData::ParameterIndex iparam, const EventContext &ctx) const override
Average value.
Definition: SCT_ConditionsParameterTool.cxx:131