228 std::map<int,int> map_redimp_vec;
229 std::vector<std::unordered_map<long int, int> > vec_map_pair_pos;
230 for (
size_t i =0; i!= vec_impact.size(); i++){
231 map_redimp_vec[vec_impact[i]] =
int(i);
232 std::unordered_map<long int, int> map_pair_pos;
233 vec_map_pair_pos.push_back(map_pair_pos);
238 std::map<int, int> map_imp_ch;
240 std::map<int, int> map_imp_redimp;
244 for (
int wireind=0;wireind!=rb.nbins();wireind++){
247 for (
int imp_no = imps_range.first; imp_no != imps_range.second; imp_no ++){
248 map_imp_ch[imp_no] = wireind;
249 map_imp_redimp[imp_no] = imp_no - wire_imp_no;
263 int max_imp = ib.nbins();
282 const auto patch = diff->patch();
283 const auto qweight = diff->weights();
285 const int poffset_bin = diff->poffset_bin();
286 const int toffset_bin = diff->toffset_bin();
288 const int np =
patch.rows();
289 const int nt =
patch.cols();
293 for (
int pbin = 0; pbin != np; pbin++){
294 int abs_pbin = pbin + poffset_bin;
295 if (abs_pbin < min_imp || abs_pbin >= max_imp)
continue;
296 double weight = qweight[pbin];
297 auto const channel = map_imp_ch[abs_pbin];
298 auto const redimp = map_imp_redimp[abs_pbin];
299 auto const array_num_redimp = map_redimp_vec[redimp];
300 auto const next_array_num_redimp = map_redimp_vec[redimp+1];
302 auto& map_pair_pos = vec_map_pair_pos.at(array_num_redimp);
303 auto& next_map_pair_pos = vec_map_pair_pos.at(next_array_num_redimp);
305 auto& vec_charge = vec_vec_charge.at(array_num_redimp);
306 auto& next_vec_charge = vec_vec_charge.at(next_array_num_redimp);
308 for (
int tbin = 0; tbin!= nt; tbin++){
309 int abs_tbin = tbin + toffset_bin;
310 double charge =
patch(pbin, tbin);
324 long int index1 =
channel*100000 + abs_tbin;
325 auto it = map_pair_pos.find(index1);
326 if (it == map_pair_pos.end()){
327 map_pair_pos[index1] = vec_charge.size();
328 vec_charge.emplace_back(
channel, abs_tbin, charge*weight);
330 std::get<2>(vec_charge.at(it->second)) += charge * weight;
333 auto it1 = next_map_pair_pos.find(index1);
334 if (it1 == next_map_pair_pos.end()){
335 next_map_pair_pos[index1] = next_vec_charge.size();
336 next_vec_charge.emplace_back(
channel, abs_tbin, charge*(1-weight));
338 std::get<2>(next_vec_charge.at(it1->second)) += charge*(1-weight);
359 if (counter % 5000==0){
370 for (
auto it = vec_map_pair_pos.begin(); it != vec_map_pair_pos.end(); it++){
376 diff->clear_sampling();
const Binning & region_binning() const
const Binning & impact_binning() const
auto counter(T begin, T end)
Returns an object to iterate values from begin to end in a range-for loop.
int wire_impact(int wireind) const
Return the impact position index coincident with the wire index.
std::pair< int, int > wire_impacts(int wireind) const