30 #include "messagefacility/MessageLogger/MessageLogger.h"
43 : fCalDataModuleLabel{pset.get<std::string>(
"CalDataModuleLabel")}
83 unsigned int nPlanes = my_geometry.
Nplanes();
91 for(
unsigned int i_plane=0; i_plane < nPlanes; ++i_plane)
103 const unsigned int nTimeTicks = wireVec.at(0).NSignal();
107 for (
unsigned int i_plane=0; i_plane < my_geometry.
Nplanes(); i_plane++){
109 std::stringstream ss_tmp_name,ss_tmp_title;
110 ss_tmp_name <<
"h_WireData_" << i_plane;
111 ss_tmp_title <<
fCalDataModuleLabel <<
" wire data for plane " << i_plane <<
";Wire Number;Time Tick";
120 ss_tmp_title.str().c_str(),
121 my_geometry.
Nwires(i_plane),
123 my_geometry.
Nwires(i_plane),
131 for (std::vector<recob::Wire>::const_iterator iwire = wireVec.begin(); iwire < wireVec.end(); iwire++) {
133 std::vector<geo::WireID> possible_wireIDs = my_geometry.
ChannelToWire(iwire->Channel());
135 try { this_wireID = possible_wireIDs.at(0);}
136 catch(cet::exception& excep) { mf::LogError(
"CornerFinderAlg") <<
"Bail out! No Possible Wires!\n"; }
138 unsigned int i_plane = this_wireID.
Plane;
139 unsigned int i_wire = this_wireID.
Wire;
143 for(
unsigned int i_time = 0; i_time < nTimeTicks; i_time++){
144 WireData_histos.at(i_plane).SetBinContent(i_wire,i_time,(iwire->Signal()).at(i_time));
150 for (
unsigned int i_plane=0; i_plane < my_geometry.
Nplanes(); i_plane++){
166 my_geometry.
View(pid),
177 for(
unsigned int cstat = 0; cstat < my_geometry.
Ncryostats(); ++cstat){
178 for(
unsigned int tpc = 0; tpc < my_geometry.
Cryostat(cstat).
NTPC(); ++tpc){
185 MF_LOG_DEBUG(
"CornerFinderAlg")
186 <<
"Doing histogram " << histos
187 <<
", of plane " << plane
188 <<
" with start points " << startx <<
" " << starty;
197 MF_LOG_DEBUG(
"CornerFinderAlg") <<
"Total feature points now is " << corner_vector.size();
212 my_geometry.
View(pid),
220 bool operator() (
int i,
int j) {
231 bool operator() (
int i,
int j) {
233 int mid = (b-
a)/2 +
a;
234 if(i>=
a && i<=b && j>=
a && j<=b)
237 else if(j>=
a && j<=b && (i<a || i>b) )
240 else if(i>=
a && i<=b && (j<a || j>b) )
258 MF_LOG_DEBUG(
"CornerFinderAlg")
259 <<
"Working plane " << pid.Plane <<
".";
264 std::vector<int> cut_points_x {0};
265 std::vector<int> cut_points_y {0};
267 for (
int ix=1; ix<=x_bins; ix++){
275 if(jx==ix+fTrimming_buffer)
break;
280 cut_points_x.push_back(ix);
285 for (
int iy=1; iy<=y_bins; iy++){
293 if(jy==iy+fTrimming_buffer)
break;
298 cut_points_y.push_back(iy);
303 MF_LOG_DEBUG(
"CornerFinderAlg")
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))
328 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));
329 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));
331 x_low.push_back(cut_points_x.at(0));
332 x_high.push_back(x_high.at(il));
333 y_low.push_back(y_low.at(il));
334 y_high.push_back(y_high.at(il));
336 x_high[il] = cut_points_x.at(0);
340 x_high[il] = cut_points_x.at(0);
344 x_low[il] = cut_points_x.at(0);
349 current_size = x_low.size();
351 for(
size_t il=0; il<current_size; il++){
353 int comp_value = (y_high.at(il) - y_low.at(il)) / 2;
354 std::sort(cut_points_y.begin(),cut_points_y.end(),
compare_to_value(comp_value));
356 if(cut_points_y.at(0) <= y_low.at(il) || cut_points_y.at(0) >= y_high.at(il))
359 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));
360 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));
362 y_low.push_back(cut_points_y.at(0));
363 y_high.push_back(y_high.at(il));
364 x_low.push_back(x_low.at(il));
365 x_high.push_back(x_high.at(il));
367 y_high[il] = cut_points_y.at(0);
371 y_high[il] = cut_points_y.at(0);
375 y_low[il] = cut_points_y.at(0);
382 MF_LOG_DEBUG(
"CornerFinderAlg")
383 <<
"First point in x is " << cut_points_x.at(0);
385 std::sort(cut_points_x.begin(),cut_points_x.end(),
compare_to_value(x_bins/2));
387 MF_LOG_DEBUG(
"CornerFinderAlg")
388 <<
"Now the first point in x is " << cut_points_x.at(0);
390 MF_LOG_DEBUG(
"CornerFinderAlg")
391 <<
"First point in y is " << cut_points_y.at(0);
393 std::sort(cut_points_y.begin(),cut_points_y.end(),
compare_to_value(y_bins/2));
395 MF_LOG_DEBUG(
"CornerFinderAlg")
396 <<
"Now the first point in y is " << cut_points_y.at(0);
398 MF_LOG_DEBUG(
"CornerFinderAlg")
399 <<
"\nIntegral on the SW side is "
400 <<
WireData_histos.at(pid.Plane).Integral(1,cut_points_x.at(0),1,cut_points_y.at(0))
401 <<
"\nIntegral on the SE side is "
402 <<
WireData_histos.at(pid.Plane).Integral(cut_points_x.at(0),x_bins,1,cut_points_y.at(0))
403 <<
"\nIntegral on the NW side is "
404 <<
WireData_histos.at(pid.Plane).Integral(1,cut_points_x.at(0),cut_points_y.at(0),y_bins)
405 <<
"\nIntegral on the NE side is "
406 <<
WireData_histos.at(pid.Plane).Integral(cut_points_x.at(0),x_bins,cut_points_y.at(0),y_bins);
409 for(
size_t il=0; il<x_low.size(); il++){
411 std::stringstream h_name;
412 h_name <<
"h_" << pid.Cryostat <<
"_" << pid.TPC <<
"_" << pid.Plane <<
"_sub" << il;
413 TH2F h_tmp( (h_name.str()).c_str(),
"",
414 x_high.at(il)-x_low.at(il)+1,x_low.at(il),x_high.at(il),
415 y_high.at(il)-y_low.at(il)+1,y_low.at(il),y_high.at(il));
417 for(
int ix=1; ix<=(x_high.at(il)-x_low.at(il)+1); ix++){
418 for(
int iy=1; iy<=(y_high.at(il)-y_low.at(il)+1); iy++){
419 h_tmp.SetBinContent(ix,iy,
WireData_histos.at(pid.Plane).GetBinContent(x_low.at(il)+(ix-1),y_low.at(il)+(iy-1)));
434 std::vector<geo::WireID>
const& wireIDs,
436 std::vector<recob::EndPoint2D> & corner_vector,
441 const int x_bins = h_wire_data.GetNbinsX();
442 const float x_min = h_wire_data.GetXaxis()->GetBinLowEdge(1);
443 const float x_max = h_wire_data.GetXaxis()->GetBinUpEdge(x_bins);
445 const int y_bins = h_wire_data.GetNbinsY();
446 const float y_min = h_wire_data.GetYaxis()->GetBinLowEdge(1);
447 const float y_max = h_wire_data.GetYaxis()->GetBinUpEdge(y_bins);
452 std::stringstream conversion_name; conversion_name <<
"h_conversion_" << view <<
"_" <<
run_number <<
"_" <<
event_number;
453 std::stringstream dx_name; dx_name <<
"h_derivative_x_" << view <<
"_" <<
run_number <<
"_" <<
event_number;
454 std::stringstream dy_name; dy_name <<
"h_derivative_y_" << view <<
"_" <<
run_number <<
"_" <<
event_number;
455 std::stringstream cornerScore_name; cornerScore_name <<
"h_cornerScore_" << view <<
"_" <<
run_number <<
"_" <<
event_number;
456 std::stringstream maxSuppress_name; maxSuppress_name <<
"h_maxSuppress_" << view <<
"_" <<
run_number <<
"_" <<
event_number;
458 TH2F conversion_histo(conversion_name.str().c_str(),
"Image Conversion Histogram",
459 converted_x_bins,x_min,x_max,
460 converted_y_bins,y_min,y_max);
462 TH2F derivativeX_histo(dx_name.str().c_str(),
"Partial Derivatives (x)",
463 converted_x_bins,x_min,x_max,
464 converted_y_bins,y_min,y_max);
466 TH2F derivativeY_histo(dy_name.str().c_str(),
"Partial Derivatives (y)",
467 converted_x_bins,x_min,x_max,
468 converted_y_bins,y_min,y_max);
470 TH2D cornerScore_histo(cornerScore_name.str().c_str(),
"Corner Score",
471 converted_x_bins,x_min,x_max,
472 converted_y_bins,y_min,y_max);
474 TH2D maxSuppress_histo(maxSuppress_name.str().c_str(),
"Corner Points (Maximum Suppressed)",
475 converted_x_bins,x_min,x_max,
476 converted_y_bins,y_min,y_max);
488 std::vector<geo::WireID>
const& wireIDs,
490 std::vector<recob::EndPoint2D> & corner_vector)
492 const int x_bins = h_wire_data.GetNbinsX();
493 const float x_min = h_wire_data.GetXaxis()->GetBinLowEdge(1);
494 const float x_max = h_wire_data.GetXaxis()->GetBinUpEdge(x_bins);
496 const int y_bins = h_wire_data.GetNbinsY();
497 const float y_min = h_wire_data.GetYaxis()->GetBinLowEdge(1);
498 const float y_max = h_wire_data.GetYaxis()->GetBinUpEdge(y_bins);
503 std::stringstream conversion_name; conversion_name <<
"h_conversion_" << view <<
"_" <<
run_number <<
"_" <<
event_number;
504 std::stringstream dx_name; dx_name <<
"h_derivative_x_" << view <<
"_" <<
run_number <<
"_" <<
event_number;
505 std::stringstream dy_name; dy_name <<
"h_derivative_y_" << view <<
"_" <<
run_number <<
"_" <<
event_number;
506 std::stringstream cornerScore_name; cornerScore_name <<
"h_cornerScore_" << view <<
"_" <<
run_number <<
"_" <<
event_number;
507 std::stringstream maxSuppress_name; maxSuppress_name <<
"h_maxSuppress_" << view <<
"_" <<
run_number <<
"_" <<
event_number;
509 TH2F h_conversion (conversion_name.str().c_str(),
510 "Image Conversion Histogram",
511 converted_x_bins,x_min,x_max,
512 converted_y_bins,y_min,y_max);
513 TH2F h_derivative_x(dx_name.str().c_str(),
514 "Partial Derivatives (x)",
515 converted_x_bins,x_min,x_max,
516 converted_y_bins,y_min,y_max);
517 TH2F h_derivative_y(dy_name.str().c_str(),
518 "Partial Derivatives (y)",
519 converted_x_bins,x_min,x_max,
520 converted_y_bins,y_min,y_max);
521 TH2D h_cornerScore (cornerScore_name.str().c_str(),
522 "Feature Point Corner Score",
523 converted_x_bins,x_min,x_max,
524 converted_y_bins,y_min,y_max);
525 TH2D h_maxSuppress (maxSuppress_name.str().c_str(),
526 "Corner Points (Maximum Suppressed)",
527 converted_x_bins,x_min,x_max,
528 converted_y_bins,y_min,y_max);
536 std::stringstream LI_name; LI_name <<
"h_lineIntegralScore_" << view <<
"_" <<
run_number <<
"_" <<
event_number;
537 TH2F h_lineIntegralScore(LI_name.str().c_str(),
538 "Line Integral Score",
550 double temp_integral=0;
552 const TF2 fConversion_TF2(
"fConversion_func",
fConversion_func.c_str(),-20,20,-20,20);
554 for(
int ix=1; ix<=h_conversion.GetNbinsX(); ix++){
555 for(
int iy=1; iy<=h_conversion.GetNbinsY(); iy++){
557 temp_integral = h_wire_data.Integral(ix,ix,iy,iy);
564 h_conversion.SetBinContent(ix,iy,temp_integral);
571 temp_integral += h_wire_data.GetBinContent(jx,jy)*fConversion_TF2.Eval(ix-jx,iy-jy);
574 h_conversion.SetBinContent(ix,iy,temp_integral);
579 if( (temp_integral > h_wire_data.GetBinContent(ix-1,iy) && temp_integral > h_wire_data.GetBinContent(ix+1,iy))
580 || (temp_integral > h_wire_data.GetBinContent(ix,iy-1) && temp_integral > h_wire_data.GetBinContent(ix,iy+1)))
581 h_conversion.SetBinContent(ix,iy,temp_integral);
587 if( (temp_integral > h_wire_data.GetBinContent(ix-1,iy) && temp_integral > h_wire_data.GetBinContent(ix+1,iy))
588 || (temp_integral > h_wire_data.GetBinContent(ix,iy-1) && temp_integral > h_wire_data.GetBinContent(ix,iy+1)))
594 h_conversion.SetBinContent(ix,iy,temp_integral);
610 const int x_bins = h_conversion.GetNbinsX();
611 const int y_bins = h_conversion.GetNbinsY();
619 h_derivative_x.SetBinContent(ix,iy,
620 0.5*(h_conversion.GetBinContent(ix+1,iy)-h_conversion.GetBinContent(ix-1,iy))
621 + 0.25*(h_conversion.GetBinContent(ix+1,iy+1)-h_conversion.GetBinContent(ix-1,iy+1))
622 + 0.25*(h_conversion.GetBinContent(ix+1,iy-1)-h_conversion.GetBinContent(ix-1,iy-1)));
623 h_derivative_y.SetBinContent(ix,iy,
624 0.5*(h_conversion.GetBinContent(ix,iy+1)-h_conversion.GetBinContent(ix,iy-1))
625 + 0.25*(h_conversion.GetBinContent(ix-1,iy+1)-h_conversion.GetBinContent(ix-1,iy-1))
626 + 0.25*(h_conversion.GetBinContent(ix+1,iy+1)-h_conversion.GetBinContent(ix+1,iy-1)));
629 h_derivative_x.SetBinContent(ix,iy,
630 12*(h_conversion.GetBinContent(ix+1,iy)-h_conversion.GetBinContent(ix-1,iy))
631 + 8*(h_conversion.GetBinContent(ix+1,iy+1)-h_conversion.GetBinContent(ix-1,iy+1))
632 + 8*(h_conversion.GetBinContent(ix+1,iy-1)-h_conversion.GetBinContent(ix-1,iy-1))
633 + 2*(h_conversion.GetBinContent(ix+1,iy+2)-h_conversion.GetBinContent(ix-1,iy+2))
634 + 2*(h_conversion.GetBinContent(ix+1,iy-2)-h_conversion.GetBinContent(ix-1,iy-2))
635 + 6*(h_conversion.GetBinContent(ix+2,iy)-h_conversion.GetBinContent(ix-2,iy))
636 + 4*(h_conversion.GetBinContent(ix+2,iy+1)-h_conversion.GetBinContent(ix-2,iy+1))
637 + 4*(h_conversion.GetBinContent(ix+2,iy-1)-h_conversion.GetBinContent(ix-2,iy-1))
638 + 1*(h_conversion.GetBinContent(ix+2,iy+2)-h_conversion.GetBinContent(ix-2,iy+2))
639 + 1*(h_conversion.GetBinContent(ix+2,iy-2)-h_conversion.GetBinContent(ix-2,iy-2)));
640 h_derivative_y.SetBinContent(ix,iy,
641 12*(h_conversion.GetBinContent(ix,iy+1)-h_conversion.GetBinContent(ix,iy-1))
642 + 8*(h_conversion.GetBinContent(ix-1,iy+1)-h_conversion.GetBinContent(ix-1,iy-1))
643 + 8*(h_conversion.GetBinContent(ix+1,iy+1)-h_conversion.GetBinContent(ix+1,iy-1))
644 + 2*(h_conversion.GetBinContent(ix-2,iy+1)-h_conversion.GetBinContent(ix-2,iy-1))
645 + 2*(h_conversion.GetBinContent(ix+2,iy+1)-h_conversion.GetBinContent(ix+2,iy-1))
646 + 6*(h_conversion.GetBinContent(ix,iy+2)-h_conversion.GetBinContent(ix,iy-2))
647 + 4*(h_conversion.GetBinContent(ix-1,iy+2)-h_conversion.GetBinContent(ix-1,iy-2))
648 + 4*(h_conversion.GetBinContent(ix+1,iy+2)-h_conversion.GetBinContent(ix+1,iy-2))
649 + 1*(h_conversion.GetBinContent(ix-2,iy+2)-h_conversion.GetBinContent(ix-2,iy-2))
650 + 1*(h_conversion.GetBinContent(ix+2,iy+2)-h_conversion.GetBinContent(ix+2,iy-2)));
653 mf::LogError(
"CornerFinderAlg") <<
"Sobel derivative not supported for neighborhoods > 2.";
662 h_derivative_x.SetBinContent(ix,iy,
663 (h_conversion.GetBinContent(ix+1,iy)-h_conversion.GetBinContent(ix-1,iy)));
664 h_derivative_y.SetBinContent(ix,iy,
665 (h_conversion.GetBinContent(ix,iy+1)-h_conversion.GetBinContent(ix,iy-1)));
668 mf::LogError(
"CornerFinderAlg") <<
"Local derivative not yet supported for neighborhoods > 1.";
674 mf::LogError(
"CornerFinderAlg") <<
"Bad derivative algorithm! " <<
fDerivative_method;
683 float func_blur[11][11];
684 func_blur[0][0] = 0.000000;
685 func_blur[0][1] = 0.000000;
686 func_blur[0][2] = 0.000000;
687 func_blur[0][3] = 0.000001;
688 func_blur[0][4] = 0.000002;
689 func_blur[0][5] = 0.000004;
690 func_blur[0][6] = 0.000002;
691 func_blur[0][7] = 0.000001;
692 func_blur[0][8] = 0.000000;
693 func_blur[0][9] = 0.000000;
694 func_blur[0][10] = 0.000000;
695 func_blur[1][0] = 0.000000;
696 func_blur[1][1] = 0.000000;
697 func_blur[1][2] = 0.000004;
698 func_blur[1][3] = 0.000045;
699 func_blur[1][4] = 0.000203;
700 func_blur[1][5] = 0.000335;
701 func_blur[1][6] = 0.000203;
702 func_blur[1][7] = 0.000045;
703 func_blur[1][8] = 0.000004;
704 func_blur[1][9] = 0.000000;
705 func_blur[1][10] = 0.000000;
706 func_blur[2][0] = 0.000000;
707 func_blur[2][1] = 0.000004;
708 func_blur[2][2] = 0.000123;
709 func_blur[2][3] = 0.001503;
710 func_blur[2][4] = 0.006738;
711 func_blur[2][5] = 0.011109;
712 func_blur[2][6] = 0.006738;
713 func_blur[2][7] = 0.001503;
714 func_blur[2][8] = 0.000123;
715 func_blur[2][9] = 0.000004;
716 func_blur[2][10] = 0.000000;
717 func_blur[3][0] = 0.000001;
718 func_blur[3][1] = 0.000045;
719 func_blur[3][2] = 0.001503;
720 func_blur[3][3] = 0.018316;
721 func_blur[3][4] = 0.082085;
722 func_blur[3][5] = 0.135335;
723 func_blur[3][6] = 0.082085;
724 func_blur[3][7] = 0.018316;
725 func_blur[3][8] = 0.001503;
726 func_blur[3][9] = 0.000045;
727 func_blur[3][10] = 0.000001;
728 func_blur[4][0] = 0.000002;
729 func_blur[4][1] = 0.000203;
730 func_blur[4][2] = 0.006738;
731 func_blur[4][3] = 0.082085;
732 func_blur[4][4] = 0.367879;
733 func_blur[4][5] = 0.606531;
734 func_blur[4][6] = 0.367879;
735 func_blur[4][7] = 0.082085;
736 func_blur[4][8] = 0.006738;
737 func_blur[4][9] = 0.000203;
738 func_blur[4][10] = 0.000002;
739 func_blur[5][0] = 0.000004;
740 func_blur[5][1] = 0.000335;
741 func_blur[5][2] = 0.011109;
742 func_blur[5][3] = 0.135335;
743 func_blur[5][4] = 0.606531;
744 func_blur[5][5] = 1.000000;
745 func_blur[5][6] = 0.606531;
746 func_blur[5][7] = 0.135335;
747 func_blur[5][8] = 0.011109;
748 func_blur[5][9] = 0.000335;
749 func_blur[5][10] = 0.000004;
750 func_blur[6][0] = 0.000002;
751 func_blur[6][1] = 0.000203;
752 func_blur[6][2] = 0.006738;
753 func_blur[6][3] = 0.082085;
754 func_blur[6][4] = 0.367879;
755 func_blur[6][5] = 0.606531;
756 func_blur[6][6] = 0.367879;
757 func_blur[6][7] = 0.082085;
758 func_blur[6][8] = 0.006738;
759 func_blur[6][9] = 0.000203;
760 func_blur[6][10] = 0.000002;
761 func_blur[7][0] = 0.000001;
762 func_blur[7][1] = 0.000045;
763 func_blur[7][2] = 0.001503;
764 func_blur[7][3] = 0.018316;
765 func_blur[7][4] = 0.082085;
766 func_blur[7][5] = 0.135335;
767 func_blur[7][6] = 0.082085;
768 func_blur[7][7] = 0.018316;
769 func_blur[7][8] = 0.001503;
770 func_blur[7][9] = 0.000045;
771 func_blur[7][10] = 0.000001;
772 func_blur[8][0] = 0.000000;
773 func_blur[8][1] = 0.000004;
774 func_blur[8][2] = 0.000123;
775 func_blur[8][3] = 0.001503;
776 func_blur[8][4] = 0.006738;
777 func_blur[8][5] = 0.011109;
778 func_blur[8][6] = 0.006738;
779 func_blur[8][7] = 0.001503;
780 func_blur[8][8] = 0.000123;
781 func_blur[8][9] = 0.000004;
782 func_blur[8][10] = 0.000000;
783 func_blur[9][0] = 0.000000;
784 func_blur[9][1] = 0.000000;
785 func_blur[9][2] = 0.000004;
786 func_blur[9][3] = 0.000045;
787 func_blur[9][4] = 0.000203;
788 func_blur[9][5] = 0.000335;
789 func_blur[9][6] = 0.000203;
790 func_blur[9][7] = 0.000045;
791 func_blur[9][8] = 0.000004;
792 func_blur[9][9] = 0.000000;
793 func_blur[9][10] = 0.000000;
794 func_blur[10][0] = 0.000000;
795 func_blur[10][1] = 0.000000;
796 func_blur[10][2] = 0.000000;
797 func_blur[10][3] = 0.000001;
798 func_blur[10][4] = 0.000002;
799 func_blur[10][5] = 0.000004;
800 func_blur[10][6] = 0.000002;
801 func_blur[10][7] = 0.000001;
802 func_blur[10][8] = 0.000000;
803 func_blur[10][9] = 0.000000;
804 func_blur[10][10] = 0.000000;
806 double temp_integral_x = 0;
807 double temp_integral_y = 0;
812 mf::LogWarning(
"CornerFinderAlg") <<
"WARNING...BlurNeighborhoods>10 not currently allowed. Shrinking to 10.";
816 TH2F *h_clone_derivative_x = (TH2F*)h_derivative_x.Clone(
"h_clone_derivative_x");
817 TH2F *h_clone_derivative_y = (TH2F*)h_derivative_y.Clone(
"h_clone_derivative_y");
822 for(
int ix=1; ix<=h_derivative_x.GetNbinsX(); ix++){
823 for(
int iy=1; iy<=h_derivative_y.GetNbinsY(); iy++){
830 temp_integral_x += h_clone_derivative_x->GetBinContent(jx,jy)*func_blur[(ix-jx)+5][(iy-jy)+5];
831 temp_integral_y += h_clone_derivative_y->GetBinContent(jx,jy)*func_blur[(ix-jx)+5][(iy-jy)+5];
834 h_derivative_x.SetBinContent(ix,iy,temp_integral_x);
835 h_derivative_y.SetBinContent(ix,iy,temp_integral_y);
840 delete h_clone_derivative_x;
841 delete h_clone_derivative_y;
855 const int x_bins = h_derivative_x.GetNbinsX();
856 const int y_bins = h_derivative_y.GetNbinsY();
859 double st_xx = 0., st_xy = 0., st_yy = 0.;
865 st_xx=0.; st_xy=0.; st_yy=0.;
870 st_xx += h_derivative_x.GetBinContent(jx,jy)*h_derivative_x.GetBinContent(jx,jy);
871 st_yy += h_derivative_y.GetBinContent(jx,jy)*h_derivative_y.GetBinContent(jx,jy);
872 st_xy += h_derivative_x.GetBinContent(jx,jy)*h_derivative_y.GetBinContent(jx,jy);
882 st_xx -= h_derivative_x.GetBinContent(ix-fCornerScore_neighborhood-1,jy)*h_derivative_x.GetBinContent(ix-fCornerScore_neighborhood-1,jy);
883 st_xx += h_derivative_x.GetBinContent(ix+fCornerScore_neighborhood,jy)*h_derivative_x.GetBinContent(ix+fCornerScore_neighborhood,jy);
885 st_yy -= h_derivative_y.GetBinContent(ix-fCornerScore_neighborhood-1,jy)*h_derivative_y.GetBinContent(ix-fCornerScore_neighborhood-1,jy);
886 st_yy += h_derivative_y.GetBinContent(ix+fCornerScore_neighborhood,jy)*h_derivative_y.GetBinContent(ix+fCornerScore_neighborhood,jy);
888 st_xy -= h_derivative_x.GetBinContent(ix-fCornerScore_neighborhood-1,jy)*h_derivative_y.GetBinContent(ix-fCornerScore_neighborhood-1,jy);
889 st_xy += h_derivative_x.GetBinContent(ix+fCornerScore_neighborhood,jy)*h_derivative_y.GetBinContent(ix+fCornerScore_neighborhood,jy);
894 h_cornerScore.SetBinContent(ix,iy,
898 h_cornerScore.SetBinContent(ix,iy,
914 std::vector<recob::EndPoint2D>
916 std::vector<geo::WireID> wireIDs,
918 TH2D & h_maxSuppress,
922 std::vector<recob::EndPoint2D> corner_vector;
923 const int x_bins = h_cornerScore.GetNbinsX();
924 const int y_bins = h_cornerScore.GetNbinsY();
926 for(
int iy=1; iy<=y_bins; iy++){
927 for(
int ix=1; ix<=x_bins; ix++){
932 double temp_max = -1000;
933 double temp_center_bin =
false;
938 if(h_cornerScore.GetBinContent(jx,jy) > temp_max){
939 temp_max = h_cornerScore.GetBinContent(jx,jy);
940 if(jx==ix && jy==iy) temp_center_bin=
true;
941 else{ temp_center_bin=
false; }
954 wireIDs[wire_number],
955 h_cornerScore.GetBinContent(ix,iy),
959 corner_vector.push_back(corner);
961 h_maxSuppress.SetBinContent(ix,iy,h_cornerScore.GetBinContent(ix,iy));
966 return corner_vector;
973 int x1 = hist.GetXaxis()->FindBin( begin_x );
974 int y1 = hist.GetYaxis()->FindBin( begin_y );
975 int x2 = hist.GetXaxis()->FindBin( end_x );
976 int y2 = hist.GetYaxis()->FindBin( end_y );
978 if(x1==x2 &&
abs(y1-y2)<1
e-5)
991 float slope = (y2-y1)/((
float)(x2-x1));
993 for(
int ix=x1; ix<=x2; ix++){
998 y_min = y1 + slope*(ix-x1);
999 y_max = y1 + slope*(ix+1-x1);
1002 y_max = (y1+1) + slope*(ix-x1);
1003 y_min = (y1+1) + slope*(ix+1-x1);
1006 for(
int iy=y_min; iy<=y_max; iy++){
1009 if( hist.GetBinContent(ix,iy) > threshold )
1018 for(
int iy=y_min; iy<=y_max; iy++){
1020 if( hist.GetBinContent(x1,iy) > threshold)
1026 return fraction/bin_counter;
1033 std::vector<recob::EndPoint2D>
const & corner_vector,
1034 std::vector<recob::EndPoint2D> & corner_lineIntegralScore_vector,
1035 TH2F & h_lineIntegralScore)
const {
1037 for(
auto const i_corner : corner_vector){
1041 for(
auto const j_corner : corner_vector){
1045 i_corner.WireID().Wire,i_corner.DriftTime(),
1046 j_corner.WireID().Wire,j_corner.DriftTime(),
1061 corner_lineIntegralScore_vector.push_back(corner);
1064 h_lineIntegralScore.SetBinContent(h_wire_data.GetXaxis()->FindBin(i_corner.WireID().Wire),
1065 h_wire_data.GetYaxis()->FindBin(i_corner.DriftTime()),
std::string fDerivative_BlurFunc
std::vector< std::tuple< int, TH2F, int, int > > WireData_trimmed_histos
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)
Encapsulate the construction of a single cyostat.
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
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 &)
BEGIN_PROLOG or score(default)}sbnd_crttrackmatchingalg_crID
std::string fCalDataModuleLabel
void InitializeGeometry(geo::Geometry const &)
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
TH2F const & GetWireDataHist(unsigned int) const
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
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.
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
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.
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
algorithm to find feature 2D points
CornerFinderAlg(fhicl::ParameterSet const &pset)
float fCornerScore_Noble_epsilon
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
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.
std::string fDerivative_method
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
std::vector< TH1D > WireData_histos_ProjectionX
int fConversion_bins_per_input_x
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
float fConversion_threshold
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
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
int fMaxSuppress_threshold
int fConversion_bins_per_input_y
int fConversion_func_neighborhood
art framework interface to geometry description
Encapsulate the construction of a single detector plane.
float fTrimming_threshold