BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
check_db_paths_exist.C
Go to the documentation of this file.
1#include "../../function_set.h"
2
3// function for checking existence of the files whose paths stored in the Database
4// returns the success code: 0 - without errors, error_code - otherwise
5int check_db_paths_exist(int period_number = 8)
6{
7 UniqueRunNumber* run_numbers;
8 int run_count = UniRunPeriod::GetRunNumbers(run_numbers, period_number);
9 if (run_count <= 0) {
10 cout << "ERROR: There are no runs in the UniConDa Database for period " << period_number << endl;
11 return -1;
12 }
13
14 bool isAllIn = true;
15 for (int i = 0; i < run_count; i++) {
16 // get run time
17 UniRun* pRun = UniRun::GetRun(run_numbers[i].period_number, run_numbers[i].run_number);
18 if (pRun == nullptr) {
19 cout << "The function encountered with errors: no experimental run was found ("
20 << run_numbers[i].period_number << ":" << run_numbers[i].run_number << "). This run will be skipped!"
21 << endl;
22 continue;
23 }
24
25 // get all raw files for the current run
26 TObjArray* raw_files = pRun->GetRawFiles();
27 delete pRun;
28 if (raw_files == nullptr)
29 continue;
30
31 // cycle by all raw files for the current run
32 for (const auto& j : *raw_files) {
33 UniRawFile* pRawFile = (UniRawFile*)j;
34
35 TString strFilePath = pRawFile->GetFilePath();
36 gSystem->ExpandPathName(strFilePath);
37
38 if (gSystem->AccessPathName(strFilePath.Data())) {
39 isAllIn = false;
40 cout << "ATTENTION: The current raw file does not exist: " << strFilePath << endl;
41 }
42 }
43 }
44
45 if (isAllIn)
46 cout << endl << "All run paths exist" << endl;
47 else
48 cout << endl << "There are absent run paths!" << endl;
49
50 return 0;
51}
int i
Definition P4_F32vec4.h:22
R__EXTERN TSystem * gSystem
const char * Data() const
/home/soul/bmnroot/database/uni_db1/UniRawFile.h Class for the table: raw_file
Definition UniRawFile.h:19
TString GetFilePath()
get file path of the current raw file
Definition UniRawFile.h:110
static int GetRunNumbers(UniqueRunNumber *&run_numbers, int period_number)
get numbers of runs existing in the Database for a selected period
UniRun.h Class for the table: run_.
Definition UniRun.h:21
static UniRun * GetRun(int period_number, int run_number)
get run from the database
Definition UniRun.cxx:161
TObjArray * GetRawFiles()
get array of raw files (UniRawFile*) corresponding to the run (return nullptr if an error occured)
Definition UniRun.cxx:798
int check_db_paths_exist(int period_number=8)