ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetConditions
PixelConditionsData
PixelConditionsData
ChargeCalibrationBundle.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
11
12
#ifndef ChargeCalibrationBundle_h
13
#define ChargeCalibrationBundle_h
14
15
#include "
PixelReadoutDefinitions/PixelReadoutDefinitions.h
"
//diode types
16
#include "
PixelConditionsData/ChargeCalibParameters.h
"
//Thresholds, LegacyFitParameters etc
17
#include "
PixelConditionsData/PixelChargeCalibCondData.h
"
18
#include "
CxxUtils/trapping_fp.h
"
19
#include <vector>
20
#include <map>
//also has std::pair
21
22
namespace
PixelChargeCalib
{
24
struct
ChargeCalibrationBundle
{
25
bool
isValid
=
true
;
26
bool
useLUT
=
false
;
27
bool
useTXT
=
false
;
28
29
std::vector<PixelChargeCalib::Thresholds>
threshold
;
30
std::vector<PixelChargeCalib::Thresholds>
thresholdLong
;
31
std::vector<PixelChargeCalib::Thresholds>
thresholdGanged
;
32
std::vector<PixelChargeCalib::LegacyFitParameters>
params
;
33
std::vector<PixelChargeCalib::LegacyFitParameters>
paramsGanged
;
34
std::vector<PixelChargeCalib::LinearFitParameters>
lin
;
35
std::vector<PixelChargeCalib::LinearFitParameters>
linGanged
;
36
std::vector<PixelChargeCalib::Resolutions>
totRes
;
37
PixelChargeCalibCondData::IBLModule
tot2Charges
;
38
PixelChargeCalibCondData::CalibrationStrategy
calibrationType
{
PixelChargeCalibCondData::CalibrationStrategy::RUN1PIX
};
39
//
41
ChargeCalibrationBundle
(
size_t
n,
bool
lut =
false
,
bool
txt =
false
):
useLUT
(lut),
useTXT
(txt){
42
threshold
.reserve(n);
43
thresholdLong
.reserve(n);
44
thresholdGanged
.reserve(n);
45
params
.reserve(n);
46
paramsGanged
.reserve(n);
47
lin
.reserve(n);
48
linGanged
.reserve(n);
49
totRes
.reserve(n);
50
}
51
//return the index, within range (start, end), where the charge threshold is exceeded
52
//or -1 if it is not
53
int
54
idxAtChargeLimit
(
float
chargeLimit,
InDetDD::PixelDiodeType
type
,
int
start,
int
end)
const
{
55
const
auto
&relevantArray = (
type
==
InDetDD::PixelDiodeType::NORMAL
) ?
params
:
paramsGanged
;
56
int
idx=-1;
57
for
(
int
i = start;i!=end;++i){
58
const
float
tmpcharge = relevantArray.back().Q(i);
59
if
(tmpcharge > chargeLimit){
60
idx = i;
61
break
;
62
}
63
}
64
return
idx;
65
}
66
67
void
68
insertLinearParams
(
InDetDD::PixelDiodeType
type
,
int
idxLimit){
69
// Tell clang to optimize assuming that FP exceptions can trap.
70
// Otherwise, it can vectorize the division, which can lead to
71
// spurious division-by-zero traps from unused vector lanes.
72
CXXUTILS_TRAPPING_FP
;
73
auto
&targetArray = (
type
==
InDetDD::PixelDiodeType::NORMAL
) ?
lin
:
linGanged
;
74
if
(idxLimit <= 0){
//duplicates original logic
75
targetArray.emplace_back(0.f,0.f);
76
return
;
77
}
78
//not entirely satisfactory, the fit derivatives are not continuous
79
//and a difference of 5 seems a bit arbitrary
80
const
auto
&readArray = (
type
==
InDetDD::PixelDiodeType::NORMAL
) ?
params
:
paramsGanged
;
81
static
constexpr
int
dx = 5;
82
const
float
x1 = idxLimit;
83
const
float
x2 = idxLimit-dx;
84
const
float
y1 = readArray.back().Q(x1);
85
const
float
y2 = readArray.back().Q(x2);
86
targetArray.emplace_back((y1-y2)/dx, (y2*x1-y1*x2)/dx);
87
}
88
};
89
}
90
91
#endif
ChargeCalibParameters.h
Structs for holding charge calibration parameterisation and data.
PixelChargeCalibCondData.h
PixelReadoutDefinitions.h
PixelChargeCalibCondData::IBLModule
std::vector< IBLCalibration > IBLModule
Definition
PixelChargeCalibCondData.h:31
PixelChargeCalibCondData::CalibrationStrategy
CalibrationStrategy
Definition
PixelChargeCalibCondData.h:34
PixelChargeCalibCondData::CalibrationStrategy::RUN1PIX
@ RUN1PIX
Definition
PixelChargeCalibCondData.h:35
InDetDD::PixelDiodeType
PixelDiodeType
Definition
PixelReadoutDefinitions.h:28
InDetDD::PixelDiodeType::NORMAL
@ NORMAL
Definition
PixelReadoutDefinitions.h:30
PixelChargeCalib
Definition
IChargeCalibrationParser.h:30
type
PixelChargeCalib::ChargeCalibrationBundle::linGanged
std::vector< PixelChargeCalib::LinearFitParameters > linGanged
Definition
ChargeCalibrationBundle.h:35
PixelChargeCalib::ChargeCalibrationBundle::thresholdGanged
std::vector< PixelChargeCalib::Thresholds > thresholdGanged
Definition
ChargeCalibrationBundle.h:31
PixelChargeCalib::ChargeCalibrationBundle::threshold
std::vector< PixelChargeCalib::Thresholds > threshold
Definition
ChargeCalibrationBundle.h:29
PixelChargeCalib::ChargeCalibrationBundle::calibrationType
PixelChargeCalibCondData::CalibrationStrategy calibrationType
Definition
ChargeCalibrationBundle.h:38
PixelChargeCalib::ChargeCalibrationBundle::ChargeCalibrationBundle
ChargeCalibrationBundle(size_t n, bool lut=false, bool txt=false)
constructor with reserve for the vectors, n = number of frontends
Definition
ChargeCalibrationBundle.h:41
PixelChargeCalib::ChargeCalibrationBundle::lin
std::vector< PixelChargeCalib::LinearFitParameters > lin
Definition
ChargeCalibrationBundle.h:34
PixelChargeCalib::ChargeCalibrationBundle::isValid
bool isValid
Definition
ChargeCalibrationBundle.h:25
PixelChargeCalib::ChargeCalibrationBundle::useTXT
bool useTXT
Definition
ChargeCalibrationBundle.h:27
PixelChargeCalib::ChargeCalibrationBundle::paramsGanged
std::vector< PixelChargeCalib::LegacyFitParameters > paramsGanged
Definition
ChargeCalibrationBundle.h:33
PixelChargeCalib::ChargeCalibrationBundle::idxAtChargeLimit
int idxAtChargeLimit(float chargeLimit, InDetDD::PixelDiodeType type, int start, int end) const
Definition
ChargeCalibrationBundle.h:54
PixelChargeCalib::ChargeCalibrationBundle::insertLinearParams
void insertLinearParams(InDetDD::PixelDiodeType type, int idxLimit)
Definition
ChargeCalibrationBundle.h:68
PixelChargeCalib::ChargeCalibrationBundle::thresholdLong
std::vector< PixelChargeCalib::Thresholds > thresholdLong
Definition
ChargeCalibrationBundle.h:30
PixelChargeCalib::ChargeCalibrationBundle::totRes
std::vector< PixelChargeCalib::Resolutions > totRes
Definition
ChargeCalibrationBundle.h:36
PixelChargeCalib::ChargeCalibrationBundle::tot2Charges
PixelChargeCalibCondData::IBLModule tot2Charges
Definition
ChargeCalibrationBundle.h:37
PixelChargeCalib::ChargeCalibrationBundle::useLUT
bool useLUT
Definition
ChargeCalibrationBundle.h:26
PixelChargeCalib::ChargeCalibrationBundle::params
std::vector< PixelChargeCalib::LegacyFitParameters > params
Definition
ChargeCalibrationBundle.h:32
trapping_fp.h
Tell the compiler to optimize assuming that FP may trap.
CXXUTILS_TRAPPING_FP
#define CXXUTILS_TRAPPING_FP
Definition
trapping_fp.h:24
Generated on
for ATLAS Offline Software by
1.17.0