164 auto EvntHeader = std::make_unique<R3BEventHeader>();
165 auto read_branch_names = std::vector<std::string>{};
166 auto write_branch_names = std::vector<std::string>{};
167 run->SetEventHeader(EvntHeader.release());
169 auto task_option = options_.tasks;
170 run->SetEventHeader(std::make_unique<R3BEventHeader>().release());
172 if (
const auto& option = task_option.digi; option.enable)
174 parse_branch_names(option, read_branch_names, 2, write_branch_names, 2);
175 auto engine_map = create_neuland_digi_engine_map(option, read_branch_names.at(1));
176 auto engine_gen = engine_map.at({ option.paddle, option.channel });
177 auto task = std::make_unique<R3BNeulandDigitizer>(
178 engine_gen(), read_branch_names.at(0), write_branch_names.at(0), write_branch_names.at(1));
179 task->EnableCalDataOutput(option.enable_sim_cal);
180 task->SetName(task_option.digi.name.c_str());
181 run->AddTask(task.release());
184 if (
const auto& option = task_option.sim_cal_to_cal; option.enable)
186 parse_branch_names(option, read_branch_names, 1, write_branch_names, 1);
187 auto task = std::make_unique<R3B::Neuland::SimCal2Cal>(read_branch_names.at(0), write_branch_names.at(0));
188 task->SetName(option.name.c_str());
189 run->AddTask(task.release());
192 if (
const auto& option = task_option.hit_monitor; option.enable)
194 parse_branch_names(option, read_branch_names, 1, write_branch_names, 0);
195 auto task = std::make_unique<R3BNeulandHitMon>(read_branch_names.at(0));
196 task->SetName(option.name.c_str());
197 run->AddTask(task.release());
200 if (
const auto& option = task_option.prim_inter_finder; option.enable)
202 parse_branch_names(option, read_branch_names, 2, write_branch_names, 3);
203 auto task = std::make_unique<R3BNeulandPrimaryInteractionFinder>(read_branch_names.at(0),
204 read_branch_names.at(1),
205 write_branch_names.at(0),
206 write_branch_names.at(1),
207 write_branch_names.at(2));
208 task->SetName(option.name.c_str());
209 run->AddTask(task.release());
212 if (
const auto& option = task_option.cluster_finder; option.enable)
214 parse_branch_names(option, read_branch_names, 1, write_branch_names, 1);
215 auto task = std::make_unique<R3BNeulandClusterFinder>(read_branch_names.at(0), write_branch_names.at(0));
216 task->SetName(option.name.c_str());
217 run->AddTask(task.release());
220 if (
const auto& option = task_option.cluster_finder; option.enable)
222 parse_branch_names(option, read_branch_names, 2, write_branch_names, 2);
223 auto task = std::make_unique<R3BNeulandPrimaryClusterFinder>(
224 read_branch_names.at(0), read_branch_names.at(1), write_branch_names.at(0), write_branch_names.at(1));
225 task->SetName(option.name.c_str());
226 run->AddTask(task.release());
229 if (
const auto& option = task_option.multi_calorimeter_train; option.enable)
231 parse_branch_names(option, read_branch_names, 3, write_branch_names, 0);
232 auto task = std::make_unique<R3BNeulandMultiplicityCalorimetricTrain>(
233 read_branch_names.at(0), read_branch_names.at(1), read_branch_names.at(2));
234 task->SetName(option.name.c_str());
235 task->SetUseHits(option.use_hit);
236 task->SetWeight(option.weight);
237 task->SetEdepOpt(option.edep_opt.init, option.edep_opt.step, option.edep_opt.lower, option.edep_opt.upper);
238 task->SetEdepOffOpt(option.edep_off_opt.init,
239 option.edep_off_opt.step,
240 option.edep_off_opt.lower,
241 option.edep_off_opt.upper);
242 task->SetNclusterOffOpt(option.n_cluster_opt.init,
243 option.n_cluster_opt.step,
244 option.n_cluster_opt.lower,
245 option.n_cluster_opt.upper);
246 task->SetNclusterOffOpt(option.n_cluster_off_opt.init,
247 option.n_cluster_off_opt.step,
248 option.n_cluster_off_opt.lower,
249 option.n_cluster_off_opt.upper);
250 run->AddTask(task.release());
253 if (
const auto& option = task_option.multi_bayes_train; option.enable)
255 parse_branch_names(option, read_branch_names, 2, write_branch_names, 0);
257 std::make_unique<R3BNeulandMultiplicityBayesTrain>(read_branch_names.at(0), read_branch_names.at(1));
258 task->SetName(option.name.c_str());
259 run->AddTask(task.release());
262 if (
const auto& option = task_option.multi_bayes; option.enable)
264 parse_branch_names(option, read_branch_names, 1, write_branch_names, 1);
266 std::make_unique<R3BNeulandMultiplicityBayes>(read_branch_names.at(0), write_branch_names.at(0));
267 task->SetName(option.name.c_str());
268 run->AddTask(task.release());
271 if (
const auto& option = task_option.neutron_r_value; option.enable)
273 parse_branch_names(option, read_branch_names, 2, write_branch_names, 1);
274 auto task = std::make_unique<R3BNeulandNeutronsRValue>(
275 option.neutron_energy_mev, read_branch_names.at(0), read_branch_names.at(1), write_branch_names.at(0));
276 task->SetName(option.name.c_str());
277 run->AddTask(task.release());
280 if (
const auto& option = task_option.cal_to_hit_par_task; option.enable)
282 parse_branch_names(option, read_branch_names, 2, write_branch_names, 1);
283 auto task = std::make_unique<R3B::Neuland::Cal2HitParTask>(
284 option.method, read_branch_names.at(0), read_branch_names.at(1), write_branch_names.at(0));
285 task->SetMinStat(option.min_stat);
286 run->AddTask(task.release());