Jpp 20.0.0-rc.7
the software that should make you happy
Loading...
Searching...
No Matches
JASTRONOMY::JPseudoExperiment Struct Reference

Pseudo experiment using CDF for combined generation and likelihood evaluation. More...

#include <JPseudoExperiment.hh>

Inheritance diagram for JASTRONOMY::JPseudoExperiment:
JASTRONOMY::JPseudoExperiment_t JASTRONOMY::JExperiment

Classes

struct  cdf_type
 Auxiliary data structure for CDF. More...
 
struct  parameters_type
 Nuisance parameters. More...
 

Public Types

typedef JAspera::fit_type fit_type
 fit type
 

Public Member Functions

 JPseudoExperiment ()
 Default constructor.
 
template<class H_t >
 JPseudoExperiment (const H_t &hs, const H_t &hb)
 Constructor.
 
template<class H_t >
 JPseudoExperiment (const H_t &hS, const H_t &hB, const H_t &hs, const H_t &hb)
 Constructor.
 
void add (const TObject *ps, const TObject *pb)
 Add objects with PDFs of signal and background.
 
void add (const TObject *pS, const TObject *pB, const TObject *ps, const TObject *pb)
 Add objects with PDFs of signal and background.
 
void add (const TH1 &hs, const TH1 &hb)
 Add histograms with PDFs of signal and background.
 
void add (const TH1 &hS, const TH1 &hB, const TH1 &hs, const TH1 &hb)
 Add histograms with PDFs of signal and background.
 
void add (const TH2 &hs, const TH2 &hb)
 Add histograms with PDFs of signal and background.
 
void add (const TH2 &hS, const TH2 &hB, const TH2 &hs, const TH2 &hb)
 Add histograms with PDFs of signal and background.
 
void add (const TH3 &hs, const TH3 &hb)
 Add histograms with PDFs of signal and background.
 
void add (const TH3 &hS, const TH3 &hB, const TH3 &hs, const TH3 &hb)
 Add histograms with PDFs of signal and background.
 
void add (const double s, const double b)
 Add signal and background.
 
void add (const double S, const double B, const double s, const double b)
 Add signal and background.
 
double getSignal () const
 Get total signal.
 
double getBackground () const
 Get total background.
 
virtual void set (const double fS, const double fB=1.0) override
 Set scaling factors of signal and background strengths.
 
virtual JAsperagetAspera () override
 Get fit method.
 
virtual stats_type run (JAspera &out) const
 Generate pseudo experiment and transfer values to fit method.
 
virtual stats_type run (JAspera &out, const size_t nb) const
 Generate background only pseudo experiment and transfer S/N values to fit method.
 
void configure (size_t N)
 Configure lookup tables.
 
result_type operator() ()
 Generate pseudo experiment and fit signal strength.
 
result_type operator() (const size_t nb)
 Generate background only pseudo experiment and fit signal strength.
 
void operator() (std::vector< result_type > &storage)
 Run pseudo experiments using given storage.
 
template<class T , class JValue_t >
void operator() (JValue_t result_type::*pm, std::vector< T > &storage)
 Run pseudo experiments using given storage.
 
template<class T , class JValue_t >
void operator() (JValue_t JAspera::fit_type::*pm, std::vector< T > &storage)
 Run pseudo experiments using given storage.
 
double getSignalStrengthForUpperLimit (const JAspera &aspera, const double Q, const size_t numberOfTests, const double precision=1.0e-4)
 Get signal strength given result of experiment and probability of upper limit.
 

Static Public Member Functions

static double getSNR ()
 Get minimal signa-to-noise ratio.
 
static void setSNR (const double value)
 Set minimal signa-to-noise ratio.
 
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.
 

Public Attributes

struct JASTRONOMY::JPseudoExperiment::parameters_type nuisance
 

Static Public Attributes

static constexpr double MINIMAL_SIGNAL_STRENGTH = 1.0e-10
 
static constexpr double MAXIMAL_SIGNAL_STRENGTH = 1.0e+10
 

