19 #include "GaudiKernel/PhysicalConstants.h"
51 const SCT_ID* idHelper{
nullptr};
55 return StatusCode::SUCCESS;
63 if (writeHandle.isValid()) {
64 ATH_MSG_DEBUG(
"CondHandle " << writeHandle.fullKey() <<
" is already valid."
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;
77 writeHandle.addDependency(sctDetEle);
83 if (readCdoTemp==
nullptr) {
85 return StatusCode::FAILURE;
87 writeHandle.addDependency(readHandleTemp);
88 ATH_MSG_INFO(
"Input is " << readHandleTemp.fullKey() <<
" with the range of " << readHandleTemp.getRange());
93 if (readCdoHV==
nullptr) {
95 return StatusCode::FAILURE;
97 writeHandle.addDependency(readHandleHV);
98 ATH_MSG_INFO(
"Input is " << readHandleHV.fullKey() <<
" with the range of " << readHandleHV.getRange());
107 if (fieldCondObj==
nullptr) {
109 return StatusCode::FAILURE;
111 writeHandle.addDependency(readHandle);
112 fieldCondObj->getInitializedCache(fieldCache);
116 std::unique_ptr<SiLorentzAngleCondData> writeCdo{std::make_unique<SiLorentzAngleCondData>()};
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);
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 *= sqrt(std::abs(biasVoltage / deplVoltage));
157 double meanElectricField{0.};
158 if (depletionDepth>0.) {
159 meanElectricField = biasVoltage / depletionDepth;
172 double tanLorentzAnglePhi{element->design().readoutSide() * mobility * element->hitDepthDirection()
173 * element->hitPhiDirection() * (element->normal().cross(magneticField)).
dot(element->phiAxis())};
174 writeCdo->setTanLorentzAngle(elementHash, tanLorentzAnglePhi);
178 double lorentzCorrectionPhi{-0.5 * element->hitPhiDirection() * tanLorentzAnglePhi * depletionDepth};
179 writeCdo->setLorentzShift(elementHash, lorentzCorrectionPhi);
183 double tanLorentzAngleEta{element->design().readoutSide() * mobility * element->hitDepthDirection()
184 * element->hitEtaDirection() * (element->normal().cross(magneticField)).
dot(element->etaAxis())};
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);
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];