107 fMaxSuppress_neighborhood };
118 unsigned int nPlanes = my_geometry.
Nplanes();
131 for(
unsigned int i_plane=0; i_plane < nPlanes; ++i_plane)
143 const unsigned int nTimeTicks = wireVec.at(0).NSignal();
147 for (
unsigned int i_plane=0; i_plane < my_geometry.
Nplanes(); i_plane++){
149 std::stringstream ss_tmp_name,ss_tmp_title;
150 ss_tmp_name <<
"h_WireData_" << i_plane;
151 ss_tmp_title <<
fCalDataModuleLabel <<
" wire data for plane " << i_plane <<
";Wire Number;Time Tick";
160 ss_tmp_title.str().c_str(),
161 my_geometry.
Nwires(i_plane),
163 my_geometry.
Nwires(i_plane),
173 std::vector<geo::WireID> possible_wireIDs = my_geometry.
ChannelToWire(iwire->Channel());
175 try { this_wireID = possible_wireIDs.at(0);}
178 unsigned int i_plane = this_wireID.
Plane;
179 unsigned int i_wire = this_wireID.
Wire;
183 for(
unsigned int i_time = 0; i_time < nTimeTicks; i_time++){
184 WireData_histos.at(i_plane).SetBinContent(i_wire,i_time,(iwire->Signal()).at(i_time));
190 for (
unsigned int i_plane=0; i_plane < my_geometry.
Nplanes(); i_plane++){
224 for(
unsigned int cstat = 0; cstat < my_geometry.
Ncryostats(); ++cstat){
225 for(
unsigned int tpc = 0; tpc < my_geometry.
Cryostat(cstat).
NTPC(); ++tpc){
233 <<
"Doing histogram " << histos
234 <<
", of plane " << plane
235 <<
" with start points " << startx <<
" " << starty;
240 LOG_DEBUG(
"CornerFinderAlg") <<
"Total feature points now is " << corner_vector.size();
271 float i_time, j_time;
272 for(
size_t i=0; i != corner_vector.size(); i++){
274 i_wire = corner_vector.at(i).WireID().Wire;
275 i_time = corner_vector.at(i).DriftTime();
277 for(
size_t j=i+1; j != corner_vector.size(); j++){
279 j_wire = corner_vector.at(j).WireID().Wire;
280 j_time = corner_vector.at(j).DriftTime();
282 if(std::abs(i_wire-j_wire) < 5 && std::abs(i_time - j_time) < 10){
283 corner_vector.erase(corner_vector.begin()+j);
296 bool operator() (
int i,
int j) {
297 return std::abs(b-i)<std::abs(b-j);
307 bool operator() (
int i,
int j) {
309 int mid = (b-a)/2 + a;
310 if(i>=a && i<=b && j>=a && j<=b)
311 return std::abs(mid-i)<std::abs(mid-j);
313 else if(j>=a && j<=b && (i<a || i>b) )
316 else if(i>=a && i<=b && (j<a || j>b) )
335 <<
"Working plane " <<
pid.Plane <<
".";
340 std::vector<int> cut_points_x {0};
341 std::vector<int> cut_points_y {0};
343 for (
int ix=1; ix<=x_bins; ix++){
351 if(jx==ix+fTrimming_buffer)
break;
356 cut_points_x.push_back(ix);
361 for (
int iy=1; iy<=y_bins; iy++){
369 if(jy==iy+fTrimming_buffer)
break;
374 cut_points_y.push_back(iy);
380 <<
"We have a total of " << cut_points_x.size() <<
" x cut points." 381 <<
"\nWe have a total of " << cut_points_y.size() <<
" y cut points.";
383 std::vector<int> x_low{1};
384 std::vector<int> x_high{x_bins};
385 std::vector<int> y_low{1};
386 std::vector<int> y_high{y_bins};
387 bool x_change =
true;
388 bool y_change =
true;
389 while(x_change || y_change){
394 size_t current_size = x_low.size();
396 for(
size_t il=0; il<current_size; il++){
398 int comp_value = (x_high.at(il) + x_low.at(il)) / 2;
399 std::sort(cut_points_x.begin(),cut_points_x.end(),
compare_to_value(comp_value));
401 if(cut_points_x.at(0) <= x_low.at(il) || cut_points_x.at(0) >= x_high.at(il))
404 double integral_low =
WireData_histos.at(
pid.Plane).Integral(x_low.at(il),cut_points_x.at(0),y_low.at(il),y_high.at(il));
405 double integral_high =
WireData_histos.at(
pid.Plane).Integral(cut_points_x.at(0),x_high.at(il),y_low.at(il),y_high.at(il));
407 x_low.push_back(cut_points_x.at(0));
408 x_high.push_back(x_high.at(il));
409 y_low.push_back(y_low.at(il));
410 y_high.push_back(y_high.at(il));
412 x_high[il] = cut_points_x.at(0);
416 x_high[il] = cut_points_x.at(0);
420 x_low[il] = cut_points_x.at(0);
425 current_size = x_low.size();
427 for(
size_t il=0; il<current_size; il++){
429 int comp_value = (y_high.at(il) - y_low.at(il)) / 2;
430 std::sort(cut_points_y.begin(),cut_points_y.end(),
compare_to_value(comp_value));
432 if(cut_points_y.at(0) <= y_low.at(il) || cut_points_y.at(0) >= y_high.at(il))
435 double integral_low =
WireData_histos.at(
pid.Plane).Integral(x_low.at(il),x_high.at(il),y_low.at(il),cut_points_y.at(0));
436 double integral_high =
WireData_histos.at(
pid.Plane).Integral(x_low.at(il),x_high.at(il),cut_points_y.at(0),y_high.at(il));
438 y_low.push_back(cut_points_y.at(0));
439 y_high.push_back(y_high.at(il));
440 x_low.push_back(x_low.at(il));
441 x_high.push_back(x_high.at(il));
443 y_high[il] = cut_points_y.at(0);
447 y_high[il] = cut_points_y.at(0);
451 y_low[il] = cut_points_y.at(0);
459 <<
"First point in x is " << cut_points_x.at(0);
461 std::sort(cut_points_x.begin(),cut_points_x.end(),
compare_to_value(x_bins/2));
464 <<
"Now the first point in x is " << cut_points_x.at(0);
467 <<
"First point in y is " << cut_points_y.at(0);
469 std::sort(cut_points_y.begin(),cut_points_y.end(),
compare_to_value(y_bins/2));
472 <<
"Now the first point in y is " << cut_points_y.at(0);
475 <<
"\nIntegral on the SW side is " 477 <<
"\nIntegral on the SE side is " 478 <<
WireData_histos.at(
pid.Plane).Integral(cut_points_x.at(0),x_bins,1,cut_points_y.at(0))
479 <<
"\nIntegral on the NW side is " 480 <<
WireData_histos.at(
pid.Plane).Integral(1,cut_points_x.at(0),cut_points_y.at(0),y_bins)
481 <<
"\nIntegral on the NE side is " 482 <<
WireData_histos.at(
pid.Plane).Integral(cut_points_x.at(0),x_bins,cut_points_y.at(0),y_bins);
485 for(
size_t il=0; il<x_low.size(); il++){
487 std::stringstream h_name;
488 h_name <<
"h_" <<
pid.Cryostat <<
"_" <<
pid.TPC <<
"_" <<
pid.Plane <<
"_sub" << il;
489 TH2F h_tmp( (h_name.str()).c_str(),
"",
490 x_high.at(il)-x_low.at(il)+1,x_low.at(il),x_high.at(il),
491 y_high.at(il)-y_low.at(il)+1,y_low.at(il),y_high.at(il));
493 for(
int ix=1; ix<=(x_high.at(il)-x_low.at(il)+1); ix++){
494 for(
int iy=1; iy<=(y_high.at(il)-y_low.at(il)+1); iy++){
495 h_tmp.SetBinContent(ix,iy,
WireData_histos.at(
pid.Plane).GetBinContent(x_low.at(il)+(ix-1),y_low.at(il)+(iy-1)));
510 std::vector<geo::WireID> wireIDs,
512 std::vector<recob::EndPoint2D> & corner_vector,
517 const int x_bins = h_wire_data.GetNbinsX();
518 const float x_min = h_wire_data.GetXaxis()->GetBinLowEdge(1);
519 const float x_max = h_wire_data.GetXaxis()->GetBinUpEdge(x_bins);
521 const int y_bins = h_wire_data.GetNbinsY();
522 const float y_min = h_wire_data.GetYaxis()->GetBinLowEdge(1);
523 const float y_max = h_wire_data.GetYaxis()->GetBinUpEdge(y_bins);
528 std::stringstream conversion_name; conversion_name <<
"h_conversion_" << view <<
"_" <<
run_number <<
"_" <<
event_number;
529 std::stringstream dx_name; dx_name <<
"h_derivative_x_" << view <<
"_" <<
run_number <<
"_" <<
event_number;
530 std::stringstream dy_name; dy_name <<
"h_derivative_y_" << view <<
"_" <<
run_number <<
"_" <<
event_number;
531 std::stringstream cornerScore_name; cornerScore_name <<
"h_cornerScore_" << view <<
"_" <<
run_number <<
"_" <<
event_number;
532 std::stringstream maxSuppress_name; maxSuppress_name <<
"h_maxSuppress_" << view <<
"_" <<
run_number <<
"_" <<
event_number;
534 TH2F conversion_histo(conversion_name.str().c_str(),
"Image Conversion Histogram",
536 converted_y_bins,y_min,y_max);
538 TH2F derivativeX_histo(dx_name.str().c_str(),
"Partial Derivatives (x)",
540 converted_y_bins,y_min,y_max);
542 TH2F derivativeY_histo(dy_name.str().c_str(),
"Partial Derivatives (y)",
544 converted_y_bins,y_min,y_max);
546 TH2D cornerScore_histo(cornerScore_name.str().c_str(),
"Corner Score",
548 converted_y_bins,y_min,y_max);
550 TH2D maxSuppress_histo(maxSuppress_name.str().c_str(),
"Corner Points (Maximum Suppressed)",
552 converted_y_bins,y_min,y_max);
564 std::vector<geo::WireID> wireIDs,
566 std::vector<recob::EndPoint2D> & corner_vector){
569 const int x_bins = h_wire_data.GetNbinsX();
570 const float x_min = h_wire_data.GetXaxis()->GetBinLowEdge(1);
571 const float x_max = h_wire_data.GetXaxis()->GetBinUpEdge(x_bins);
573 const int y_bins = h_wire_data.GetNbinsY();
574 const float y_min = h_wire_data.GetYaxis()->GetBinLowEdge(1);
575 const float y_max = h_wire_data.GetYaxis()->GetBinUpEdge(y_bins);
580 std::stringstream conversion_name; conversion_name <<
"h_conversion_" << view <<
"_" <<
run_number <<
"_" <<
event_number;
581 std::stringstream dx_name; dx_name <<
"h_derivative_x_" << view <<
"_" <<
run_number <<
"_" <<
event_number;
582 std::stringstream dy_name; dy_name <<
"h_derivative_y_" << view <<
"_" <<
run_number <<
"_" <<
event_number;
583 std::stringstream cornerScore_name; cornerScore_name <<
"h_cornerScore_" << view <<
"_" <<
run_number <<
"_" <<
event_number;
584 std::stringstream maxSuppress_name; maxSuppress_name <<
"h_maxSuppress_" << view <<
"_" <<
run_number <<
"_" <<
event_number;
586 TH2F h_conversion ((conversion_name.str()).c_str(),
587 "Image Conversion Histogram",
589 converted_y_bins,y_min,y_max);
590 TH2F h_derivative_x((dx_name.str()).c_str(),
591 "Partial Derivatives (x)",
593 converted_y_bins,y_min,y_max);
594 TH2F h_derivative_y((dy_name.str()).c_str(),
595 "Partial Derivatives (y)",
597 converted_y_bins,y_min,y_max);
598 TH2D h_cornerScore ((cornerScore_name.str()).c_str(),
599 "Feature Point Corner Score",
601 converted_y_bins,y_min,y_max);
602 TH2D h_maxSuppress ((maxSuppress_name.str()).c_str(),
603 "Corner Points (Maximum Suppressed)",
605 converted_y_bins,y_min,y_max);
611 std::vector<recob::EndPoint2D> corner_vector_tmp;
614 std::stringstream LI_name; LI_name <<
"h_lineIntegralScore_" << view <<
"_" <<
run_number <<
"_" <<
event_number;
615 TH2F h_lineIntegralScore((LI_name.str()).c_str(),
616 "Line Integral Score",
628 double temp_integral=0;
630 const TF2 fConversion_TF2(
"fConversion_func",
fConversion_func.c_str(),-20,20,-20,20);
632 for(
int ix=1; ix<=h_conversion.GetNbinsX(); ix++){
633 for(
int iy=1; iy<=h_conversion.GetNbinsY(); iy++){
635 temp_integral = h_wire_data.Integral(ix,ix,iy,iy);
642 h_conversion.SetBinContent(ix,iy,temp_integral);
649 temp_integral += h_wire_data.GetBinContent(jx,jy)*fConversion_TF2.Eval(ix-jx,iy-jy);
652 h_conversion.SetBinContent(ix,iy,temp_integral);
657 if( (temp_integral > h_wire_data.GetBinContent(ix-1,iy) && temp_integral > h_wire_data.GetBinContent(ix+1,iy))
658 || (temp_integral > h_wire_data.GetBinContent(ix,iy-1) && temp_integral > h_wire_data.GetBinContent(ix,iy+1)))
659 h_conversion.SetBinContent(ix,iy,temp_integral);
665 if( (temp_integral > h_wire_data.GetBinContent(ix-1,iy) && temp_integral > h_wire_data.GetBinContent(ix+1,iy))
666 || (temp_integral > h_wire_data.GetBinContent(ix,iy-1) && temp_integral > h_wire_data.GetBinContent(ix,iy+1)))
672 h_conversion.SetBinContent(ix,iy,temp_integral);
688 const int x_bins = h_conversion.GetNbinsX();
689 const int y_bins = h_conversion.GetNbinsY();
697 h_derivative_x.SetBinContent(ix,iy,
698 0.5*(h_conversion.GetBinContent(ix+1,iy)-h_conversion.GetBinContent(ix-1,iy))
699 + 0.25*(h_conversion.GetBinContent(ix+1,iy+1)-h_conversion.GetBinContent(ix-1,iy+1))
700 + 0.25*(h_conversion.GetBinContent(ix+1,iy-1)-h_conversion.GetBinContent(ix-1,iy-1)));
701 h_derivative_y.SetBinContent(ix,iy,
702 0.5*(h_conversion.GetBinContent(ix,iy+1)-h_conversion.GetBinContent(ix,iy-1))
703 + 0.25*(h_conversion.GetBinContent(ix-1,iy+1)-h_conversion.GetBinContent(ix-1,iy-1))
704 + 0.25*(h_conversion.GetBinContent(ix+1,iy+1)-h_conversion.GetBinContent(ix+1,iy-1)));
707 h_derivative_x.SetBinContent(ix,iy,
708 12*(h_conversion.GetBinContent(ix+1,iy)-h_conversion.GetBinContent(ix-1,iy))
709 + 8*(h_conversion.GetBinContent(ix+1,iy+1)-h_conversion.GetBinContent(ix-1,iy+1))
710 + 8*(h_conversion.GetBinContent(ix+1,iy-1)-h_conversion.GetBinContent(ix-1,iy-1))
711 + 2*(h_conversion.GetBinContent(ix+1,iy+2)-h_conversion.GetBinContent(ix-1,iy+2))
712 + 2*(h_conversion.GetBinContent(ix+1,iy-2)-h_conversion.GetBinContent(ix-1,iy-2))
713 + 6*(h_conversion.GetBinContent(ix+2,iy)-h_conversion.GetBinContent(ix-2,iy))
714 + 4*(h_conversion.GetBinContent(ix+2,iy+1)-h_conversion.GetBinContent(ix-2,iy+1))
715 + 4*(h_conversion.GetBinContent(ix+2,iy-1)-h_conversion.GetBinContent(ix-2,iy-1))
716 + 1*(h_conversion.GetBinContent(ix+2,iy+2)-h_conversion.GetBinContent(ix-2,iy+2))
717 + 1*(h_conversion.GetBinContent(ix+2,iy-2)-h_conversion.GetBinContent(ix-2,iy-2)));
718 h_derivative_y.SetBinContent(ix,iy,
719 12*(h_conversion.GetBinContent(ix,iy+1)-h_conversion.GetBinContent(ix,iy-1))
720 + 8*(h_conversion.GetBinContent(ix-1,iy+1)-h_conversion.GetBinContent(ix-1,iy-1))
721 + 8*(h_conversion.GetBinContent(ix+1,iy+1)-h_conversion.GetBinContent(ix+1,iy-1))
722 + 2*(h_conversion.GetBinContent(ix-2,iy+1)-h_conversion.GetBinContent(ix-2,iy-1))
723 + 2*(h_conversion.GetBinContent(ix+2,iy+1)-h_conversion.GetBinContent(ix+2,iy-1))
724 + 6*(h_conversion.GetBinContent(ix,iy+2)-h_conversion.GetBinContent(ix,iy-2))
725 + 4*(h_conversion.GetBinContent(ix-1,iy+2)-h_conversion.GetBinContent(ix-1,iy-2))
726 + 4*(h_conversion.GetBinContent(ix+1,iy+2)-h_conversion.GetBinContent(ix+1,iy-2))
727 + 1*(h_conversion.GetBinContent(ix-2,iy+2)-h_conversion.GetBinContent(ix-2,iy-2))
728 + 1*(h_conversion.GetBinContent(ix+2,iy+2)-h_conversion.GetBinContent(ix+2,iy-2)));
731 mf::LogError(
"CornerFinderAlg") <<
"Sobel derivative not supported for neighborhoods > 2.";
740 h_derivative_x.SetBinContent(ix,iy,
741 (h_conversion.GetBinContent(ix+1,iy)-h_conversion.GetBinContent(ix-1,iy)));
742 h_derivative_y.SetBinContent(ix,iy,
743 (h_conversion.GetBinContent(ix,iy+1)-h_conversion.GetBinContent(ix,iy-1)));
746 mf::LogError(
"CornerFinderAlg") <<
"Local derivative not yet supported for neighborhoods > 1.";
761 float func_blur[11][11];
762 func_blur[0][0] = 0.000000;
763 func_blur[0][1] = 0.000000;
764 func_blur[0][2] = 0.000000;
765 func_blur[0][3] = 0.000001;
766 func_blur[0][4] = 0.000002;
767 func_blur[0][5] = 0.000004;
768 func_blur[0][6] = 0.000002;
769 func_blur[0][7] = 0.000001;
770 func_blur[0][8] = 0.000000;
771 func_blur[0][9] = 0.000000;
772 func_blur[0][10] = 0.000000;
773 func_blur[1][0] = 0.000000;
774 func_blur[1][1] = 0.000000;
775 func_blur[1][2] = 0.000004;
776 func_blur[1][3] = 0.000045;
777 func_blur[1][4] = 0.000203;
778 func_blur[1][5] = 0.000335;
779 func_blur[1][6] = 0.000203;
780 func_blur[1][7] = 0.000045;
781 func_blur[1][8] = 0.000004;
782 func_blur[1][9] = 0.000000;
783 func_blur[1][10] = 0.000000;
784 func_blur[2][0] = 0.000000;
785 func_blur[2][1] = 0.000004;
786 func_blur[2][2] = 0.000123;
787 func_blur[2][3] = 0.001503;
788 func_blur[2][4] = 0.006738;
789 func_blur[2][5] = 0.011109;
790 func_blur[2][6] = 0.006738;
791 func_blur[2][7] = 0.001503;
792 func_blur[2][8] = 0.000123;
793 func_blur[2][9] = 0.000004;
794 func_blur[2][10] = 0.000000;
795 func_blur[3][0] = 0.000001;
796 func_blur[3][1] = 0.000045;
797 func_blur[3][2] = 0.001503;
798 func_blur[3][3] = 0.018316;
799 func_blur[3][4] = 0.082085;
800 func_blur[3][5] = 0.135335;
801 func_blur[3][6] = 0.082085;
802 func_blur[3][7] = 0.018316;
803 func_blur[3][8] = 0.001503;
804 func_blur[3][9] = 0.000045;
805 func_blur[3][10] = 0.000001;
806 func_blur[4][0] = 0.000002;
807 func_blur[4][1] = 0.000203;
808 func_blur[4][2] = 0.006738;
809 func_blur[4][3] = 0.082085;
810 func_blur[4][4] = 0.367879;
811 func_blur[4][5] = 0.606531;
812 func_blur[4][6] = 0.367879;
813 func_blur[4][7] = 0.082085;
814 func_blur[4][8] = 0.006738;
815 func_blur[4][9] = 0.000203;
816 func_blur[4][10] = 0.000002;
817 func_blur[5][0] = 0.000004;
818 func_blur[5][1] = 0.000335;
819 func_blur[5][2] = 0.011109;
820 func_blur[5][3] = 0.135335;
821 func_blur[5][4] = 0.606531;
822 func_blur[5][5] = 1.000000;
823 func_blur[5][6] = 0.606531;
824 func_blur[5][7] = 0.135335;
825 func_blur[5][8] = 0.011109;
826 func_blur[5][9] = 0.000335;
827 func_blur[5][10] = 0.000004;
828 func_blur[6][0] = 0.000002;
829 func_blur[6][1] = 0.000203;
830 func_blur[6][2] = 0.006738;
831 func_blur[6][3] = 0.082085;
832 func_blur[6][4] = 0.367879;
833 func_blur[6][5] = 0.606531;
834 func_blur[6][6] = 0.367879;
835 func_blur[6][7] = 0.082085;
836 func_blur[6][8] = 0.006738;
837 func_blur[6][9] = 0.000203;
838 func_blur[6][10] = 0.000002;
839 func_blur[7][0] = 0.000001;
840 func_blur[7][1] = 0.000045;
841 func_blur[7][2] = 0.001503;
842 func_blur[7][3] = 0.018316;
843 func_blur[7][4] = 0.082085;
844 func_blur[7][5] = 0.135335;
845 func_blur[7][6] = 0.082085;
846 func_blur[7][7] = 0.018316;
847 func_blur[7][8] = 0.001503;
848 func_blur[7][9] = 0.000045;
849 func_blur[7][10] = 0.000001;
850 func_blur[8][0] = 0.000000;
851 func_blur[8][1] = 0.000004;
852 func_blur[8][2] = 0.000123;
853 func_blur[8][3] = 0.001503;
854 func_blur[8][4] = 0.006738;
855 func_blur[8][5] = 0.011109;
856 func_blur[8][6] = 0.006738;
857 func_blur[8][7] = 0.001503;
858 func_blur[8][8] = 0.000123;
859 func_blur[8][9] = 0.000004;
860 func_blur[8][10] = 0.000000;
861 func_blur[9][0] = 0.000000;
862 func_blur[9][1] = 0.000000;
863 func_blur[9][2] = 0.000004;
864 func_blur[9][3] = 0.000045;
865 func_blur[9][4] = 0.000203;
866 func_blur[9][5] = 0.000335;
867 func_blur[9][6] = 0.000203;
868 func_blur[9][7] = 0.000045;
869 func_blur[9][8] = 0.000004;
870 func_blur[9][9] = 0.000000;
871 func_blur[9][10] = 0.000000;
872 func_blur[10][0] = 0.000000;
873 func_blur[10][1] = 0.000000;
874 func_blur[10][2] = 0.000000;
875 func_blur[10][3] = 0.000001;
876 func_blur[10][4] = 0.000002;
877 func_blur[10][5] = 0.000004;
878 func_blur[10][6] = 0.000002;
879 func_blur[10][7] = 0.000001;
880 func_blur[10][8] = 0.000000;
881 func_blur[10][9] = 0.000000;
882 func_blur[10][10] = 0.000000;
884 double temp_integral_x = 0;
885 double temp_integral_y = 0;
890 mf::LogWarning(
"CornerFinderAlg") <<
"WARNING...BlurNeighborhoods>10 not currently allowed. Shrinking to 10.";
894 TH2F *h_clone_derivative_x = (TH2F*)h_derivative_x.Clone(
"h_clone_derivative_x");
895 TH2F *h_clone_derivative_y = (TH2F*)h_derivative_y.Clone(
"h_clone_derivative_y");
900 for(
int ix=1; ix<=h_derivative_x.GetNbinsX(); ix++){
901 for(
int iy=1; iy<=h_derivative_y.GetNbinsY(); iy++){
908 temp_integral_x += h_clone_derivative_x->GetBinContent(jx,jy)*func_blur[(ix-jx)+5][(iy-jy)+5];
909 temp_integral_y += h_clone_derivative_y->GetBinContent(jx,jy)*func_blur[(ix-jx)+5][(iy-jy)+5];
912 h_derivative_x.SetBinContent(ix,iy,temp_integral_x);
913 h_derivative_y.SetBinContent(ix,iy,temp_integral_y);
918 delete h_clone_derivative_x;
919 delete h_clone_derivative_y;
933 const int x_bins = h_derivative_x.GetNbinsX();
934 const int y_bins = h_derivative_y.GetNbinsY();
937 double st_xx = 0., st_xy = 0., st_yy = 0.;
943 st_xx=0.; st_xy=0.; st_yy=0.;
948 st_xx += h_derivative_x.GetBinContent(jx,jy)*h_derivative_x.GetBinContent(jx,jy);
949 st_yy += h_derivative_y.GetBinContent(jx,jy)*h_derivative_y.GetBinContent(jx,jy);
950 st_xy += h_derivative_x.GetBinContent(jx,jy)*h_derivative_y.GetBinContent(jx,jy);
960 st_xx -= h_derivative_x.GetBinContent(ix-fCornerScore_neighborhood-1,jy)*h_derivative_x.GetBinContent(ix-fCornerScore_neighborhood-1,jy);
961 st_xx += h_derivative_x.GetBinContent(ix+fCornerScore_neighborhood,jy)*h_derivative_x.GetBinContent(ix+fCornerScore_neighborhood,jy);
963 st_yy -= h_derivative_y.GetBinContent(ix-fCornerScore_neighborhood-1,jy)*h_derivative_y.GetBinContent(ix-fCornerScore_neighborhood-1,jy);
964 st_yy += h_derivative_y.GetBinContent(ix+fCornerScore_neighborhood,jy)*h_derivative_y.GetBinContent(ix+fCornerScore_neighborhood,jy);
966 st_xy -= h_derivative_x.GetBinContent(ix-fCornerScore_neighborhood-1,jy)*h_derivative_y.GetBinContent(ix-fCornerScore_neighborhood-1,jy);
967 st_xy += h_derivative_x.GetBinContent(ix+fCornerScore_neighborhood,jy)*h_derivative_y.GetBinContent(ix+fCornerScore_neighborhood,jy);
972 h_cornerScore.SetBinContent(ix,iy,
976 h_cornerScore.SetBinContent(ix,iy,
993 std::vector<recob::EndPoint2D> & corner_vector,
994 std::vector<geo::WireID> wireIDs,
996 TH2D & h_maxSuppress,
1000 const int x_bins = h_cornerScore.GetNbinsX();
1001 const int y_bins = h_cornerScore.GetNbinsY();
1004 bool temp_center_bin;
1006 for(
int iy=1; iy<=y_bins; iy++){
1007 for(
int ix=1; ix<=x_bins; ix++){
1013 temp_center_bin =
false;
1018 if(h_cornerScore.GetBinContent(jx,jy) > temp_max){
1019 temp_max = h_cornerScore.GetBinContent(jx,jy);
1020 if(jx==ix && jy==iy) temp_center_bin=
true;
1021 else{ temp_center_bin=
false; }
1027 if(temp_center_bin){
1034 wireIDs[wire_number],
1035 h_cornerScore.GetBinContent(ix,iy),
1039 corner_vector.push_back(
corner);
1041 h_maxSuppress.SetBinContent(ix,iy,h_cornerScore.GetBinContent(ix,iy));
1047 return corner_vector.size();
1055 int x1 = hist.GetXaxis()->FindBin( begin_x );
1056 int y1 = hist.GetYaxis()->FindBin( begin_y );
1057 int x2 = hist.GetXaxis()->FindBin( end_x );
1058 int y2 = hist.GetYaxis()->FindBin( end_y );
1060 if(x1==x2 && abs(y1-y2)<1
e-5)
1074 int bin_counter = 0;
1078 float slope = (y2-
y1)/((
float)(x2-
x1));
1080 for(
int ix=x1; ix<=
x2; ix++){
1085 y_min = y1 + slope*(ix-
x1);
1086 y_max = y1 + slope*(ix+1-
x1);
1089 y_max = (y1+1) + slope*(ix-x1);
1090 y_min = (y1+1) + slope*(ix+1-x1);
1093 for(
int iy=y_min; iy<=y_max; iy++){
1096 if( hist.GetBinContent(ix,iy) > threshold )
1111 for(
int iy=y_min; iy<=y_max; iy++){
1113 if( hist.GetBinContent(x1,iy) > threshold)
1119 return fraction/bin_counter;
1125 std::vector<float> fractions(3);
1127 for(
size_t i=0; i!=Steps; ++i)
1129 double s = float(i)/float(Steps);
1130 double uvw[3], ticks[3];
1140 fractions.at(j) += 1.;
1143 for(
size_t j=0; j!=fractions.size(); ++j)
1144 fractions.at(j) /= float(Steps);
1153 std::vector<recob::EndPoint2D>
const & corner_vector,
1154 std::vector<recob::EndPoint2D> & corner_lineIntegralScore_vector,
1155 TH2F & h_lineIntegralScore){
1159 for(
auto const i_corner : corner_vector){
1163 for(
auto const j_corner : corner_vector){
1167 i_corner.WireID().Wire,i_corner.DriftTime(),
1168 j_corner.WireID().Wire,j_corner.DriftTime(),
1183 corner_lineIntegralScore_vector.push_back(
corner);
1186 h_lineIntegralScore.SetBinContent(h_wire_data.GetXaxis()->FindBin(i_corner.WireID().Wire),
1187 h_wire_data.GetYaxis()->FindBin(i_corner.DriftTime()),
1192 return corner_lineIntegralScore_vector.size();
std::string fDerivative_BlurFunc
std::vector< std::tuple< int, TH2F, int, int > > WireData_trimmed_histos
std::vector< float > line_integrals(trkf::BezierTrack &, size_t Steps, float threshold)
std::string fConversion_func
std::vector< TH2D > fMaxSuppress_histos
void create_cornerScore_histogram(TH2F const &h_derivative_x, TH2F const &h_derivative_y, TH2D &h_cornerScore)
Encapsulate the construction of a single cyostat.
void reconfigure(fhicl::ParameterSet const &pset)
Float_t y1[n_points_granero]
std::string fCornerScore_algorithm
float fIntegral_fraction_threshold
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
int fDerivative_neighborhood
std::vector< TH2D > fCornerScore_histos
std::vector< TH2F > fDerivativeX_histos
Float_t x1[n_points_granero]
int fCornerScore_neighborhood
void create_smaller_histos(geo::Geometry const &)
std::vector< TH2F > fDerivativeY_histos
std::string fCalDataModuleLabel
float line_integral(TH2F const &hist, int x1, float y1, int x2, float y2, float threshold)
void InitializeGeometry(geo::Geometry const &)
void attach_feature_points_LineIntegralScore(TH2F const &h_wire_data, std::vector< geo::WireID > wireIDs, geo::View_t view, std::vector< recob::EndPoint2D > &)
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
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
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
void get_feature_points(std::vector< recob::EndPoint2D > &, geo::Geometry const &)
float fIntegral_bin_threshold
virtual ~CornerFinderAlg()
void create_derivative_histograms(TH2F const &h_conversion, TH2F &h_derivative_x, TH2F &h_derivative_y)
unsigned int Nwires(unsigned int p, unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wires in the specified plane.
Float_t y2[n_points_geant4]
void get_feature_points_fast(std::vector< recob::EndPoint2D > &, geo::Geometry const &)
void CleanCornerFinderAlg()
IteratorBox< plane_id_iterator,&GeometryCore::begin_plane_id,&GeometryCore::end_plane_id > IteratePlaneIDs() const
Enables ranged-for loops on all plane IDs of the detector.
void GrabWires(std::vector< recob::Wire > const &wireVec, geo::Geometry const &)
View_t View() const
Which coordinate does this plane measure.
void attach_feature_points(TH2F const &h_wire_data, std::vector< geo::WireID > wireIDs, geo::View_t view, std::vector< recob::EndPoint2D > &, int startx=0, int starty=0)
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
TH2F const & GetWireDataHist(unsigned int)
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
void remove_duplicates(std::vector< recob::EndPoint2D > &)
unsigned int NTPC() const
Number of TPCs in this cryostat.
std::vector< TH2F > WireData_histos
CryostatGeo const & Cryostat(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
void GetProjectedPointUVWT(double s, double *uvw, double *ticks, int c, int t) const
std::string fDerivative_method
size_t perform_maximum_suppression(TH2D const &h_cornerScore, std::vector< recob::EndPoint2D > &corner_vector, std::vector< geo::WireID > wireIDs, geo::View_t view, TH2D &h_maxSuppress, int startx=0, int starty=0)
The geometry of one entire detector, as served by art.
PlaneID_t Plane
Index of the plane within its TPC.
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
std::vector< std::vector< geo::WireID > > WireData_IDs
size_t 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)
std::vector< TH1D > WireData_histos_ProjectionX
int fConversion_bins_per_input_x
std::vector< TH2F > fConversion_histos
float fCornerScore_Harris_kappa
Encapsulate the construction of a single detector plane.
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc'th TPC in the cryostat.
unsigned int event_number
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
float fConversion_threshold
int fDerivative_BlurNeighborhood
int fMaxSuppress_neighborhood
double fTrimming_totalThreshold
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
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
cet::coded_exception< error, detail::translate > exception
Encapsulate the construction of a single detector plane.
float fTrimming_threshold
void create_image_histo(TH2F const &h_wire_data, TH2F &h_conversion)