Protected Member Functions

template<class H_t >
bool add (const TObject *ps, const TObject *pb)
 Add objects with PDF of signal and background.
 
template<class H_t >
bool add (const TObject *pS, const TObject *pB, const TObject *ps, const TObject *pb)
 Add objects with PDF of signal and background.
 
double getProbabilityForUpperLimit (const double ps, const double ts, const size_t nx) const
 Get probability for given pseudo experiment and signal strength to exceed minimal test statistic for upper limit.
 

Protected Attributes

cdf_type cs
 CDF of signal.
 
cdf_type cb
 CDF of background.
 
JAspera aspera
 pre-computed N/S values
 
double fs = 1.0
 scaling factor signal strength
 
double fb = 1.0
 scaling factor background strength
 
JAspera fit
 fit
 

Static Private Member Functions

static double & get_snr ()
 Get minimal signa-to-noise ratio.
 

Detailed Description

Pseudo experiment using CDF for combined generation and likelihood evaluation.

Definition at line 339 of file JPseudoExperiment.hh.

Member Typedef Documentation

◆ fit_type

Constructor & Destructor Documentation

◆ JPseudoExperiment() [1/3]

JASTRONOMY::JPseudoExperiment::JPseudoExperiment ( )
inline

Default constructor.

Definition at line 347 of file JPseudoExperiment.hh.

348 {}

◆ JPseudoExperiment() [2/3]

template<class H_t >
JASTRONOMY::JPseudoExperiment::JPseudoExperiment ( const H_t & hs,
const H_t & hb )
inline

Constructor.

Parameters
hshistogram with PDF of signal
hbhistogram with PDF of background

Definition at line 358 of file JPseudoExperiment.hh.

360 {
361 add(hs, hb);
362 }
void add(const TObject *ps, const TObject *pb)
Add objects with PDFs of signal and background.

◆ JPseudoExperiment() [3/3]

template<class H_t >
JASTRONOMY::JPseudoExperiment::JPseudoExperiment ( const H_t & hS,
const H_t & hB,
const H_t & hs,
const H_t & hb )
inline

Constructor.

Parameters
hShistogram with PDF for generation of signal
hBhistogram with PDF for generation of background
hshistogram with PDF for evaluation of signal
hbhistogram with PDF for evaluation of background

Definition at line 374 of file JPseudoExperiment.hh.

378 {
379 add(hS, hB, hs, hb);
380 }

Member Function Documentation

◆ add() [1/12]

void JASTRONOMY::JPseudoExperiment::add ( const TObject * ps,
const TObject * pb )
inline

Add objects with PDFs of signal and background.

Parameters
pspointer to object with PDF of signal
pbpointer to object with PDF of background

Definition at line 389 of file JPseudoExperiment.hh.

391 {
392 if (add<TH3>(ps, pb)) { return; }
393 if (add<TH2>(ps, pb)) { return; }
394 if (add<TH1>(ps, pb)) { return; }
395 }

◆ add() [2/12]

void JASTRONOMY::JPseudoExperiment::add ( const TObject * pS,
const TObject * pB,
const TObject * ps,
const TObject * pb )
inline

Add objects with PDFs of signal and background.

Parameters
pSpointer to object with PDF for generation of signal
pBpointer to object with PDF for generation of background
pspointer to object with PDF for evaluation of signal
pbpointer to object with PDF for evaluation of background

Definition at line 406 of file JPseudoExperiment.hh.

410 {
411 if (add<TH3>(pS, pB, ps, pb)) { return; }
412 if (add<TH2>(pS, pB, ps, pb)) { return; }
413 if (add<TH1>(pS, pB, ps, pb)) { return; }
414 }

◆ add() [3/12]

void JASTRONOMY::JPseudoExperiment::add ( const TH1 & hs,
const TH1 & hb )
inline

Add histograms with PDFs of signal and background.

Parameters
hshistogram with PDF of signal
hbhistogram with PDF of background

