1 #define BOOST_TEST_MODULE ( OpFlashAlg_test ) 2 #include "boost/test/unit_test.hpp" 11 BOOST_AUTO_TEST_SUITE(OpFlashAlg_test)
31 const size_t vector_size = 1;
32 const double PE_base = 10;
34 unsigned int AccumIndex = 0;
35 unsigned int HitIndex = 0;
37 std::vector<double> Binned(vector_size,PE_base);
38 std::vector< std::vector<int> > Contributors(vector_size);
39 std::vector<int> FlashesInAccumulator;
42 Binned,Contributors,FlashesInAccumulator);
44 BOOST_TEST( Contributors.at(AccumIndex).size() == 1U);
45 BOOST_TEST( Contributors.at(AccumIndex).at(0) == (
int)HitIndex );
46 BOOST_TEST( Binned.at(AccumIndex) == PE+PE_base );
47 BOOST_TEST( FlashesInAccumulator.size() == 0U);
53 const size_t vector_size = 1;
54 const double PE_base = 10;
56 unsigned int AccumIndex = 0;
57 unsigned int HitIndex = 0;
59 std::vector<double> Binned(vector_size,PE_base);
60 std::vector< std::vector<int> > Contributors(vector_size);
61 std::vector<int> FlashesInAccumulator;
64 Binned,Contributors,FlashesInAccumulator);
66 BOOST_TEST( Contributors.at(AccumIndex).size() == 1U);
67 BOOST_TEST( Contributors.at(AccumIndex).at(0) == (
int)HitIndex );
68 BOOST_TEST( Binned.at(AccumIndex) == PE+PE_base );
69 BOOST_TEST( FlashesInAccumulator.size() == 1U);
75 const size_t vector_size = 1;
76 const double PE_base = 10;
78 unsigned int AccumIndex = 0;
79 unsigned int HitIndex = 0;
81 std::vector<double> Binned(vector_size,PE_base);
82 std::vector< std::vector<int> > Contributors(vector_size);
83 std::vector<int> FlashesInAccumulator;
86 Binned,Contributors,FlashesInAccumulator);
88 BOOST_TEST( Contributors.at(AccumIndex).size() == 1U);
89 BOOST_TEST( Contributors.at(AccumIndex).at(0) == (
int)HitIndex );
90 BOOST_TEST( Binned.at(AccumIndex) == PE+PE_base );
91 BOOST_TEST( FlashesInAccumulator.size() == 0U);
94 unsigned int HitIndex2 = 1;
96 Binned,Contributors,FlashesInAccumulator);
98 BOOST_TEST( Contributors.at(AccumIndex).size() == 2U);
99 BOOST_TEST( Contributors.at(AccumIndex).at(0) == (
int)HitIndex );
100 BOOST_TEST( Contributors.at(AccumIndex).at(1) == (
int)HitIndex2 );
101 BOOST_TEST( Binned.at(AccumIndex) == PE*2+PE_base );
102 BOOST_TEST( FlashesInAccumulator.size() == 1U);
108 const size_t vector_size = 10;
109 const double PE_vals = 10;
111 std::vector<double> BinnedPE(vector_size,PE_vals);
112 std::vector<int> FlashesInAccumulator;
113 std::map<double, std::map<int,std::vector<int> >, std::greater<double> > FlashesBySize;
117 BOOST_TEST( FlashesBySize.size() == 0U );
123 const size_t vector_size = 10;
124 const double PE_vals = 10;
126 std::vector<double> BinnedPE(vector_size,PE_vals);
129 std::vector<int> FlashesInAccumulator(1,2);
131 std::map<double, std::map<int,std::vector<int> >, std::greater<double> > FlashesBySize;
135 BOOST_TEST( FlashesBySize.size() == 1U );
136 BOOST_TEST( FlashesBySize.count(50) == 1U );
137 BOOST_TEST( FlashesBySize.count(10) == 0U );
138 BOOST_TEST( FlashesBySize[50].
size() == 1U );
139 BOOST_TEST( FlashesBySize[50].
count(1) == 1U );
140 BOOST_TEST( FlashesBySize[50][1].
size() == 1U );
141 BOOST_TEST( FlashesBySize[50][1][0] == 2 );
147 const size_t vector_size = 10;
148 const double PE_vals = 10;
150 std::vector<double> BinnedPE(vector_size,PE_vals);
154 std::vector<int> FlashesInAccumulator { 2, 8 };
156 std::map<double, std::map<int,std::vector<int> >, std::greater<double> > FlashesBySize;
160 BOOST_TEST( FlashesBySize.size() == 1U );
161 BOOST_TEST( FlashesBySize.count(50) == 1U );
162 BOOST_TEST( FlashesBySize.count(10) == 0U );
164 BOOST_TEST( FlashesBySize[50].
size() == 1U );
165 BOOST_TEST( FlashesBySize[50].
count(1) == 1U );
166 BOOST_TEST( FlashesBySize[50][1].
size() == 2U );
167 BOOST_TEST( FlashesBySize[50][1][0] == 2 );
168 BOOST_TEST( FlashesBySize[50][1][1] == 8 );
174 const size_t vector_size = 10;
175 const double PE_vals = 10;
177 std::vector<double> BinnedPE1(vector_size,PE_vals);
180 std::vector<double> BinnedPE2(vector_size,PE_vals);
183 std::vector<int> FlashesInAccumulator1 { 2, 5 };
184 std::vector<int> FlashesInAccumulator2(1,8);
186 std::map<double, std::map<int,std::vector<int> >, std::greater<double> > FlashesBySize;
191 BOOST_TEST( FlashesBySize.size() == 2U );
193 BOOST_TEST( FlashesBySize.count(50) == 1U );
194 BOOST_TEST( FlashesBySize.count(60) == 1U );
195 BOOST_TEST( FlashesBySize.count(10) == 0U );
197 auto map_begin = FlashesBySize.begin();
198 BOOST_TEST( map_begin->first == 60 );
200 auto map_last = FlashesBySize.end();
202 BOOST_TEST( map_last->first == 50 );
204 BOOST_TEST( FlashesBySize[50].
size() == 2U );
205 BOOST_TEST( FlashesBySize[50].
count(1) == 1U );
206 BOOST_TEST( FlashesBySize[50].
count(2) == 1U );
208 BOOST_TEST( FlashesBySize[50][1].
size() == 1U );
209 BOOST_TEST( FlashesBySize[50][1][0] == 2 );
210 BOOST_TEST( FlashesBySize[50][2].
size() == 1U );
211 BOOST_TEST( FlashesBySize[50][2][0] == 8 );
213 BOOST_TEST( FlashesBySize[60].
size() == 1U );
214 BOOST_TEST( FlashesBySize[60].
count(1) == 1U );
215 BOOST_TEST( FlashesBySize[60].
count(2) == 0U );
216 BOOST_TEST( FlashesBySize[60][1].
size() == 1U );
217 BOOST_TEST( FlashesBySize[60][1][0] == 5 );
225 const size_t vector_size = 1;
226 std::vector< std::vector<int> > Contributors(vector_size);
229 std::vector<int> HitClaimedByFlash(NHits,-1);
230 std::vector<int> HitsThisFlash;
237 BOOST_TEST( HitsThisFlash.size() == 0U);
245 const size_t vector_size = 1;
246 std::vector< std::vector<int> > Contributors(vector_size);
248 Contributors[0].push_back(1); Contributors[0].push_back(3);
250 std::vector<int> HitClaimedByFlash(NHits,-1);
251 std::vector<int> HitsThisFlash;
258 BOOST_TEST( HitsThisFlash.size() == 2U );
259 BOOST_TEST( HitsThisFlash[0] == 1 );
260 BOOST_TEST( HitsThisFlash[1] == 3 );
268 const size_t vector_size = 1;
269 std::vector< std::vector<int> > Contributors(vector_size);
271 Contributors[0].push_back(1); Contributors[0].push_back(3);
273 std::vector<int> HitClaimedByFlash(NHits,-1);
274 HitClaimedByFlash[1] = 0;
275 HitClaimedByFlash[2] = 1;
276 std::vector<int> HitsThisFlash;
283 BOOST_TEST( HitsThisFlash.size() == 1U );
284 BOOST_TEST( HitsThisFlash[0] == 3 );
292 const size_t vector_size = 2;
293 std::vector< std::vector<int> > Contributors(vector_size);
294 Contributors[0].push_back(1); Contributors[0].push_back(3);
295 Contributors[1].push_back(5); Contributors[1].push_back(6);
297 std::vector<int> HitClaimedByFlash(NHits,-1);
298 HitClaimedByFlash[1] = 0;
299 HitClaimedByFlash[2] = 1;
300 std::vector<int> HitsThisFlash;
307 BOOST_TEST( HitsThisFlash.size() == 2U );
308 BOOST_TEST( HitsThisFlash[0] == 5 );
309 BOOST_TEST( HitsThisFlash[1] == 6 );
319 for(
size_t i=0; i<NHits; i++)
320 HitVector.emplace_back(0,0,0,0,0,0,0,hit_pe,0);
322 std::vector<int> HitsThisFlash;
323 std::vector< std::vector<int> > HitsPerFlash;
325 std::vector<int> HitClaimedByFlash(NHits,-1);
333 BOOST_TEST( HitsPerFlash.size() == 0U);
334 BOOST_TEST( HitClaimedByFlash[0] == -1);
344 for(
size_t i=0; i<NHits; i++)
345 HitVector.emplace_back(0,0,0,0,0,0,0,hit_pe,0);
347 std::vector<int> HitsThisFlash(1,0);
348 std::vector< std::vector<int> > HitsPerFlash;
350 std::vector<int> HitClaimedByFlash(NHits,-1);
358 BOOST_TEST( HitsPerFlash.size() == 0U);
359 BOOST_TEST( HitClaimedByFlash[0] == -1);
369 for(
size_t i=0; i<NHits; i++)
370 HitVector.emplace_back(0,0,0,0,0,0,0,hit_pe,0);
372 std::vector<int> HitsThisFlash(1,0);
373 std::vector< std::vector<int> > HitsPerFlash;
375 std::vector<int> HitClaimedByFlash(NHits,-1);
383 BOOST_TEST( HitsPerFlash.size() == 1U);
384 BOOST_TEST( HitsPerFlash[0][0] == 0);
385 BOOST_TEST( HitClaimedByFlash[0] == 0);
395 for(
size_t i=0; i<NHits; i++)
396 HitVector.emplace_back(0,0,0,0,0,0,0,hit_pe,0);
398 std::vector<int> HitsThisFlash(1,0);
399 std::vector< std::vector<int> > HitsPerFlash;
401 std::vector<int> HitClaimedByFlash(NHits,-1);
409 BOOST_TEST( HitsPerFlash.size() == 1U);
410 BOOST_TEST( HitsPerFlash[0][0] == 0);
411 BOOST_TEST( HitClaimedByFlash[0] == 0);
412 BOOST_TEST( HitClaimedByFlash[1] == -1);
422 for(
size_t i=0; i<NHits; i++)
423 HitVector.emplace_back(0,0,0,0,0,0,0,hit_pe,0);
425 std::vector<int> HitsThisFlash;
426 HitsThisFlash.push_back(0); HitsThisFlash.push_back(1);
427 std::vector< std::vector<int> > HitsPerFlash;
429 std::vector<int> HitClaimedByFlash(NHits,-1);
437 BOOST_TEST( HitsPerFlash.size() == 0U);
438 BOOST_TEST( HitClaimedByFlash[0] == -1);
439 BOOST_TEST( HitClaimedByFlash[1] == -1);
449 for(
size_t i=0; i<NHits; i++)
450 HitVector.emplace_back(0,0,0,0,0,0,0,hit_pe,0);
452 std::vector<int> HitsThisFlash;
453 HitsThisFlash.push_back(0); HitsThisFlash.push_back(1);
454 std::vector< std::vector<int> > HitsPerFlash;
456 std::vector<int> HitClaimedByFlash(NHits,-1);
464 BOOST_TEST( HitsPerFlash.size() == 1U);
465 BOOST_TEST( HitsPerFlash[0][0] == 0);
466 BOOST_TEST( HitsPerFlash[0][1] == 1);
467 BOOST_TEST( HitClaimedByFlash[0] == 0);
468 BOOST_TEST( HitClaimedByFlash[1] == 0);
476 std::vector<int> HitsThisRefinedFlash;
477 double PEAccumulated=0, FlashMaxTime=0, FlashMinTime=0;
480 double peak_time = 0;
483 for(
size_t i=0; i<NHits; i++){
484 HitVector.emplace_back(0,peak_time,0,0,width,0,0,hit_pe,0);
489 std::map<double, std::vector<int>, std::greater<double> > HitsBySize;
490 for(
size_t i=0; i<NHits; i++)
491 HitsBySize[HitVector.at(i).PE()].push_back(i);
493 std::vector<bool> HitsUsed(NHits,
true);
498 HitsThisRefinedFlash,
503 BOOST_TEST( HitsThisRefinedFlash.size() == 0U );
504 BOOST_TEST(
std::count(HitsUsed.begin(),HitsUsed.end(),
true) == (
int)NHits);
505 BOOST_TEST( PEAccumulated == 0 );
506 BOOST_TEST( FlashMaxTime == 0 );
507 BOOST_TEST( FlashMinTime == 0 );
516 std::vector<int> HitsThisRefinedFlash;
517 double PEAccumulated=0, FlashMaxTime=0, FlashMinTime=0;
520 double peak_time = 0;
523 for(
size_t i=0; i<NHits; i++){
524 HitVector.emplace_back(0,peak_time,0,0,width,0,0,hit_pe,0);
529 std::map<double, std::vector<int>, std::greater<double> > HitsBySize;
530 for(
size_t i=0; i<NHits; i++)
531 HitsBySize[HitVector.at(i).PE()].push_back(i);
533 std::vector<bool> HitsUsed(NHits,
false);
538 HitsThisRefinedFlash,
543 BOOST_TEST( HitsThisRefinedFlash.size() == 1U );
544 BOOST_TEST(
std::count(HitsUsed.begin(),HitsUsed.end(),
true) == 1);
545 BOOST_TEST( HitsUsed.at(NHits-1) ==
true);
546 BOOST_TEST( PEAccumulated == 60 );
547 BOOST_TEST( FlashMaxTime == 9. );
548 BOOST_TEST( FlashMinTime == -1. );
557 std::vector<int> HitsThisRefinedFlash;
558 double PEAccumulated=0, FlashMaxTime=0, FlashMinTime=0;
561 double peak_time = 0;
564 for(
size_t i=0; i<NHits; i++){
565 HitVector.emplace_back(0,peak_time,0,0,width,0,0,hit_pe,0);
570 std::map<double, std::vector<int>, std::greater<double> > HitsBySize;
571 for(
size_t i=0; i<NHits; i++)
572 HitsBySize[HitVector.at(i).PE()].push_back(i);
574 std::vector<bool> HitsUsed(NHits,
false);
575 HitsUsed[NHits-1] =
true;
580 HitsThisRefinedFlash,
585 BOOST_TEST( HitsThisRefinedFlash.size() == 1U );
586 BOOST_TEST(
std::count(HitsUsed.begin(),HitsUsed.end(),
true) == 2);
587 BOOST_TEST( HitsUsed.at(NHits-1) ==
true);
588 BOOST_TEST( HitsUsed.at(NHits-2) ==
true);
589 BOOST_TEST( PEAccumulated == 50 );
590 BOOST_TEST( FlashMaxTime == 8. );
591 BOOST_TEST( FlashMinTime == -2. );
600 std::vector<int> HitsThisRefinedFlash;
601 double PEAccumulated=0, FlashMaxTime=0, FlashMinTime=0;
604 double peak_time = 0;
607 for(
size_t i=0; i<NHits; i++){
608 HitVector.emplace_back(0,peak_time,0,0,width,0,0,hit_pe,0);
613 std::map<double, std::vector<int>, std::greater<double> > HitsBySize;
614 for(
size_t i=0; i<NHits; i++)
615 HitsBySize[HitVector.at(i).PE()].push_back(i);
616 std::vector<bool> HitsUsed(NHits,
false);
621 HitsThisRefinedFlash,
631 HitsThisRefinedFlash,
636 BOOST_TEST( HitsThisRefinedFlash.size() == 1U );
637 BOOST_TEST(
std::count(HitsUsed.begin(),HitsUsed.end(),
true) == 1);
638 BOOST_TEST( HitsUsed.at(NHits-1) ==
true);
639 BOOST_TEST( PEAccumulated == 60 );
640 BOOST_TEST( FlashMaxTime == 9. );
641 BOOST_TEST( FlashMinTime == -1. );
650 std::vector<int> HitsThisRefinedFlash;
651 double PEAccumulated=0, FlashMaxTime=0, FlashMinTime=0;
654 double peak_time = 0;
657 for(
size_t i=0; i<NHits; i++){
658 HitVector.emplace_back(0,peak_time,0,0,width,0,0,hit_pe,0);
663 std::map<double, std::vector<int>, std::greater<double> > HitsBySize;
664 for(
size_t i=0; i<NHits; i++)
665 HitsBySize[HitVector.at(i).PE()].push_back(i);
666 std::vector<bool> HitsUsed(NHits,
false);
671 HitsThisRefinedFlash,
681 HitsThisRefinedFlash,
686 BOOST_TEST( HitsThisRefinedFlash.size() == 2U );
687 BOOST_TEST(
std::count(HitsUsed.begin(),HitsUsed.end(),
true) == 2);
688 BOOST_TEST( HitsUsed.at(NHits-1) ==
true);
689 BOOST_TEST( HitsUsed.at(NHits-2) ==
true);
690 BOOST_TEST( PEAccumulated == 110 );
691 BOOST_TEST( FlashMaxTime == 9. );
692 BOOST_TEST( FlashMinTime == -2. );
701 std::vector<int> HitsThisRefinedFlash;
702 double PEAccumulated=0, FlashMaxTime=0, FlashMinTime=0;
705 double peak_time = 0;
708 for(
size_t i=0; i<NHits; i++){
709 HitVector.emplace_back(0,peak_time,0,0,width,0,0,hit_pe,0);
714 std::map<double, std::vector<int>, std::greater<double> > HitsBySize;
715 for(
size_t i=0; i<NHits; i++)
716 HitsBySize[HitVector.at(i).PE()].push_back(i);
717 std::vector<bool> HitsUsed(NHits,
false);
722 HitsThisRefinedFlash,
732 HitsThisRefinedFlash,
737 BOOST_TEST( HitsThisRefinedFlash.size() == 1U );
738 BOOST_TEST(
std::count(HitsUsed.begin(),HitsUsed.end(),
true) == 1);
739 BOOST_TEST( HitsUsed.at(NHits-1) ==
true);
740 BOOST_TEST( HitsUsed.at(NHits-2) ==
false);
741 BOOST_TEST( PEAccumulated == 60 );
742 BOOST_TEST( FlashMaxTime == 4.05 );
743 BOOST_TEST( FlashMinTime == 3.95 );
749 std::vector< std::vector<int> > RefinedHitsPerFlash;
751 std::vector<int> HitsThisRefinedFlash{0,1,2};
752 std::vector<bool> HitsUsed{
true,
true,
true,
false,
false};
753 double PEAccumulated = 60;
756 HitsThisRefinedFlash,
761 BOOST_TEST( RefinedHitsPerFlash.size() == 1U );
762 BOOST_TEST( RefinedHitsPerFlash[0].
size() == 3U );
763 BOOST_TEST( RefinedHitsPerFlash[0][0] == 0 );
764 BOOST_TEST( RefinedHitsPerFlash[0][1] == 1 );
765 BOOST_TEST( RefinedHitsPerFlash[0][2] == 2 );
766 BOOST_TEST(
std::count(HitsUsed.begin(),HitsUsed.end(),
true) == 3);
772 std::vector< std::vector<int> > RefinedHitsPerFlash;
774 std::vector<int> HitsThisRefinedFlash{0};
775 std::vector<bool> HitsUsed{
true,
false,
false,
false,
false};
776 double PEAccumulated = 60;
779 HitsThisRefinedFlash,
784 BOOST_TEST( RefinedHitsPerFlash.size() == 1U );
785 BOOST_TEST( RefinedHitsPerFlash[0].
size() == 1U );
786 BOOST_TEST( RefinedHitsPerFlash[0][0] == 0 );
787 BOOST_TEST(
std::count(HitsUsed.begin(),HitsUsed.end(),
true) == 1);
793 std::vector< std::vector<int> > RefinedHitsPerFlash;
795 std::vector<int> HitsThisRefinedFlash{0};
796 std::vector<bool> HitsUsed{
true,
false,
false,
false,
false};
797 double PEAccumulated = 30;
800 HitsThisRefinedFlash,
805 BOOST_TEST( RefinedHitsPerFlash.size() == 0U );
806 BOOST_TEST(
std::count(HitsUsed.begin(),HitsUsed.end(),
true) == 1);
807 BOOST_TEST( HitsUsed[0] ==
true);
813 std::vector< std::vector<int> > RefinedHitsPerFlash;
815 std::vector<int> HitsThisRefinedFlash{0,1,2};
816 std::vector<bool> HitsUsed{
true,
true,
true,
false,
false};
817 double PEAccumulated = 30;
820 HitsThisRefinedFlash,
825 BOOST_TEST( RefinedHitsPerFlash.size() == 0U );
826 BOOST_TEST(
std::count(HitsUsed.begin(),HitsUsed.end(),
true) == 1);
827 BOOST_TEST( HitsUsed[0] ==
true);
828 BOOST_TEST( HitsUsed[1] ==
false);
829 BOOST_TEST( HitsUsed[2] ==
false);
835 double MaxTime = -1e9, MinTime = 1e9;
836 double TotalPE=0, AveTime=0, AveAbsTime=0, FastToTotal=0;
839 std::vector<double> PEs(NOpChannels,0);
842 double peak_time = 1;
845 recob::OpHit currentHit(op_channel,peak_time,0,0,width,0,0,hit_pe,0);
856 BOOST_TEST( MaxTime == peak_time );
857 BOOST_TEST( MinTime == peak_time );
858 BOOST_TEST( AveTime == peak_time*hit_pe );
859 BOOST_TEST( AveAbsTime == 0 );
860 BOOST_TEST( FastToTotal == 0 );
861 BOOST_TEST( TotalPE == hit_pe );
862 BOOST_TEST( PEs.at(op_channel) == hit_pe );
863 BOOST_TEST( PEs.at(4) == 0 );
868 double MaxTime = 1, MinTime = 1;
869 double TotalPE=20, AveTime=20, AveAbsTime=0, FastToTotal=0;
872 std::vector<double> PEs(NOpChannels,0);
876 double peak_time = 5;
879 recob::OpHit currentHit(op_channel,peak_time,0,0,width,0,0,hit_pe,0);
890 BOOST_TEST( MaxTime == peak_time );
891 BOOST_TEST( MinTime == 1 );
892 BOOST_TEST( AveTime == peak_time*hit_pe+20 );
893 BOOST_TEST( AveAbsTime == 0 );
894 BOOST_TEST( FastToTotal == 0 );
895 BOOST_TEST( TotalPE == hit_pe+20 );
896 BOOST_TEST( PEs.at(op_channel) == hit_pe );
897 BOOST_TEST( PEs.at(0) == 20 );
898 BOOST_TEST( PEs.at(4) == 0 );
905 double iPE = 100;
double iTime = 0;
double iWidth=0.5;
906 double jPE = 100;
double jTime = -1;
double jWidth=0.5;
917 double iPE = 100;
double iTime = 0;
double iWidth=0.5;
918 double jPE = 100;
double jTime = 0;
double jWidth=0.5;
929 double iPE = 100;
double iTime = 0;
double iWidth=0.5;
930 double jPE = 10;
double jTime = 1.6;
double jWidth=0.5;
935 double good_result = (jPE - std::exp(-1)*iPE)/(std::sqrt(std::exp(-1)*iPE));
937 BOOST_TEST( result == good_result,
tolerance);
943 double iPE = 100;
double iTime = 0;
double iWidth=0.5;
944 double jPE = 10;
double jTime = 16;
double jWidth=0.5;
949 double good_result = (jPE - std::exp(-10)*iPE)/(std::sqrt(std::exp(-10)*iPE));
951 BOOST_TEST( result == good_result,
tolerance);
957 double iPE = 100;
double iTime = 0;
double iWidth=1;
958 double jPE = 10;
double jTime = 1.6;
double jWidth=0.5;
963 double good_result = (jPE - std::exp(-1)*iPE*0.5)/(std::sqrt(std::exp(-1)*iPE*0.5));
965 BOOST_TEST( result == good_result,
tolerance);
973 std::vector<recob::OpFlash> FlashVector(NFlashes);
974 std::vector<bool> MarkedForRemoval(NFlashes-BeginFlash,
false);
980 BOOST_TEST( MarkedForRemoval.size() == 0U );
989 std::vector<double> PEs(30,0);
991 std::vector<double> WireCenters(3,0);
992 std::vector<double> WireWidths(3,0);
994 std::vector<recob::OpFlash> FlashVector;
995 FlashVector.emplace_back(0,
1009 std::vector<bool> MarkedForRemoval(NFlashes-BeginFlash,
false);
1015 BOOST_TEST( MarkedForRemoval.size() == 1U );
1016 BOOST_TEST( MarkedForRemoval[0] ==
false );
1017 BOOST_TEST( FlashVector.size() == 1U );
1018 BOOST_TEST( FlashVector[0].Time() == 0 );
1019 BOOST_TEST( FlashVector[0].TimeWidth() == 0.5 );
1026 size_t BeginFlash=0;
1028 std::vector<double> PEs(30,0);
1030 std::vector<double> WireCenters(3,0);
1031 std::vector<double> WireWidths(3,0);
1033 std::vector<recob::OpFlash> FlashVector;
1034 FlashVector.emplace_back(0,
1048 FlashVector.emplace_back(1e6,
1062 std::vector<bool> MarkedForRemoval(NFlashes-BeginFlash,
false);
1068 BOOST_TEST( MarkedForRemoval.size() == 2U );
1069 BOOST_TEST( MarkedForRemoval[0] ==
false );
1070 BOOST_TEST( MarkedForRemoval[1] ==
false );
1071 BOOST_TEST( FlashVector.size() == 2U );
1072 BOOST_TEST( FlashVector[0].Time() == 0 );
1073 BOOST_TEST( FlashVector[1].Time() == 1e6 );
1080 size_t BeginFlash=0;
1082 std::vector<double> PEs(30,0);
1084 std::vector<double> PEs_Small(30,0);
1085 PEs_Small.at(0) = 5;
1086 std::vector<double> WireCenters(3,0);
1087 std::vector<double> WireWidths(3,0);
1089 std::vector<recob::OpFlash> FlashVector;
1090 FlashVector.emplace_back(0,
1104 FlashVector.emplace_back(1.6,
1118 FlashVector.emplace_back(1e6,
1132 std::vector<bool> MarkedForRemoval(NFlashes-BeginFlash,
false);
1138 BOOST_TEST( MarkedForRemoval.size() == 3U );
1139 BOOST_TEST( MarkedForRemoval[0] ==
false );
1140 BOOST_TEST( MarkedForRemoval[1] ==
true );
1141 BOOST_TEST( MarkedForRemoval[2] ==
false );
1142 BOOST_TEST( FlashVector.size() == 3U );
1143 BOOST_TEST( FlashVector[0].Time() == 0 );
1144 BOOST_TEST( FlashVector[0].TotalPE() == 100 );
1145 BOOST_TEST( FlashVector[1].Time() == 1.6 );
1146 BOOST_TEST( FlashVector[1].TotalPE() == 5 );
1147 BOOST_TEST( FlashVector[2].Time() == 1e6 );
1148 BOOST_TEST( FlashVector[2].TotalPE() == 100 );
1155 size_t BeginFlash=1;
1157 std::vector<double> PEs(30,0);
1159 std::vector<double> PEs_Small(30,0);
1160 PEs_Small.at(0) = 5;
1161 std::vector<double> WireCenters(3,0);
1162 std::vector<double> WireWidths(3,0);
1164 std::vector<recob::OpFlash> FlashVector;
1165 FlashVector.emplace_back(-1e6,
1179 FlashVector.emplace_back(0,
1193 FlashVector.emplace_back(1.6,
1207 FlashVector.emplace_back(1e6,
1221 std::vector<bool> MarkedForRemoval(NFlashes-BeginFlash,
false);
1227 BOOST_TEST( MarkedForRemoval.size() == 3U );
1228 BOOST_TEST( MarkedForRemoval[0] ==
false );
1229 BOOST_TEST( MarkedForRemoval[1] ==
true );
1230 BOOST_TEST( MarkedForRemoval[2] ==
false );
1231 BOOST_TEST( FlashVector.size() == 4U );
1232 BOOST_TEST( FlashVector[0].Time() == -1e6 );
1233 BOOST_TEST( FlashVector[0].TotalPE() == 100 );
1234 BOOST_TEST( FlashVector[1].Time() == 0 );
1235 BOOST_TEST( FlashVector[1].TotalPE() == 100 );
1236 BOOST_TEST( FlashVector[2].Time() == 1.6 );
1237 BOOST_TEST( FlashVector[2].TotalPE() == 5 );
1238 BOOST_TEST( FlashVector[3].Time() == 1e6 );
1239 BOOST_TEST( FlashVector[3].TotalPE() == 100 );
1246 size_t BeginFlash=1;
1248 std::vector<double> PEs(30,0);
1250 std::vector<double> PEs_Small(30,0);
1251 PEs_Small.at(0) = 5;
1252 std::vector<double> WireCenters(3,0);
1253 std::vector<double> WireWidths(3,0);
1255 std::vector<recob::OpFlash> FlashVector;
1256 FlashVector.emplace_back(-1e6,
1270 FlashVector.emplace_back(0,
1284 FlashVector.emplace_back(1.6,
1298 FlashVector.emplace_back(1e6,
1312 std::vector<bool> MarkedForRemoval{
false,
true,
false};
1313 std::vector< std::vector<int> > RefinedHitsPerFlash(NFlashes-BeginFlash);
1314 RefinedHitsPerFlash[0].push_back(0);
1315 RefinedHitsPerFlash[1].push_back(1);
1316 RefinedHitsPerFlash[2].push_back(2);
1321 RefinedHitsPerFlash);
1323 BOOST_TEST( FlashVector.size() == 3U );
1324 BOOST_TEST( FlashVector[0].Time() == -1e6 );
1325 BOOST_TEST( FlashVector[0].TotalPE() == 100 );
1326 BOOST_TEST( FlashVector[1].Time() == 0 );
1327 BOOST_TEST( FlashVector[1].TotalPE() == 100 );
1328 BOOST_TEST( FlashVector[2].Time() == 1e6 );
1329 BOOST_TEST( FlashVector[2].TotalPE() == 100 );
1331 BOOST_TEST( RefinedHitsPerFlash.size() == 2U );
1332 BOOST_TEST( RefinedHitsPerFlash[0][0] == 0 );
1333 BOOST_TEST( RefinedHitsPerFlash[1][0] == 2 );
1340 size_t BeginFlash=5;
1342 std::vector<recob::OpFlash> FlashVector(NFlashes);
1343 std::vector<bool> MarkedForRemoval(NFlashes-BeginFlash,
false);
1344 std::vector< std::vector<int> > RefinedHitsPerFlash(NFlashes-BeginFlash);
1349 RefinedHitsPerFlash);
1351 BOOST_TEST( FlashVector.size() == NFlashes );
1356 BOOST_AUTO_TEST_SUITE_END()
void FillHitsThisFlash(std::vector< std::vector< int >> const &Contributors, int const &Bin, std::vector< int > const &HitClaimedByFlash, std::vector< int > &HitsThisFlash)
void CheckAndStoreFlash(std::vector< std::vector< int >> &RefinedHitsPerFlash, std::vector< int > const &HitsThisRefinedFlash, double const PEAccumulated, float const FlashThreshold, std::vector< bool > &HitsUsed)
void AddHitContribution(recob::OpHit const ¤tHit, double &MaxTime, double &MinTime, double &AveTime, double &FastToTotal, double &AveAbsTime, double &TotalPE, std::vector< double > &PEs)
void FindSeedHit(std::map< double, std::vector< int >, std::greater< double >> const &HitsBySize, std::vector< bool > &HitsUsed, std::vector< recob::OpHit > const &HitVector, std::vector< int > &HitsThisRefinedFlash, double &PEAccumulated, double &FlashMaxTime, double &FlashMinTime)
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
void MarkFlashesForRemoval(std::vector< recob::OpFlash > const &FlashVector, size_t const BeginFlash, std::vector< bool > &MarkedForRemoval)
void ClaimHits(std::vector< recob::OpHit > const &HitVector, std::vector< int > const &HitsThisFlash, float const FlashThreshold, std::vector< std::vector< int >> &HitsPerFlash, std::vector< int > &HitClaimedByFlash)
constexpr float FlashThreshold
void FillFlashesBySizeMap(std::vector< int > const &FlashesInAccumulator, std::vector< double > const &BinnedPE, int const &Accumulator, std::map< double, std::map< int, std::vector< int >>, std::greater< double >> &FlashesBySize)
BOOST_AUTO_TEST_CASE(checkGetAccumIndex)
void AddHitToFlash(int const &HitID, std::vector< bool > &HitsUsed, recob::OpHit const ¤tHit, double const WidthTolerance, std::vector< int > &HitsThisRefinedFlash, double &PEAccumulated, double &FlashMaxTime, double &FlashMinTime)
std::vector< reco::ClusterHit2D * > HitVector
What follows are several highly useful typedefs which we want to expose to the outside world...
unsigned int GetAccumIndex(double const PeakTime, double const MinTime, double const BinWidth, double const BinOffset)
constexpr double WidthTolerance
void RemoveFlashesFromVectors(std::vector< bool > const &MarkedForRemoval, std::vector< recob::OpFlash > &FlashVector, size_t const BeginFlash, std::vector< std::vector< int >> &RefinedHitsPerFlash)
void FillAccumulator(unsigned int const &AccumIndex, unsigned int const &HitIndex, double const PE, float const FlashThreshold, std::vector< double > &Binned, std::vector< std::vector< int >> &Contributors, std::vector< int > &FlashesInAccumulator)
double GetLikelihoodLateLight(double const iPE, double const iTime, double const iWidth, double const jPE, double const jTime, double const jWidth)