13 std::ifstream file(csv_file_path);
14 if (!file.is_open()) {
15 throw std::runtime_error(
"Could not open CSV file: " + csv_file_path);
19 std::getline(file, line);
21 while (std::getline(file, line)) {
22 std::istringstream ss(line);
25 std::getline(ss, token,
',');
26 int min_run = std::stoi(token);
28 std::getline(ss, token,
',');
29 int max_run = std::stoi(token);
31 std::getline(ss, token);
32 std::string path = token;
34 if (run_number >= min_run && run_number <= max_run) {
38 throw std::runtime_error(
"Run number not found in CSV mapping.");
43 auto tchain = std::make_unique<TChain>(
"rawConv");
45 tchain->Add(Form(
"%srun_%06d/sndsw_raw-*", base_folder.c_str(), run_number));
48 for (
int i = 0; i<n_files; ++i){
49 tchain->Add(Form(
"%srun_%06d/sndsw_raw-%04d.root", base_folder.c_str(), run_number, i));