Definition at line 423 of file JPseudoExperiment.hh.

425 {
426 for (Int_t ix = 1; ix <= hs.GetXaxis()->GetNbins(); ++ix) {
427 add(hs.GetBinContent(ix),
428 hb.GetBinContent(ix));
429 }
430 }

◆ add() [4/12]

void JASTRONOMY::JPseudoExperiment::add ( const TH1 & hS,
const TH1 & hB,
const TH1 & hs,
const TH1 & hb )
inline

Add histograms with PDFs of signal and background.

Parameters
hShistogram with PDF for generation of signal
hBhistogram with PDF for generation of background
hshistogram with PDF for evaluation of signal
hbhistogram with PDF for evaluation of background

Definition at line 441 of file JPseudoExperiment.hh.

445 {
446 for (Int_t ix = 1; ix <= hs.GetXaxis()->GetNbins(); ++ix) {
447 add(hS.GetBinContent(ix),
448 hB.GetBinContent(ix),
449 hs.GetBinContent(ix),
450 hb.GetBinContent(ix));
451 }
452 }

◆ add() [5/12]

void JASTRONOMY::JPseudoExperiment::add ( const TH2 & hs,
const TH2 & hb )
inline

Add histograms with PDFs of signal and background.

Parameters
hshistogram with PDF of signal
hbhistogram with PDF of background

Definition at line 461 of file JPseudoExperiment.hh.

463 {
464 for (Int_t ix = 1; ix <= hs.GetXaxis()->GetNbins(); ++ix) {
465 for (Int_t iy = 1; iy <= hs.GetYaxis()->GetNbins(); ++iy) {
466 add(hs.GetBinContent(ix, iy),
467 hb.GetBinContent(ix, iy));
468 }
469 }
470 }

◆ add() [6/12]

void JASTRONOMY::JPseudoExperiment::add ( const TH2 & hS,
const TH2 & hB,
const TH2 & hs,
const TH2 & hb )
inline

Add histograms with PDFs of signal and background.

Parameters
hShistogram with PDF for generation of signal
hBhistogram with PDF for generation of background
hshistogram with PDF for evaluation of signal
hbhistogram with PDF for evaluation of background

Definition at line 481 of file JPseudoExperiment.hh.

485 {
486 for (Int_t ix = 1; ix <= hs.GetXaxis()->GetNbins(); ++ix) {
487 for (Int_t iy = 1; iy <= hs.GetYaxis()->GetNbins(); ++iy) {
488 add(hS.GetBinContent(ix, iy),
489 hB.GetBinContent(ix, iy),
490 hs.GetBinContent(ix, iy),
491 hb.GetBinContent(ix, iy));
492 }
493 }
494 }

◆ add() [7/12]

void JASTRONOMY::JPseudoExperiment::add ( const TH3 & hs,
const TH3 & hb )
inline

Add histograms with PDFs of signal and background.

Parameters
hshistogram with PDF of signal
hbhistogram with PDF of background

Definition at line 503 of file JPseudoExperiment.hh.

505 {
506 for (Int_t ix = 1; ix <= hs.GetXaxis()->GetNbins(); ++ix) {
507 for (Int_t iy = 1; iy <= hs.GetYaxis()->GetNbins(); ++iy) {
508 for (Int_t iz = 1; iz <= hs.GetZaxis()->GetNbins(); ++iz) {
509 add(hs.GetBinContent(ix, iy, iz),
510 hb.GetBinContent(ix, iy, iz));
511 }
512 }
513 }
514 }

◆ add() [8/12]

void JASTRONOMY::JPseudoExperiment::add ( const TH3 & hS,
const TH3 & hB,
const TH3 & hs,
const TH3 & hb )
inline

Add histograms with PDFs of signal and background.

Parameters
hShistogram with PDF for generation of signal
hBhistogram with PDF for generation of background
hshistogram with PDF for evaluation of signal
hbhistogram with PDF for evaluation of background

