Jpp test-rotations-old-533-g2bdbdb559
the software that should make you happy
Loading...
Searching...
No Matches
JGen2.hh
Go to the documentation of this file.
1#ifndef __JASTRONOMY__JGEN2__
2#define __JASTRONOMY__JGEN2__
3
4#include <vector>
5#include <numeric>
6
9
10
11/**
12 * \file
13 *
14 * Set of pseudo experments.
15 * \author mdejong
16 */
17namespace JASTRONOMY {}
18namespace JPP { using namespace JASTRONOMY; }
19
20namespace JASTRONOMY {
21
22 /**
23 * Auxiliary data structure to fit signal strength using likelihood ratio for multiple pseudo experiments.
24 */
25 struct JGen2 :
26 public std::vector<JPseudoExperiment>,
28 {
29 /**
30 * Set scaling factors of signal and background strengths.
31 *
32 * \param fS signal strength
33 * \param fB background strength
34 */
35 void set(const double fS, const double fB)
36 {
37 for (auto& i : static_cast<std::vector<JPseudoExperiment>&>(*this)) {
38 i.set(fS, fB);
39 }
40 }
41
42
43 /**
44 * Get total signal.
45 *
46 * \return signal
47 */
48 double getSignal() const
49 {
50 return std::accumulate(this->begin(), this->end(), 0.0, [](const double y, const JPseudoExperiment& px) { return y + px.getSignal(); } );
51 }
52
53
54 /**
55 * Get total background.
56 *
57 * \return background
58 */
59 double getBackground() const
60 {
61 return std::accumulate(this->begin(), this->end(), 0.0, [](const double y, const JPseudoExperiment& px) { return y + px.getBackground(); } );
62 }
63
64
65 /**
66 * Get fit method.
67 *
68 * \return fit
69 */
70 virtual JAspera& getAspera() override
71 {
72 return this->fit;
73 }
74
75
76 /**
77 * Generate pseudo experiment and transfer S/N values to fit method.
78 *
79 * \param out output
80 * \return result
81 */
82 virtual stats_type run(JAspera& out) const
83 {
84 stats_type px = { 0, 0 };
85
86 for (const auto& i : static_cast<const std::vector<JPseudoExperiment>&>(*this)) {
87 px += i.run(out);
88 }
89
90 return px;
91 }
92
93 protected:
94 JAspera fit; //!< fit
95 };
96}
97
98#endif
Per aspera ad astra.
Pseudo experiment.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure to fit signal strength using likelihood ratio.
Definition JAspera.hh:24
Auxiliary data structure to fit signal strength using likelihood ratio for multiple pseudo experiment...
Definition JGen2.hh:28
virtual JAspera & getAspera() override
Get fit method.
Definition JGen2.hh:70
virtual stats_type run(JAspera &out) const
Generate pseudo experiment and transfer S/N values to fit method.
Definition JGen2.hh:82
void set(const double fS, const double fB)
Set scaling factors of signal and background strengths.
Definition JGen2.hh:35
double getSignal() const
Get total signal.
Definition JGen2.hh:48
JAspera fit
fit
Definition JGen2.hh:94
double getBackground() const
Get total background.
Definition JGen2.hh:59
Auxiliary interface for pseudo experiment.
Pseudo experiment using CDF for combined generation and likelihood evaluation.
double getSignal() const
Get total signal.
double getBackground() const
Get total background.