40 {
41
43 int mc_spectator_index = mc_dataset.getSpectatorIndex(sideband_variable);
44
45 double total_signal_mc = 0.0;
46 double total_mc = 0.0;
47 double sum_signal_sr = 0.0;
48 double sum_sr = 0.0;
49 double sum_signal_br = 0.0;
50 double sum_br = 0.0;
51 double sum_signal_nr = 0.0;
52 double sum_nr = 0.0;
53
54 for (unsigned int iEvent = 0; iEvent < mc_dataset.getNumberOfEvents(); ++iEvent) {
55 mc_dataset.loadEvent(iEvent);
56 if (mc_dataset.m_isSignal)
57 total_signal_mc += mc_dataset.m_weight;
58 total_mc += mc_dataset.m_weight;
59 if (mc_dataset.m_spectators[mc_spectator_index] == 1.0) {
60 if (mc_dataset.m_isSignal)
61 sum_signal_sr += mc_dataset.m_weight;
62 sum_sr += mc_dataset.m_weight;
63 } else if (mc_dataset.m_spectators[mc_spectator_index] == 2.0) {
64 if (mc_dataset.m_isSignal)
65 sum_signal_br += mc_dataset.m_weight;
66 sum_br += mc_dataset.m_weight;
67 } else if (mc_dataset.m_spectators[mc_spectator_index] == 3.0) {
68 if (mc_dataset.m_isSignal)
69 sum_signal_nr += mc_dataset.m_weight;
70 sum_nr += mc_dataset.m_weight;
71 }
72 }
73
74 double total_data = 0.0;
75 double sum_data_sr = 0.0;
76 double sum_data_br = 0.0;
77 double sum_data_nr = 0.0;
78
79 for (unsigned int iEvent = 0; iEvent < dataset.getNumberOfEvents(); ++iEvent) {
80 dataset.loadEvent(iEvent);
81 total_data += dataset.m_weight;
83 sum_data_sr += dataset.m_weight;
85 sum_data_br += dataset.m_weight;
87 sum_data_nr += dataset.m_weight;
88 }
89 }
90
91 if (sum_signal_br / sum_br > 0.01) {
92 B2WARNING("The background region you defined in the sideband subtraction contains more than 1% signal");
93 }
94 if (sum_signal_nr / sum_nr > 0.01) {
95 B2WARNING("The negative signal region you defined in the sideband subtraction contains more than 1% signal");
96 }
97
98 if (sum_data_sr - sum_signal_sr < 0) {
99 B2ERROR("There is less data in the signal region than the expected amount of signal events in the signal region estimated from MC.");
100 }
101
102 if (total_data - total_signal_mc < 0) {
103 B2ERROR("There is less data than the expected amount of signal events estimated from MC.");
104 }
105
106
107
108
109
111
112
114
115
116
118
119 B2INFO("Data " << total_data << " " << sum_data_sr << " " << sum_data_br << " " << sum_data_nr);
120 B2INFO("MC " << total_mc << " " << sum_sr << " " << sum_br << " " << sum_nr);
121 B2INFO("MC (signal)" << total_signal_mc << " " << sum_signal_sr << " " << sum_signal_br << " " << sum_signal_nr);
124
125 }
Dataset(const GeneralOptions &general_options)
Constructs a new dataset given the general options.
Dataset & m_dataset
Wrapped dataset.
double m_negative_signal_weight
the weight for negative signal events
double m_signal_weight
the weight for signal events
double m_background_weight
the weight for background events
int m_spectator_index
spectator containing the sideband variable