BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
get_file_list.C
Go to the documentation of this file.
1// macro for obtaining file list satisfying given criteria
2#ifndef __CLING__
4#include "../FileCatalogue.h"
5using namespace std;
6#endif
7
9{
10 // create one or more FileCondition objects with necessary criteria
11 unique_ptr<FileCondition> period_condition =
12 make_unique<FileCondition>(FileCondition::kPeriodNumber, FileCondition::kEqual, 9);
13 unique_ptr<FileCondition> energy_condition =
14 make_unique<FileCondition>(FileCondition::kEnergy, FileCondition::kEqual, 3.0f);
15
16 // add FileCondition objects to vector
17 vector<unique_ptr<FileCondition>> condition_vec;
18 condition_vec.push_back(std::move(period_condition));
19 condition_vec.push_back(std::move(energy_condition));
20
21 // create File Catalogue interface
22 FileCatalogue* FC = new FileCatalogue();
23
24 vector<string> file_lfns;
25
26 // call GetFileList() function and pass the vector
27 int res = FC->GetFileList(std::move(condition_vec), file_lfns);
28
29 // print result vector with LFN (Logical File Name) strings
30 if (res)
31 cout << "Error: " << GetErrorString(-res) << endl;
32 else {
33 cout << " File List for the condtions: " << (file_lfns.empty() ? "empty" : "") << endl;
34 for (auto file_lfn : file_lfns)
35 cout << " " << file_lfn << endl;
36 }
37 delete FC;
38}
string const GetErrorString(int error_id)
Main Interface Class to work with the File Catalog of the experiment Throws runtime_exception if a cr...
int GetFileList(vector< unique_ptr< FileCondition > > file_conditions, vector< string > &filepaths)
Function for searching for file metadata in the File Catalog using specified conditions.
void get_file_list()
Definition json.hpp:4446