20 const std::out_of_range
22 std::stringstream
error;
23 error <<
"PixelChargeCalibCondData::"<< functionName <<
"("<<
enum2uint(
type,__func__)<<
", " << moduleHash <<
", " << FE <<
"): out of bounds";
24 return std::out_of_range(
error.str());
26 const std::out_of_range
27 generateError(
const char * functionName,
unsigned int moduleHash,
unsigned int FE,
unsigned int val){
28 std::stringstream
error;
29 error <<
"PixelChargeCalibCondData::"<< functionName <<
"(" << moduleHash <<
", " << FE <<
", "<<
val <<
"): out of bounds";
30 return std::out_of_range(
error.str());
32 const std::out_of_range
33 generateError(
const char * functionName,
unsigned int moduleHash,
unsigned int FE){
34 std::stringstream
error;
35 error <<
"PixelChargeCalibCondData::"<< functionName <<
"(" << moduleHash <<
", " << FE <<
"): out of bounds";
36 return std::out_of_range(
error.str());
38 const std::out_of_range
39 generateError(
const char * functionName,
unsigned int moduleHash){
40 std::stringstream
error;
41 error <<
"PixelChargeCalibCondData::"<< functionName <<
"(" << moduleHash <<
"): out of bounds";
42 return std::out_of_range(
error.str());
71 const auto & [barrel_ec, layer] = becLayer;
76 setThresholds(t, moduleHash, std::vector<Thresholds>(numFE, thresholds));
82 setLinearFitParameters(t, moduleHash, std::vector<PixelChargeCalib::LinearFitParameters>(numFE, zeroLinFit));
85 setTotResolutions(moduleHash, std::vector<PixelChargeCalib::Resolutions>(numFE, zeroResolution));
92 if (hashIndexedVector.size()<=moduleHash){
95 hashIndexedVector[moduleHash] = thresholds;
102 const auto &feIndexedVector = hashIndexedVector.at(moduleHash);
103 if (FE < feIndexedVector.size()) {
104 return feIndexedVector[FE];
106 throw generateError(__func__,
type, moduleHash, FE);
113 if (thisVector.size()<=moduleHash){
116 thisVector[moduleHash] = parameters;
124 const auto &v = thisVector.at(moduleHash);
128 throw generateError(__func__,
type, moduleHash, FE);
135 if ( thisVector.size()<=moduleHash){
138 thisVector[moduleHash] = parameters;
146 const auto &typeMap =
m_linFit.at(idx);
148 const auto &linFit = typeMap.at(moduleHash);
149 if (FE < linFit.size()) {
150 return typeMap.at(moduleHash).at(FE);
152 throw generateError(__func__,
type, moduleHash, FE);
168 throw generateError(__func__, moduleHash, FE);
180 float tot = legacy.
ToT(Q);
186 if (
float tot1 = lin.
ToT(Q); tot1 != 0.f)
return tot1;
195 unsigned int moduleHash,
208 const auto analogueThreshold = thresholds.value;
214 if (
float charge1 = lin.
Q(ToT); charge1 != 0.f)
return charge1;
234 const auto analogueThreshold = thresholds.value;
240 if (
float charge1 = lin.
Q(ToT); charge1 != 0.f)
return charge1;
248 throw generateError(__func__, moduleHash,
static_cast<int>(strategy));
256 throw generateError(__func__, moduleHash);
268 throw generateError(__func__, moduleHash);
277 return it->second.at(FE);
279 throw generateError(__func__, moduleHash,FE);
285 throw generateError(__func__, moduleHash,FE, ToT);
288 return charges[ToT - 1];
294 float minDiff = FLT_MAX;
298 if (
diff < minDiff) {
double charge(const T &p)
Struct for holding vectors of charge calibration constants, with utility methods.
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< std::vector< unsigned int >, bool > res
constexpr std::size_t enum2uint(T n, std::string_view callingFunctionName="")
Convert an enum class to size_t for use as an array index.
Store pixel constant parameters in PixelModuleData.
void diff(const Jet &rJet1, const Jet &rJet2, std::map< std::string, double > varDiff)
Difference between jets - Non-Class function required by trigger.
void setLinearFitParameters(InDetDD::PixelDiodeType type, unsigned int moduleHash, const std::vector< PixelChargeCalib::LinearFitParameters > ¶meters)
void setLegacyFitParameters(InDetDD::PixelDiodeType type, unsigned int moduleHash, const std::vector< PixelChargeCalib::LegacyFitParameters > ¶meters)
void setTot2Charges(unsigned int moduleHash, IBLModule charges)
PixelChargeCalib::LegacyFitParameters getLegacyFitParameters(InDetDD::PixelDiodeType type, unsigned int moduleHash, unsigned int FE) const
CalibrationStrategy getCalibrationStrategy(unsigned int moduleHash) const
PixelChargeCalibCondData()=default
std::map< int, CalibrationStrategy > m_calibrationStrategy
std::vector< IBLCalibration > IBLModule
float getCharge(InDetDD::PixelDiodeType type, unsigned int moduleHash, unsigned int FE, float ToT) const
std::array< std::vector< std::vector< PixelChargeCalib::LinearFitParameters > >, s_NPixelDiodes > m_linFit
void setAllFromConfigData(unsigned int moduleHash, const PixelModuleData *configData, const std::pair< int, int > &becLayer, unsigned int numFE)
void setThresholds(InDetDD::PixelDiodeType type, unsigned int moduleHash, const std::vector< PixelChargeCalib::Thresholds > &thresholds)
const IBLCalibration & getTot2Charges(unsigned int moduleHash, unsigned int FE) const
std::vector< std::vector< PixelChargeCalib::Resolutions > > m_totRes
void setCalibrationStrategy(unsigned int moduleHash, CalibrationStrategy strategy)
void setAllFromBundle(unsigned int moduleHash, const PixelChargeCalib::ChargeCalibrationBundle &b)
std::size_t m_sizeOfHashVector
void setTotResolutions(unsigned int moduleHash, const std::vector< PixelChargeCalib::Resolutions > &value)
static constexpr size_t IBLCalibrationSize
std::array< std::vector< std::vector< PixelChargeCalib::Thresholds > >, s_NPixelDiodes > m_thresholds
std::map< int, IBLModule > m_tot2Charges
PixelChargeCalib::Thresholds getThresholds(InDetDD::PixelDiodeType type, unsigned int moduleHash, unsigned int FE) const
float getToT(InDetDD::PixelDiodeType type, unsigned int moduleHash, unsigned int FE, float Q) const
float getToTLUTFEI4(unsigned int moduleHash, unsigned int FE, float Q) const
static constexpr std::size_t s_NPixelDiodes
float getTotRes(unsigned int moduleHash, unsigned int FE, float Q) const
PixelChargeCalib::LinearFitParameters getLinearFitParameters(InDetDD::PixelDiodeType type, unsigned int moduleHash, unsigned int FE) const
std::array< float, IBLCalibrationSize > IBLCalibration
float getChargeLUTFEI4(unsigned int moduleHash, unsigned int FE, unsigned int ToT) const
std::array< std::vector< std::vector< PixelChargeCalib::LegacyFitParameters > >, s_NPixelDiodes > m_legacyFit
int getDefaultInTimeThreshold(int barrel_ec, int layer) const
int getDefaultAnalogThreshold(int barrel_ec, int layer) const
float getDefaultQ2TotA() const
int getDefaultAnalogThresholdNoise(int barrel_ec, int layer) const
float getDefaultQ2TotC() const
float getDefaultQ2TotE() const
int getDefaultAnalogThresholdSigma(int barrel_ec, int layer) 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.
bundles of parameters used together in the PixelChargeCalibCondAlg
static constexpr float defaultOverflow
float ToT(float Q) const
Return Time-over-threshold given charge Q.