|
ATLAS Offline Software
|
Go to the documentation of this file.
5 #include "GaudiKernel/EventIDRange.h"
15 #include <nlohmann/json.hpp>
28 constexpr
int halfModuleThreshold{8};
43 return StatusCode::SUCCESS;
51 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.");
52 return StatusCode::SUCCESS;
57 if (not pixelDetEleHandle.
isValid() or elements==
nullptr) {
59 return StatusCode::FAILURE;
69 std::unique_ptr<PixelChargeCalibCondData> writeCdo(std::make_unique<PixelChargeCalibCondData>(
m_pixelID->
wafer_hash_max()));
71 const EventIDBase
start{EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, 0, 0, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM};
72 const EventIDBase
stop {EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM};
78 if (readCdo==
nullptr) {
80 return StatusCode::FAILURE;
83 if (not readHandle.
range(rangeW)) {
85 return StatusCode::FAILURE;
87 ATH_MSG_INFO(
"Size of CondAttrListCollection " << readHandle.
fullKey() <<
" readCdo->size()= " << readCdo->
size());
89 std::unique_ptr<IChargeCalibrationParser> pParser{};
91 for (
const auto & attrList : *readCdo) {
95 if (
payload.exists(
"data_array") and not
payload[
"data_array"].isNull()) {
97 pParser = std::make_unique<LUTChargeCalibParser>(configData, elements,
m_pixelID);
101 return StatusCode::FAILURE;
105 std::string fileContent((std::istreambuf_iterator<char>(
infile)), std::istreambuf_iterator<char>());
109 for (
const auto &[
hash,
data] : jsonData.items()) {
110 const unsigned int moduleHash = std::stoul(
hash);
111 IdentifierHash wafer_hash = IdentifierHash(moduleHash);
117 return StatusCode::FAILURE;
120 if (!
b.tot2Charges.empty()) {
121 writeCdo -> setTot2Charges(moduleHash,
b.tot2Charges);
124 writeCdo -> setAllFromBundle(moduleHash,
b);
142 IdentifierHash wafer_hash = IdentifierHash(moduleHash);
146 writeCdo -> setAllFromConfigData(moduleHash, configData, becLayer, numFE);
153 IdentifierHash wafer_hash = IdentifierHash(moduleHash);
165 writeCdo -> setThresholds(
type, moduleHash, std::vector<Thresholds>(numFE,
defaults));
170 if (writeHandle.
record(rangeW, std::move(writeCdo)).isFailure()) {
171 ATH_MSG_FATAL(
"Could not record PixelChargeCalibCondData " << writeHandle.
key() <<
" with EventRange " << rangeW <<
" into Conditions Store");
172 return StatusCode::FAILURE;
174 ATH_MSG_INFO(
"recorded new CDO " << writeHandle.
key() <<
" with range " << rangeW <<
" into Conditions Store");
176 return StatusCode::SUCCESS;
def retrieve(aClass, aKey=None)
int getDefaultAnalogThresholdSigma(int barrel_ec, int layer) const
char data[hepevt_bytes_allocation_ATLAS]
int getDefaultAnalogThreshold(int barrel_ec, int layer) const
const DataObjID & fullKey() const
int getDefaultAnalogThresholdNoise(int barrel_ec, int layer) const
SG::WriteCondHandleKey< PixelChargeCalibCondData > m_writeKey
static std::string find_file(const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
int getDefaultInTimeThreshold(int barrel_ec, int layer) const
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
std::pair< int, int > getBecAndLayer(const PixelID *pPixelId, IdentifierHash hash)
constexpr std::size_t enum2uint(T n, const std::string &callingFunctionName="")
Convert an enum class to size_t for use as an array index.
bool range(EventIDRange &r)
bool empty() const
Test if the key is blank.
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
This class is a collection of AttributeLists where each one is associated with a channel number....
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module) const
For a single crystal.
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
An algorithm that can be simultaneously executed in multiple threads.
virtual StatusCode execute(const EventContext &ctx) const override final
const DataObjID & fullKey() const
Gaudi::Property< std::string > m_pixelIDName
::StatusCode StatusCode
StatusCode definition for legacy code.
int numberOfCircuits() const
Total number of circuits:
Struct for holding vectors of charge calibration constants, with utility methods.
Gaudi::Property< std::string > m_jsonFileName
virtual StatusCode initialize() override final
SG::ReadCondHandleKey< PixelModuleData > m_configKey
int layer_disk(const Identifier &id) const
SG::ReadCondHandleKey< CondAttrListCollection > m_readKey
const std::string & key() const
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
StatusCode initialize(bool used=true)
size_type wafer_hash_max(void) const
dictionary defaults
This includes now the top quark, the leptons and the bosons.
PixelReadoutTechnology getReadoutTechnology() const
size_type size() const
number of Chan/AttributeList pairs
const PixelID * m_pixelID
PixelChargeLUTCalibCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
bundles of parameters used together in the PixelChargeCalibCondAlg
coral::AttributeList AttributeList
Gaudi::Property< int > m_inputSource
Interface to parsers which accept a string or json object and return a ChargeCalibrationBundle.
Parses a database run4 Look-Up-Table format string to a ChargeCalibrationBundle.
const std::string & key() const
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
const SiDetectorElement * getDetectorElement(const IdentifierHash &hash) const