73 auto event_header = std::make_unique<R3BEventHeader>();
74 auto read_branch_names = std::vector<std::string>{};
75 auto write_branch_names = std::vector<std::string>{};
76 LOGP(info,
"Setting the event header to be R3BEventHeader!");
77 run->SetEventHeader(std::move(event_header));
81 if (
const auto& option = task_option.neuland_digitizer; option.enable)
84 run->AddTask(task.release());
87 if (
const auto& option = task_option.neuland_sim_cal_to_cal; option.enable)
89 parse_io_branch_names(option, read_branch_names, 1, write_branch_names, 1);
90 auto task = std::make_unique<R3B::Neuland::SimCal2Cal>(read_branch_names.at(0), write_branch_names.at(0));
91 task->SetName(option.name.c_str());
92 run->AddTask(task.release());
95 if (
const auto& option = task_option.neuland_hit_mon; option.enable)
97 parse_io_branch_names(option, read_branch_names, 1, write_branch_names, 0);
98 auto task = std::make_unique<R3BNeulandHitMon>(read_branch_names.at(0));
99 task->SetName(option.name.c_str());
100 run->AddTask(task.release());
103 if (
const auto& option = task_option.neuland_primary_interaction_finder; option.enable)
105 parse_io_branch_names(option, read_branch_names, 2, write_branch_names, 3);
106 auto task = std::make_unique<R3BNeulandPrimaryInteractionFinder>(read_branch_names.at(0),
107 read_branch_names.at(1),
108 write_branch_names.at(0),
109 write_branch_names.at(1),
110 write_branch_names.at(2));
111 task->SetName(option.name.c_str());
112 run->AddTask(task.release());
115 if (
const auto& option = task_option.neuland_cluster_finder; option.enable)
117 parse_io_branch_names(option, read_branch_names, 1, write_branch_names, 1);
118 auto task = std::make_unique<R3BNeulandClusterFinder>(read_branch_names.at(0), write_branch_names.at(0));
119 task->SetName(option.name.c_str());
120 run->AddTask(task.release());
123 if (
const auto& option = task_option.neuland_primary_cluster_finder; option.enable)
125 parse_io_branch_names(option, read_branch_names, 2, write_branch_names, 2);
126 auto task = std::make_unique<R3BNeulandPrimaryClusterFinder>(
127 read_branch_names.at(0), read_branch_names.at(1), write_branch_names.at(0), write_branch_names.at(1));
128 task->SetName(option.name.c_str());
129 run->AddTask(task.release());
132 if (
const auto& option = task_option.neuland_multi_calorimeter_train; option.enable)
134 parse_io_branch_names(option, read_branch_names, 3, write_branch_names, 0);
135 auto task = std::make_unique<R3BNeulandMultiplicityCalorimetricTrain>(
136 read_branch_names.at(0), read_branch_names.at(1), read_branch_names.at(2));
137 task->SetName(option.name.c_str());
138 task->SetUseHits(option.use_hit);
139 task->SetWeight(option.weight);
140 task->SetEdepOpt(option.edep_opt.init, option.edep_opt.step, option.edep_opt.lower, option.edep_opt.upper);
141 task->SetEdepOffOpt(option.edep_off_opt.init,
142 option.edep_off_opt.step,
143 option.edep_off_opt.lower,
144 option.edep_off_opt.upper);
145 task->SetNclusterOffOpt(option.n_cluster_opt.init,
146 option.n_cluster_opt.step,
147 option.n_cluster_opt.lower,
148 option.n_cluster_opt.upper);
149 task->SetNclusterOffOpt(option.n_cluster_off_opt.init,
150 option.n_cluster_off_opt.step,
151 option.n_cluster_off_opt.lower,
152 option.n_cluster_off_opt.upper);
153 run->AddTask(task.release());
156 if (
const auto& option = task_option.neuland_multi_bayes_train; option.enable)
158 parse_io_branch_names(option, read_branch_names, 2, write_branch_names, 0);
160 std::make_unique<R3BNeulandMultiplicityBayesTrain>(read_branch_names.at(0), read_branch_names.at(1));
161 task->SetName(option.name.c_str());
162 run->AddTask(task.release());
165 if (
const auto& option = task_option.neuland_multi_bayes; option.enable)
167 parse_io_branch_names(option, read_branch_names, 1, write_branch_names, 1);
169 std::make_unique<R3BNeulandMultiplicityBayes>(read_branch_names.at(0), write_branch_names.at(0));
170 task->SetName(option.name.c_str());
171 run->AddTask(task.release());
174 if (
const auto& option = task_option.neuland_neutron_r_value; option.enable)
176 parse_io_branch_names(option, read_branch_names, 2, write_branch_names, 1);
177 auto task = std::make_unique<R3BNeulandNeutronsRValue>(
178 option.neutron_energy_mev, read_branch_names.at(0), read_branch_names.at(1), write_branch_names.at(0));
179 task->SetName(option.name.c_str());
180 run->AddTask(task.release());
183 if (
const auto& option = task_option.neuland_map_data_converter_task; option.enable)
185 parse_io_branch_names(option, read_branch_names, 2, write_branch_names, 2);
186 auto task = std::make_unique<Calibration::MapDataConverterTask>(
187 read_branch_names.at(0), read_branch_names.at(1), write_branch_names.at(0), write_branch_names.at(1));
188 task->SetName(option.name.c_str());
189 run->AddTask(task.release());
192 if (
const auto& option = task_option.neuland_map_to_cal_par_task; option.enable)
194 parse_io_branch_names(option, read_branch_names, 2, write_branch_names, 2);
195 auto task = std::make_unique<R3B::Neuland::Map2CalParTask>(
196 read_branch_names.at(0), read_branch_names.at(1), write_branch_names.at(0), write_branch_names.at(1));
197 task->SetTrigEnabled(option.has_trig_enabled);
198 task->SetErrorMethod(option.error_method);
199 run->AddTask(task.release());
202 if (
const auto& option = task_option.neuland_map_to_cal_task; option.enable)
204 auto task = std::make_unique<std::remove_cvref_t<
decltype(option)>::Task>(option);
205 run->AddTask(task.release());
208 if (
const auto& option = task_option.los_map_to_cal_par_task; option.enable)
210 parse_io_branch_names(option, read_branch_names, 2, write_branch_names, 1);
211 auto task = std::make_unique<R3BLosMapped2CalPar>();
212 run->AddTask(task.release());
215 if (
const auto& option = task_option.los_map_to_cal_task; option.enable)
217 parse_io_branch_names(option, read_branch_names, 3, write_branch_names, 1);
218 auto task = std::make_unique<R3BLosMapped2Cal>();
219 static constexpr auto LOS_MODULE_NUM = 8;
220 task->SetNofModules(1, LOS_MODULE_NUM);
222 run->AddTask(task.release());
225 if (
const auto& option = task_option.neuland_cal_to_hit_par_task; option.enable)
227 auto task = std::make_unique<std::remove_cvref_t<
decltype(option)>::Task>(option);
228 run->AddTask(task.release());
231 if (
const auto& option = task_option.los_provide_t_start; option.enable)
233 parse_io_branch_names(option, read_branch_names, 2, write_branch_names, 0);
234 auto task = std::make_unique<R3BLosProvideTStart>();
235 run->AddTask(task.release());
238 if (
const auto& option = task_option.neuland_cal_to_hit_task; option.enable)
240 parse_io_branch_names(option, read_branch_names, 2, write_branch_names, 1);
241 auto task = std::make_unique<R3B::Neuland::Cal2HitTask>(
242 read_branch_names.at(0), read_branch_names.at(1), write_branch_names.at(0));
243 task->SetTrigger(option.mode);
244 task->SetGlobalTimeOffset(option.global_time_offset);
245 run->AddTask(task.release());
248 if (
const auto& option = task_option.neuland_cosmic_monitor_task; option.enable)
250 auto task = std::make_unique<std::remove_cvref_t<
decltype(option)>::Task>(option);
251 run->AddTask(task.release());
254 if (
const auto& option = task_option.neuland_hit_online_monitor_task; option.enable)
256 auto task = std::make_unique<std::remove_cvref_t<
decltype(option)>::Task>(option);
257 run->AddTask(task.release());
260 if (
const auto& option = task_option.neuland_cal_monitor_task; option.enable)
262 parse_io_branch_names(option, read_branch_names, 1, write_branch_names, 0);
263 auto task = std::make_unique<R3B::Neuland::CalMonitorTask>(read_branch_names.at(0));
264 task->SetTrigger(option.mode);
265 run->AddTask(task.release());