11 if (pCurrentPeriod ==
nullptr) {
12 cout <<
"The function encountered with errors: no experimental period was found with number " << period_number
19 delete pCurrentPeriod;
20 if (period_end_time ==
nullptr) {
21 cout <<
"ERROR: there is no end time for Period " << period_number <<
"Exiting..." << endl;
31 int critical_errors = 0, no_event_count_run = 0, out_start_run_time = 0, out_end_run_time = 0, no_end_time_run = 0,
32 no_raw_files_run = 0, out_start_raw_time = 0, out_end_raw_time = 0, first_event_gt1 = 0, event_gap = 0,
33 parity_event_gap = 0, event_sum_mismatch = 0, time_interval_mismatch = 0;
34 for (
int i = 0;
i < run_count;
i++) {
35 bool is_success =
true;
39 if (pCurrentRun ==
nullptr) {
40 cout <<
"The function encountered with errors: no experimental run was found ("
49 if (run_event_count ==
nullptr) {
52 cout <<
"ERROR: there is no event count in the run" << endl;
56 if ((run_start_time < period_start_time) || (run_start_time > (*period_end_time))) {
59 cout <<
"ERROR: the start time of the run is out of range: " << run_start_time.
AsSQLString() << endl;
62 if (run_end_time ==
nullptr) {
65 cout <<
"ERROR: there is no end time of the run" << endl;
67 if (((*run_end_time) < period_start_time) || ((*run_end_time) > (*period_end_time))) {
70 cout <<
"ERROR: the end time of the run is out of range: " << run_end_time->
AsSQLString() << endl;
77 if (raw_files ==
nullptr) {
79 cout <<
"ERROR: there are no raw files in the run" << endl;
84 int sum_event_count = 0;
85 TDatime min_start_time(
"2100-01-01 00:00:00"), max_end_time(
"1995-01-01 00:00:00");
86 vector<int> v_start_event, v_end_event;
87 for (
const auto& j : *raw_files) {
103 out_start_raw_time++;
104 cout <<
"ERROR: the start time of the raw file is out of range: "
112 cout <<
"ERROR: the end time of the raw file is out of range: "
117 if (v_start_event.empty() && (file_start_event != 1)) {
120 cout <<
"ERROR: first event > 1 (first_event = " << file_start_event <<
")" << endl;
124 if (v_start_event.size() >
PARITY) {
125 int prev_end_event = v_end_event[v_end_event.size() -
PARITY];
126 int event_gap = file_start_event - prev_end_event;
127 if (event_gap !=
PARITY) {
130 cout <<
"ERROR: event gap > " <<
PARITY <<
" (current_event = " << file_start_event
131 <<
", previous event = " << prev_end_event << endl;
136 if ((
PARITY > 1) && (v_start_event.size() %
PARITY != 0)) {
137 int parity_start_event = v_start_event[v_start_event.size() - 1];
138 int parity_gap = file_start_event - parity_start_event;
139 if (parity_gap != 1) {
142 cout <<
"ERROR: parity event gap > 1 (current_event = " << file_start_event
143 <<
", parity start event = " << parity_start_event << endl;
147 sum_event_count += file_event_count;
149 v_start_event.push_back(file_start_event);
150 v_end_event.push_back(file_end_event);
153 if ((run_event_count !=
nullptr) && ((*run_event_count) != sum_event_count)) {
155 event_sum_mismatch++;
156 cout <<
"ERROR: raw event sum is different from run event count (" << sum_event_count <<
" <> "
157 << *run_event_count <<
")" << endl;
159 if ((run_end_time !=
nullptr) && ((run_start_time != min_start_time) || ((*run_end_time) != max_end_time))) {
162 time_interval_mismatch++;
163 cout <<
"ERROR: run time interval (" << run_start_time.
AsSQLString() <<
" - " << run_end_time->
AsSQLString()
164 <<
") is different from raw file time (" << min_start_time.AsSQLString() <<
" - "
169 cout <<
"Event numbers and time intervals were successfully matched" << endl;
173 if (critical_errors > 0)
174 cout <<
"Critical Errors: " << critical_errors << endl;
175 if (no_event_count_run > 0)
176 cout <<
"No event count in " << no_event_count_run <<
" run(s)" << endl;
177 if (out_start_run_time > 0)
178 cout <<
"The start time of the run is out of range in " << out_start_run_time <<
" run(s)" << endl;
179 if (no_end_time_run > 0)
180 cout <<
"There is no end time in " << no_end_time_run <<
" run(s)" << endl;
181 if (out_end_run_time > 0)
182 cout <<
"The end time of the run is out of range in " << out_end_run_time <<
" run(s)" << endl;
183 if (no_raw_files_run > 0)
184 cout <<
"No raw files in " << no_raw_files_run <<
" run(s)" << endl;
185 if (out_start_raw_time > 0)
186 cout <<
"The start time of the raw file is out of range in " << out_start_raw_time <<
" run(s)" << endl;
187 if (out_end_raw_time > 0)
188 cout <<
"The end time of the raw file is out of range in " << out_end_raw_time <<
" run(s)" << endl;
189 if (first_event_gt1 > 0)
190 cout <<
"First event > 1 in " << first_event_gt1 <<
" run(s)" << endl;
192 cout <<
"Event gap > 1 in " << event_gap <<
" run(s)" << endl;
193 if (parity_event_gap > 0)
194 cout <<
"Parity event gap > 1 in " << parity_event_gap <<
" run(s)" << endl;
195 if (event_sum_mismatch > 0)
196 cout <<
"Raw event sum is different from run event count in " << event_sum_mismatch <<
" run(s)" << endl;
197 if (time_interval_mismatch > 0)
198 cout <<
"Run time interval is different from raw file time in " << time_interval_mismatch <<
" run(s)" << endl;
static int GetRunNumbers(UniqueRunNumber *&run_numbers, int start_period, int start_run=0, int end_period=-1, int end_run=-1)
get numbers of runs stored in the Database for a selected range
int check_event_and_time(int period_number, int start_run, int end_run)
int postrun_check(int period_number=8, int start_run=6310, int end_run=8427)
Main post run checking procedure to match run metadata and parameters of the raw files.