Real experiment using PDF of signal and background.
More...
#include <JRealExperiment.hh>
|
| | JRealExperiment () |
| | Default constructor.
|
| |
| template<class H_t > |
| | JRealExperiment (const H_t &hd, const H_t &hs, const H_t &hb) |
| | Constructor.
|
| |
| void | add (const TObject *pd, const TObject *ps, const TObject *pb) |
| | Add objects with data and PDFs of signal and background.
|
| |
| void | add (const TH1 &hd, const TH1 &hs, const TH1 &hb) |
| | Add histograms with data and PDFs of signal and background.
|
| |
| void | add (const TH2 &hd, const TH2 &hs, const TH2 &hb) |
| | Add histograms with data and PDFs of signal and background.
|
| |
| void | add (const TH3 &hd, const TH3 &hs, const TH3 &hb) |
| | Add histograms with data and PDFs of signal and background.
|
| |
| void | add (const size_t n, const double s, const double b) |
| | Add data, signal and background.
|
| |
| void | put (const double s, const double b) |
| | Put signal and background to list of pre-computed N/S values.
|
| |
| void | put (const size_t n, const double s, const double b) |
| | Put signal and background to list of pre-computed N/S values.
|
| |
| double | getLikelihood (const double p) const |
| | Get likelihood for given signal strength.
|
| |
| double | getDerivative (const double p) const |
| | Get derivative of likelihood for given signal strength.
|
| |
| fit_type | operator() () const |
| | Fit signal strength.
|
| |
| double | getSignal () const |
| | Get total signal strength.
|
| |
| void | setSignal (const double wS) |
| | Set signal strength.
|
| |
| void | addSignal (const double wS) |
| | Add signal strength.
|
| |
|
| static bool | check (const double s, const double b) |
| | Check validity of signal and background.
|
| |
| static bool | check (const TAxis *ha, const TAxis *hb) |
| | Check histogram bins.
|
| |
| static bool | check (const TH1 &ha, const TH1 &hb) |
| | Check histogram bins.
|
| |
| static bool | check (const TH2 &ha, const TH2 &hb) |
| | Check histogram bins.
|
| |
| static bool | check (const TH3 &ha, const TH3 &hb) |
| | Check histogram bins.
|
| |
|
| static constexpr double | EPSILON = 1.0e-3 |
| | precision determination of signal strength
|
| |
|
| template<class H_t > |
| bool | add (const TObject *pd, const TObject *ps, const TObject *pb) |
| | Add objects with data and PDFs of signal and background.
|
| |
|
| double | ws = 0.0 |
| | total signal strength
|
| |
Real experiment using PDF of signal and background.
Definition at line 29 of file JRealExperiment.hh.
◆ JRealExperiment() [1/2]
| JASTRONOMY::JRealExperiment::JRealExperiment |
( |
| ) |
|
|
inline |
◆ JRealExperiment() [2/2]
template<class H_t >
| JASTRONOMY::JRealExperiment::JRealExperiment |
( |
const H_t & | hd, |
|
|
const H_t & | hs, |
|
|
const H_t & | hb ) |
|
inline |
Constructor.
- Parameters
-
| hd | histogram with data |
| hs | histogram with PDF of signal |
| hb | histogram with PDF of background |
Definition at line 48 of file JRealExperiment.hh.
51 {
53 }
void add(const TObject *pd, const TObject *ps, const TObject *pb)
Add objects with data and PDFs of signal and background.
◆ add() [1/6]
Add objects with data and PDFs of signal and background.
- Parameters
-
| pd | pointer to object with data |
| ps | pointer to object with PDF of signal |
| pb | pointer to object with PDF of background |
Definition at line 63 of file JRealExperiment.hh.
66 {
67 if (
add<TH3>(pd, ps, pb)) {
return; }
68 if (
add<TH2>(pd, ps, pb)) {
return; }
69 if (
add<TH1>(pd, ps, pb)) {
return; }
70 }
◆ add() [2/6]
| void JASTRONOMY::JRealExperiment::add |
( |
const TH1 & | hd, |
|
|
const TH1 & | hs, |
|
|
const TH1 & | hb ) |
|
inline |
Add histograms with data and PDFs of signal and background.
- Parameters
-
| hd | histogram with data |
| hs | histogram with PDF of signal |
| hb | histogram with PDF of background |
Definition at line 80 of file JRealExperiment.hh.
83 {
84 for (Int_t ix = 1; ix <= hs.GetXaxis()->GetNbins(); ++ix) {
85 add(hd.GetBinContent(ix),
86 hs.GetBinContent(ix),
87 hb.GetBinContent(ix));
88 }
89 }
◆ add() [3/6]
| void JASTRONOMY::JRealExperiment::add |
( |
const TH2 & | hd, |
|
|
const TH2 & | hs, |
|
|
const TH2 & | hb ) |
|
inline |
Add histograms with data and PDFs of signal and background.
- Parameters
-
| hd | histogram with data |
| hs | histogram with PDF of signal |
| hb | histogram with PDF of background |
Definition at line 99 of file JRealExperiment.hh.
102 {
103 for (Int_t ix = 1; ix <= hs.GetXaxis()->GetNbins(); ++ix) {
104 for (Int_t iy = 1; iy <= hs.GetYaxis()->GetNbins(); ++iy) {
105 add(hd.GetBinContent(ix, iy),
106 hs.GetBinContent(ix, iy),
107 hb.GetBinContent(ix, iy));
108 }
109 }
110 }
◆ add() [4/6]
| void JASTRONOMY::JRealExperiment::add |
( |
const TH3 & | hd, |
|
|
const TH3 & | hs, |
|
|
const TH3 & | hb ) |
|
inline |
Add histograms with data and PDFs of signal and background.
- Parameters
-
| hd | histogram with data |
| hs | histogram with PDF of signal |
| hb | histogram with PDF of background |
Definition at line 120 of file JRealExperiment.hh.
123 {
124 for (Int_t ix = 1; ix <= hs.GetXaxis()->GetNbins(); ++ix) {
125 for (Int_t iy = 1; iy <= hs.GetYaxis()->GetNbins(); ++iy) {
126 for (Int_t iz = 1; iz <= hs.GetZaxis()->GetNbins(); ++iz) {
127 add(hd.GetBinContent(ix, iy, iz),
128 hs.GetBinContent(ix, iy, iz),
129 hb.GetBinContent(ix, iy, iz));
130 }
131 }
132 }
133 }
◆ add() [5/6]
| void JASTRONOMY::JRealExperiment::add |
( |
const size_t | n, |
|
|
const double | s, |
|
|
const double | b ) |
|
inline |
Add data, signal and background.
- Parameters
-
| n | data |
| s | signal |
| b | background |
Definition at line 143 of file JRealExperiment.hh.
146 {
149 }
150 }
void put(const double s, const double b)
Put signal and background to list of pre-computed N/S values.
static bool check(const double s, const double b)
Check validity of signal and background.
◆ add() [6/6]
Add objects with data and PDFs of signal and background.
- Parameters
-
| pd | pointer to object with data |
| ps | pointer to object with PDF of signal |
| pb | pointer to object with PDF of background |
- Returns
- true if added; else false
Definition at line 162 of file JRealExperiment.hh.
165 {
166 if (dynamic_cast<const H_t*>(pd) != NULL &&
167 dynamic_cast<const H_t*>(ps) != NULL &&
168 dynamic_cast<const H_t*>(pb) != NULL) {
169
170 const H_t& hd = dynamic_cast<const H_t&>(*pd);
171 const H_t& hs = dynamic_cast<const H_t&>(*ps);
172 const H_t& hb = dynamic_cast<const H_t&>(*pb);
173
175
177
178 return true;
179 }
180 }
181
182 return false;
183 }
◆ check() [1/5]
| static bool JASTRONOMY::JExperiment::check |
( |
const double | s, |
|
|
const double | b ) |
|
inlinestaticinherited |
Check validity of signal and background.
- Parameters
-
- Returns
- true if signal and backgroud are valid; else false
Definition at line 34 of file JExperiment.hh.
35 {
36 return (s > 0.0 && b > 0.0);
37 }
◆ check() [2/5]
| static bool JASTRONOMY::JExperiment::check |
( |
const TAxis * | ha, |
|
|
const TAxis * | hb ) |
|
inlinestaticinherited |
Check histogram bins.
- Parameters
-
| ha | histogram axis |
| hb | histogram axis |
- Returns
- true if same binning; else false
Definition at line 47 of file JExperiment.hh.
48 {
49 return (ha->GetNbins() == hb->GetNbins() &&
50 ha->GetXmin() == hb->GetXmin() &&
51 ha->GetXmax() == hb->GetXmax());
52 }
◆ check() [3/5]
| static bool JASTRONOMY::JExperiment::check |
( |
const TH1 & | ha, |
|
|
const TH1 & | hb ) |
|
inlinestaticinherited |
Check histogram bins.
- Parameters
-
- Returns
- true if same binning; else false
Definition at line 61 of file JExperiment.hh.
62 {
63 return check(ha.GetXaxis(), hb.GetXaxis());
64 }
◆ check() [4/5]
| static bool JASTRONOMY::JExperiment::check |
( |
const TH2 & | ha, |
|
|
const TH2 & | hb ) |
|
inlinestaticinherited |
Check histogram bins.
- Parameters
-
- Returns
- true if same binning; else false
Definition at line 74 of file JExperiment.hh.
75 {
76 return (
check(ha.GetXaxis(), hb.GetXaxis()) &&
77 check(ha.GetYaxis(), hb.GetYaxis()));
78 }
◆ check() [5/5]
| static bool JASTRONOMY::JExperiment::check |
( |
const TH3 & | ha, |
|
|
const TH3 & | hb ) |
|
inlinestaticinherited |
Check histogram bins.
- Parameters
-
- Returns
- true if same binning; else false
Definition at line 88 of file JExperiment.hh.
89 {
90 return (
check(ha.GetXaxis(), hb.GetXaxis()) &&
91 check(ha.GetYaxis(), hb.GetYaxis()) &&
92 check(ha.GetZaxis(), hb.GetZaxis()));
93 }
◆ put() [1/2]
| void JASTRONOMY::JAspera::put |
( |
const double | s, |
|
|
const double | b ) |
|
inlineinherited |
Put signal and background to list of pre-computed N/S values.
- Parameters
-
Definition at line 44 of file JAspera.hh.
46 {
47 push_back(b/s);
48
50 }
double ws
total signal strength
◆ put() [2/2]
| void JASTRONOMY::JAspera::put |
( |
const size_t | n, |
|
|
const double | s, |
|
|
const double | b ) |
|
inlineinherited |
Put signal and background to list of pre-computed N/S values.
- Parameters
-
| n | data |
| s | signal |
| b | background |
Definition at line 60 of file JAspera.hh.
63 {
64 for (
size_t i = 0; i !=
n; ++i) {
65 push_back(b/s);
66 }
67
69 }
◆ getLikelihood()
| double JASTRONOMY::JAspera::getLikelihood |
( |
const double | p | ) |
const |
|
inlineinherited |
Get likelihood for given signal strength.
- Parameters
-
- Returns
- likelihood
Definition at line 78 of file JAspera.hh.
79 {
81
84 }
85
86 if (y > 0.0)
88 else
89 return 0.0;
90 }
◆ getDerivative()
| double JASTRONOMY::JAspera::getDerivative |
( |
const double | p | ) |
const |
|
inlineinherited |
Get derivative of likelihood for given signal strength.
- Parameters
-
- Returns
- derivative of likelihood
Definition at line 99 of file JAspera.hh.
100 {
102
105 }
106
108 }
◆ operator()()
| fit_type JASTRONOMY::JAspera::operator() |
( |
| ) |
const |
|
inlineinherited |
Fit signal strength.
- Returns
- result
Definition at line 116 of file JAspera.hh.
117 {
119
120 double x1 = 0.0;
121 double x2 = (double) this->size() /
ws;
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
143
144 if (f1 > 0.0) {
145
147
149
150 const double xm = 0.5 * (x1 + x2);
152
153 const double s = sqrt(fm*fm - f1*f2);
154
155 if (s == 0.0) {
156 break;
157 }
158
159 const double xn = xm + (xm - x1) * fm/s;
161
162 if (signbit(fn) != signbit(fm)) {
163
164 x1 = xm;
165 f1 = fm;
166 x2 = xn;
167 f2 = fn;
168
169 } else {
170
171 if (signbit(fn)) {
172
173 x2 = xn;
174 f2 = fn;
175
176 } else {
177
178 x1 = xn;
179 f1 = fn;
180 }
181 }
182 }
183
184 const double x = 0.5 * (x1 + x2);
185
187 }
188
189 return { 0.0, 0.0 };
190 }
double getLikelihood(const double p) const
Get likelihood for given signal strength.
static constexpr double EPSILON
precision determination of signal strength
double getDerivative(const double p) const
Get derivative of likelihood for given signal strength.
◆ getSignal()
| double JASTRONOMY::JAspera::getSignal |
( |
| ) |
const |
|
inlineinherited |
Get total signal strength.
- Returns
- signal strength
Definition at line 198 of file JAspera.hh.
◆ setSignal()
| void JASTRONOMY::JAspera::setSignal |
( |
const double | wS | ) |
|
|
inlineinherited |
Set signal strength.
- Parameters
-
Definition at line 209 of file JAspera.hh.
◆ addSignal()
| void JASTRONOMY::JAspera::addSignal |
( |
const double | wS | ) |
|
|
inlineinherited |
Add signal strength.
- Parameters
-
Definition at line 220 of file JAspera.hh.
◆ EPSILON
| double JASTRONOMY::JAspera::EPSILON = 1.0e-3 |
|
staticconstexprinherited |
precision determination of signal strength
Definition at line 26 of file JAspera.hh.
◆ ws
| double JASTRONOMY::JAspera::ws = 0.0 |
|
protectedinherited |
The documentation for this struct was generated from the following file: