ATLAS Offline Software
Loading...
Searching...
No Matches
SCT_SiliconConditionsTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
6
13
14// Constructor
15SCT_SiliconConditionsTool::SCT_SiliconConditionsTool(const std::string& type, const std::string& name, const IInterface* parent):
16 base_class(type, name, parent)
17{
18 // These will get overwritten if used but give them some initial value anyway.
22}
23
24// Initialize
26 ATH_MSG_DEBUG("SCT_SiliconConditionsTool::initialize()");
27
30 if (m_useGeoModel) {
31 ATH_MSG_INFO("Default conditions come from GeoModel.");
32 } else {
33 ATH_MSG_INFO("GeoModel requests to use Conditions DB.");
34 }
35 }
36
37 ATH_CHECK(m_condKeyHV.initialize((not m_useGeoModel) and m_useDB));
38 ATH_CHECK(m_condKeyTemp.initialize((not m_useGeoModel) and m_useDB));
39
40 if (not m_useGeoModel) {
41 ATH_MSG_INFO("Will use temperature and voltages from this service (not from GeoModel).");
42
43 // Get from Conditions database. Register callback, etc.
44 if (m_useDB) {
45 ATH_CHECK(detStore()->retrieve(m_sct_id, "SCT_ID"));
46
47 ATH_MSG_INFO("SCTDCSSvc retrieved");
48 }
49 } else {
50 // Otherwise we use the GeoModel values
54 }
55 return StatusCode::SUCCESS;
56}
57
58// Finalize
60 ATH_MSG_DEBUG("SCT_SiliconConditionsTool::finalize()");
61 return StatusCode::SUCCESS;
62}
63
64// Silicon temperature (by Identifier)
65float SCT_SiliconConditionsTool::temperature(const Identifier& elementId, const EventContext& ctx) const {
66 const IdentifierHash elementHash{m_sct_id->wafer_hash(elementId)};
67 return temperature(elementHash, ctx);
68}
69
70// Silicon bias voltage (by Identifier)
71float SCT_SiliconConditionsTool::biasVoltage(const Identifier& elementId, const EventContext& ctx) const {
72 const IdentifierHash elementHash{m_sct_id->wafer_hash(elementId)};
73 return biasVoltage(elementHash, ctx);
74}
75
76// Silicon depletion voltage (by Identifier)
77float SCT_SiliconConditionsTool::depletionVoltage(const Identifier& /*elementId*/, const EventContext& /*ctx*/) const {
79}
80
81// Silicon temperature (by IdentifierHash)
82float SCT_SiliconConditionsTool::temperature(const IdentifierHash& elementHash, const EventContext& ctx) const {
83 if (m_useDB and (not m_useGeoModel)) {
85 if (data==nullptr) return m_defaultTemperature;
87 if (not data->getValue(elementHash, temperature)) return m_defaultTemperature;
88 if (temperature <= -30.){
89 ATH_MSG_DEBUG( "Sensor temperature: "<< temperature <<" < -30 ");
91 }
92 return temperature;
93 }
95}
96
97// Silicon bias voltage (by IdentifierHash)
98float SCT_SiliconConditionsTool::biasVoltage(const IdentifierHash& elementHash, const EventContext& ctx) const {
99
100 if (m_useDB and (not m_useGeoModel)) {
102 if (data==nullptr) return m_defaultBiasVoltage;
103 float hv{m_defaultBiasVoltage};
104 if (not data->getValue(elementHash, hv)) return m_defaultBiasVoltage;
105 if (hv < 0.) {
106 ATH_MSG_DEBUG("HV: "<< hv <<" < 0 ");
108 }
109 return hv;
110 }
112}
113
114// Silicon deplition voltage (by IdentifierHash)
115float SCT_SiliconConditionsTool::depletionVoltage(const IdentifierHash& /*elementHash*/, const EventContext& /*ctx*/) const {
117}
118
119bool
121{
122 bool conditionsPresent{false};
123 bool useCondDB{false};
124
125 if (m_rdbSvc.retrieve().isFailure()) {
126 ATH_MSG_ERROR("Could not locate RDBAccessSvc");
127 return false;
128 }
129
130 if (m_geoModelSvc.retrieve().isFailure()) {
131 ATH_MSG_ERROR("Could not locate GeoModelSvc");
132 return false;
133 }
134 DecodeVersionKey versionKey{&*m_geoModelSvc, "SCT"};
135 ATH_MSG_DEBUG("Checking GeoModel Version Tag: "<< versionKey.tag() << " at Node: " << versionKey.node());
136
137 IRDBRecordset_ptr sctConditionsSet{m_rdbSvc->getRecordsetPtr("SctConditions", versionKey.tag(), versionKey.node())};
138 if (sctConditionsSet->size()) {
139 ATH_MSG_DEBUG("Default conditions available from GeoModel.");
140 const IRDBRecord* defaultConditions{(*sctConditionsSet)[0]};
141 m_geoModelTemperature = defaultConditions->getDouble("TEMPERATURE");
142 m_geoModelBiasVoltage = defaultConditions->getDouble("BIASVOLT");
143 m_geoModelDepletionVoltage = defaultConditions->getDouble("DEPLETIONVOLT");
144 conditionsPresent = true;
145 // If m_forceUseGeoModel set then we ignore the USECONDDB column and
146 // keep useCondDB = false
147 if ((not m_forceUseGeoModel) and (not defaultConditions->isFieldNull("USECONDDB"))) { // USECONDDB Not present in old SCT tables
148 useCondDB = (defaultConditions->getInt("USECONDDB"));
149 }
150 } else {
151 ATH_MSG_WARNING("Default conditions NOT available in GeoModel database. Using old GeoModel defaults");
152 // These are pre DC3 geometries. Probably never will be used.
156 conditionsPresent = true;
157 }
158
159 return ((not useCondDB) and conditionsPresent);
160
161}
162
165 if (not condData.isValid()) {
166 ATH_MSG_ERROR("Failed to get " << m_condKeyHV.key());
167 return nullptr;
168 }
169 return *condData;
170}
171
174 if (not condData.isValid()) {
175 ATH_MSG_ERROR("Failed to get " << m_condKeyTemp.key());
176 return nullptr;
177 }
178 return *condData;
179}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
Definition of the abstract IRDBAccessSvc interface.
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition of the abstract IRDBRecord interface.
Definition of the abstract IRDBRecordset interface.
This is an Identifier helper class for the SCT subdetector.
Header file for the SCT_SiliconConditionsTool class which implements the ISiliconConditionsTool inter...
This is a helper class to query the version tags from GeoModelSvc and determine the appropriate tag a...
const std::string & tag() const
Return version tag.
const std::string & node() const
Return the version node.
IRDBRecord is one record in the IRDBRecordset object.
Definition IRDBRecord.h:27
virtual bool isFieldNull(const std::string &fieldName) const =0
Check if the field value is NULL.
virtual int getInt(const std::string &fieldName) const =0
Get int field value.
virtual double getDouble(const std::string &fieldName) const =0
Get double field value.
virtual unsigned int size() const =0
This is a "hash" representation of an Identifier.
Class for data object used in SCT_DCSConditions{HV,Temp}CondAlg, SCT_DCSConditionsTool,...
const SCT_DCSFloatCondData * getCondDataHV(const EventContext &ctx) const
SG::ReadCondHandleKey< SCT_DCSFloatCondData > m_condKeyHV
virtual float depletionVoltage(const Identifier &elementId, const EventContext &ctx) const override
Silicon depletion voltage by Identifier.
virtual StatusCode initialize() override
Initialise.
SCT_SiliconConditionsTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
ServiceHandle< IRDBAccessSvc > m_rdbSvc
ServiceHandle< IGeoModelSvc > m_geoModelSvc
const SCT_DCSFloatCondData * getCondDataTemp(const EventContext &ctx) const
SG::ReadCondHandleKey< SCT_DCSFloatCondData > m_condKeyTemp
virtual StatusCode finalize() override
Finalise.
virtual float biasVoltage(const Identifier &elementId, const EventContext &ctx) const override
Silicon bias voltage by Identifier.
virtual float temperature(const Identifier &elementId, const EventContext &ctx) const override
Silicon temperature by Identifier.