Definition at line 525 of file JPseudoExperiment.hh.

529 {
530 for (Int_t ix = 1; ix <= hs.GetXaxis()->GetNbins(); ++ix) {
531 for (Int_t iy = 1; iy <= hs.GetYaxis()->GetNbins(); ++iy) {
532 for (Int_t iz = 1; iz <= hs.GetZaxis()->GetNbins(); ++iz) {
533 add(hS.GetBinContent(ix, iy, iz),
534 hB.GetBinContent(ix, iy, iz),
535 hs.GetBinContent(ix, iy, iz),
536 hb.GetBinContent(ix, iy, iz));
537 }
538 }
539 }
540 }

◆ add() [9/12]

void JASTRONOMY::JPseudoExperiment::add ( const double s,
const double b )
inline

Add signal and background.

Parameters
ssignal
bbackground

Definition at line 549 of file JPseudoExperiment.hh.

551 {
552 if (check(s, b)) {
553
554 cs.put(s);
555 cb.put(b);
556
557 aspera.put(s, b);
558 }
559 }
void put(const double s, const double b)
Put signal and background to list of pre-computed N/S values.
Definition JAspera.hh:44
static bool check(const double s, const double b)
Check validity of signal and background.
void put(const double x)
Put given value.
cdf_type cb
CDF of background.
JAspera aspera
pre-computed N/S values

◆ add() [10/12]

void JASTRONOMY::JPseudoExperiment::add ( const double S,
const double B,
const double s,
const double b )
inline

Add signal and background.

Parameters
Ssignal for generation
Bbackground for generation
ssignal for evaluation
bbackground for evaluation

Definition at line 570 of file JPseudoExperiment.hh.

574 {
575 if (//check(S, B) &&
576 check(s, b)) {
577
578 cs.put(S);
579 cb.put(B);
580
581 aspera.put(s, b);
582 }
583 }

◆ getSignal()

double JASTRONOMY::JPseudoExperiment::getSignal ( ) const
inline

Get total signal.

Returns
signal

Definition at line 591 of file JPseudoExperiment.hh.

592 {
593 return cs.back() * this->fs;
594 }
double fs
scaling factor signal strength

◆ getBackground()

double JASTRONOMY::JPseudoExperiment::getBackground ( ) const
inline

Get total background.

Returns
background

Definition at line 602 of file JPseudoExperiment.hh.

603 {
604 return cb.back() * this->fb;
605 }
double fb
scaling factor background strength

◆ set()

virtual void JASTRONOMY::JPseudoExperiment::set ( const double fS,
const double fB = 1.0 )
inlineoverridevirtual

Set scaling factors of signal and background strengths.

Parameters
fSsignal strength
fBbackground strength

Implements JASTRONOMY::JPseudoExperiment_t.

Definition at line 614 of file JPseudoExperiment.hh.

615 {
616 for (auto& i : aspera) {
617 i *= fB / this->fb;
618 }
619
620 this->fs = fS;
621 this->fb = fB;
622 }

◆ getAspera()

virtual JAspera & JASTRONOMY::JPseudoExperiment::getAspera ( )
inlineoverridevirtual

Get fit method.

Returns
fit

Implements JASTRONOMY::JPseudoExperiment_t.

Definition at line 630 of file JPseudoExperiment.hh.

631 {
632 return this->fit;
633 }

◆ run() [1/2]

virtual stats_type JASTRONOMY::JPseudoExperiment::run ( JAspera & out) const
inlinevirtual

Generate pseudo experiment and transfer values to fit method.

Parameters
outoutput
Returns
result

Implements JASTRONOMY::JPseudoExperiment_t.

Definition at line 642 of file JPseudoExperiment.hh.

