41 : fCalDataModuleLabel{pset.
get<std::string>(
"CalDataModuleLabel")}
83 unsigned int nPlanes = my_geometry.
Nplanes(tpcid);
103 const unsigned int nTimeTicks = wireVec.at(0).NSignal();
109 auto const i_plane = planeid.Plane;
111 std::stringstream ss_tmp_name, ss_tmp_title;
112 ss_tmp_name <<
"h_WireData_" << i_plane;
114 <<
";Wire Number;Time Tick";
116 auto const num_wires = my_geometry.
Nwires(planeid);
117 if (static_cast<unsigned int>(
WireData_histos[i_plane].GetNbinsX()) == num_wires) {
124 ss_tmp_title.str().c_str(),
137 std::vector<geo::WireID> possible_wireIDs = my_geometry.
ChannelToWire(iwire->Channel());
140 this_wireID = possible_wireIDs.at(0);
143 mf::LogError(
"CornerFinderAlg") <<
"Bail out! No Possible Wires!\n";
146 unsigned int i_plane = this_wireID.
Plane;
147 unsigned int i_wire = this_wireID.
Wire;
151 for (
unsigned int i_time = 0; i_time < nTimeTicks; i_time++) {
152 WireData_histos.at(i_plane).SetBinContent(i_wire, i_time, (iwire->Signal()).at(i_time));
157 for (
unsigned int i_plane = 0; i_plane < my_geometry.
Nplanes(); i_plane++) {
184 for (
unsigned int tpc = 0; tpc < cryostat.NTPC(); ++tpc) {
191 MF_LOG_DEBUG(
"CornerFinderAlg") <<
"Doing histogram " << histos <<
", of plane " << plane
192 <<
" with start points " << startx <<
" " << starty;
196 cryostat.TPC(tpc).Plane(plane).View(),
201 MF_LOG_DEBUG(
"CornerFinderAlg") <<
"Total feature points now is " << corner_vector.size();
211 std::vector<recob::EndPoint2D>& corner_vector,
240 int mid = (b - a) / 2 + a;
241 if (i >= a && i <= b && j >= a && j <= b)
244 else if (j >= a && j <= b && (i < a || i > b))
247 else if (i >= a && i <= b && (j < a || j > b))
265 MF_LOG_DEBUG(
"CornerFinderAlg") <<
"Working plane " <<
pid.Plane <<
".";
270 std::vector<int> cut_points_x{0};
271 std::vector<int> cut_points_y{0};
273 for (
int ix = 1; ix <= x_bins; ix++) {
281 if (jx == ix + fTrimming_buffer)
break;
288 for (
int iy = 1; iy <= y_bins; iy++) {
296 if (jy == iy + fTrimming_buffer)
break;
304 <<
"We have a total of " << cut_points_x.size() <<
" x cut points." 305 <<
"\nWe have a total of " << cut_points_y.size() <<
" y cut points.";
307 std::vector<int> x_low{1};
308 std::vector<int> x_high{x_bins};
309 std::vector<int> y_low{1};
310 std::vector<int> y_high{y_bins};
311 bool x_change =
true;
312 bool y_change =
true;
313 while (x_change || y_change) {
318 size_t current_size = x_low.size();
320 for (
size_t il = 0; il < current_size; il++) {
322 int comp_value = (x_high.at(il) + x_low.at(il)) / 2;
323 std::sort(cut_points_x.begin(), cut_points_x.end(),
compare_to_value(comp_value));
325 if (cut_points_x.at(0) <= x_low.at(il) || cut_points_x.at(0) >= x_high.at(il))
continue;
328 x_low.at(il), cut_points_x.at(0), y_low.at(il), y_high.at(il));
330 cut_points_x.at(0), x_high.at(il), y_low.at(il), y_high.at(il));
332 x_low.push_back(cut_points_x.at(0));
333 x_high.push_back(x_high.at(il));
334 y_low.push_back(y_low.at(il));
335 y_high.push_back(y_high.at(il));
337 x_high[il] = cut_points_x.at(0);
342 x_high[il] = cut_points_x.at(0);
347 x_low[il] = cut_points_x.at(0);
352 current_size = x_low.size();
354 for (
size_t il = 0; il < current_size; il++) {
356 int comp_value = (y_high.at(il) - y_low.at(il)) / 2;
357 std::sort(cut_points_y.begin(), cut_points_y.end(),
compare_to_value(comp_value));
359 if (cut_points_y.at(0) <= y_low.at(il) || cut_points_y.at(0) >= y_high.at(il))
continue;
362 x_low.at(il), x_high.at(il), y_low.at(il), cut_points_y.at(0));
364 x_low.at(il), x_high.at(il), cut_points_y.at(0), y_high.at(il));
366 y_low.push_back(cut_points_y.at(0));
367 y_high.push_back(y_high.at(il));
368 x_low.push_back(x_low.at(il));
369 x_high.push_back(x_high.at(il));
371 y_high[il] = cut_points_y.at(0);
376 y_high[il] = cut_points_y.at(0);
381 y_low[il] = cut_points_y.at(0);
387 MF_LOG_DEBUG(
"CornerFinderAlg") <<
"First point in x is " << cut_points_x.at(0);
389 std::sort(cut_points_x.begin(), cut_points_x.end(),
compare_to_value(x_bins / 2));
391 MF_LOG_DEBUG(
"CornerFinderAlg") <<
"Now the first point in x is " << cut_points_x.at(0);
393 MF_LOG_DEBUG(
"CornerFinderAlg") <<
"First point in y is " << cut_points_y.at(0);
395 std::sort(cut_points_y.begin(), cut_points_y.end(),
compare_to_value(y_bins / 2));
397 MF_LOG_DEBUG(
"CornerFinderAlg") <<
"Now the first point in y is " << cut_points_y.at(0);
400 <<
"\nIntegral on the SW side is " 401 <<
WireData_histos.at(
pid.Plane).Integral(1, cut_points_x.at(0), 1, cut_points_y.at(0))
402 <<
"\nIntegral on the SE side is " 403 <<
WireData_histos.at(
pid.Plane).Integral(cut_points_x.at(0), x_bins, 1, cut_points_y.at(0))
404 <<
"\nIntegral on the NW side is " 405 <<
WireData_histos.at(
pid.Plane).Integral(1, cut_points_x.at(0), cut_points_y.at(0), y_bins)
406 <<
"\nIntegral on the NE side is " 408 cut_points_x.at(0), x_bins, cut_points_y.at(0), y_bins);
410 for (
size_t il = 0; il < x_low.size(); il++) {
412 std::stringstream h_name;
413 h_name <<
"h_" <<
pid.Cryostat <<
"_" <<
pid.TPC <<
"_" <<
pid.Plane <<
"_sub" << il;
414 TH2F h_tmp((h_name.str()).c_str(),
416 x_high.at(il) - x_low.at(il) + 1,
419 y_high.at(il) - y_low.at(il) + 1,
423 for (
int ix = 1; ix <= (x_high.at(il) - x_low.at(il) + 1); ix++) {
424 for (
int iy = 1; iy <= (y_high.at(il) - y_low.at(il) + 1); iy++) {
425 h_tmp.SetBinContent(ix,
428 y_low.at(il) + (iy - 1)));
433 std::make_tuple(
pid.Plane, h_tmp, x_low.at(il) - 1, y_low.at(il) - 1));
442 std::vector<geo::WireID>
const& wireIDs,
444 std::vector<recob::EndPoint2D>& corner_vector,
449 const int x_bins = h_wire_data.GetNbinsX();
450 const float x_min = h_wire_data.GetXaxis()->GetBinLowEdge(1);
451 const float x_max = h_wire_data.GetXaxis()->GetBinUpEdge(x_bins);
453 const int y_bins = h_wire_data.GetNbinsY();
454 const float y_min = h_wire_data.GetYaxis()->GetBinLowEdge(1);
455 const float y_max = h_wire_data.GetYaxis()->GetBinUpEdge(y_bins);
460 std::stringstream conversion_name;
462 std::stringstream dx_name;
464 std::stringstream dy_name;
466 std::stringstream cornerScore_name;
468 std::stringstream maxSuppress_name;
471 TH2F conversion_histo(conversion_name.str().c_str(),
472 "Image Conversion Histogram",
480 TH2F derivativeX_histo(dx_name.str().c_str(),
481 "Partial Derivatives (x)",
489 TH2F derivativeY_histo(dy_name.str().c_str(),
490 "Partial Derivatives (y)",
498 TH2D cornerScore_histo(cornerScore_name.str().c_str(),
507 TH2D maxSuppress_histo(maxSuppress_name.str().c_str(),
508 "Corner Points (Maximum Suppressed)",
520 cornerScore_histo, wireIDs, view, maxSuppress_histo, startx, starty);
526 TH2F
const& h_wire_data,
527 std::vector<geo::WireID>
const& wireIDs,
529 std::vector<recob::EndPoint2D>& corner_vector)
531 const int x_bins = h_wire_data.GetNbinsX();
532 const float x_min = h_wire_data.GetXaxis()->GetBinLowEdge(1);
533 const float x_max = h_wire_data.GetXaxis()->GetBinUpEdge(x_bins);
535 const int y_bins = h_wire_data.GetNbinsY();
536 const float y_min = h_wire_data.GetYaxis()->GetBinLowEdge(1);
537 const float y_max = h_wire_data.GetYaxis()->GetBinUpEdge(y_bins);
542 std::stringstream conversion_name;
544 std::stringstream dx_name;
546 std::stringstream dy_name;
548 std::stringstream cornerScore_name;
550 std::stringstream maxSuppress_name;
553 TH2F h_conversion(conversion_name.str().c_str(),
554 "Image Conversion Histogram",
561 TH2F h_derivative_x(dx_name.str().c_str(),
562 "Partial Derivatives (x)",
569 TH2F h_derivative_y(dy_name.str().c_str(),
570 "Partial Derivatives (y)",
577 TH2D h_cornerScore(cornerScore_name.str().c_str(),
578 "Feature Point Corner Score",
585 TH2D h_maxSuppress(maxSuppress_name.str().c_str(),
586 "Corner Points (Maximum Suppressed)",
600 std::stringstream LI_name;
602 TH2F h_lineIntegralScore(
603 LI_name.str().c_str(),
"Line Integral Score", x_bins,
x_min,
x_max, y_bins, y_min, y_max);
612 double temp_integral = 0;
614 const TF2 fConversion_TF2(
"fConversion_func",
fConversion_func.c_str(), -20, 20, -20, 20);
616 for (
int ix = 1; ix <= h_conversion.GetNbinsX(); ix++) {
617 for (
int iy = 1; iy <= h_conversion.GetNbinsY(); iy++) {
619 temp_integral = h_wire_data.Integral(ix, ix, iy, iy);
626 h_conversion.SetBinContent(ix, iy, temp_integral);
634 for (
int jy = iy - fConversion_func_neighborhood;
638 h_wire_data.GetBinContent(jx, jy) * fConversion_TF2.Eval(ix - jx, iy - jy);
641 h_conversion.SetBinContent(ix, iy, temp_integral);
646 if ((temp_integral > h_wire_data.GetBinContent(ix - 1, iy) &&
647 temp_integral > h_wire_data.GetBinContent(ix + 1, iy)) ||
648 (temp_integral > h_wire_data.GetBinContent(ix, iy - 1) &&
649 temp_integral > h_wire_data.GetBinContent(ix, iy + 1)))
650 h_conversion.SetBinContent(ix, iy, temp_integral);
656 if ((temp_integral > h_wire_data.GetBinContent(ix - 1, iy) &&
657 temp_integral > h_wire_data.GetBinContent(ix + 1, iy)) ||
658 (temp_integral > h_wire_data.GetBinContent(ix, iy - 1) &&
659 temp_integral > h_wire_data.GetBinContent(ix, iy + 1)))
665 h_conversion.SetBinContent(ix, iy, temp_integral);
678 TH2F& h_derivative_x,
679 TH2F& h_derivative_y)
682 const int x_bins = h_conversion.GetNbinsX();
683 const int y_bins = h_conversion.GetNbinsY();
691 h_derivative_x.SetBinContent(ix,
693 0.5 * (h_conversion.GetBinContent(ix + 1, iy) -
694 h_conversion.GetBinContent(ix - 1, iy)) +
695 0.25 * (h_conversion.GetBinContent(ix + 1, iy + 1) -
696 h_conversion.GetBinContent(ix - 1, iy + 1)) +
697 0.25 * (h_conversion.GetBinContent(ix + 1, iy - 1) -
698 h_conversion.GetBinContent(ix - 1, iy - 1)));
699 h_derivative_y.SetBinContent(ix,
701 0.5 * (h_conversion.GetBinContent(ix, iy + 1) -
702 h_conversion.GetBinContent(ix, iy - 1)) +
703 0.25 * (h_conversion.GetBinContent(ix - 1, iy + 1) -
704 h_conversion.GetBinContent(ix - 1, iy - 1)) +
705 0.25 * (h_conversion.GetBinContent(ix + 1, iy + 1) -
706 h_conversion.GetBinContent(ix + 1, iy - 1)));
709 h_derivative_x.SetBinContent(
712 12 * (h_conversion.GetBinContent(ix + 1, iy) - h_conversion.GetBinContent(ix - 1, iy)) +
713 8 * (h_conversion.GetBinContent(ix + 1, iy + 1) -
714 h_conversion.GetBinContent(ix - 1, iy + 1)) +
715 8 * (h_conversion.GetBinContent(ix + 1, iy - 1) -
716 h_conversion.GetBinContent(ix - 1, iy - 1)) +
717 2 * (h_conversion.GetBinContent(ix + 1, iy + 2) -
718 h_conversion.GetBinContent(ix - 1, iy + 2)) +
719 2 * (h_conversion.GetBinContent(ix + 1, iy - 2) -
720 h_conversion.GetBinContent(ix - 1, iy - 2)) +
722 (h_conversion.GetBinContent(ix + 2, iy) - h_conversion.GetBinContent(ix - 2, iy)) +
723 4 * (h_conversion.GetBinContent(ix + 2, iy + 1) -
724 h_conversion.GetBinContent(ix - 2, iy + 1)) +
725 4 * (h_conversion.GetBinContent(ix + 2, iy - 1) -
726 h_conversion.GetBinContent(ix - 2, iy - 1)) +
727 1 * (h_conversion.GetBinContent(ix + 2, iy + 2) -
728 h_conversion.GetBinContent(ix - 2, iy + 2)) +
729 1 * (h_conversion.GetBinContent(ix + 2, iy - 2) -
730 h_conversion.GetBinContent(ix - 2, iy - 2)));
731 h_derivative_y.SetBinContent(
734 12 * (h_conversion.GetBinContent(ix, iy + 1) - h_conversion.GetBinContent(ix, iy - 1)) +
735 8 * (h_conversion.GetBinContent(ix - 1, iy + 1) -
736 h_conversion.GetBinContent(ix - 1, iy - 1)) +
737 8 * (h_conversion.GetBinContent(ix + 1, iy + 1) -
738 h_conversion.GetBinContent(ix + 1, iy - 1)) +
739 2 * (h_conversion.GetBinContent(ix - 2, iy + 1) -
740 h_conversion.GetBinContent(ix - 2, iy - 1)) +
741 2 * (h_conversion.GetBinContent(ix + 2, iy + 1) -
742 h_conversion.GetBinContent(ix + 2, iy - 1)) +
744 (h_conversion.GetBinContent(ix, iy + 2) - h_conversion.GetBinContent(ix, iy - 2)) +
745 4 * (h_conversion.GetBinContent(ix - 1, iy + 2) -
746 h_conversion.GetBinContent(ix - 1, iy - 2)) +
747 4 * (h_conversion.GetBinContent(ix + 1, iy + 2) -
748 h_conversion.GetBinContent(ix + 1, iy - 2)) +
749 1 * (h_conversion.GetBinContent(ix - 2, iy + 2) -
750 h_conversion.GetBinContent(ix - 2, iy - 2)) +
751 1 * (h_conversion.GetBinContent(ix + 2, iy + 2) -
752 h_conversion.GetBinContent(ix + 2, iy - 2)));
756 <<
"Sobel derivative not supported for neighborhoods > 2.";
765 h_derivative_x.SetBinContent(
768 (h_conversion.GetBinContent(ix + 1, iy) - h_conversion.GetBinContent(ix - 1, iy)));
769 h_derivative_y.SetBinContent(
772 (h_conversion.GetBinContent(ix, iy + 1) - h_conversion.GetBinContent(ix, iy - 1)));
776 <<
"Local derivative not yet supported for neighborhoods > 1.";
789 float func_blur[11][11];
790 func_blur[0][0] = 0.000000;
791 func_blur[0][1] = 0.000000;
792 func_blur[0][2] = 0.000000;
793 func_blur[0][3] = 0.000001;
794 func_blur[0][4] = 0.000002;
795 func_blur[0][5] = 0.000004;
796 func_blur[0][6] = 0.000002;
797 func_blur[0][7] = 0.000001;
798 func_blur[0][8] = 0.000000;
799 func_blur[0][9] = 0.000000;
800 func_blur[0][10] = 0.000000;
801 func_blur[1][0] = 0.000000;
802 func_blur[1][1] = 0.000000;
803 func_blur[1][2] = 0.000004;
804 func_blur[1][3] = 0.000045;
805 func_blur[1][4] = 0.000203;
806 func_blur[1][5] = 0.000335;
807 func_blur[1][6] = 0.000203;
808 func_blur[1][7] = 0.000045;
809 func_blur[1][8] = 0.000004;
810 func_blur[1][9] = 0.000000;
811 func_blur[1][10] = 0.000000;
812 func_blur[2][0] = 0.000000;
813 func_blur[2][1] = 0.000004;
814 func_blur[2][2] = 0.000123;
815 func_blur[2][3] = 0.001503;
816 func_blur[2][4] = 0.006738;
817 func_blur[2][5] = 0.011109;
818 func_blur[2][6] = 0.006738;
819 func_blur[2][7] = 0.001503;
820 func_blur[2][8] = 0.000123;
821 func_blur[2][9] = 0.000004;
822 func_blur[2][10] = 0.000000;
823 func_blur[3][0] = 0.000001;
824 func_blur[3][1] = 0.000045;
825 func_blur[3][2] = 0.001503;
826 func_blur[3][3] = 0.018316;
827 func_blur[3][4] = 0.082085;
828 func_blur[3][5] = 0.135335;
829 func_blur[3][6] = 0.082085;
830 func_blur[3][7] = 0.018316;
831 func_blur[3][8] = 0.001503;
832 func_blur[3][9] = 0.000045;
833 func_blur[3][10] = 0.000001;
834 func_blur[4][0] = 0.000002;
835 func_blur[4][1] = 0.000203;
836 func_blur[4][2] = 0.006738;
837 func_blur[4][3] = 0.082085;
838 func_blur[4][4] = 0.367879;
839 func_blur[4][5] = 0.606531;
840 func_blur[4][6] = 0.367879;
841 func_blur[4][7] = 0.082085;
842 func_blur[4][8] = 0.006738;
843 func_blur[4][9] = 0.000203;
844 func_blur[4][10] = 0.000002;
845 func_blur[5][0] = 0.000004;
846 func_blur[5][1] = 0.000335;
847 func_blur[5][2] = 0.011109;
848 func_blur[5][3] = 0.135335;
849 func_blur[5][4] = 0.606531;
850 func_blur[5][5] = 1.000000;
851 func_blur[5][6] = 0.606531;
852 func_blur[5][7] = 0.135335;
853 func_blur[5][8] = 0.011109;
854 func_blur[5][9] = 0.000335;
855 func_blur[5][10] = 0.000004;
856 func_blur[6][0] = 0.000002;
857 func_blur[6][1] = 0.000203;
858 func_blur[6][2] = 0.006738;
859 func_blur[6][3] = 0.082085;
860 func_blur[6][4] = 0.367879;
861 func_blur[6][5] = 0.606531;
862 func_blur[6][6] = 0.367879;
863 func_blur[6][7] = 0.082085;
864 func_blur[6][8] = 0.006738;
865 func_blur[6][9] = 0.000203;
866 func_blur[6][10] = 0.000002;
867 func_blur[7][0] = 0.000001;
868 func_blur[7][1] = 0.000045;
869 func_blur[7][2] = 0.001503;
870 func_blur[7][3] = 0.018316;
871 func_blur[7][4] = 0.082085;
872 func_blur[7][5] = 0.135335;
873 func_blur[7][6] = 0.082085;
874 func_blur[7][7] = 0.018316;
875 func_blur[7][8] = 0.001503;
876 func_blur[7][9] = 0.000045;
877 func_blur[7][10] = 0.000001;
878 func_blur[8][0] = 0.000000;
879 func_blur[8][1] = 0.000004;
880 func_blur[8][2] = 0.000123;
881 func_blur[8][3] = 0.001503;
882 func_blur[8][4] = 0.006738;
883 func_blur[8][5] = 0.011109;
884 func_blur[8][6] = 0.006738;
885 func_blur[8][7] = 0.001503;
886 func_blur[8][8] = 0.000123;
887 func_blur[8][9] = 0.000004;
888 func_blur[8][10] = 0.000000;
889 func_blur[9][0] = 0.000000;
890 func_blur[9][1] = 0.000000;
891 func_blur[9][2] = 0.000004;
892 func_blur[9][3] = 0.000045;
893 func_blur[9][4] = 0.000203;
894 func_blur[9][5] = 0.000335;
895 func_blur[9][6] = 0.000203;
896 func_blur[9][7] = 0.000045;
897 func_blur[9][8] = 0.000004;
898 func_blur[9][9] = 0.000000;
899 func_blur[9][10] = 0.000000;
900 func_blur[10][0] = 0.000000;
901 func_blur[10][1] = 0.000000;
902 func_blur[10][2] = 0.000000;
903 func_blur[10][3] = 0.000001;
904 func_blur[10][4] = 0.000002;
905 func_blur[10][5] = 0.000004;
906 func_blur[10][6] = 0.000002;
907 func_blur[10][7] = 0.000001;
908 func_blur[10][8] = 0.000000;
909 func_blur[10][9] = 0.000000;
910 func_blur[10][10] = 0.000000;
912 double temp_integral_x = 0;
913 double temp_integral_y = 0;
919 <<
"WARNING...BlurNeighborhoods>10 not currently allowed. Shrinking to 10.";
923 TH2F* h_clone_derivative_x = (TH2F*)h_derivative_x.Clone(
"h_clone_derivative_x");
924 TH2F* h_clone_derivative_y = (TH2F*)h_derivative_y.Clone(
"h_clone_derivative_y");
929 for (
int ix = 1; ix <= h_derivative_x.GetNbinsX(); ix++) {
930 for (
int iy = 1; iy <= h_derivative_y.GetNbinsY(); iy++) {
940 h_clone_derivative_x->GetBinContent(jx, jy) * func_blur[(ix - jx) + 5][(iy - jy) + 5];
942 h_clone_derivative_y->GetBinContent(jx, jy) * func_blur[(ix - jx) + 5][(iy - jy) + 5];
945 h_derivative_x.SetBinContent(ix, iy, temp_integral_x);
946 h_derivative_y.SetBinContent(ix, iy, temp_integral_y);
950 delete h_clone_derivative_x;
951 delete h_clone_derivative_y;
960 TH2F
const& h_derivative_y,
964 const int x_bins = h_derivative_x.GetNbinsX();
965 const int y_bins = h_derivative_y.GetNbinsY();
968 double st_xx = 0., st_xy = 0., st_yy = 0.;
982 st_xx += h_derivative_x.GetBinContent(jx, jy) * h_derivative_x.GetBinContent(jx, jy);
983 st_yy += h_derivative_y.GetBinContent(jx, jy) * h_derivative_y.GetBinContent(jx, jy);
984 st_xy += h_derivative_x.GetBinContent(jx, jy) * h_derivative_y.GetBinContent(jx, jy);
993 st_xx -= h_derivative_x.GetBinContent(ix - fCornerScore_neighborhood - 1, jy) *
994 h_derivative_x.GetBinContent(ix - fCornerScore_neighborhood - 1, jy);
995 st_xx += h_derivative_x.GetBinContent(ix + fCornerScore_neighborhood, jy) *
996 h_derivative_x.GetBinContent(ix + fCornerScore_neighborhood, jy);
998 st_yy -= h_derivative_y.GetBinContent(ix - fCornerScore_neighborhood - 1, jy) *
999 h_derivative_y.GetBinContent(ix - fCornerScore_neighborhood - 1, jy);
1000 st_yy += h_derivative_y.GetBinContent(ix + fCornerScore_neighborhood, jy) *
1001 h_derivative_y.GetBinContent(ix + fCornerScore_neighborhood, jy);
1003 st_xy -= h_derivative_x.GetBinContent(ix - fCornerScore_neighborhood - 1, jy) *
1004 h_derivative_y.GetBinContent(ix - fCornerScore_neighborhood - 1, jy);
1005 st_xy += h_derivative_x.GetBinContent(ix + fCornerScore_neighborhood, jy) *
1006 h_derivative_y.GetBinContent(ix + fCornerScore_neighborhood, jy);
1011 h_cornerScore.SetBinContent(
1015 h_cornerScore.SetBinContent(
1018 (st_xx * st_yy - st_xy * st_xy) -
1033 TH2D
const& h_cornerScore,
1034 std::vector<geo::WireID> wireIDs,
1036 TH2D& h_maxSuppress,
1040 std::vector<recob::EndPoint2D> corner_vector;
1041 const int x_bins = h_cornerScore.GetNbinsX();
1042 const int y_bins = h_cornerScore.GetNbinsY();
1044 for (
int iy = 1; iy <= y_bins; iy++) {
1045 for (
int ix = 1; ix <= x_bins; ix++) {
1049 double temp_max = -1000;
1050 double temp_center_bin =
false;
1055 if (h_cornerScore.GetBinContent(jx, jy) > temp_max) {
1056 temp_max = h_cornerScore.GetBinContent(jx, jy);
1057 if (jx == ix && jy == iy)
1058 temp_center_bin =
true;
1060 temp_center_bin =
false;
1066 if (temp_center_bin) {
1073 time_tick, wireIDs[wire_number], h_cornerScore.GetBinContent(ix, iy), id, view, totalQ);
1074 corner_vector.push_back(
corner);
1076 h_maxSuppress.SetBinContent(ix, iy, h_cornerScore.GetBinContent(ix, iy));
1080 return corner_vector;
1089 float threshold)
const 1092 int x1 = hist.GetXaxis()->FindBin(begin_x);
1093 int y1 = hist.GetYaxis()->FindBin(begin_y);
1094 int x2 = hist.GetXaxis()->FindBin(end_x);
1095 int y2 = hist.GetYaxis()->FindBin(end_y);
1097 if (x1 == x2 &&
abs(y1 - y2) < 1
e-5)
return 0;
1105 int bin_counter = 0;
1109 float slope = (y2 -
y1) / ((
float)(x2 -
x1));
1111 for (
int ix = x1; ix <=
x2; ix++) {
1116 y_min = y1 + slope * (ix -
x1);
1117 y_max = y1 + slope * (ix + 1 -
x1);
1120 y_max = (y1 + 1) + slope * (ix - x1);
1121 y_min = (y1 + 1) + slope * (ix + 1 - x1);
1124 for (
int iy = y_min; iy <= y_max; iy++) {
1127 if (hist.GetBinContent(ix, iy) > threshold) fraction += 1.;
1134 for (
int iy = y_min; iy <= y_max; iy++) {
1136 if (hist.GetBinContent(x1, iy) > threshold) fraction += 1.;
1140 return fraction / bin_counter;
1146 TH2F
const& h_wire_data,
1147 std::vector<recob::EndPoint2D>
const& corner_vector,
1148 std::vector<recob::EndPoint2D>& corner_lineIntegralScore_vector,
1149 TH2F& h_lineIntegralScore)
const 1152 for (
auto const i_corner : corner_vector) {
1156 for (
auto const j_corner : corner_vector) {
1159 i_corner.WireID().Wire,
1160 i_corner.DriftTime(),
1161 j_corner.WireID().Wire,
1162 j_corner.DriftTime(),
1175 corner_lineIntegralScore_vector.push_back(
corner);
1177 h_lineIntegralScore.SetBinContent(h_wire_data.GetXaxis()->FindBin(i_corner.WireID().Wire),
1178 h_wire_data.GetYaxis()->FindBin(i_corner.DriftTime()),
std::string fDerivative_BlurFunc
details::range_type< T > Iterate() const
Initializes the specified ID with the ID of the first cryostat.
std::vector< std::vector< geo::WireID > > WireData_IDs
void create_image_histo(TH2F const &h_wire_data, TH2F &h_conversion) const
std::string fConversion_func
void create_cornerScore_histogram(TH2F const &h_derivative_x, TH2F const &h_derivative_y, TH2D &h_cornerScore)
std::vector< WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
Encapsulate the construction of a single cyostat.
Float_t y1[n_points_granero]
std::vector< std::tuple< int, TH2F, int, int > > WireData_trimmed_histos
std::pair< float, float > minmax(const float a, const float b)
minmax
std::string fCornerScore_algorithm
std::vector< recob::EndPoint2D > perform_maximum_suppression(TH2D const &h_cornerScore, std::vector< geo::WireID > wireIDs, geo::View_t view, TH2D &h_maxSuppress, int startx=0, int starty=0) const
float fIntegral_fraction_threshold
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
int fDerivative_neighborhood
Float_t x1[n_points_granero]
void attach_feature_points(TH2F const &h_wire_data, std::vector< geo::WireID > const &wireIDs, geo::View_t view, std::vector< recob::EndPoint2D > &, int startx=0, int starty=0)
int fCornerScore_neighborhood
void create_smaller_histos(geo::Geometry const &)
The data type to uniquely identify a Plane.
std::string fCalDataModuleLabel
constexpr auto abs(T v)
Returns the absolute value of the argument.
void InitializeGeometry(geo::Geometry const &)
compare_to_range(int a, int b)
WireID_t Wire
Index of the wire within its plane.
std::string fConversion_algorithm
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
Geometry information for a single cryostat.
TH2F const & GetWireDataHist(unsigned int) const
void get_feature_points(std::vector< recob::EndPoint2D > &, geo::Geometry const &)
float fIntegral_bin_threshold
void create_derivative_histograms(TH2F const &h_conversion, TH2F &h_derivative_x, TH2F &h_derivative_y)
Float_t y2[n_points_geant4]
void get_feature_points_fast(std::vector< recob::EndPoint2D > &, geo::Geometry const &)
void calculate_line_integral_score(TH2F const &h_wire_data, std::vector< recob::EndPoint2D > const &corner_vector, std::vector< recob::EndPoint2D > &corner_lineIntegralScore_vector, TH2F &h_lineIntegralScore) const
bool operator()(int i, int j)
void GrabWires(std::vector< recob::Wire > const &wireVec, geo::Geometry const &)
algorithm to find feature 2D points
CornerFinderAlg(fhicl::ParameterSet const &pset)
float fCornerScore_Noble_epsilon
T get(std::string const &key) const
void get_feature_points_LineIntegralScore(std::vector< recob::EndPoint2D > &, geo::Geometry const &)
std::vector< TH1D > WireData_histos_ProjectionY
float line_integral(TH2F const &hist, int x1, float y1, int x2, float y2, float threshold) const
std::vector< TH2F > WireData_histos
std::string fDerivative_method
The geometry of one entire detector, as served by art.
The data type to uniquely identify a TPC.
PlaneID_t Plane
Index of the plane within its TPC.
std::vector< TH1D > WireData_histos_ProjectionX
int fConversion_bins_per_input_x
float fCornerScore_Harris_kappa
Encapsulate the construction of a single detector plane.
unsigned int event_number
View_t View(PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
float fConversion_threshold
unsigned int Nwires(PlaneID const &planeid) const
Returns the total number of wires in the specified plane.
int fDerivative_BlurNeighborhood
int fMaxSuppress_neighborhood
void attach_feature_points_LineIntegralScore(TH2F const &h_wire_data, std::vector< geo::WireID > const &wireIDs, geo::View_t view, std::vector< recob::EndPoint2D > &)
double fTrimming_totalThreshold
unsigned int Nplanes(TPCID const &tpcid=tpc_zero) const
Returns the total number of planes in the specified TPC.
int fMaxSuppress_threshold
Float_t x2[n_points_geant4]
int fConversion_bins_per_input_y
int fConversion_func_neighborhood
art framework interface to geometry description
bool operator()(int i, int j)
cet::coded_exception< error, detail::translate > exception
Encapsulate the construction of a single detector plane.
float fTrimming_threshold