19#include "GaudiKernel/PhysicalConstants.h"
51 const SCT_ID* idHelper{
nullptr};
55 return StatusCode::SUCCESS;
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;
73 if (elements==
nullptr) {
75 return StatusCode::FAILURE;
83 if (readCdoTemp==
nullptr) {
85 return StatusCode::FAILURE;
93 if (readCdoHV==
nullptr) {
95 return StatusCode::FAILURE;
107 if (fieldCondObj==
nullptr) {
109 return StatusCode::FAILURE;
116 std::unique_ptr<SiLorentzAngleCondData> writeCdo{std::make_unique<SiLorentzAngleCondData>()};
120 for (
unsigned int hash{0}; hash<
m_maxHash; hash++) {
123 double temperatureC{0.0};
124 double deplVoltage{0.0};
125 double biasVoltage{0.0};
135 ATH_MSG_DEBUG(
"SCT Hash = " << elementHash <<
" Temperature = " << temperatureC <<
" [deg C], BiasV = " << biasVoltage <<
" DeplV = " << deplVoltage);
141 ATH_MSG_DEBUG(
"Invalid temperature: " << temperatureC <<
" C. " <<
"Setting to " <<
m_temperature.value() <<
" C. " <<
"Detector element hash: " << elementHash);
143 double temperature{temperatureC + Gaudi::Units::STP_Temperature};
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.");
153 if (std::abs(biasVoltage) < std::abs(deplVoltage)) {
154 depletionDepth *= std::sqrt(std::abs(biasVoltage / deplVoltage));
157 double meanElectricField{0.};
158 if (depletionDepth>0.) {
159 meanElectricField = biasVoltage / depletionDepth;
174 writeCdo->setTanLorentzAngle(elementHash, tanLorentzAnglePhi);
178 double lorentzCorrectionPhi{-0.5 * element->
hitPhiDirection() * tanLorentzAnglePhi * depletionDepth};
179 writeCdo->setLorentzShift(elementHash, lorentzCorrectionPhi);
185 writeCdo->setTanLorentzAngleEta(elementHash, tanLorentzAngleEta);
186 double lorentzCorrectionEta{-0.5 * element->
hitPhiDirection() * tanLorentzAngleEta * depletionDepth};
187 writeCdo->setLorentzShiftEta(elementHash, lorentzCorrectionEta);
190 writeCdo->setBiasVoltage(elementHash, biasVoltage/CLHEP::volt);
191 writeCdo->setTemperature(elementHash, temperatureC);
192 writeCdo->setDepletionVoltage(elementHash, deplVoltage/CLHEP::volt);
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));
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;
209 ATH_MSG_INFO(
"recorded new CDO " << writeHandle.
key() <<
" with range " << writeHandle.
getRange() <<
" into Conditions Store");
211 return StatusCode::SUCCESS;
216 return StatusCode::SUCCESS;
224 ATH_MSG_VERBOSE(
"Getting magnetic field from MT magnetic field service.");
227 point[0] = pointvec[0];
228 point[1] = pointvec[1];
229 point[2] = pointvec[2];
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
This is an Identifier helper class for the SCT subdetector.
const ServiceHandle< StoreGateSvc > & detStore() const
Base class for conditions algorithms.
void getInitializedCache(MagField::AtlasFieldCache &cache) const
get B field cache for evaluation as a function of 2-d or 3-d position.
This is a "hash" representation of an Identifier.
int readoutSide() const
ReadoutSide.
Class to hold the SiDetectorElement objects to be put in the detector store.
const SiDetectorElement * getDetectorElement(const IdentifierHash &hash) const
Class to hold geometrical description of a silicon detector element.
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.
virtual const Amg::Vector3D & center() const override final
Center in global coordinates.
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
Local cache for magnetic field (based on MagFieldServices/AtlasFieldSvcTLS.h)
void getField(const double *ATH_RESTRICT xyz, double *ATH_RESTRICT bxyz, double *ATH_RESTRICT deriv=nullptr)
get B field value at given position xyz[3] is in mm, bxyz[3] is in kT if deriv[9] is given,...
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
virtual StatusCode finalize() override final
SG::WriteCondHandleKey< SiLorentzAngleCondData > m_writeKey
SG::ReadCondHandleKey< SCT_DCSFloatCondData > m_readKeyHV
DoubleProperty m_temperatureMax
BooleanProperty m_sctDefaults
virtual StatusCode execute(const EventContext &ctx) const override final
BooleanProperty m_useGeoModel
SCTSiLorentzAngleCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCondObjInputKey
DoubleProperty m_nominalField
ToolHandle< ISiliconConditionsTool > m_siConditionsTool
SG::ReadCondHandleKey< SCT_DCSFloatCondData > m_readKeyTemp
BooleanProperty m_useMagFieldCache
DoubleProperty m_deplVoltage
virtual StatusCode initialize() override final
Class for data object used in SCT_DCSConditions{HV,Temp}CondAlg, SCT_DCSConditionsTool,...
This is an Identifier helper class for the SCT subdetector.
size_type wafer_hash_max() const
const_pointer_type retrieve()
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