643 {
644 out.addSignal(aspera.getSignal());
645
646 const size_t ns = gRandom->Poisson(getSignal() * nuisance.signal ->get()); // number of signal events
647 const size_t nb = gRandom->Poisson(getBackground() * nuisance.background->get()); // number of background events
648
649 for (size_t i = ns; i != 0; --i) { out.push_back(aspera[cs.get_index(gRandom->Rndm())]); } // store distributed signal events
650 for (size_t i = nb; i != 0; --i) { out.push_back(aspera[cb.get_index(gRandom->Rndm())]); } // store distributed background events
651
652 return { ns, nb };
653 }
double getSignal() const
Get total signal strength.
Definition JAspera.hh:236
size_t get_index(const double rv, const bool option=false) const
Get index corresponding to given random value.
struct JASTRONOMY::JPseudoExperiment::parameters_type nuisance
double getSignal() const
Get total signal.
double getBackground() const
Get total background.

◆ run() [2/2]

virtual stats_type JASTRONOMY::JPseudoExperiment::run ( JAspera & out,
const size_t nb ) const
inlinevirtual

Generate background only pseudo experiment and transfer S/N values to fit method.

Parameters
outoutput
nbnumber of background events
Returns
result

Implements JASTRONOMY::JPseudoExperiment_t.

Definition at line 663 of file JPseudoExperiment.hh.

664 {
665 out.addSignal(aspera.getSignal());
666
667 for (size_t i = nb; i != 0; --i) { out.push_back(aspera[cb.get_index(gRandom->Rndm())]); } // store distributed background events
668
669 return { 0, nb };
670 }

◆ configure()

void JASTRONOMY::JPseudoExperiment::configure ( size_t N)
inline

Configure lookup tables.

Parameters
Nnumber of bins

Definition at line 716 of file JPseudoExperiment.hh.

717 {
718 cs.configure(N);
719 cb.configure(N);
720 }
void configure(size_t N)
Configure lookup table to substitute binary search.

◆ add() [11/12]

template<class H_t >
bool JASTRONOMY::JPseudoExperiment::add ( const TObject * ps,
const TObject * pb )
inlineprotected

Add objects with PDF of signal and background.

Parameters
pspointer to object with PDF of signal
pbpointer to object with PDF of background
Returns
true if added; else false

Definition at line 731 of file JPseudoExperiment.hh.

733 {
734 if (dynamic_cast<const H_t*>(ps) != NULL &&
735 dynamic_cast<const H_t*>(pb) != NULL) {
736
737 const H_t& hs = dynamic_cast<const H_t&>(*ps);
738 const H_t& hb = dynamic_cast<const H_t&>(*pb);
739
740 if (check(hs, hb)) {
741
742 add(hs, hb);
743
744 return true;
745 }
746 }
747
748 return false;
749 }

◆ add() [12/12]

template<class H_t >
bool JASTRONOMY::JPseudoExperiment::add ( const TObject * pS,
const TObject * pB,
const TObject * ps,
const TObject * pb )
inlineprotected

Add objects with PDF of signal and background.

Parameters
pSpointer to object with PDF for generation of signal
pBpointer to object with PDF for generation of background
pspointer to object with PDF for evaluation of signal
pbpointer to object with PDF for evaluation of background
Returns
true if added; else false

Definition at line 762 of file JPseudoExperiment.hh.

766 {
767 if (dynamic_cast<const H_t*>(pS) != NULL &&
768 dynamic_cast<const H_t*>(pB) != NULL &&
769 dynamic_cast<const H_t*>(ps) != NULL &&
770 dynamic_cast<const H_t*>(pb) != NULL) {
771
772 const H_t& hS = dynamic_cast<const H_t&>(*pS);
773 const H_t& hB = dynamic_cast<const H_t&>(*pB);
774 const H_t& hs = dynamic_cast<const H_t&>(*ps);
775 const H_t& hb = dynamic_cast<const H_t&>(*pb);
776
777 if (check(hS, hB) && check(hB, hs) && check(hs, hb)) {
778
779 add(hS, hB, hs, hb);
780
781 return true;
782 }
783 }
784
785 return false;
786 }

◆ operator()() [1/5]

result_type JASTRONOMY::JPseudoExperiment_t::operator() ( )
inlineinherited

