45 {
47
49
50 SG::WriteCondHandle<SiLorentzAngleCondData> writeHandle{
m_writeKey, ctx};
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;
54 }
55
56
57 SG::ReadCondHandle<PixelDCSTempData> readHandleTemp(
m_readKeyTemp, ctx);
58 const PixelDCSTempData* readCdoTemp(*readHandleTemp);
59 if (readCdoTemp==nullptr) {
61 return StatusCode::FAILURE;
62 }
64 ATH_MSG_DEBUG(
"Input is " << readHandleTemp.fullKey() <<
" with the range of " << readHandleTemp.getRange());
65
66
67 SG::ReadCondHandle<PixelDCSHVData> readHandleHV(
m_readKeyHV, ctx);
68 const PixelDCSHVData* readCdoHV(*readHandleHV);
69 if (readCdoHV==nullptr) {
71 return StatusCode::FAILURE;
72 }
74 ATH_MSG_DEBUG(
"Input is " << readHandleHV.fullKey() <<
" with the range of " << readHandleHV.getRange());
75
76
77 MagField::AtlasFieldCache fieldCache;
80
82 const AtlasFieldCacheCondObj* fieldCondObj{*readHandleField};
83
84 if (fieldCondObj == nullptr) {
86 return StatusCode::FAILURE;
87 }
88
89
93
95
97 const CondAttrListCollection* readCdoBFieldSensor(*readHandleBFieldSensor);
98 if (readCdoBFieldSensor==nullptr) {
100 return StatusCode::FAILURE;
101 }
103 ATH_MSG_DEBUG(
"Input is " << readHandleBFieldSensor.fullKey() <<
" with the range of " << readHandleBFieldSensor.getRange() );
104
105 }
106 }
107
108
109 SG::ReadCondHandle<InDetDD::SiDetectorElementCollection> pixelDetEle(
m_pixelDetEleCollKey, ctx);
110 const InDetDD::SiDetectorElementCollection* elements(pixelDetEle.retrieve());
111 if (elements==nullptr) {
113 return StatusCode::FAILURE;
114 }
116
117
118 std::unique_ptr<SiLorentzAngleCondData> writeCdo{std::make_unique<SiLorentzAngleCondData>()};
120 writeCdo->resize(wafer_hash_max);
123
124 double temperature = readCdoTemp->getTemperature(elementHash)+273.15;
125 double deplVoltage = 0.0*CLHEP::volt;
126 double biasVoltage = readCdoHV->getBiasVoltage(elementHash)*CLHEP::volt;
127
128 ATH_MSG_DEBUG(
"Pixel Hash = " << elementHash <<
" Temperature = " << temperature <<
" [deg K], BiasV = " << biasVoltage <<
" DeplV = " << deplVoltage);
129
130 const InDetDD::SiDetectorElement* element = elements->getDetectorElement(elementHash);
131 double depletionDepth = element->
thickness();
132 if (std::fabs(biasVoltage) < std::fabs(deplVoltage)) {
133 depletionDepth *= std::sqrt(std::fabs(biasVoltage/deplVoltage));
134 }
135
136 const InDetDD::PixelModuleDesign* p_design =
dynamic_cast<const InDetDD::PixelModuleDesign*
>(&element->
design());
137
138 if (not p_design){
139 ATH_MSG_FATAL(
"Dynamic cast to PixelModuleDesign* failed in PixelSiLorentzAngleCondAlg::execute");
140 return StatusCode::FAILURE;
141 }
142 double forceLorentzToZero = 1.0;
145 forceLorentzToZero = 0.0;
146 }
147
148 const InDet::SiliconProperties &siProperties =
m_siPropertiesTool->getSiProperties(elementHash, ctx);
150
151
153
154
155
156
157
159 writeCdo->setTanLorentzAngle(elementHash, tanLorentzAnglePhi);
160
161
162
163 double lorentzCorrectionPhi = -0.5*element->
hitPhiDirection()*tanLorentzAnglePhi*depletionDepth;
164 writeCdo->setLorentzShift(elementHash, lorentzCorrectionPhi);
165
166
168 writeCdo->setTanLorentzAngleEta(elementHash, tanLorentzAngleEta);
169 double lorentzCorrectionEta = -0.5*element->
hitPhiDirection()*tanLorentzAngleEta*depletionDepth;
170 writeCdo->setLorentzShiftEta(elementHash, lorentzCorrectionEta);
171
172
173 writeCdo->setBiasVoltage(elementHash, biasVoltage/CLHEP::volt);
174 writeCdo->setTemperature(elementHash, temperature-273.15);
175 writeCdo->setDepletionVoltage(elementHash, deplVoltage/CLHEP::volt);
176
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));
185 }
186
187
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;
191 }
192
193 ATH_MSG_DEBUG(
"recorded new CDO " << writeHandle.
key() <<
" with range " << writeHandle.
getRange() <<
" into Conditions Store");
194
195 return StatusCode::SUCCESS;
196}
#define ATH_MSG_VERBOSE(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.
double signedHallMobility(InDetDD::CarrierType carrier) const
Identifier::size_type size_type
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
SG::ReadCondHandleKey< PixelDCSHVData > m_readKeyHV
Amg::Vector3D getMagneticField(MagField::AtlasFieldCache &m_fieldCache, const InDetDD::SiDetectorElement *element) const
SG::WriteCondHandleKey< SiLorentzAngleCondData > m_writeKey
BooleanProperty m_useMagFieldDcs
SG::ReadCondHandleKey< CondAttrListCollection > m_readKeyBFieldSensor
BooleanProperty m_useMagFieldCache
ToolHandle< ISiPropertiesTool > m_siPropertiesTool
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCondObjInputKey
BooleanProperty m_disable3D
SG::ReadCondHandleKey< PixelDCSTempData > m_readKeyTemp
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