Auxiliary data structure to store high-voltage versus gain data and interpolate the nominal high-voltage.
More...
#include <JHVInterpolator.hh>
|
| JHVInterpolator (TMultiGraph &object) |
| Constructor. More...
|
|
void | AddPoint (Double_t HV, Double_t gain, Double_t gainError) |
| Add point to diagram. More...
|
|
void | SetPoint (Int_t i, Double_t HV, Double_t gain, Double_t gainError) |
| Set point with index i. More...
|
|
const bool | checkHV (const double HV) const |
| Checks whether high-voltage is within range. More...
|
|
const bool | checkHV (const double HV1, const double HV2) const |
| Checks whether two high-voltage values are different. More...
|
|
const bool | checkGain (const double gain) const |
| Checks if gain is within range. More...
|
|
const bool | areIncreasing (const Int_t i, const Int_t j) const |
| Checks whether the gains of two points are strictly increasing as function of their absolute high-voltage. More...
|
|
const bool | areValid (const Int_t i, const Int_t j) const |
| Checks whether two points are valid for inter-/extrapolation. More...
|
|
bool | interpolateHV (const double gainTarget) |
| Inter-/Extrapolate the high-voltage value corresponding to the target gain value. More...
|
|
double | getHV () const |
| Get interpolated high-voltage. More...
|
|
double | getHVError () const |
| Get error estimate on interpolated high-voltage. More...
|
|
TGraphErrors * | getData () const |
| Get graph with the input data for the interpolation. More...
|
|
TGraphErrors * | getResult () const |
| Get graph with the interpolation result. More...
|
|
Auxiliary data structure to store high-voltage versus gain data and interpolate the nominal high-voltage.
Definition at line 37 of file JHVInterpolator.hh.
◆ JHVInterpolator()
JCALIBRATE::JHVInterpolator::JHVInterpolator |
( |
TMultiGraph & |
object | ) |
|
|
inline |
Constructor.
- Parameters
-
Definition at line 44 of file JHVInterpolator.hh.
47 TGraphErrors* g0 =
new TGraphErrors();
50 g0->SetLineColor (kRed);
51 g0->SetMarkerColor(kRed);
52 g0->SetMarkerStyle(kFullDotSmall);
57 TGraphErrors*
g1 =
new TGraphErrors();
60 g1->SetMarkerStyle(kFullDotSmall);
Double_t g1(const Double_t x)
Function.
static const char * HVINTERPOLATOR_RESULT
static const char * HVINTERPOLATOR_DATA
TMultiGraph * data
HV-versus-gain data.
◆ AddPoint()
void JCALIBRATE::JHVInterpolator::AddPoint |
( |
Double_t |
HV, |
|
|
Double_t |
gain, |
|
|
Double_t |
gainError |
|
) |
| |
|
inline |
Add point to diagram.
- Parameters
-
HV | high-voltage [V] |
gain | gain value |
gainError | error on gain value |
Definition at line 74 of file JHVInterpolator.hh.
78 const Int_t N =
g1->GetN();
80 g1->SetPoint (N, fabs(HV), gain);
81 g1->SetPointError(N, 0.0, gainError);
TGraphErrors * getData() const
Get graph with the input data for the interpolation.
◆ SetPoint()
void JCALIBRATE::JHVInterpolator::SetPoint |
( |
Int_t |
i, |
|
|
Double_t |
HV, |
|
|
Double_t |
gain, |
|
|
Double_t |
gainError |
|
) |
| |
|
inline |
Set point with index i.
- Parameters
-
i | index of point |
HV | high-voltage [V] |
gain | gain value |
gainError | error on gain value |
Definition at line 93 of file JHVInterpolator.hh.
97 g1->SetPoint (i, fabs(HV), gain);
98 g1->SetPointError(i, 0.0, gainError);
◆ checkHV() [1/2]
const bool JCALIBRATE::JHVInterpolator::checkHV |
( |
const double |
HV | ) |
const |
|
inline |
Checks whether high-voltage is within range.
- Parameters
-
- Returns
- true if high-voltage is within range; else false
Definition at line 108 of file JHVInterpolator.hh.
static JRange< double > hvRange
Allowed high-voltage range [V].
◆ checkHV() [2/2]
const bool JCALIBRATE::JHVInterpolator::checkHV |
( |
const double |
HV1, |
|
|
const double |
HV2 |
|
) |
| const |
|
inline |
Checks whether two high-voltage values are different.
- Parameters
-
HV1 | first high-voltage [V] |
HV2 | second high-voltage [V] |
- Returns
- true if absolute difference is greater than minimal required difference; else false
Definition at line 122 of file JHVInterpolator.hh.
124 return (fabs(HV1 - HV2) >
dHVmin);
static double dHVmin
Minimal high-voltage difference between two points [V].
◆ checkGain()
const bool JCALIBRATE::JHVInterpolator::checkGain |
( |
const double |
gain | ) |
const |
|
inline |
Checks if gain is within range.
- Parameters
-
- Returns
- true if gain within allowed range; else false
Definition at line 134 of file JHVInterpolator.hh.
static JRange< double > gainRange
Allowed gain range.
◆ areIncreasing()
const bool JCALIBRATE::JHVInterpolator::areIncreasing |
( |
const Int_t |
i, |
|
|
const Int_t |
j |
|
) |
| const |
|
inline |
Checks whether the gains of two points are strictly increasing as function of their absolute high-voltage.
- Parameters
-
i | index of first point |
j | index of second point |
- Returns
- true if gains of given points are strictly increasing
as function of the absolute high-voltage; else false
Definition at line 149 of file JHVInterpolator.hh.
153 if ((i >= 0 && i < g1->GetN()) &&
154 (
j >= 0 && i < g1->GetN())) {
156 return ((
g1->GetPointX(i) >
g1->GetPointX(
j) &&
g1->GetPointY(i) >
g1->GetPointY(
j)) ||
157 (
g1->GetPointX(i) <
g1->GetPointX(
j) &&
g1->GetPointY(i) <
g1->GetPointY(
j)));
◆ areValid()
const bool JCALIBRATE::JHVInterpolator::areValid |
( |
const Int_t |
i, |
|
|
const Int_t |
j |
|
) |
| const |
|
inline |
Checks whether two points are valid for inter-/extrapolation.
- Parameters
-
i | index of first point |
j | index of second point |
- Returns
- true if valid for inter-/extrapolation; else false
Definition at line 173 of file JHVInterpolator.hh.
177 if ((i >= 0 && i < g1->GetN()) &&
178 (
j >= 0 && j < g1->GetN())) {
180 const double HV_i = -fabs(
g1->GetPointX(i));
181 const double HV_j = -fabs(
g1->GetPointX(
j));
182 const double gain_i =
g1->GetPointY(i);
183 const double gain_j =
g1->GetPointY(
j);
const bool checkGain(const double gain) const
Checks if gain is within range.
const bool areIncreasing(const Int_t i, const Int_t j) const
Checks whether the gains of two points are strictly increasing as function of their absolute high-vol...
const bool checkHV(const double HV) const
Checks whether high-voltage is within range.
◆ interpolateHV()
bool JCALIBRATE::JHVInterpolator::interpolateHV |
( |
const double |
gainTarget | ) |
|
|
inline |
Inter-/Extrapolate the high-voltage value corresponding to the target gain value.
- Parameters
-
gainTarget | target gain value for inter-/extrapolation |
- Returns
- true if inter-/extrapolation successful; else false
Definition at line 201 of file JHVInterpolator.hh.
214 for (Int_t k = 2; k <
g1->GetN(); ++k) {
216 const double dGain_i = fabs(
g1->GetPointY(i) - gainTarget);
217 const double dGain_j = fabs(
g1->GetPointY(
j) - gainTarget);
218 const double dGain_k = fabs(
g1->GetPointY(k) - gainTarget);
220 if (dGain_k < dGain_j) {
233 const double logHV0 = log(fabs(
g1->GetPointX(i)));
234 const double logHV1 = log(fabs(
g1->GetPointX(
j)));
236 const double logG0 = log(
g1->GetPointY(i));
237 const double logG1 = log(
g1->GetPointY(
j));
238 const double elogG0 =
g1->GetErrorY(i) /
g1->GetPointY(i);
239 const double elogG1 =
g1->GetErrorY(
j) /
g1->GetPointY(
j);
241 const double dlogG0 = log(gainTarget) - logG0;
242 const double dlogG1 = log(gainTarget) - logG1;
244 const double slope = (logG1 - logG0) / (logHV1 - logHV0);
246 const double HVnom = exp(dlogG0 / slope + logHV0);
247 const double eHVnom = HVnom * sqrt(dlogG1 * dlogG1 * elogG0 * elogG0 +
248 dlogG0 * dlogG0 * elogG1 * elogG1) / fabs(slope * (logG1 - logG0));
250 const double distance = fabs((log(HVnom) - logHV0) / (logHV0 - logHV1));
251 static const double maxDist = 2.0;
257 g0->SetPoint (0, HVnom, gainTarget);
258 g0->SetPointError(0, eHVnom, 0.0);
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
const bool areValid(const Int_t i, const Int_t j) const
Checks whether two points are valid for inter-/extrapolation.
TGraphErrors * getResult() const
Get graph with the interpolation result.
◆ getHV()
double JCALIBRATE::JHVInterpolator::getHV |
( |
| ) |
const |
|
inline |
Get interpolated high-voltage.
- Returns
- inter-/extrapolated high-voltage
corresponding to target gain value [V]
Definition at line 274 of file JHVInterpolator.hh.
278 if (g0->GetN() > 0) {
280 return g0->GetPointX(0);
284 THROW(JNoValue,
"JHVInterpolator::getHV(): Missing HV inter-/extrapolation point. Please call JHVInterpolator::interpolateHV() first.");
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
◆ getHVError()
double JCALIBRATE::JHVInterpolator::getHVError |
( |
| ) |
const |
|
inline |
Get error estimate on interpolated high-voltage.
- Returns
- error on inter-/extrapolated high-voltage
corresponding to the target gain value [V]
Definition at line 295 of file JHVInterpolator.hh.
299 if (g0->GetN() > 0) {
301 return g0->GetErrorX(0);
305 THROW(JNoValue,
"JHVInterpolator::getHVError(): Missing HV inter-/extrpolation point. Please call JHVInterpolator::interpolateHV() first.");
◆ getData()
TGraphErrors* JCALIBRATE::JHVInterpolator::getData |
( |
| ) |
const |
|
inline |
Get graph with the input data for the interpolation.
- Returns
- pointer to graph with input data
Definition at line 315 of file JHVInterpolator.hh.
317 TList* list =
data->GetListOfGraphs();
323 }
else if (list == NULL) {
325 THROW(JNullPointerException,
"JHVInterpolator()::getData(): Emtpy list of graphs.");
◆ getResult()
TGraphErrors* JCALIBRATE::JHVInterpolator::getResult |
( |
| ) |
const |
|
inline |
Get graph with the interpolation result.
- Returns
- pointer to graph with the interpolation result
Definition at line 339 of file JHVInterpolator.hh.
341 TList* list =
data->GetListOfGraphs();
347 }
else if (list == NULL) {
349 THROW(JNullPointerException,
"JHVInterpolator::getResult(): Empty list of graphs.");
◆ setMinHVDistance()
static void JCALIBRATE::JHVInterpolator::setMinHVDistance |
( |
const double |
minDist | ) |
|
|
inlinestatic |
Set minimal separation distance for high-voltage.
- Parameters
-
minDist | minimal separation distance for high-voltage |
Definition at line 363 of file JHVInterpolator.hh.
◆ setHVRange()
static void JCALIBRATE::JHVInterpolator::setHVRange |
( |
const JRange< double > |
range | ) |
|
|
inlinestatic |
Set valid gain range.
- Parameters
-
range | valid high-voltage range [V] |
Definition at line 374 of file JHVInterpolator.hh.
◆ setGainRange()
static void JCALIBRATE::JHVInterpolator::setGainRange |
( |
const JRange< double > |
range | ) |
|
|
inlinestatic |
◆ data
TMultiGraph* JCALIBRATE::JHVInterpolator::data |
|
private |
◆ dHVmin
double JCALIBRATE::JHVInterpolator::dHVmin = 2 * 3.14 |
|
staticprivate |
Minimal high-voltage difference between two points [V].
Default values.
Definition at line 395 of file JHVInterpolator.hh.
◆ hvRange
JRange< double > JCALIBRATE::JHVInterpolator::hvRange = JRange<double>(-1500, -80) |
|
staticprivate |
◆ gainRange
JRange< double > JCALIBRATE::JHVInterpolator::gainRange |
|
staticprivate |
Initial value:
static const double FITTOT_GAIN_MAX
Default maximal gain.
static const double FITTOT_GAIN_MIN
Default minimal gain.
Allowed gain range.
Definition at line 397 of file JHVInterpolator.hh.
The documentation for this struct was generated from the following file: