7 #include "GaudiKernel/PhysicalConstants.h"
22 const PixelID* idHelper{
nullptr};
40 return StatusCode::SUCCESS;
51 if (writeHandle.isValid()) {
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;
63 writeHandle.addDependency(readHandleTemp);
69 if (readCdoHV==
nullptr) {
71 return StatusCode::FAILURE;
73 writeHandle.addDependency(readHandleHV);
84 if (fieldCondObj ==
nullptr) {
86 return StatusCode::FAILURE;
90 writeHandle.addDependency(readHandleField);
91 fieldCondObj->getInitializedCache (fieldCache);
98 if (readCdoBFieldSensor==
nullptr) {
100 return StatusCode::FAILURE;
102 writeHandle.addDependency(readHandleBFieldSensor);
111 if (elements==
nullptr) {
113 return StatusCode::FAILURE;
115 writeHandle.addDependency(pixelDetEle);
118 std::unique_ptr<SiLorentzAngleCondData> writeCdo{std::make_unique<SiLorentzAngleCondData>()};
120 writeCdo->resize(wafer_hash_max);
124 double temperature = readCdoTemp->
getTemperature(elementHash)+273.15;
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);
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.");