Generate pseudo experiment and fit signal strength.

Returns
result

Definition at line 115 of file JPseudoExperiment.hh.

116 {
117 JAspera& aspera = getAspera();
118
119 // reset
120
121 aspera.clear();
122 aspera.setSignal(0.0);
123
124 return { run(aspera), aspera() };
125 }
virtual JAspera & getAspera()=0
Get fit method.
virtual stats_type run(JAspera &out) const =0
Generate pseudo experiment and transfer S/N values to fit method.

◆ operator()() [2/5]

result_type JASTRONOMY::JPseudoExperiment_t::operator() ( const size_t nb)
inlineinherited

Generate background only pseudo experiment and fit signal strength.

Parameters
nbnumber of background events
Returns
result

Definition at line 134 of file JPseudoExperiment.hh.

135 {
136 JAspera& aspera = getAspera();
137
138 // reset
139
140 aspera.clear();
141 aspera.setSignal(0.0);
142
143 return { run(aspera, nb), aspera() };
144 }

◆ operator()() [3/5]

void JASTRONOMY::JPseudoExperiment_t::operator() ( std::vector< result_type > & storage)
inlineinherited

Run pseudo experiments using given storage.

Parameters
storagestorage

Definition at line 152 of file JPseudoExperiment.hh.

153 {
154 for (auto& i : storage) {
155 i = (*this)();
156 }
157 }

◆ operator()() [4/5]

template<class T , class JValue_t >
void JASTRONOMY::JPseudoExperiment_t::operator() ( JValue_t result_type::* pm,
std::vector< T > & storage )
inlineinherited

Run pseudo experiments using given storage.

Parameters
pmpointer to data member of result
storagestorage

Definition at line 167 of file JPseudoExperiment.hh.

168 {
169 for (auto& i : storage) {
170 i = (*this)().*pm;
171 }
172 }

◆ operator()() [5/5]

template<class T , class JValue_t >
void JASTRONOMY::JPseudoExperiment_t::operator() ( JValue_t JAspera::fit_type::* pm,
std::vector< T > & storage )
inlineinherited

Run pseudo experiments using given storage.

Parameters
pmpointer to data member of result
storagestorage

Definition at line 182 of file JPseudoExperiment.hh.

183 {
184 (*this)(static_cast<JValue_t result_type::*>(pm), storage);
185 }

◆ getSignalStrengthForUpperLimit()

double JASTRONOMY::JPseudoExperiment_t::getSignalStrengthForUpperLimit ( const JAspera & aspera,
const double Q,
const size_t numberOfTests,
const double precision = 1.0e-4 )
inlineinherited

Get signal strength given result of experiment and probability of upper limit.

Parameters
asperaresult of experiment
Qprobability
numberOfTestsnumber of tests
precisionprecision
Returns
signal strength

Definition at line 201 of file JPseudoExperiment.hh.

