59{
60
61 SG::WriteCondHandle<SiLorentzAngleCondData> writeHandle{
m_writeKey, ctx};
62
65 << " In theory this should not be called, but may happen"
66 << " if multiple concurrent events are being processed out of order.");
67 return StatusCode::SUCCESS;
68 }
69
70
71 SG::ReadCondHandle<InDetDD::SiDetectorElementCollection> sctDetEle(
m_SCTDetEleCollKey, ctx);
72 const InDetDD::SiDetectorElementCollection* elements(sctDetEle.retrieve());
73 if (elements==nullptr) {
75 return StatusCode::FAILURE;
76 }
78
80
81 SG::ReadCondHandle<SCT_DCSFloatCondData> readHandleTemp{
m_readKeyTemp, ctx};
82 const SCT_DCSFloatCondData* readCdoTemp{*readHandleTemp};
83 if (readCdoTemp==nullptr) {
85 return StatusCode::FAILURE;
86 }
89
90
91 SG::ReadCondHandle<SCT_DCSFloatCondData> readHandleHV{
m_readKeyHV, ctx};
92 const SCT_DCSFloatCondData* readCdoHV{*readHandleHV};
93 if (readCdoHV==nullptr) {
95 return StatusCode::FAILURE;
96 }
99 }
100
101 MagField::AtlasFieldCache fieldCache;
103
105 const AtlasFieldCacheCondObj* fieldCondObj{*readHandle};
106
107 if (fieldCondObj==nullptr) {
109 return StatusCode::FAILURE;
110 }
113 }
114
115
116 std::unique_ptr<SiLorentzAngleCondData> writeCdo{std::make_unique<SiLorentzAngleCondData>()};
118
119
121 const IdentifierHash elementHash{
hash};
122
123 double temperatureC{0.0};
124 double deplVoltage{0.0};
125 double biasVoltage{0.0};
126
131 } else {
135 ATH_MSG_DEBUG(
"SCT Hash = " << elementHash <<
" Temperature = " << temperatureC <<
" [deg C], BiasV = " << biasVoltage <<
" DeplV = " << deplVoltage);
136 }
137
138
141 ATH_MSG_DEBUG(
"Invalid temperature: " << temperatureC <<
" C. " <<
"Setting to " <<
m_temperature.value() <<
" C. " <<
"Detector element hash: " << elementHash);
142 }
143 double temperature{temperatureC + Gaudi::Units::STP_Temperature};
144
145
146
147
148 const InDetDD::SiDetectorElement* element{elements->getDetectorElement(elementHash)};
149 double depletionDepth{element->
thickness()};
150 if (deplVoltage==0.0) {
151 ATH_MSG_WARNING(
"Depletion voltage in "<<__FILE__<<
" is zero, which might be a bug.");
152 }
153 if (std::abs(biasVoltage) < std::abs(deplVoltage)) {
154 depletionDepth *= std::sqrt(std::abs(biasVoltage / deplVoltage));
155 }
156
157 double meanElectricField{0.};
158 if (depletionDepth>0.) {
159 meanElectricField = biasVoltage / depletionDepth;
160 }
161 InDet::SiliconProperties siProperties;
164
165
167
168
169
170
171
174 writeCdo->setTanLorentzAngle(elementHash, tanLorentzAnglePhi);
175
176
177
178 double lorentzCorrectionPhi{-0.5 * element->
hitPhiDirection() * tanLorentzAnglePhi * depletionDepth};
179 writeCdo->setLorentzShift(elementHash, lorentzCorrectionPhi);
180
181
182
185 writeCdo->setTanLorentzAngleEta(elementHash, tanLorentzAngleEta);
186 double lorentzCorrectionEta{-0.5 * element->
hitPhiDirection() * tanLorentzAngleEta * depletionDepth};
187 writeCdo->setLorentzShiftEta(elementHash, lorentzCorrectionEta);
188
189
190 writeCdo->setBiasVoltage(elementHash, biasVoltage/CLHEP::volt);
191 writeCdo->setTemperature(elementHash, temperatureC);
192 writeCdo->setDepletionVoltage(elementHash, deplVoltage/CLHEP::volt);
193
194 ATH_MSG_DEBUG(
"Hash = " << elementHash <<
" tanPhi = " << lorentzCorrectionPhi <<
" shiftPhi = " << writeCdo->getLorentzShift(elementHash) <<
"Depletion depth = " << depletionDepth);
195 ATH_MSG_VERBOSE(
"Temperature (C), bias voltage, depletion voltage: " << temperatureC <<
", " << biasVoltage/CLHEP::volt <<
", " << deplVoltage/CLHEP::volt);
197 ATH_MSG_VERBOSE(
"Mobility (cm2/V/s): " << mobility/(CLHEP::cm2/CLHEP::volt/CLHEP::s));
198 ATH_MSG_VERBOSE(
"Magnetic Field (tesla): " <<
"(" << magneticField.x()/CLHEP::tesla <<
"," << magneticField.y()/CLHEP::tesla <<
"," << magneticField.z()/CLHEP::tesla <<
")");
199 ATH_MSG_VERBOSE(
"LorentzShift, tanLorentzAngle = " << writeCdo->getLorentzShift(elementHash) <<
", " << writeCdo->getTanLorentzAngle(elementHash));
200 ATH_MSG_VERBOSE(
"LorentzShiftEta, tanLorentzAngleEta = " << writeCdo->getLorentzShiftEta(elementHash) <<
", " << writeCdo->getTanLorentzAngleEta(elementHash));
201 }
202
203
204 if (writeHandle.
record(std::move(writeCdo)).isFailure()) {
205 ATH_MSG_FATAL(
"Could not record SiLorentzAngleCondData " << writeHandle.
key()
206 <<
" with EventRange " << writeHandle.
getRange() <<
" into Conditions Store");
207 return StatusCode::FAILURE;
208 }
209 ATH_MSG_INFO(
"recorded new CDO " << writeHandle.
key() <<
" with range " << writeHandle.
getRange() <<
" into Conditions Store");
210
211 return StatusCode::SUCCESS;
212}
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
void getInitializedCache(MagField::AtlasFieldCache &cache) const
get B field cache for evaluation as a function of 2-d or 3-d position.
int readoutSide() const
ReadoutSide.
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
InDetDD::CarrierType carrierType() const
carrier type for readout.
const Amg::Vector3D & etaAxis() const
double hitPhiDirection() const
See previous method.
virtual const Amg::Vector3D & normal() const override final
Get reconstruction local normal axes in global frame.
const Amg::Vector3D & phiAxis() const
double hitDepthDirection() const
Directions of hit depth,phi,eta axes relative to reconstruction local position axes (LocalPosition).
double hitEtaDirection() const
See previous method.
void setConditions(double temperature, double electricField)
double signedHallMobility(InDetDD::CarrierType carrier) const
DoubleProperty m_temperatureMin
DoubleProperty m_temperature
Amg::Vector3D getMagneticField(MagField::AtlasFieldCache &fieldCache, const InDetDD::SiDetectorElement *element) const
DoubleProperty m_biasVoltage
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_SCTDetEleCollKey
SG::WriteCondHandleKey< SiLorentzAngleCondData > m_writeKey
SG::ReadCondHandleKey< SCT_DCSFloatCondData > m_readKeyHV
DoubleProperty m_temperatureMax
BooleanProperty m_sctDefaults
BooleanProperty m_useGeoModel
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCondObjInputKey
ToolHandle< ISiliconConditionsTool > m_siConditionsTool
SG::ReadCondHandleKey< SCT_DCSFloatCondData > m_readKeyTemp
BooleanProperty m_useMagFieldCache
DoubleProperty m_deplVoltage
const DataObjID & fullKey() const
const EventIDRange & getRange()
const std::string & key() const
void addDependency(const EventIDRange &range)
const EventIDRange & getRange() const
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
const DataObjID & fullKey() const
Eigen::Matrix< double, 3, 1 > Vector3D