1 #define BOOST_TEST_MODULE ( OpFlashAlg_test )
2 #include "boost/test/unit_test.hpp"
13 BOOST_AUTO_TEST_SUITE(OpFlashAlg_test)
33 const size_t vector_size = 1;
34 const double PE_base = 10;
36 unsigned int AccumIndex = 0;
37 unsigned int HitIndex = 0;
39 std::vector<double> Binned(vector_size,PE_base);
40 std::vector< std::vector<int> > Contributors(vector_size);
41 std::vector<int> FlashesInAccumulator;
44 Binned,Contributors,FlashesInAccumulator);
46 BOOST_TEST( Contributors.at(AccumIndex).size() == 1U);
47 BOOST_TEST( Contributors.at(AccumIndex).at(0) == (int)HitIndex );
48 BOOST_TEST( Binned.at(AccumIndex) == PE+PE_base );
49 BOOST_TEST( FlashesInAccumulator.size() == 0U);
55 const size_t vector_size = 1;
56 const double PE_base = 10;
58 unsigned int AccumIndex = 0;
59 unsigned int HitIndex = 0;
61 std::vector<double> Binned(vector_size,PE_base);
62 std::vector< std::vector<int> > Contributors(vector_size);
63 std::vector<int> FlashesInAccumulator;
66 Binned,Contributors,FlashesInAccumulator);
68 BOOST_TEST( Contributors.at(AccumIndex).size() == 1U);
69 BOOST_TEST( Contributors.at(AccumIndex).at(0) == (int)HitIndex );
70 BOOST_TEST( Binned.at(AccumIndex) == PE+PE_base );
71 BOOST_TEST( FlashesInAccumulator.size() == 1U);
77 const size_t vector_size = 1;
78 const double PE_base = 10;
80 unsigned int AccumIndex = 0;
81 unsigned int HitIndex = 0;
83 std::vector<double> Binned(vector_size,PE_base);
84 std::vector< std::vector<int> > Contributors(vector_size);
85 std::vector<int> FlashesInAccumulator;
88 Binned,Contributors,FlashesInAccumulator);
90 BOOST_TEST( Contributors.at(AccumIndex).size() == 1U);
91 BOOST_TEST( Contributors.at(AccumIndex).at(0) == (int)HitIndex );
92 BOOST_TEST( Binned.at(AccumIndex) == PE+PE_base );
93 BOOST_TEST( FlashesInAccumulator.size() == 0U);
96 unsigned int HitIndex2 = 1;
98 Binned,Contributors,FlashesInAccumulator);
100 BOOST_TEST( Contributors.at(AccumIndex).size() == 2U);
101 BOOST_TEST( Contributors.at(AccumIndex).at(0) == (int)HitIndex );
102 BOOST_TEST( Contributors.at(AccumIndex).at(1) == (int)HitIndex2 );
103 BOOST_TEST( Binned.at(AccumIndex) == PE*2+PE_base );
104 BOOST_TEST( FlashesInAccumulator.size() == 1U);
110 const size_t vector_size = 10;
111 const double PE_vals = 10;
113 std::vector<double> BinnedPE(vector_size,PE_vals);
114 std::vector<int> FlashesInAccumulator;
115 std::map<double, std::map<int,std::vector<int> >, std::greater<double> > FlashesBySize;
119 BOOST_TEST( FlashesBySize.size() == 0U );
125 const size_t vector_size = 10;
126 const double PE_vals = 10;
128 std::vector<double> BinnedPE(vector_size,PE_vals);
131 std::vector<int> FlashesInAccumulator(1,2);
133 std::map<double, std::map<int,std::vector<int> >, std::greater<double> > FlashesBySize;
137 BOOST_TEST( FlashesBySize.size() == 1U );
138 BOOST_TEST( FlashesBySize.count(50) == 1U );
139 BOOST_TEST( FlashesBySize.count(10) == 0U );
140 BOOST_TEST( FlashesBySize[50].
size() == 1U );
141 BOOST_TEST( FlashesBySize[50].
count(1) == 1U );
142 BOOST_TEST( FlashesBySize[50][1].
size() == 1U );
143 BOOST_TEST( FlashesBySize[50][1][0] == 2 );
149 const size_t vector_size = 10;
150 const double PE_vals = 10;
152 std::vector<double> BinnedPE(vector_size,PE_vals);
156 std::vector<int> FlashesInAccumulator { 2, 8 };
158 std::map<double, std::map<int,std::vector<int> >, std::greater<double> > FlashesBySize;
162 BOOST_TEST( FlashesBySize.size() == 1U );
163 BOOST_TEST( FlashesBySize.count(50) == 1U );
164 BOOST_TEST( FlashesBySize.count(10) == 0U );
166 BOOST_TEST( FlashesBySize[50].
size() == 1U );
167 BOOST_TEST( FlashesBySize[50].
count(1) == 1U );
168 BOOST_TEST( FlashesBySize[50][1].
size() == 2U );
169 BOOST_TEST( FlashesBySize[50][1][0] == 2 );
170 BOOST_TEST( FlashesBySize[50][1][1] == 8 );
176 const size_t vector_size = 10;
177 const double PE_vals = 10;
179 std::vector<double> BinnedPE1(vector_size,PE_vals);
182 std::vector<double> BinnedPE2(vector_size,PE_vals);
185 std::vector<int> FlashesInAccumulator1 { 2, 5 };
186 std::vector<int> FlashesInAccumulator2(1,8);
188 std::map<double, std::map<int,std::vector<int> >, std::greater<double> > FlashesBySize;
193 BOOST_TEST( FlashesBySize.size() == 2U );
195 BOOST_TEST( FlashesBySize.count(50) == 1U );
196 BOOST_TEST( FlashesBySize.count(60) == 1U );
197 BOOST_TEST( FlashesBySize.count(10) == 0U );
199 auto map_begin = FlashesBySize.begin();
200 BOOST_TEST( map_begin->first == 60 );
202 auto map_last = FlashesBySize.end();
204 BOOST_TEST( map_last->first == 50 );
206 BOOST_TEST( FlashesBySize[50].
size() == 2U );
207 BOOST_TEST( FlashesBySize[50].
count(1) == 1U );
208 BOOST_TEST( FlashesBySize[50].
count(2) == 1U );
210 BOOST_TEST( FlashesBySize[50][1].
size() == 1U );
211 BOOST_TEST( FlashesBySize[50][1][0] == 2 );
212 BOOST_TEST( FlashesBySize[50][2].
size() == 1U );
213 BOOST_TEST( FlashesBySize[50][2][0] == 8 );
215 BOOST_TEST( FlashesBySize[60].
size() == 1U );
216 BOOST_TEST( FlashesBySize[60].
count(1) == 1U );
217 BOOST_TEST( FlashesBySize[60].
count(2) == 0U );
218 BOOST_TEST( FlashesBySize[60][1].
size() == 1U );
219 BOOST_TEST( FlashesBySize[60][1][0] == 5 );
227 const size_t vector_size = 1;
228 std::vector< std::vector<int> > Contributors(vector_size);
231 std::vector<int> HitClaimedByFlash(NHits,-1);
232 std::vector<int> HitsThisFlash;
239 BOOST_TEST( HitsThisFlash.size() == 0U);
247 const size_t vector_size = 1;
248 std::vector< std::vector<int> > Contributors(vector_size);
250 Contributors[0].push_back(1); Contributors[0].push_back(3);
252 std::vector<int> HitClaimedByFlash(NHits,-1);
253 std::vector<int> HitsThisFlash;
260 BOOST_TEST( HitsThisFlash.size() == 2U );
261 BOOST_TEST( HitsThisFlash[0] == 1 );
262 BOOST_TEST( HitsThisFlash[1] == 3 );
270 const size_t vector_size = 1;
271 std::vector< std::vector<int> > Contributors(vector_size);
273 Contributors[0].push_back(1); Contributors[0].push_back(3);
275 std::vector<int> HitClaimedByFlash(NHits,-1);
276 HitClaimedByFlash[1] = 0;
277 HitClaimedByFlash[2] = 1;
278 std::vector<int> HitsThisFlash;
285 BOOST_TEST( HitsThisFlash.size() == 1U );
286 BOOST_TEST( HitsThisFlash[0] == 3 );
294 const size_t vector_size = 2;
295 std::vector< std::vector<int> > Contributors(vector_size);
296 Contributors[0].push_back(1); Contributors[0].push_back(3);
297 Contributors[1].push_back(5); Contributors[1].push_back(6);
299 std::vector<int> HitClaimedByFlash(NHits,-1);
300 HitClaimedByFlash[1] = 0;
301 HitClaimedByFlash[2] = 1;
302 std::vector<int> HitsThisFlash;
309 BOOST_TEST( HitsThisFlash.size() == 2U );
310 BOOST_TEST( HitsThisFlash[0] == 5 );
311 BOOST_TEST( HitsThisFlash[1] == 6 );
321 for(
size_t i=0; i<NHits; i++)
322 HitVector.emplace_back(0,0,0,0,0,0,0,hit_pe,0);
324 std::vector<int> HitsThisFlash;
325 std::vector< std::vector<int> > HitsPerFlash;
327 std::vector<int> HitClaimedByFlash(NHits,-1);
335 BOOST_TEST( HitsPerFlash.size() == 0U);
336 BOOST_TEST( HitClaimedByFlash[0] == -1);
346 for(
size_t i=0; i<NHits; i++)
347 HitVector.emplace_back(0,0,0,0,0,0,0,hit_pe,0);
349 std::vector<int> HitsThisFlash(1,0);
350 std::vector< std::vector<int> > HitsPerFlash;
352 std::vector<int> HitClaimedByFlash(NHits,-1);
360 BOOST_TEST( HitsPerFlash.size() == 0U);
361 BOOST_TEST( HitClaimedByFlash[0] == -1);
371 for(
size_t i=0; i<NHits; i++)
372 HitVector.emplace_back(0,0,0,0,0,0,0,hit_pe,0);
374 std::vector<int> HitsThisFlash(1,0);
375 std::vector< std::vector<int> > HitsPerFlash;
377 std::vector<int> HitClaimedByFlash(NHits,-1);
385 BOOST_TEST( HitsPerFlash.size() == 1U);
386 BOOST_TEST( HitsPerFlash[0][0] == 0);
387 BOOST_TEST( HitClaimedByFlash[0] == 0);
397 for(
size_t i=0; i<NHits; i++)
398 HitVector.emplace_back(0,0,0,0,0,0,0,hit_pe,0);
400 std::vector<int> HitsThisFlash(1,0);
401 std::vector< std::vector<int> > HitsPerFlash;
403 std::vector<int> HitClaimedByFlash(NHits,-1);
411 BOOST_TEST( HitsPerFlash.size() == 1U);
412 BOOST_TEST( HitsPerFlash[0][0] == 0);
413 BOOST_TEST( HitClaimedByFlash[0] == 0);
414 BOOST_TEST( HitClaimedByFlash[1] == -1);
424 for(
size_t i=0; i<NHits; i++)
425 HitVector.emplace_back(0,0,0,0,0,0,0,hit_pe,0);
427 std::vector<int> HitsThisFlash;
428 HitsThisFlash.push_back(0); HitsThisFlash.push_back(1);
429 std::vector< std::vector<int> > HitsPerFlash;
431 std::vector<int> HitClaimedByFlash(NHits,-1);
439 BOOST_TEST( HitsPerFlash.size() == 0U);
440 BOOST_TEST( HitClaimedByFlash[0] == -1);
441 BOOST_TEST( HitClaimedByFlash[1] == -1);
451 for(
size_t i=0; i<NHits; i++)
452 HitVector.emplace_back(0,0,0,0,0,0,0,hit_pe,0);
454 std::vector<int> HitsThisFlash;
455 HitsThisFlash.push_back(0); HitsThisFlash.push_back(1);
456 std::vector< std::vector<int> > HitsPerFlash;
458 std::vector<int> HitClaimedByFlash(NHits,-1);
466 BOOST_TEST( HitsPerFlash.size() == 1U);
467 BOOST_TEST( HitsPerFlash[0][0] == 0);
468 BOOST_TEST( HitsPerFlash[0][1] == 1);
469 BOOST_TEST( HitClaimedByFlash[0] == 0);
470 BOOST_TEST( HitClaimedByFlash[1] == 0);
478 std::vector<int> HitsThisRefinedFlash;
479 double PEAccumulated=0, FlashMaxTime=0, FlashMinTime=0;
482 double peak_time = 0;
485 for(
size_t i=0; i<NHits; i++){
486 HitVector.emplace_back(0,peak_time,0,0,width,0,0,hit_pe,0);
491 std::map<double, std::vector<int>, std::greater<double> > HitsBySize;
492 for(
size_t i=0; i<NHits; i++)
493 HitsBySize[HitVector.at(i).PE()].push_back(i);
495 std::vector<bool> HitsUsed(NHits,
true);
500 HitsThisRefinedFlash,
505 BOOST_TEST( HitsThisRefinedFlash.size() == 0U );
506 BOOST_TEST(
std::count(HitsUsed.begin(),HitsUsed.end(),
true) == (
int)NHits);
507 BOOST_TEST( PEAccumulated == 0 );
508 BOOST_TEST( FlashMaxTime == 0 );
509 BOOST_TEST( FlashMinTime == 0 );
518 std::vector<int> HitsThisRefinedFlash;
519 double PEAccumulated=0, FlashMaxTime=0, FlashMinTime=0;
522 double peak_time = 0;
525 for(
size_t i=0; i<NHits; i++){
526 HitVector.emplace_back(0,peak_time,0,0,width,0,0,hit_pe,0);
531 std::map<double, std::vector<int>, std::greater<double> > HitsBySize;
532 for(
size_t i=0; i<NHits; i++)
533 HitsBySize[HitVector.at(i).PE()].push_back(i);
535 std::vector<bool> HitsUsed(NHits,
false);
540 HitsThisRefinedFlash,
545 BOOST_TEST( HitsThisRefinedFlash.size() == 1U );
546 BOOST_TEST(
std::count(HitsUsed.begin(),HitsUsed.end(),
true) == 1);
547 BOOST_TEST( HitsUsed.at(NHits-1) ==
true);
548 BOOST_TEST( PEAccumulated == 60 );
549 BOOST_TEST( FlashMaxTime == 9. );
550 BOOST_TEST( FlashMinTime == -1. );
559 std::vector<int> HitsThisRefinedFlash;
560 double PEAccumulated=0, FlashMaxTime=0, FlashMinTime=0;
563 double peak_time = 0;
566 for(
size_t i=0; i<NHits; i++){
567 HitVector.emplace_back(0,peak_time,0,0,width,0,0,hit_pe,0);
572 std::map<double, std::vector<int>, std::greater<double> > HitsBySize;
573 for(
size_t i=0; i<NHits; i++)
574 HitsBySize[HitVector.at(i).PE()].push_back(i);
576 std::vector<bool> HitsUsed(NHits,
false);
577 HitsUsed[NHits-1] =
true;
582 HitsThisRefinedFlash,
587 BOOST_TEST( HitsThisRefinedFlash.size() == 1U );
588 BOOST_TEST(
std::count(HitsUsed.begin(),HitsUsed.end(),
true) == 2);
589 BOOST_TEST( HitsUsed.at(NHits-1) ==
true);
590 BOOST_TEST( HitsUsed.at(NHits-2) ==
true);
591 BOOST_TEST( PEAccumulated == 50 );
592 BOOST_TEST( FlashMaxTime == 8. );
593 BOOST_TEST( FlashMinTime == -2. );
602 std::vector<int> HitsThisRefinedFlash;
603 double PEAccumulated=0, FlashMaxTime=0, FlashMinTime=0;
606 double peak_time = 0;
609 for(
size_t i=0; i<NHits; i++){
610 HitVector.emplace_back(0,peak_time,0,0,width,0,0,hit_pe,0);
615 std::map<double, std::vector<int>, std::greater<double> > HitsBySize;
616 for(
size_t i=0; i<NHits; i++)
617 HitsBySize[HitVector.at(i).PE()].push_back(i);
618 std::vector<bool> HitsUsed(NHits,
false);
623 HitsThisRefinedFlash,
633 HitsThisRefinedFlash,
638 BOOST_TEST( HitsThisRefinedFlash.size() == 1U );
639 BOOST_TEST(
std::count(HitsUsed.begin(),HitsUsed.end(),
true) == 1);
640 BOOST_TEST( HitsUsed.at(NHits-1) ==
true);
641 BOOST_TEST( PEAccumulated == 60 );
642 BOOST_TEST( FlashMaxTime == 9. );
643 BOOST_TEST( FlashMinTime == -1. );
652 std::vector<int> HitsThisRefinedFlash;
653 double PEAccumulated=0, FlashMaxTime=0, FlashMinTime=0;
656 double peak_time = 0;
659 for(
size_t i=0; i<NHits; i++){
660 HitVector.emplace_back(0,peak_time,0,0,width,0,0,hit_pe,0);
665 std::map<double, std::vector<int>, std::greater<double> > HitsBySize;
666 for(
size_t i=0; i<NHits; i++)
667 HitsBySize[HitVector.at(i).PE()].push_back(i);
668 std::vector<bool> HitsUsed(NHits,
false);
673 HitsThisRefinedFlash,
683 HitsThisRefinedFlash,
688 BOOST_TEST( HitsThisRefinedFlash.size() == 2U );
689 BOOST_TEST(
std::count(HitsUsed.begin(),HitsUsed.end(),
true) == 2);
690 BOOST_TEST( HitsUsed.at(NHits-1) ==
true);
691 BOOST_TEST( HitsUsed.at(NHits-2) ==
true);
692 BOOST_TEST( PEAccumulated == 110 );
693 BOOST_TEST( FlashMaxTime == 9. );
694 BOOST_TEST( FlashMinTime == -2. );
703 std::vector<int> HitsThisRefinedFlash;
704 double PEAccumulated=0, FlashMaxTime=0, FlashMinTime=0;
707 double peak_time = 0;
710 for(
size_t i=0; i<NHits; i++){
711 HitVector.emplace_back(0,peak_time,0,0,width,0,0,hit_pe,0);
716 std::map<double, std::vector<int>, std::greater<double> > HitsBySize;
717 for(
size_t i=0; i<NHits; i++)
718 HitsBySize[HitVector.at(i).PE()].push_back(i);
719 std::vector<bool> HitsUsed(NHits,
false);
724 HitsThisRefinedFlash,
734 HitsThisRefinedFlash,
739 BOOST_TEST( HitsThisRefinedFlash.size() == 1U );
740 BOOST_TEST(
std::count(HitsUsed.begin(),HitsUsed.end(),
true) == 1);
741 BOOST_TEST( HitsUsed.at(NHits-1) ==
true);
742 BOOST_TEST( HitsUsed.at(NHits-2) ==
false);
743 BOOST_TEST( PEAccumulated == 60 );
744 BOOST_TEST( FlashMaxTime == 4.05 );
745 BOOST_TEST( FlashMinTime == 3.95 );
751 std::vector< std::vector<int> > RefinedHitsPerFlash;
753 std::vector<int> HitsThisRefinedFlash{0,1,2};
754 std::vector<bool> HitsUsed{
true,
true,
true,
false,
false};
755 double PEAccumulated = 60;
758 HitsThisRefinedFlash,
763 BOOST_TEST( RefinedHitsPerFlash.size() == 1U );
764 BOOST_TEST( RefinedHitsPerFlash[0].
size() == 3U );
765 BOOST_TEST( RefinedHitsPerFlash[0][0] == 0 );
766 BOOST_TEST( RefinedHitsPerFlash[0][1] == 1 );
767 BOOST_TEST( RefinedHitsPerFlash[0][2] == 2 );
768 BOOST_TEST(
std::count(HitsUsed.begin(),HitsUsed.end(),
true) == 3);
774 std::vector< std::vector<int> > RefinedHitsPerFlash;
776 std::vector<int> HitsThisRefinedFlash{0};
777 std::vector<bool> HitsUsed{
true,
false,
false,
false,
false};
778 double PEAccumulated = 60;
781 HitsThisRefinedFlash,
786 BOOST_TEST( RefinedHitsPerFlash.size() == 1U );
787 BOOST_TEST( RefinedHitsPerFlash[0].
size() == 1U );
788 BOOST_TEST( RefinedHitsPerFlash[0][0] == 0 );
789 BOOST_TEST(
std::count(HitsUsed.begin(),HitsUsed.end(),
true) == 1);
795 std::vector< std::vector<int> > RefinedHitsPerFlash;
797 std::vector<int> HitsThisRefinedFlash{0};
798 std::vector<bool> HitsUsed{
true,
false,
false,
false,
false};
799 double PEAccumulated = 30;
802 HitsThisRefinedFlash,
807 BOOST_TEST( RefinedHitsPerFlash.size() == 0U );
808 BOOST_TEST(
std::count(HitsUsed.begin(),HitsUsed.end(),
true) == 1);
809 BOOST_TEST( HitsUsed[0] ==
true);
815 std::vector< std::vector<int> > RefinedHitsPerFlash;
817 std::vector<int> HitsThisRefinedFlash{0,1,2};
818 std::vector<bool> HitsUsed{
true,
true,
true,
false,
false};
819 double PEAccumulated = 30;
822 HitsThisRefinedFlash,
827 BOOST_TEST( RefinedHitsPerFlash.size() == 0U );
828 BOOST_TEST(
std::count(HitsUsed.begin(),HitsUsed.end(),
true) == 1);
829 BOOST_TEST( HitsUsed[0] ==
true);
830 BOOST_TEST( HitsUsed[1] ==
false);
831 BOOST_TEST( HitsUsed[2] ==
false);
837 double MaxTime = -1e9, MinTime = 1e9;
838 double TotalPE=0, AveTime=0, AveAbsTime=0, FastToTotal=0;
840 size_t NOpChannels = 5;
841 std::vector<double> PEs(NOpChannels,0);
844 double peak_time = 1;
847 recob::OpHit currentHit(op_channel,peak_time,0,0,width,0,0,hit_pe,0);
858 BOOST_TEST( MaxTime == peak_time );
859 BOOST_TEST( MinTime == peak_time );
860 BOOST_TEST( AveTime == peak_time*hit_pe );
861 BOOST_TEST( AveAbsTime == 0 );
862 BOOST_TEST( FastToTotal == 0 );
863 BOOST_TEST( TotalPE == hit_pe );
864 BOOST_TEST( PEs.at(op_channel) == hit_pe );
865 BOOST_TEST( PEs.at(4) == 0 );
870 double MaxTime = 1, MinTime = 1;
871 double TotalPE=20, AveTime=20, AveAbsTime=0, FastToTotal=0;
873 size_t NOpChannels = 5;
874 std::vector<double> PEs(NOpChannels,0);
878 double peak_time = 5;
881 recob::OpHit currentHit(op_channel,peak_time,0,0,width,0,0,hit_pe,0);
892 BOOST_TEST( MaxTime == peak_time );
893 BOOST_TEST( MinTime == 1 );
894 BOOST_TEST( AveTime == peak_time*hit_pe+20 );
895 BOOST_TEST( AveAbsTime == 0 );
896 BOOST_TEST( FastToTotal == 0 );
897 BOOST_TEST( TotalPE == hit_pe+20 );
898 BOOST_TEST( PEs.at(op_channel) == hit_pe );
899 BOOST_TEST( PEs.at(0) == 20 );
900 BOOST_TEST( PEs.at(4) == 0 );
907 double iPE = 100;
double iTime = 0;
double iWidth=0.5;
908 double jPE = 100;
double jTime = -1;
double jWidth=0.5;
919 double iPE = 100;
double iTime = 0;
double iWidth=0.5;
920 double jPE = 100;
double jTime = 0;
double jWidth=0.5;
931 double iPE = 100;
double iTime = 0;
double iWidth=0.5;
932 double jPE = 10;
double jTime = 1.6;
double jWidth=0.5;
937 double good_result = (jPE -
std::exp(-1)*iPE)/(std::sqrt(
std::exp(-1)*iPE));
939 BOOST_TEST( result == good_result,
tolerance);
945 double iPE = 100;
double iTime = 0;
double iWidth=0.5;
946 double jPE = 10;
double jTime = 16;
double jWidth=0.5;
951 double good_result = (jPE -
std::exp(-10)*iPE)/(std::sqrt(
std::exp(-10)*iPE));
953 BOOST_TEST( result == good_result,
tolerance);
959 double iPE = 100;
double iTime = 0;
double iWidth=1;
960 double jPE = 10;
double jTime = 1.6;
double jWidth=0.5;
965 double good_result = (jPE -
std::exp(-1)*iPE*0.5)/(std::sqrt(
std::exp(-1)*iPE*0.5));
967 BOOST_TEST( result == good_result,
tolerance);
975 std::vector<recob::OpFlash> FlashVector(NFlashes);
976 std::vector<bool> MarkedForRemoval(NFlashes-BeginFlash,
false);
982 BOOST_TEST( MarkedForRemoval.size() == 0U );
991 std::vector<double> PEs(30,0);
993 std::vector<double> WireCenters(3,0);
994 std::vector<double> WireWidths(3,0);
996 std::vector<recob::OpFlash> FlashVector;
997 FlashVector.emplace_back(0,
1011 std::vector<bool> MarkedForRemoval(NFlashes-BeginFlash,
false);
1017 BOOST_TEST( MarkedForRemoval.size() == 1U );
1018 BOOST_TEST( MarkedForRemoval[0] ==
false );
1019 BOOST_TEST( FlashVector.size() == 1U );
1020 BOOST_TEST( FlashVector[0].Time() == 0 );
1021 BOOST_TEST( FlashVector[0].TimeWidth() == 0.5 );
1028 size_t BeginFlash=0;
1030 std::vector<double> PEs(30,0);
1032 std::vector<double> WireCenters(3,0);
1033 std::vector<double> WireWidths(3,0);
1035 std::vector<recob::OpFlash> FlashVector;
1036 FlashVector.emplace_back(0,
1050 FlashVector.emplace_back(1e6,
1064 std::vector<bool> MarkedForRemoval(NFlashes-BeginFlash,
false);
1070 BOOST_TEST( MarkedForRemoval.size() == 2U );
1071 BOOST_TEST( MarkedForRemoval[0] ==
false );
1072 BOOST_TEST( MarkedForRemoval[1] ==
false );
1073 BOOST_TEST( FlashVector.size() == 2U );
1074 BOOST_TEST( FlashVector[0].Time() == 0 );
1075 BOOST_TEST( FlashVector[1].Time() == 1e6 );
1082 size_t BeginFlash=0;
1084 std::vector<double> PEs(30,0);
1086 std::vector<double> PEs_Small(30,0);
1087 PEs_Small.at(0) = 5;
1088 std::vector<double> WireCenters(3,0);
1089 std::vector<double> WireWidths(3,0);
1091 std::vector<recob::OpFlash> FlashVector;
1092 FlashVector.emplace_back(0,
1106 FlashVector.emplace_back(1.6,
1120 FlashVector.emplace_back(1e6,
1134 std::vector<bool> MarkedForRemoval(NFlashes-BeginFlash,
false);
1140 BOOST_TEST( MarkedForRemoval.size() == 3U );
1141 BOOST_TEST( MarkedForRemoval[0] ==
false );
1142 BOOST_TEST( MarkedForRemoval[1] ==
true );
1143 BOOST_TEST( MarkedForRemoval[2] ==
false );
1144 BOOST_TEST( FlashVector.size() == 3U );
1145 BOOST_TEST( FlashVector[0].Time() == 0 );
1146 BOOST_TEST( FlashVector[0].TotalPE() == 100 );
1147 BOOST_TEST( FlashVector[1].Time() == 1.6 );
1148 BOOST_TEST( FlashVector[1].TotalPE() == 5 );
1149 BOOST_TEST( FlashVector[2].Time() == 1e6 );
1150 BOOST_TEST( FlashVector[2].TotalPE() == 100 );
1157 size_t BeginFlash=1;
1159 std::vector<double> PEs(30,0);
1161 std::vector<double> PEs_Small(30,0);
1162 PEs_Small.at(0) = 5;
1163 std::vector<double> WireCenters(3,0);
1164 std::vector<double> WireWidths(3,0);
1166 std::vector<recob::OpFlash> FlashVector;
1167 FlashVector.emplace_back(-1e6,
1181 FlashVector.emplace_back(0,
1195 FlashVector.emplace_back(1.6,
1209 FlashVector.emplace_back(1e6,
1223 std::vector<bool> MarkedForRemoval(NFlashes-BeginFlash,
false);
1229 BOOST_TEST( MarkedForRemoval.size() == 3U );
1230 BOOST_TEST( MarkedForRemoval[0] ==
false );
1231 BOOST_TEST( MarkedForRemoval[1] ==
true );
1232 BOOST_TEST( MarkedForRemoval[2] ==
false );
1233 BOOST_TEST( FlashVector.size() == 4U );
1234 BOOST_TEST( FlashVector[0].Time() == -1e6 );
1235 BOOST_TEST( FlashVector[0].TotalPE() == 100 );
1236 BOOST_TEST( FlashVector[1].Time() == 0 );
1237 BOOST_TEST( FlashVector[1].TotalPE() == 100 );
1238 BOOST_TEST( FlashVector[2].Time() == 1.6 );
1239 BOOST_TEST( FlashVector[2].TotalPE() == 5 );
1240 BOOST_TEST( FlashVector[3].Time() == 1e6 );
1241 BOOST_TEST( FlashVector[3].TotalPE() == 100 );
1248 size_t BeginFlash=1;
1250 std::vector<double> PEs(30,0);
1252 std::vector<double> PEs_Small(30,0);
1253 PEs_Small.at(0) = 5;
1254 std::vector<double> WireCenters(3,0);
1255 std::vector<double> WireWidths(3,0);
1257 std::vector<recob::OpFlash> FlashVector;
1258 FlashVector.emplace_back(-1e6,
1272 FlashVector.emplace_back(0,
1286 FlashVector.emplace_back(1.6,
1300 FlashVector.emplace_back(1e6,
1314 std::vector<bool> MarkedForRemoval{
false,
true,
false};
1315 std::vector< std::vector<int> > RefinedHitsPerFlash(NFlashes-BeginFlash);
1316 RefinedHitsPerFlash[0].push_back(0);
1317 RefinedHitsPerFlash[1].push_back(1);
1318 RefinedHitsPerFlash[2].push_back(2);
1323 RefinedHitsPerFlash);
1325 BOOST_TEST( FlashVector.size() == 3U );
1326 BOOST_TEST( FlashVector[0].Time() == -1e6 );
1327 BOOST_TEST( FlashVector[0].TotalPE() == 100 );
1328 BOOST_TEST( FlashVector[1].Time() == 0 );
1329 BOOST_TEST( FlashVector[1].TotalPE() == 100 );
1330 BOOST_TEST( FlashVector[2].Time() == 1e6 );
1331 BOOST_TEST( FlashVector[2].TotalPE() == 100 );
1333 BOOST_TEST( RefinedHitsPerFlash.size() == 2U );
1334 BOOST_TEST( RefinedHitsPerFlash[0][0] == 0 );
1335 BOOST_TEST( RefinedHitsPerFlash[1][0] == 2 );
1342 size_t BeginFlash=5;
1344 std::vector<recob::OpFlash> FlashVector(NFlashes);
1345 std::vector<bool> MarkedForRemoval(NFlashes-BeginFlash,
false);
1346 std::vector< std::vector<int> > RefinedHitsPerFlash(NFlashes-BeginFlash);
1351 RefinedHitsPerFlash);
1353 BOOST_TEST( FlashVector.size() == NFlashes );
1358 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)
std::size_t size(FixedBins< T, C > const &) noexcept
std::array< float, 2 > HitVector(const recob::Hit &hit, const geo::GeometryCore *geo, const detinfo::DetectorPropertiesData &dprop)
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)
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)
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)
unsigned int GetAccumIndex(double const PeakTime, double const MinTime, double const BinWidth, double const BinOffset)
constexpr double WidthTolerance
std::size_t count(Cont const &cont)
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)