205 {
206 using namespace std;
207
208 const JAspera::fit_type result = aspera(true);
209
210 size_t n = 0;
211
212 this->set(0.0);
213
214 for (size_t i = 0; i != numberOfTests; ++i) {
215
216 JAspera aspera;
217
218 this->run(aspera);
219
220 if (aspera(true).signal < result.signal) {
221 n += 1;
222 }
223 }
224
225 if (n > (1.0 - Q) * numberOfTests) {
226
227 double mumin = 1.0;
228 double mumax = 1.0;
229
230 {
231 for ( ; ; mumax *= 2.0) {
232
233 const double ts = aspera.getTestStatisticForUpperLimit(mumax);
234
235 this->set(mumax);
236
237 const double ps = this->getProbabilityForUpperLimit(mumax, ts, numberOfTests);
238
239 if (ps < 1.0 - Q || mumax > MAXIMAL_SIGNAL_STRENGTH) {
240 break;
241 }
242 }
243 }
244
245 if (mumax == 1.0) {
246
247 mumin = 0.5*mumax;
248
249 for ( ; ; mumin *= 0.5) {
250
251 const double ts = aspera.getTestStatisticForUpperLimit(mumin);
252
253 this->set(mumin);
254
255 const double ps = this->getProbabilityForUpperLimit(mumin, ts, numberOfTests);
256
257 if (ps > 1.0 - Q || mumin < MINIMAL_SIGNAL_STRENGTH) {
258 break;
259 }
260 }
261
262 mumax = 2.0*mumin;
263
264 } else {
265
266 mumin = 0.5*mumax;
267 }
268
269 if (mumin < MINIMAL_SIGNAL_STRENGTH)
270 return mumin;
271 else if (mumax > MAXIMAL_SIGNAL_STRENGTH)
272 return mumax;
273 else {
274
275 for ( ; ; ) { // binary search
276
277 const double mu = 0.5 * (mumin + mumax);
278
279 const double ts = aspera.getTestStatisticForUpperLimit(mu);
280
281 this->set(mu);
282
283 const double ps = this->getProbabilityForUpperLimit(mu, ts, numberOfTests);
284
285 if (fabs(ps - (1.0 - Q)) <= precision) {
286 return mu;
287 }
288
289 if (ps >= 1.0 - Q)
290 mumin = mu;
291 else
292 mumax = mu;
293 }
294 }
295 }
296
297 return 0.0;
298 }
const int n
Definition JPolint.hh:791
static constexpr double MINIMAL_SIGNAL_STRENGTH
double getProbabilityForUpperLimit(const double ps, const double ts, const size_t nx) const
Get probability for given pseudo experiment and signal strength to exceed minimal test statistic for ...
virtual void set(const double fS, const double fB=1.0)=0
Set scaling factors of signal and background strengths.
static constexpr double MAXIMAL_SIGNAL_STRENGTH

◆ getProbabilityForUpperLimit()

double JASTRONOMY::JPseudoExperiment_t::getProbabilityForUpperLimit ( const double ps,
const double ts,
const size_t nx ) const
inlineprotectedinherited

Get probability for given pseudo experiment and signal strength to exceed minimal test statistic for upper limit.

Parameters
pssignal strength
tstest statistic
nxnumber of pseudo experiments

Definition at line 308 of file JPseudoExperiment.hh.

311 {
312 size_t ns = 0;
313
314 for (size_t i = 0; i != nx; ++i) {
315
316 JAspera aspera;
317
318 this->run(aspera);
319
320 if (ps <= std::numeric_limits<double>::min()) {
321
322 if (aspera().signal <= ps) {
323 ns += 1;
324 }
325
326 } else if (aspera.getTestStatisticForUpperLimit(ps) > ts) {
327 ns += 1;
328 }
329 }
330
331 return (double) ns / (double) nx;
332 }

◆ getSNR()

static double JASTRONOMY::JExperiment::getSNR ( )
inlinestaticinherited

Get minimal signa-to-noise ratio.

Returns
signa-to-noise ratio.

Definition at line 32 of file JExperiment.hh.

33 {
34 return get_snr();
35 }
static double & get_snr()
Get minimal signa-to-noise ratio.

◆ setSNR()

static void JASTRONOMY::JExperiment::setSNR ( const double value)
inlinestaticinherited

Set minimal signa-to-noise ratio.

Parameters
valuesigna-to-noise ratio.

Definition at line 43 of file JExperiment.hh.

44 {
45 get_snr() = value;
46 }

◆ check() [1/5]

static bool JASTRONOMY::JExperiment::check ( const double s,
const double b )
inlinestaticinherited

Check validity of signal and background.

Parameters
ssignal
bbackground
Returns
true if signal and backgroud are valid; else false

Definition at line 56 of file JExperiment.hh.

57 {
58 return (s > 0.0 && b > 0.0 && s/b >= getSNR());
59 }
static double getSNR()
Get minimal signa-to-noise ratio.

◆ check() [2/5]

static bool JASTRONOMY::JExperiment::check ( const TAxis * ha,
const TAxis * hb )
inlinestaticinherited

