Commit 1a11bb61 authored by Goetz Gaycken's avatar Goetz Gaycken
Browse files

Replace maps with contiguous keys used for Pixel charge calibration by vectors.

parent 41fbd95c
Pipeline #4607824 passed with stage
in 0 seconds
......@@ -63,7 +63,7 @@ StatusCode PixelChargeCalibCondAlg::execute(const EventContext& ctx) const {
const PixelModuleData *configData = *configDataHandle;
// Construct the output Cond Object and fill it in
std::unique_ptr<PixelChargeCalibCondData> writeCdo(std::make_unique<PixelChargeCalibCondData>());
std::unique_ptr<PixelChargeCalibCondData> writeCdo(std::make_unique<PixelChargeCalibCondData>(m_pixelID->wafer_hash_max()));
const EventIDBase start{EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, 0, 0, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM};
const EventIDBase stop {EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM};
......@@ -195,9 +195,9 @@ StatusCode PixelChargeCalibCondAlg::execute(const EventContext& ctx) const {
writeCdo -> setAnalogThresholdNoise(InDetDD::PixelDiodeType::NORMAL, channelNumber, std::move(analogThresholdNoise));
writeCdo -> setInTimeThreshold(InDetDD::PixelDiodeType::NORMAL, channelNumber, std::move(inTimeThreshold));
writeCdo -> setQ2TotA(InDetDD::PixelDiodeType::NORMAL, channelNumber, totA); // can not move as shared
writeCdo -> setQ2TotE(InDetDD::PixelDiodeType::NORMAL, channelNumber, totE); // can not move as shared
writeCdo -> setQ2TotC(InDetDD::PixelDiodeType::NORMAL, channelNumber, totC); // can not move as shared
writeCdo -> setQ2TotA(InDetDD::PixelDiodeType::NORMAL, channelNumber, std::vector<float> (totA)); // can not move as shared
writeCdo -> setQ2TotE(InDetDD::PixelDiodeType::NORMAL, channelNumber, std::vector<float> (totE)); // can not move as shared
writeCdo -> setQ2TotC(InDetDD::PixelDiodeType::NORMAL, channelNumber, std::vector<float> (totC)); // can not move as shared
writeCdo -> setTotRes1(channelNumber, std::move(totRes1));
writeCdo -> setTotRes2(channelNumber, std::move(totRes2));
......@@ -208,9 +208,9 @@ StatusCode PixelChargeCalibCondAlg::execute(const EventContext& ctx) const {
writeCdo -> setAnalogThresholdNoise(InDetDD::PixelDiodeType::LONG, channelNumber, std::move(analogThresholdNoiseLong));
writeCdo -> setInTimeThreshold(InDetDD::PixelDiodeType::LONG, channelNumber, std::move(inTimeThresholdLong));
writeCdo -> setQ2TotA(InDetDD::PixelDiodeType::LONG, channelNumber, totA); // can not move as shared
writeCdo -> setQ2TotE(InDetDD::PixelDiodeType::LONG, channelNumber, totE); // can not move as shared
writeCdo -> setQ2TotC(InDetDD::PixelDiodeType::LONG, channelNumber, totC); // can not move as shared
writeCdo -> setQ2TotA(InDetDD::PixelDiodeType::LONG, channelNumber, std::move(totA)); // can move now
writeCdo -> setQ2TotE(InDetDD::PixelDiodeType::LONG, channelNumber, std::move(totE)); // can move now
writeCdo -> setQ2TotC(InDetDD::PixelDiodeType::LONG, channelNumber, std::move(totC)); // can move now
// Ganged pixel
writeCdo -> setAnalogThreshold(InDetDD::PixelDiodeType::GANGED, channelNumber, std::move(analogThresholdGanged));
......
......@@ -62,7 +62,7 @@ StatusCode PixelChargeLUTCalibCondAlg::execute(const EventContext& ctx) const {
= {InDetDD::PixelDiodeType::NORMAL, InDetDD::PixelDiodeType::LONG, InDetDD::PixelDiodeType::GANGED, InDetDD::PixelDiodeType::LARGE};
// Construct the output Cond Object and fill it in
std::unique_ptr<PixelChargeCalibCondData> writeCdo(std::make_unique<PixelChargeCalibCondData>());
std::unique_ptr<PixelChargeCalibCondData> writeCdo(std::make_unique<PixelChargeCalibCondData>(m_pixelID->wafer_hash_max()));
const EventIDBase start{EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, 0, 0, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM};
const EventIDBase stop {EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM};
......@@ -325,12 +325,12 @@ StatusCode PixelChargeLUTCalibCondAlg::execute(const EventContext& ctx) const {
writeCdo -> setAnalogThresholdNoise(InDetDD::PixelDiodeType::NORMAL, moduleHash, std::move(analogThresholdNoise));
writeCdo -> setInTimeThreshold(InDetDD::PixelDiodeType::NORMAL, moduleHash, std::move(inTimeThreshold));
writeCdo -> setQ2TotA(InDetDD::PixelDiodeType::NORMAL, moduleHash, totA); // can not move as shared
writeCdo -> setQ2TotE(InDetDD::PixelDiodeType::NORMAL, moduleHash, totE); // can not move as shared
writeCdo -> setQ2TotC(InDetDD::PixelDiodeType::NORMAL, moduleHash, totC); // can not move as shared
writeCdo -> setQ2TotA(InDetDD::PixelDiodeType::NORMAL, moduleHash, std::vector<float> (totA)); // can not move as shared
writeCdo -> setQ2TotE(InDetDD::PixelDiodeType::NORMAL, moduleHash, std::vector<float> (totE)); // can not move as shared
writeCdo -> setQ2TotC(InDetDD::PixelDiodeType::NORMAL, moduleHash, std::vector<float> (totC)); // can not move as shared
writeCdo -> setQ2TotF(InDetDD::PixelDiodeType::NORMAL, moduleHash, totF); // can not move as shared
writeCdo -> setQ2TotG(InDetDD::PixelDiodeType::NORMAL, moduleHash, totG); // can not move as shared
writeCdo -> setQ2TotF(InDetDD::PixelDiodeType::NORMAL, moduleHash, std::vector<float> (totF)); // can not move as shared
writeCdo -> setQ2TotG(InDetDD::PixelDiodeType::NORMAL, moduleHash, std::vector<float> (totG)); // can not move as shared
writeCdo -> setTotRes1(moduleHash, std::move(totRes1));
writeCdo -> setTotRes2(moduleHash, std::move(totRes2));
......@@ -341,12 +341,12 @@ StatusCode PixelChargeLUTCalibCondAlg::execute(const EventContext& ctx) const {
writeCdo -> setAnalogThresholdNoise(InDetDD::PixelDiodeType::LONG, moduleHash, std::move(analogThresholdNoiseLong));
writeCdo -> setInTimeThreshold(InDetDD::PixelDiodeType::LONG, moduleHash, std::move(inTimeThresholdLong));
writeCdo -> setQ2TotA(InDetDD::PixelDiodeType::LONG, moduleHash, totA); // can not move as shared
writeCdo -> setQ2TotE(InDetDD::PixelDiodeType::LONG, moduleHash, totE); // can not move as shared
writeCdo -> setQ2TotC(InDetDD::PixelDiodeType::LONG, moduleHash, totC); // can not move as shared
writeCdo -> setQ2TotA(InDetDD::PixelDiodeType::LONG, moduleHash, std::move(totA) ); // can move now
writeCdo -> setQ2TotE(InDetDD::PixelDiodeType::LONG, moduleHash, std::move(totE) ); // can move now
writeCdo -> setQ2TotC(InDetDD::PixelDiodeType::LONG, moduleHash, std::move(totC) ); // can move now
writeCdo -> setQ2TotF(InDetDD::PixelDiodeType::LONG, moduleHash, totF); // can not move as shared
writeCdo -> setQ2TotG(InDetDD::PixelDiodeType::LONG, moduleHash, totG); // can not move as shared
writeCdo -> setQ2TotF(InDetDD::PixelDiodeType::LONG, moduleHash, std::move(totF)); // can move now
writeCdo -> setQ2TotG(InDetDD::PixelDiodeType::LONG, moduleHash, std::move(totG)); // can move now
// Ganged/large pixel
if (p_design->getReadoutTechnology() == InDetDD::PixelReadoutTechnology::RD53) {
......
......@@ -9,11 +9,14 @@
#include <PixelReadoutDefinitions/PixelReadoutDefinitions.h>
#include <map>
#include <iostream>
#include <limits>
class PixelChargeCalibCondData
{
public:
PixelChargeCalibCondData();
PixelChargeCalibCondData(std::size_t max_module_hash);
static constexpr size_t IBLCalibrationSize{16};
using IBLCalibration = std::array<float, IBLCalibrationSize>;
......@@ -28,19 +31,19 @@ class PixelChargeCalibCondData
};
// Normal pixel
void setAnalogThreshold(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<int> value);
void setAnalogThresholdSigma(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<int> value);
void setAnalogThresholdNoise(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<int> value);
void setInTimeThreshold(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<int> value);
void setAnalogThreshold(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<int> &&value);
void setAnalogThresholdSigma(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<int> &&value);
void setAnalogThresholdNoise(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<int> &&value);
void setInTimeThreshold(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<int> &&value);
void setQ2TotA(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<float> value);
void setQ2TotE(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<float> value);
void setQ2TotC(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<float> value);
void setQ2TotF(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<float> value);
void setQ2TotG(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<float> value);
void setQ2TotA(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<float> &&value);
void setQ2TotE(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<float> &&value);
void setQ2TotC(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<float> &&value);
void setQ2TotF(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<float> &&value);
void setQ2TotG(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<float> &&value);
void setTotRes1(unsigned int moduleHash, std::vector<float> value);
void setTotRes2(unsigned int moduleHash, std::vector<float> value);
void setTotRes1(unsigned int moduleHash, std::vector<float> &&value);
void setTotRes2(unsigned int moduleHash, std::vector<float> &&value);
int getAnalogThreshold(InDetDD::PixelDiodeType type, unsigned int moduleHash, unsigned int FE) const;
int getAnalogThresholdSigma(InDetDD::PixelDiodeType type, unsigned int moduleHash, unsigned int FE) const;
......@@ -69,10 +72,29 @@ class PixelChargeCalibCondData
void clear();
private:
using chipThreshold = std::map<unsigned int, std::vector<int>>;
using chipCharge = std::map<unsigned int, std::vector<float>>;
using chipThresholdMap = std::map<InDetDD::PixelDiodeType, chipThreshold>;
using chipChargeMap = std::map<InDetDD::PixelDiodeType, chipCharge>;
std::size_t m_maxModuleHash = 0;
constexpr static std::size_t s_NPixelDiods = 4;
static unsigned short diodIndex(InDetDD::PixelDiodeType type) { return static_cast<unsigned int>(type); }
template <typename T>
static void resize(std::size_t idx, std::size_t max_size, T &container) { if (idx >= container.size()) { container.resize(max_size); } }
template <typename T, typename T_Value>
static void setValue(std::size_t max_size, T &container, unsigned int moduleHash, T_Value &&value) {
resize( moduleHash,max_size, container);
container.at(moduleHash) = std::move(value);
}
template <typename T, typename T_Value>
static void setValue(std::size_t max_size, T &container, InDetDD::PixelDiodeType type, unsigned int moduleHash, T_Value &&value) {
resize( moduleHash,max_size, container.at(diodIndex(type)));
container.at(diodIndex(type)).at(moduleHash) = std::move(value);
}
using chipThreshold = std::vector<std::vector<int>>;
using chipCharge = std::vector<std::vector<float>>;
using chipThresholdMap = std::array<chipThreshold, s_NPixelDiods>;
using chipChargeMap = std::array<chipCharge, s_NPixelDiods>;
chipThresholdMap m_analogThreshold;
chipThresholdMap m_analogThresholdSigma;
......
......@@ -5,86 +5,82 @@
#include "PixelConditionsData/PixelChargeCalibCondData.h"
#include <cfloat>
#include <cfloat>
PixelChargeCalibCondData::PixelChargeCalibCondData()
{
const std::array<InDetDD::PixelDiodeType, 4> types
= {InDetDD::PixelDiodeType::NORMAL, InDetDD::PixelDiodeType::LONG, InDetDD::PixelDiodeType::GANGED, InDetDD::PixelDiodeType::LARGE};
for (InDetDD::PixelDiodeType type : types) {
m_analogThreshold.emplace(type, chipThreshold());
m_analogThresholdSigma.emplace(type, chipThreshold());
m_analogThresholdNoise.emplace(type, chipThreshold());
m_inTimeThreshold.emplace(type, chipThreshold());
m_totA.emplace(type, chipCharge());
m_totE.emplace(type, chipCharge());
m_totC.emplace(type, chipCharge());
m_totF.emplace(type, chipCharge());
m_totG.emplace(type, chipCharge());
}
static_assert(static_cast<std::size_t>(InDetDD::PixelDiodeType::NORMAL) < s_NPixelDiods);
static_assert(static_cast<std::size_t>(InDetDD::PixelDiodeType::LONG) < s_NPixelDiods);
static_assert(static_cast<std::size_t>(InDetDD::PixelDiodeType::GANGED) < s_NPixelDiods);
static_assert(static_cast<std::size_t>(InDetDD::PixelDiodeType::LARGE) < s_NPixelDiods);
}
PixelChargeCalibCondData::PixelChargeCalibCondData(std::size_t max_module_hash) : m_maxModuleHash(max_module_hash)
{
static_assert(static_cast<std::size_t>(InDetDD::PixelDiodeType::NORMAL) < s_NPixelDiods);
static_assert(static_cast<std::size_t>(InDetDD::PixelDiodeType::LONG) < s_NPixelDiods);
static_assert(static_cast<std::size_t>(InDetDD::PixelDiodeType::GANGED) < s_NPixelDiods);
static_assert(static_cast<std::size_t>(InDetDD::PixelDiodeType::LARGE) < s_NPixelDiods);
}
void PixelChargeCalibCondData::setAnalogThreshold(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<int> value)
void PixelChargeCalibCondData::setAnalogThreshold(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<int> &&value)
{
m_analogThreshold.at(type)[moduleHash] = std::move(value);
setValue(m_maxModuleHash, m_analogThreshold, type, moduleHash, std::move(value));
}
void PixelChargeCalibCondData::setAnalogThresholdSigma(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<int> value)
void PixelChargeCalibCondData::setAnalogThresholdSigma(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<int> &&value)
{
m_analogThresholdSigma.at(type)[moduleHash] = std::move(value);
setValue(m_maxModuleHash, m_analogThresholdSigma, type, moduleHash, std::move(value));
}
void PixelChargeCalibCondData::setAnalogThresholdNoise(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<int> value)
void PixelChargeCalibCondData::setAnalogThresholdNoise(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<int> &&value)
{
m_analogThresholdNoise.at(type)[moduleHash] = std::move(value);
setValue(m_maxModuleHash, m_analogThresholdNoise, type, moduleHash, std::move(value));
}
void PixelChargeCalibCondData::setInTimeThreshold(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<int> value)
void PixelChargeCalibCondData::setInTimeThreshold(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<int> &&value)
{
m_inTimeThreshold.at(type)[moduleHash] = std::move(value);
setValue(m_maxModuleHash, m_inTimeThreshold,type, moduleHash, std::move(value));
}
void PixelChargeCalibCondData::setQ2TotA(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<float> value)
void PixelChargeCalibCondData::setQ2TotA(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<float> &&value)
{
m_totA.at(type)[moduleHash] = std::move(value);
setValue(m_maxModuleHash, m_totA,type,moduleHash,std::move(value));
}
void PixelChargeCalibCondData::setQ2TotE(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<float> value)
void PixelChargeCalibCondData::setQ2TotE(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<float> &&value)
{
m_totE.at(type)[moduleHash] = std::move(value);
setValue(m_maxModuleHash, m_totE, type, moduleHash, std::move(value));
}
void PixelChargeCalibCondData::setQ2TotC(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<float> value)
void PixelChargeCalibCondData::setQ2TotC(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<float> &&value)
{
m_totC.at(type)[moduleHash] = std::move(value);
setValue(m_maxModuleHash, m_totC,type,moduleHash, std::move(value));
}
void PixelChargeCalibCondData::setQ2TotF(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<float> value)
void PixelChargeCalibCondData::setQ2TotF(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<float> &&value)
{
m_totF.at(type)[moduleHash] = std::move(value);
setValue(m_maxModuleHash, m_totF, type, moduleHash, std::move(value));
}
void PixelChargeCalibCondData::setQ2TotG(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<float> value)
void PixelChargeCalibCondData::setQ2TotG(InDetDD::PixelDiodeType type, unsigned int moduleHash, std::vector<float> &&value)
{
m_totG.at(type)[moduleHash] = std::move(value);
setValue( m_maxModuleHash, m_totG, type, moduleHash, std::move(value) );
}
void PixelChargeCalibCondData::setTotRes1(unsigned int moduleHash, std::vector<float> value) {
m_totRes1[moduleHash] = std::move(value);
void PixelChargeCalibCondData::setTotRes1(unsigned int moduleHash, std::vector<float> &&value) {
setValue(m_maxModuleHash, m_totRes1, moduleHash,std::move(value));
}
void PixelChargeCalibCondData::setTotRes2(unsigned int moduleHash, std::vector<float> value) {
m_totRes2[moduleHash] = std::move(value);
void PixelChargeCalibCondData::setTotRes2(unsigned int moduleHash, std::vector<float> &&value) {
setValue(m_maxModuleHash, m_totRes2,moduleHash, std::move(value));
}
int PixelChargeCalibCondData::getAnalogThreshold(InDetDD::PixelDiodeType type, unsigned int moduleHash, unsigned int FE) const
{
const chipThreshold &typeMap = m_analogThreshold.at(type);
auto it = typeMap.find(moduleHash);
if (it != typeMap.end() && FE < it->second.size()) {
return it->second[FE];
const chipThreshold &typeMap = m_analogThreshold.at(diodIndex(type));
const auto &fe_vec = typeMap.at(moduleHash);
if (FE < fe_vec.size()) {
return fe_vec[FE];
}
std::stringstream error;
......@@ -94,10 +90,10 @@ int PixelChargeCalibCondData::getAnalogThreshold(InDetDD::PixelDiodeType type, u
int PixelChargeCalibCondData::getAnalogThresholdSigma(InDetDD::PixelDiodeType type, unsigned int moduleHash, unsigned int FE) const
{
const chipThreshold &typeMap = m_analogThresholdSigma.at(type);
auto it = typeMap.find(moduleHash);
if (it != typeMap.end() && FE < it->second.size()) {
return it->second[FE];
const chipThreshold &typeMap = m_analogThresholdSigma.at(diodIndex(type));
const auto &fe_vec = typeMap.at(moduleHash);
if (FE < fe_vec.size()) {
return fe_vec.at(FE);
}
std::stringstream error;
......@@ -107,10 +103,10 @@ int PixelChargeCalibCondData::getAnalogThresholdSigma(InDetDD::PixelDiodeType ty
int PixelChargeCalibCondData::getAnalogThresholdNoise(InDetDD::PixelDiodeType type, unsigned int moduleHash, unsigned int FE) const
{
const chipThreshold &typeMap = m_analogThresholdNoise.at(type);
auto it = typeMap.find(moduleHash);
if (it != typeMap.end() && FE < it->second.size()) {
return it->second[FE];
const chipThreshold &typeMap = m_analogThresholdNoise.at(diodIndex(type));
const auto &fe_vec = typeMap.at(moduleHash);
if (FE < fe_vec.size()) {
return fe_vec[FE];
}
std::stringstream error;
......@@ -120,10 +116,10 @@ int PixelChargeCalibCondData::getAnalogThresholdNoise(InDetDD::PixelDiodeType ty
int PixelChargeCalibCondData::getInTimeThreshold(InDetDD::PixelDiodeType type, unsigned int moduleHash, unsigned int FE) const
{
const chipThreshold &typeMap = m_inTimeThreshold.at(type);
auto it = typeMap.find(moduleHash);
if (it != typeMap.end() && FE < it->second.size()) {
return it->second[FE];
const chipThreshold &typeMap = m_inTimeThreshold.at(diodIndex(type));
const auto &fe_vec = typeMap.at(moduleHash);
if (FE < fe_vec.size()) {
return fe_vec[FE];
}
std::stringstream error;
......@@ -133,10 +129,10 @@ int PixelChargeCalibCondData::getInTimeThreshold(InDetDD::PixelDiodeType type, u
float PixelChargeCalibCondData::getQ2TotA(InDetDD::PixelDiodeType type, unsigned int moduleHash, unsigned int FE) const
{
const chipCharge &typeMap = m_totA.at(type);
auto it = typeMap.find(moduleHash);
if (it != typeMap.end() && FE < it->second.size()) {
return it->second[FE];
const chipCharge &typeMap = m_totA.at(diodIndex(type));
const auto &fe_vec = typeMap.at(moduleHash);
if (FE < fe_vec.size()) {
return fe_vec[FE];
}
std::stringstream error;
......@@ -146,10 +142,10 @@ float PixelChargeCalibCondData::getQ2TotA(InDetDD::PixelDiodeType type, unsigned
float PixelChargeCalibCondData::getQ2TotE(InDetDD::PixelDiodeType type, unsigned int moduleHash, unsigned int FE) const
{
const chipCharge &typeMap = m_totE.at(type);
auto it = typeMap.find(moduleHash);
if (it != typeMap.end() && FE < it->second.size()) {
return it->second[FE];
const chipCharge &typeMap = m_totE.at(diodIndex(type));
const auto &fe_vec = typeMap.at(moduleHash);
if (FE < fe_vec.size()) {
return fe_vec[FE];
}
std::stringstream error;
......@@ -159,10 +155,10 @@ float PixelChargeCalibCondData::getQ2TotE(InDetDD::PixelDiodeType type, unsigned
float PixelChargeCalibCondData::getQ2TotC(InDetDD::PixelDiodeType type, unsigned int moduleHash, unsigned int FE) const
{
const chipCharge &typeMap = m_totC.at(type);
auto it = typeMap.find(moduleHash);
if (it != typeMap.end() && FE < it->second.size()) {
return it->second[FE];
const chipCharge &typeMap = m_totC.at(diodIndex(type));
const auto &fe_vec = typeMap.at(moduleHash);
if (FE < fe_vec.size()) {
return fe_vec[FE];
}
std::stringstream error;
......@@ -172,10 +168,10 @@ float PixelChargeCalibCondData::getQ2TotC(InDetDD::PixelDiodeType type, unsigned
float PixelChargeCalibCondData::getQ2TotF(InDetDD::PixelDiodeType type, unsigned int moduleHash, unsigned int FE) const
{
const chipCharge &typeMap = m_totF.at(type);
auto it = typeMap.find(moduleHash);
if (it != typeMap.end() && FE < it->second.size()) {
return it->second[FE];
const chipCharge &typeMap = m_totF.at(diodIndex(type));
const auto &fe_vec = typeMap.at(moduleHash);
if (FE < fe_vec.size()) {
return fe_vec[FE];
}
std::stringstream error;
......@@ -185,10 +181,10 @@ float PixelChargeCalibCondData::getQ2TotF(InDetDD::PixelDiodeType type, unsigned
float PixelChargeCalibCondData::getQ2TotG(InDetDD::PixelDiodeType type, unsigned int moduleHash, unsigned int FE) const
{
const chipCharge &typeMap = m_totG.at(type);
auto it = typeMap.find(moduleHash);
if (it != typeMap.end() && FE < it->second.size()) {
return it->second[FE];
const chipCharge &typeMap = m_totG.at(diodIndex(type));
const auto &fe_vec = typeMap.at(moduleHash);
if (FE < fe_vec.size()) {
return fe_vec[FE];
}
std::stringstream error;
......@@ -199,25 +195,28 @@ float PixelChargeCalibCondData::getQ2TotG(InDetDD::PixelDiodeType type, unsigned
float PixelChargeCalibCondData::getTotRes(unsigned int moduleHash, unsigned int FE, float Q) const
{
float res1{};
auto it = m_totRes1.find(moduleHash);
if (it != m_totRes1.end() && FE < it->second.size()) {
res1 = it->second[FE];
{
const auto &fe_vec = m_totRes1.at(moduleHash);
if (FE < fe_vec.size()) {
res1 = fe_vec[FE];
} else {
std::stringstream error;
error << "PixelChargeCalibCondData::getTotRes(" << moduleHash << ", " << FE << "): res1 array out of bounds";
throw std::range_error(error.str());
}
}
float res2{};
it = m_totRes2.find(moduleHash);
if (it != m_totRes2.end() && FE < it->second.size()) {
res2 = it->second.at(FE);
{
const auto &fe_vec = m_totRes2.at(moduleHash);
if (FE < fe_vec.size()) {
res2 = fe_vec[FE];
} else {
std::stringstream error;
error << "PixelChargeCalibCondData::getTotRes(" << moduleHash << ", " << FE << "): res2 array out of bounds";
throw std::range_error(error.str());
}
}
return res1 + res2 * Q;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment