14 if (csv_file_path.empty()) {
15 csv_file_path = std::string(getenv(
"SNDSW_ROOT")) +
"/analysis/tools/data_paths.csv";
17 std::ifstream file(csv_file_path);
18 if (!file.is_open()) {
19 throw std::runtime_error(
"Could not open CSV file: " + csv_file_path);
23 std::getline(file, line);
25 while (std::getline(file, line)) {
26 std::istringstream ss(line);
29 std::getline(ss, token,
',');
30 int min_run = std::stoi(token);
32 std::getline(ss, token,
',');
33 int max_run = std::stoi(token);
35 std::getline(ss, token);
36 std::string path = token;
38 if (run_number >= min_run && run_number <= max_run) {
42 throw std::runtime_error(
"Run number not found in CSV mapping.");
47 auto tchain = std::make_unique<TChain>(
"rawConv");
49 tchain->Add(Form(
"%srun_%06d/sndsw_raw-*", base_folder.c_str(), run_number));
52 for (
int i = 0; i<n_files; ++i){
53 tchain->Add(Form(
"%srun_%06d/sndsw_raw-%04d.root", base_folder.c_str(), run_number, i));