Check histogram bins.

Parameters
hahistogram axis
hbhistogram axis
Returns
true if same binning; else false

Definition at line 69 of file JExperiment.hh.

70 {
71 return (ha->GetNbins() == hb->GetNbins() &&
72 ha->GetXmin() == hb->GetXmin() &&
73 ha->GetXmax() == hb->GetXmax());
74 }

◆ check() [3/5]

static bool JASTRONOMY::JExperiment::check ( const TH1 & ha,
const TH1 & hb )
inlinestaticinherited

Check histogram bins.

Parameters
hahistogram
hbhistogram
Returns
true if same binning; else false

Definition at line 83 of file JExperiment.hh.

84 {
85 return check(ha.GetXaxis(), hb.GetXaxis());
86 }

◆ check() [4/5]

static bool JASTRONOMY::JExperiment::check ( const TH2 & ha,
const TH2 & hb )
inlinestaticinherited

Check histogram bins.

Parameters
hahistogram
hbhistogram
Returns
true if same binning; else false

Definition at line 96 of file JExperiment.hh.

97 {
98 return (check(ha.GetXaxis(), hb.GetXaxis()) &&
99 check(ha.GetYaxis(), hb.GetYaxis()));
100 }

◆ check() [5/5]

static bool JASTRONOMY::JExperiment::check ( const TH3 & ha,
const TH3 & hb )
inlinestaticinherited

Check histogram bins.

Parameters
hahistogram
hbhistogram
Returns
true if same binning; else false

Definition at line 110 of file JExperiment.hh.

111 {
112 return (check(ha.GetXaxis(), hb.GetXaxis()) &&
113 check(ha.GetYaxis(), hb.GetYaxis()) &&
114 check(ha.GetZaxis(), hb.GetZaxis()));
115 }

◆ get_snr()

static double & JASTRONOMY::JExperiment::get_snr ( )
inlinestaticprivateinherited

Get minimal signa-to-noise ratio.

Returns
signa-to-noise ratio.

Definition at line 123 of file JExperiment.hh.

124 {
125 static double value = 0.0;
126
127 return value;
128 }

Member Data Documentation

◆ nuisance

struct JASTRONOMY::JPseudoExperiment::parameters_type JASTRONOMY::JPseudoExperiment::nuisance

◆ cs

cdf_type JASTRONOMY::JPseudoExperiment::cs
protected

CDF of signal.

Definition at line 883 of file JPseudoExperiment.hh.

◆ cb

cdf_type JASTRONOMY::JPseudoExperiment::cb
protected

CDF of background.

Definition at line 884 of file JPseudoExperiment.hh.

◆ aspera

JAspera JASTRONOMY::JPseudoExperiment::aspera
protected

pre-computed N/S values

Definition at line 886 of file JPseudoExperiment.hh.

◆ fs

double JASTRONOMY::JPseudoExperiment::fs = 1.0
protected

scaling factor signal strength

Definition at line 888 of file JPseudoExperiment.hh.

◆ fb

double JASTRONOMY::JPseudoExperiment::fb = 1.0
protected

scaling factor background strength

Definition at line 889 of file JPseudoExperiment.hh.

◆ fit

JAspera JASTRONOMY::JPseudoExperiment::fit
protected

fit

Definition at line 891 of file JPseudoExperiment.hh.

◆ MINIMAL_SIGNAL_STRENGTH

double JASTRONOMY::JPseudoExperiment_t::MINIMAL_SIGNAL_STRENGTH = 1.0e-10
staticconstexprinherited

Definition at line 188 of file JPseudoExperiment.hh.

◆ MAXIMAL_SIGNAL_STRENGTH

double JASTRONOMY::JPseudoExperiment_t::MAXIMAL_SIGNAL_STRENGTH = 1.0e+10
staticconstexprinherited

Definition at line 189 of file JPseudoExperiment.hh.


The documentation for this struct was generated from the following file: