1#include "KVCalibrator.h"
23 if (fInputMax < fInputMin)
return;
27 fCalibFunc->GetRange(fXmin, fXmax);
29 Bool_t fMonoIncreasing =
true;
30 Double_t fFuncMax = fCalibFunc->Eval(fXmax);
31 Double_t fFuncMin = fCalibFunc->Eval(fXmin);
32 if (fFuncMin > fFuncMax) {
33 fMonoIncreasing =
false;
34 std::swap(fFuncMin, fFuncMax);
37 if (!in_range(fInputMin, fFuncMin, fFuncMax) || !in_range(fInputMax, fFuncMin, fFuncMax)) {
39 if (!in_range(fInputMin, fFuncMin, fFuncMax)) {
40 if (fInputMin < fFuncMin) {
42 if (fMonoIncreasing) {
46 Range = fXmax - fXmin;
47 fFuncMin = fCalibFunc->Eval(fXmin);
49 while (fInputMin < fFuncMin);
55 Range = fXmax - fXmin;
56 fFuncMin = fCalibFunc->Eval(fXmax);
58 while (fInputMin < fFuncMin);
61 else if (fInputMin > fFuncMax) {
63 if (fMonoIncreasing) {
67 Range = fXmax - fXmin;
68 fFuncMax = fCalibFunc->Eval(fXmax);
70 while (fInputMin > fFuncMax);
76 Range = fXmax - fXmin;
77 fFuncMax = fCalibFunc->Eval(fXmin);
79 while (fInputMin > fFuncMax);
83 if (!in_range(fInputMax, fFuncMin, fFuncMax)) {
84 if (fInputMax < fFuncMin) {
86 if (fMonoIncreasing) {
90 Range = fXmax - fXmin;
91 fFuncMin = fCalibFunc->Eval(fXmin);
93 while (fInputMax < fFuncMin);
99 Range = fXmax - fXmin;
100 fFuncMin = fCalibFunc->Eval(fXmax);
102 while (fInputMax < fFuncMin);
105 else if (fInputMax > fFuncMax) {
107 if (fMonoIncreasing) {
111 Range = fXmax - fXmin;
112 fFuncMax = fCalibFunc->Eval(fXmax);
114 while (fInputMax > fFuncMax);
120 Range = fXmax - fXmin;
121 fFuncMax = fCalibFunc->Eval(fXmin);
123 while (fInputMax > fFuncMax);
128 fCalibFunc->SetRange(fXmin, fXmax);
131 if (fMonoIncreasing) {
132 fXmin = fCalibFunc->GetX(fInputMin);
133 fXmax = fCalibFunc->GetX(fInputMax);
136 fXmin = fCalibFunc->GetX(fInputMax);
137 fXmax = fCalibFunc->GetX(fInputMin);
140 fCalibFunc->SetRange(fXmin, fXmax);
155 cout <<
"_________________________________________________" << endl
157 <<
" Name : " <<
GetName() << endl
158 <<
" Type : " <<
GetType() << endl
160 <<
" Parameters :" << endl;
165 cout <<
" Status : ready" << endl;
167 cout <<
" Status : not ready" << endl;
248 throw (std::invalid_argument(
"missing calibrator options: must give func, min, and max"));
253 throw (std::invalid_argument(
"missing inverse calibrator options: must give out_min and out_max"));
275 for (
int i = 0; i < npts; ++i) {
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
virtual const Char_t * GetType() const
static TPluginHandler * LoadPlugin(const Char_t *base, const Char_t *uri="0")
Base class for all detector calibrations.
void SetUseInverseFunction(Bool_t yes=kTRUE)
Int_t GetNumberParams() const
Double_t fInputMin
required minimum input signal for inverse calibration
virtual void SetOptions(const KVNameValueList &)
virtual Double_t Compute(Double_t x, const KVNameValueList &) const
TGraph * GetGraphOfCalibration(int npts, KVValueRange< double > input_range, const KVNameValueList &par="")
TF1 * fCalibFunc
calibration function
Double_t GetParameter(int i) const
virtual void Print(Option_t *opt="") const
Print a description of the calibration object, including a list of its parameters.
Double_t fInputMax
required maximum input signal for inverse calibration
Bool_t IsUseInverseFunction() const
static KVCalibrator * MakeCalibrator(const Char_t *type)
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
Double_t GetDoubleValue(const Char_t *name) const
Bool_t HasNumericParameter(const Char_t *name) const
Bool_t HasStringParameter(const Char_t *name) const
Bool_t IsValue(const Char_t *name, value_type value) const
const Char_t * GetStringValue(const Char_t *name) const
Range of values specified by minimum, maximum.
ValueType ValueIofN(Int_t i, Int_t n) const
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
const char * GetName() const override
virtual const char * ClassName() const
Longptr_t ExecPlugin(int nargs)