7#include "GaudiKernel/PhysicalConstants.h"
22 const PixelID* idHelper{
nullptr};
40 return StatusCode::SUCCESS;
52 ATH_MSG_DEBUG(
"CondHandle " << writeHandle.
fullKey() <<
" is already valid." <<
" In theory this should not be called, but may happen" <<
" if multiple concurrent events are being processed out of order.");
53 return StatusCode::SUCCESS;
59 if (readCdoTemp==
nullptr) {
61 return StatusCode::FAILURE;
69 if (readCdoHV==
nullptr) {
71 return StatusCode::FAILURE;
84 if (fieldCondObj ==
nullptr) {
86 return StatusCode::FAILURE;
98 if (readCdoBFieldSensor==
nullptr) {
100 return StatusCode::FAILURE;
111 if (elements==
nullptr) {
113 return StatusCode::FAILURE;
118 std::unique_ptr<SiLorentzAngleCondData> writeCdo{std::make_unique<SiLorentzAngleCondData>()};
120 writeCdo->resize(wafer_hash_max);
124 double temperature = readCdoTemp->
getTemperature(elementHash)+273.15;
125 double deplVoltage = 0.0*CLHEP::volt;
126 double biasVoltage = readCdoHV->
getBiasVoltage(elementHash)*CLHEP::volt;
128 ATH_MSG_DEBUG(
"Pixel Hash = " << elementHash <<
" Temperature = " << temperature <<
" [deg K], BiasV = " << biasVoltage <<
" DeplV = " << deplVoltage);
131 double depletionDepth = element->
thickness();
132 if (std::fabs(biasVoltage) < std::fabs(deplVoltage)) {
133 depletionDepth *= std::sqrt(std::fabs(biasVoltage/deplVoltage));
139 ATH_MSG_FATAL(
"Dynamic cast to PixelModuleDesign* failed in PixelSiLorentzAngleCondAlg::execute");
140 return StatusCode::FAILURE;
142 double forceLorentzToZero = 1.0;
145 forceLorentzToZero = 0.0;
159 writeCdo->setTanLorentzAngle(elementHash, tanLorentzAnglePhi);
163 double lorentzCorrectionPhi = -0.5*element->
hitPhiDirection()*tanLorentzAnglePhi*depletionDepth;
164 writeCdo->setLorentzShift(elementHash, lorentzCorrectionPhi);
168 writeCdo->setTanLorentzAngleEta(elementHash, tanLorentzAngleEta);
169 double lorentzCorrectionEta = -0.5*element->
hitPhiDirection()*tanLorentzAngleEta*depletionDepth;
170 writeCdo->setLorentzShiftEta(elementHash, lorentzCorrectionEta);
173 writeCdo->setBiasVoltage(elementHash, biasVoltage/CLHEP::volt);
174 writeCdo->setTemperature(elementHash, temperature-273.15);
175 writeCdo->setDepletionVoltage(elementHash, deplVoltage/CLHEP::volt);
177 ATH_MSG_DEBUG(
"Hash = " << elementHash <<
" tanPhi = " << lorentzCorrectionPhi <<
" shiftPhi = " << writeCdo->getLorentzShift(elementHash) <<
" Factor = 1.0 Depletion depth = " << depletionDepth);
178 ATH_MSG_DEBUG(
"Hash = " << elementHash <<
" tanPhi = " << lorentzCorrectionPhi <<
" shiftPhi = " << writeCdo->getLorentzShift(elementHash) <<
"Depletion depth = " << depletionDepth);
179 ATH_MSG_VERBOSE(
"Temperature (C), bias voltage, depletion voltage: " << temperature-273.15 <<
", " << biasVoltage/CLHEP::volt <<
", " << deplVoltage/CLHEP::volt);
181 ATH_MSG_VERBOSE(
"Mobility (cm2/V/s): " << mobility/(CLHEP::cm2/CLHEP::volt/CLHEP::s));
182 ATH_MSG_VERBOSE(
"Magnetic Field (tesla): " <<
"(" << magneticField.x()/CLHEP::tesla <<
"," << magneticField.y()/CLHEP::tesla <<
"," << magneticField.z()/CLHEP::tesla <<
")");
183 ATH_MSG_VERBOSE(
"LorentzShift, tanLorentzAngle = " << writeCdo->getLorentzShift(elementHash) <<
", " << writeCdo->getTanLorentzAngle(elementHash));
184 ATH_MSG_VERBOSE(
"LorentzShiftEta, tanLorentzAngleEta = " << writeCdo->getLorentzShiftEta(elementHash) <<
", " << writeCdo->getTanLorentzAngleEta(elementHash));
188 if (writeHandle.
record(std::move(writeCdo)).isFailure()) {
189 ATH_MSG_FATAL(
"Could not record SiLorentzAngleCondData " << writeHandle.
key() <<
" with EventRange " << writeHandle.
getRange() <<
" into Conditions Store");
190 return StatusCode::FAILURE;
193 ATH_MSG_DEBUG(
"recorded new CDO " << writeHandle.
key() <<
" with range " << writeHandle.
getRange() <<
" into Conditions Store");
195 return StatusCode::SUCCESS;
200 return StatusCode::SUCCESS;
205 ATH_MSG_VERBOSE(
"Getting magnetic field from MT magnetic field service.");
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
This is an Identifier helper class for the Pixel 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 class is a collection of AttributeLists where each one is associated with a channel number.
This is a "hash" representation of an Identifier.
int readoutSide() const
ReadoutSide.
Class used to describe the design of a module (diode segmentation and readout scheme)
PixelReadoutTechnology getReadoutTechnology() const
virtual bool is3D() const
int rowsPerCircuit() const
Number of cell rows per circuit:
int numberOfCircuits() const
Total number of circuits:
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.
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,...
float getBiasVoltage(const int chanNum) const
float getTemperature(int chanNum) const
This is an Identifier helper class for the Pixel subdetector.
size_type wafer_hash_max() const
Identifier::size_type size_type
Gaudi::Property< std::string > m_pixelIDName
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
virtual StatusCode execute(const EventContext &ctx) const override
SG::ReadCondHandleKey< PixelDCSHVData > m_readKeyHV
Amg::Vector3D getMagneticField(MagField::AtlasFieldCache &m_fieldCache, const InDetDD::SiDetectorElement *element) const
SG::WriteCondHandleKey< SiLorentzAngleCondData > m_writeKey
DoubleProperty m_nominalField
BooleanProperty m_useMagFieldDcs
SG::ReadCondHandleKey< CondAttrListCollection > m_readKeyBFieldSensor
BooleanProperty m_useMagFieldCache
virtual StatusCode finalize() override
ToolHandle< ISiPropertiesTool > m_siPropertiesTool
virtual StatusCode initialize() override
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCondObjInputKey
BooleanProperty m_disable3D
PixelSiLorentzAngleCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
SG::ReadCondHandleKey< PixelDCSTempData > m_readKeyTemp
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