15#include "GaudiKernel/EventIDRange.h"
33 defaultThresholds(
int bec,
int layer){
35 static const Thresholds ec0{600, 24, 75, 1500};
36 static const Thresholds b0{900, 36, 110, 1000};
38 return bec==0 ? b0 : ec0;
44 defaultLegacyParameters(
int bec,
int layer){
50 return bec==0 ? b0 : ec0;
63 const EventIDBase
start{EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, 0, 0, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM};
64 const EventIDBase
stop {EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM};
79 return StatusCode::SUCCESS;
86 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.");
87 return StatusCode::SUCCESS;
92 if (not pixelDetEleHandle.
isValid() or elements==
nullptr) {
94 return StatusCode::FAILURE;
100 auto pChargeCalibData = std::make_unique<PixelChargeCalibCondData>(
m_pixelID->wafer_hash_max());
102 for (
unsigned int moduleHash{}; moduleHash <
m_pixelID->wafer_hash_max(); moduleHash++) {
107 const std::vector<Thresholds> allDefaultThresholds(numFE, defaultThresholds(barrel_ec, layer));
109 const std::vector<LegacyFitParameters> allDefaultFitParams(numFE, defaultLegacyParameters(barrel_ec, layer));
111 const std::vector<LinearFitParameters> allDefaultLinearParams(numFE,
LinearFitParameters{0.0f, 0.0f});
114 pChargeCalibData -> setThresholds(
type, moduleHash, allDefaultThresholds);
115 pChargeCalibData -> setLegacyFitParameters(
type, moduleHash, allDefaultFitParams);
116 pChargeCalibData -> setLinearFitParameters(
type, moduleHash, allDefaultLinearParams);
118 pChargeCalibData -> setTotResolutions(moduleHash, std::vector<Resolutions>(numFE, defaultResolutions()));
121 const auto & rangeW = infiniteEventRange();
122 if (writeHandle.
record(rangeW, std::move(pChargeCalibData)).isFailure()) {
123 ATH_MSG_FATAL(
"Could not record PixelChargeCalibCondData " << writeHandle.
key() <<
" with EventRange " << rangeW <<
" into Conditions Store");
124 return StatusCode::FAILURE;
126 ATH_MSG_INFO(
"recorded new CDO " << writeHandle.
key() <<
" with range " << rangeW <<
" into Conditions Store");
128 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
Structs for holding charge calibration parameterisation and data.
Struct for holding vectors of charge calibration constants, with utility methods.
Interface to parsers which accept a string or json object and return a ChargeCalibrationBundle.
constexpr std::size_t enum2uint(T n, std::string_view callingFunctionName="")
Convert an enum class to size_t for use as an array index.
const ServiceHandle< StoreGateSvc > & detStore() const
An algorithm that can be simultaneously executed in multiple threads.
SG::WriteCondHandleKey< PixelChargeCalibCondData > m_writeKey
const PixelID * m_pixelID
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
virtual StatusCode initialize() override final
virtual StatusCode execute(const EventContext &ctx) const override final
ITkPixChargeCalibAlg(const std::string &name, ISvcLocator *pSvcLocator)
This is a "hash" representation of an Identifier.
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.
const std::string & key() const
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
const DataObjID & fullKey() const
constexpr std::size_t enum2uint(T n, std::string_view callingFunctionName="")
Convert an enum class to size_t for use as an array index.
std::pair< size_t, InDetDD::PixelReadoutTechnology > numChipsAndTechnology(const InDetDD::SiDetectorElement *element)
std::pair< int, int > getBecAndLayer(const PixelID *pPixelId, IdentifierHash hash)