All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Macros | Functions | Variables
OpFlashAlg_test.cc File Reference
#include "boost/test/unit_test.hpp"
#include "larana/OpticalDetector/OpFlashAlg.h"
#include <cmath>

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   ( OpFlashAlg_test )
 

Functions

 BOOST_AUTO_TEST_CASE (checkGetAccumIndex)
 
 BOOST_AUTO_TEST_CASE (FillAccumulator_checkBelowThreshold)
 
 BOOST_AUTO_TEST_CASE (FillAccumulator_checkAboveThreshold)
 
 BOOST_AUTO_TEST_CASE (FillAccumulator_checkMultipleHits)
 
 BOOST_AUTO_TEST_CASE (FillFlashesBySizeMap_checkNoFlash)
 
 BOOST_AUTO_TEST_CASE (FillFlashesBySizeMap_checkOneFlash)
 
 BOOST_AUTO_TEST_CASE (FillFlashesBySizeMap_checkTwoFlashes)
 
 BOOST_AUTO_TEST_CASE (FillFlashesBySizeMap_checkTwoAccumulators)
 
 BOOST_AUTO_TEST_CASE (FillHitsThisFlash_EmptyContributors)
 
 BOOST_AUTO_TEST_CASE (FillHitsThisFlash_NoPrevClaimedHits)
 
 BOOST_AUTO_TEST_CASE (FillHitsThisFlash_PrevClaimedHits)
 
 BOOST_AUTO_TEST_CASE (FillHitsThisFlash_MultipleContributorVectors)
 
 BOOST_AUTO_TEST_CASE (ClaimHits_NoHitsThisFlash)
 
 BOOST_AUTO_TEST_CASE (ClaimHits_BelowFlashThreshold)
 
 BOOST_AUTO_TEST_CASE (ClaimHits_AboveFlashThreshold)
 
 BOOST_AUTO_TEST_CASE (ClaimHits_OneHitThisFlash)
 
 BOOST_AUTO_TEST_CASE (ClaimHits_TwoHitsThisFlash_BelowThreshold)
 
 BOOST_AUTO_TEST_CASE (ClaimHits_TwoHitsThisFlash_AboveThreshold)
 
 BOOST_AUTO_TEST_CASE (FindSeedHit_AllUsed)
 
 BOOST_AUTO_TEST_CASE (FindSeedHit_NoneUsed)
 
 BOOST_AUTO_TEST_CASE (FindSeedHit_FirstUsed)
 
 BOOST_AUTO_TEST_CASE (AddHitToFlash_UsedHit)
 
 BOOST_AUTO_TEST_CASE (AddHitToFlash_NewHit)
 
 BOOST_AUTO_TEST_CASE (AddHitToFlash_OutsideWidth)
 
 BOOST_AUTO_TEST_CASE (CheckAndStoreFlash_AboveThreshold)
 
 BOOST_AUTO_TEST_CASE (CheckAndStoreFlash_AboveThreshold_OneHit)
 
 BOOST_AUTO_TEST_CASE (CheckAndStoreFlash_BelowThreshold_OneHit)
 
 BOOST_AUTO_TEST_CASE (CheckAndStoreFlash_BelowThreshold_MultipleHits)
 
 BOOST_AUTO_TEST_CASE (AddHitContribution_AddFirstHit)
 
 BOOST_AUTO_TEST_CASE (AddHitContribution_AddSecondHit)
 
 BOOST_AUTO_TEST_CASE (GetLikelihoodLateLight_BackwardsTime)
 
 BOOST_AUTO_TEST_CASE (GetLikelihoodLateLight_EqualFlashes)
 
 BOOST_AUTO_TEST_CASE (GetLikelihoodLateLight_LateFlash)
 
 BOOST_AUTO_TEST_CASE (GetLikelihoodLateLight_VeryLateFlash)
 
 BOOST_AUTO_TEST_CASE (GetLikelihoodLateLight_UnequalWidths)
 
 BOOST_AUTO_TEST_CASE (MarkFlashesForRemoval_NoFlashes)
 
 BOOST_AUTO_TEST_CASE (MarkFlashesForRemoval_OneFlash)
 
 BOOST_AUTO_TEST_CASE (MarkFlashesForRemoval_TwoIndieFlashes)
 
 BOOST_AUTO_TEST_CASE (MarkFlashesForRemoval_RemoveOneFlash)
 
 BOOST_AUTO_TEST_CASE (MarkFlashesForRemoval_IgnoreFirstFlash)
 
 BOOST_AUTO_TEST_CASE (RemoveFlashesFromVectors_IgnoreFirstFlash)
 
 BOOST_AUTO_TEST_CASE (RemoveFlashesFromVectors_NoFlashes)
 

Variables

constexpr float FlashThreshold = 50
 
constexpr double WidthTolerance = 0.5
 
auto const tolerance = 1e-4% boost::test_tools::tolerance()
 

Macro Definition Documentation

#define BOOST_TEST_MODULE   ( OpFlashAlg_test )

Definition at line 1 of file OpFlashAlg_test.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( checkGetAccumIndex  )

Definition at line 15 of file OpFlashAlg_test.cc.

16 {
17 
18  BOOST_TEST(opdet::GetAccumIndex(10.0,0,1,0) == 10ul);
19  BOOST_TEST(opdet::GetAccumIndex(10.0,0,2,0) == 5ul);
20  BOOST_TEST(opdet::GetAccumIndex(10.0,0,3,0) == 3ul);
21 
22  BOOST_TEST(opdet::GetAccumIndex(10.0,-5,1,0) == 15ul);
23  BOOST_TEST(opdet::GetAccumIndex(10.0,-5,2,0) == 7ul);
24  BOOST_TEST(opdet::GetAccumIndex(10.0,-5,3,0) == 5ul);
25 
26  BOOST_TEST(opdet::GetAccumIndex(10.0,-5,1,0.5) == 15ul);
27  BOOST_TEST(opdet::GetAccumIndex(10.0,-5,2,1) == 8ul);
28 
29 }
unsigned int GetAccumIndex(double const PeakTime, double const MinTime, double const BinWidth, double const BinOffset)
Definition: OpFlashAlg.cxx:172
BOOST_AUTO_TEST_CASE ( FillAccumulator_checkBelowThreshold  )

Definition at line 31 of file OpFlashAlg_test.cc.

31  {
32 
33  const size_t vector_size = 1;
34  const double PE_base = 10;
35 
36  unsigned int AccumIndex = 0;
37  unsigned int HitIndex = 0;
38  double PE = 10;
39  std::vector<double> Binned(vector_size,PE_base);
40  std::vector< std::vector<int> > Contributors(vector_size);
41  std::vector<int> FlashesInAccumulator;
42 
43  opdet::FillAccumulator(AccumIndex,HitIndex,PE,FlashThreshold,
44  Binned,Contributors,FlashesInAccumulator);
45 
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);
50 
51 }
constexpr float FlashThreshold
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)
Definition: OpFlashAlg.cxx:182
BOOST_AUTO_TEST_CASE ( FillAccumulator_checkAboveThreshold  )

Definition at line 53 of file OpFlashAlg_test.cc.

53  {
54 
55  const size_t vector_size = 1;
56  const double PE_base = 10;
57 
58  unsigned int AccumIndex = 0;
59  unsigned int HitIndex = 0;
60  double PE = 40;
61  std::vector<double> Binned(vector_size,PE_base);
62  std::vector< std::vector<int> > Contributors(vector_size);
63  std::vector<int> FlashesInAccumulator;
64 
65  opdet::FillAccumulator(AccumIndex,HitIndex,PE,FlashThreshold,
66  Binned,Contributors,FlashesInAccumulator);
67 
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);
72 
73 }
constexpr float FlashThreshold
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)
Definition: OpFlashAlg.cxx:182
BOOST_AUTO_TEST_CASE ( FillAccumulator_checkMultipleHits  )

Definition at line 75 of file OpFlashAlg_test.cc.

75  {
76 
77  const size_t vector_size = 1;
78  const double PE_base = 10;
79 
80  unsigned int AccumIndex = 0;
81  unsigned int HitIndex = 0;
82  double PE = 25;
83  std::vector<double> Binned(vector_size,PE_base);
84  std::vector< std::vector<int> > Contributors(vector_size);
85  std::vector<int> FlashesInAccumulator;
86 
87  opdet::FillAccumulator(AccumIndex,HitIndex,PE,FlashThreshold,
88  Binned,Contributors,FlashesInAccumulator);
89 
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);
94 
95 
96  unsigned int HitIndex2 = 1;
97  opdet::FillAccumulator(AccumIndex,HitIndex2,PE,FlashThreshold,
98  Binned,Contributors,FlashesInAccumulator);
99 
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);
105 
106 }
constexpr float FlashThreshold
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)
Definition: OpFlashAlg.cxx:182
BOOST_AUTO_TEST_CASE ( FillFlashesBySizeMap_checkNoFlash  )

Definition at line 108 of file OpFlashAlg_test.cc.

109 {
110  const size_t vector_size = 10;
111  const double PE_vals = 10;
112 
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;
116 
117  opdet::FillFlashesBySizeMap(FlashesInAccumulator,BinnedPE,1,FlashesBySize);
118 
119  BOOST_TEST( FlashesBySize.size() == 0U );
120 
121 }
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)
Definition: OpFlashAlg.cxx:202
BOOST_AUTO_TEST_CASE ( FillFlashesBySizeMap_checkOneFlash  )

Definition at line 123 of file OpFlashAlg_test.cc.

124 {
125  const size_t vector_size = 10;
126  const double PE_vals = 10;
127 
128  std::vector<double> BinnedPE(vector_size,PE_vals);
129  BinnedPE[2] = 50;
130 
131  std::vector<int> FlashesInAccumulator(1,2);
132 
133  std::map<double, std::map<int,std::vector<int> >, std::greater<double> > FlashesBySize;
134 
135  opdet::FillFlashesBySizeMap(FlashesInAccumulator,BinnedPE,1,FlashesBySize);
136 
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 );
144 
145 }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
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)
Definition: OpFlashAlg.cxx:202
std::size_t count(Cont const &cont)
BOOST_AUTO_TEST_CASE ( FillFlashesBySizeMap_checkTwoFlashes  )

Definition at line 147 of file OpFlashAlg_test.cc.

148 {
149  const size_t vector_size = 10;
150  const double PE_vals = 10;
151 
152  std::vector<double> BinnedPE(vector_size,PE_vals);
153  BinnedPE[2] = 50;
154  BinnedPE[8] = 50;
155 
156  std::vector<int> FlashesInAccumulator { 2, 8 };
157 
158  std::map<double, std::map<int,std::vector<int> >, std::greater<double> > FlashesBySize;
159 
160  opdet::FillFlashesBySizeMap(FlashesInAccumulator,BinnedPE,1,FlashesBySize);
161 
162  BOOST_TEST( FlashesBySize.size() == 1U );
163  BOOST_TEST( FlashesBySize.count(50) == 1U );
164  BOOST_TEST( FlashesBySize.count(10) == 0U );
165 
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 );
171 
172 }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
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)
Definition: OpFlashAlg.cxx:202
std::size_t count(Cont const &cont)
BOOST_AUTO_TEST_CASE ( FillFlashesBySizeMap_checkTwoAccumulators  )

Definition at line 174 of file OpFlashAlg_test.cc.

175 {
176  const size_t vector_size = 10;
177  const double PE_vals = 10;
178 
179  std::vector<double> BinnedPE1(vector_size,PE_vals);
180  BinnedPE1[2] = 50;
181  BinnedPE1[5] = 60;
182  std::vector<double> BinnedPE2(vector_size,PE_vals);
183  BinnedPE2[8] = 50;
184 
185  std::vector<int> FlashesInAccumulator1 { 2, 5 };
186  std::vector<int> FlashesInAccumulator2(1,8);
187 
188  std::map<double, std::map<int,std::vector<int> >, std::greater<double> > FlashesBySize;
189 
190  opdet::FillFlashesBySizeMap(FlashesInAccumulator1,BinnedPE1,1,FlashesBySize);
191  opdet::FillFlashesBySizeMap(FlashesInAccumulator2,BinnedPE2,2,FlashesBySize);
192 
193  BOOST_TEST( FlashesBySize.size() == 2U );
194 
195  BOOST_TEST( FlashesBySize.count(50) == 1U );
196  BOOST_TEST( FlashesBySize.count(60) == 1U );
197  BOOST_TEST( FlashesBySize.count(10) == 0U );
198 
199  auto map_begin = FlashesBySize.begin();
200  BOOST_TEST( map_begin->first == 60 );
201 
202  auto map_last = FlashesBySize.end();
203  map_last--;
204  BOOST_TEST( map_last->first == 50 );
205 
206  BOOST_TEST( FlashesBySize[50].size() == 2U );
207  BOOST_TEST( FlashesBySize[50].count(1) == 1U );
208  BOOST_TEST( FlashesBySize[50].count(2) == 1U );
209 
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 );
214 
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 );
220 }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
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)
Definition: OpFlashAlg.cxx:202
std::size_t count(Cont const &cont)
BOOST_AUTO_TEST_CASE ( FillHitsThisFlash_EmptyContributors  )

Definition at line 222 of file OpFlashAlg_test.cc.

223 {
224 
225  size_t NHits = 10;
226 
227  const size_t vector_size = 1;
228  std::vector< std::vector<int> > Contributors(vector_size);
229  int Bin = 0;
230 
231  std::vector<int> HitClaimedByFlash(NHits,-1);
232  std::vector<int> HitsThisFlash;
233 
234  opdet::FillHitsThisFlash(Contributors,
235  Bin,
236  HitClaimedByFlash,
237  HitsThisFlash);
238 
239  BOOST_TEST( HitsThisFlash.size() == 0U);
240 }
void FillHitsThisFlash(std::vector< std::vector< int >> const &Contributors, int const &Bin, std::vector< int > const &HitClaimedByFlash, std::vector< int > &HitsThisFlash)
Definition: OpFlashAlg.cxx:214
BOOST_AUTO_TEST_CASE ( FillHitsThisFlash_NoPrevClaimedHits  )

Definition at line 242 of file OpFlashAlg_test.cc.

243 {
244 
245  size_t NHits = 10;
246 
247  const size_t vector_size = 1;
248  std::vector< std::vector<int> > Contributors(vector_size);
249  int Bin = 0;
250  Contributors[0].push_back(1); Contributors[0].push_back(3);
251 
252  std::vector<int> HitClaimedByFlash(NHits,-1);
253  std::vector<int> HitsThisFlash;
254 
255  opdet::FillHitsThisFlash(Contributors,
256  Bin,
257  HitClaimedByFlash,
258  HitsThisFlash);
259 
260  BOOST_TEST( HitsThisFlash.size() == 2U );
261  BOOST_TEST( HitsThisFlash[0] == 1 );
262  BOOST_TEST( HitsThisFlash[1] == 3 );
263 }
void FillHitsThisFlash(std::vector< std::vector< int >> const &Contributors, int const &Bin, std::vector< int > const &HitClaimedByFlash, std::vector< int > &HitsThisFlash)
Definition: OpFlashAlg.cxx:214
BOOST_AUTO_TEST_CASE ( FillHitsThisFlash_PrevClaimedHits  )

Definition at line 265 of file OpFlashAlg_test.cc.

266 {
267 
268  size_t NHits = 10;
269 
270  const size_t vector_size = 1;
271  std::vector< std::vector<int> > Contributors(vector_size);
272  int Bin = 0;
273  Contributors[0].push_back(1); Contributors[0].push_back(3);
274 
275  std::vector<int> HitClaimedByFlash(NHits,-1);
276  HitClaimedByFlash[1] = 0;
277  HitClaimedByFlash[2] = 1;
278  std::vector<int> HitsThisFlash;
279 
280  opdet::FillHitsThisFlash(Contributors,
281  Bin,
282  HitClaimedByFlash,
283  HitsThisFlash);
284 
285  BOOST_TEST( HitsThisFlash.size() == 1U );
286  BOOST_TEST( HitsThisFlash[0] == 3 );
287 }
void FillHitsThisFlash(std::vector< std::vector< int >> const &Contributors, int const &Bin, std::vector< int > const &HitClaimedByFlash, std::vector< int > &HitsThisFlash)
Definition: OpFlashAlg.cxx:214
BOOST_AUTO_TEST_CASE ( FillHitsThisFlash_MultipleContributorVectors  )

Definition at line 289 of file OpFlashAlg_test.cc.

290 {
291 
292  size_t NHits = 10;
293 
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);
298 
299  std::vector<int> HitClaimedByFlash(NHits,-1);
300  HitClaimedByFlash[1] = 0;
301  HitClaimedByFlash[2] = 1;
302  std::vector<int> HitsThisFlash;
303 
304  opdet::FillHitsThisFlash(Contributors,
305  1,
306  HitClaimedByFlash,
307  HitsThisFlash);
308 
309  BOOST_TEST( HitsThisFlash.size() == 2U );
310  BOOST_TEST( HitsThisFlash[0] == 5 );
311  BOOST_TEST( HitsThisFlash[1] == 6 );
312 }
void FillHitsThisFlash(std::vector< std::vector< int >> const &Contributors, int const &Bin, std::vector< int > const &HitClaimedByFlash, std::vector< int > &HitsThisFlash)
Definition: OpFlashAlg.cxx:214
BOOST_AUTO_TEST_CASE ( ClaimHits_NoHitsThisFlash  )

Definition at line 314 of file OpFlashAlg_test.cc.

315 {
316  size_t NHits = 1;
317 
318  //need this part to make a hit...
319  double hit_pe = 10;
320  std::vector<recob::OpHit> HitVector;
321  for(size_t i=0; i<NHits; i++)
322  HitVector.emplace_back(0,0,0,0,0,0,0,hit_pe,0);
323 
324  std::vector<int> HitsThisFlash;
325  std::vector< std::vector<int> > HitsPerFlash;
326 
327  std::vector<int> HitClaimedByFlash(NHits,-1);
328 
329  opdet::ClaimHits(HitVector,
330  HitsThisFlash,
332  HitsPerFlash,
333  HitClaimedByFlash);
334 
335  BOOST_TEST( HitsPerFlash.size() == 0U);
336  BOOST_TEST( HitClaimedByFlash[0] == -1);
337 }
std::array< float, 2 > HitVector(const recob::Hit &hit, const geo::GeometryCore *geo, const detinfo::DetectorPropertiesData &dprop)
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)
Definition: OpFlashAlg.cxx:227
constexpr float FlashThreshold
BOOST_AUTO_TEST_CASE ( ClaimHits_BelowFlashThreshold  )

Definition at line 339 of file OpFlashAlg_test.cc.

340 {
341  size_t NHits = 1;
342 
343  //need this part to make a hit...
344  double hit_pe = 10;
345  std::vector<recob::OpHit> HitVector;
346  for(size_t i=0; i<NHits; i++)
347  HitVector.emplace_back(0,0,0,0,0,0,0,hit_pe,0);
348 
349  std::vector<int> HitsThisFlash(1,0);
350  std::vector< std::vector<int> > HitsPerFlash;
351 
352  std::vector<int> HitClaimedByFlash(NHits,-1);
353 
354  opdet::ClaimHits(HitVector,
355  HitsThisFlash,
357  HitsPerFlash,
358  HitClaimedByFlash);
359 
360  BOOST_TEST( HitsPerFlash.size() == 0U);
361  BOOST_TEST( HitClaimedByFlash[0] == -1);
362 }
std::array< float, 2 > HitVector(const recob::Hit &hit, const geo::GeometryCore *geo, const detinfo::DetectorPropertiesData &dprop)
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)
Definition: OpFlashAlg.cxx:227
constexpr float FlashThreshold
BOOST_AUTO_TEST_CASE ( ClaimHits_AboveFlashThreshold  )

Definition at line 364 of file OpFlashAlg_test.cc.

365 {
366  size_t NHits = 1;
367 
368  //need this part to make a hit...
369  double hit_pe = 100;
370  std::vector<recob::OpHit> HitVector;
371  for(size_t i=0; i<NHits; i++)
372  HitVector.emplace_back(0,0,0,0,0,0,0,hit_pe,0);
373 
374  std::vector<int> HitsThisFlash(1,0);
375  std::vector< std::vector<int> > HitsPerFlash;
376 
377  std::vector<int> HitClaimedByFlash(NHits,-1);
378 
379  opdet::ClaimHits(HitVector,
380  HitsThisFlash,
382  HitsPerFlash,
383  HitClaimedByFlash);
384 
385  BOOST_TEST( HitsPerFlash.size() == 1U);
386  BOOST_TEST( HitsPerFlash[0][0] == 0);
387  BOOST_TEST( HitClaimedByFlash[0] == 0);
388 }
std::array< float, 2 > HitVector(const recob::Hit &hit, const geo::GeometryCore *geo, const detinfo::DetectorPropertiesData &dprop)
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)
Definition: OpFlashAlg.cxx:227
constexpr float FlashThreshold
BOOST_AUTO_TEST_CASE ( ClaimHits_OneHitThisFlash  )

Definition at line 390 of file OpFlashAlg_test.cc.

391 {
392  size_t NHits = 2;
393 
394  //need this part to make a hit...
395  double hit_pe = 100;
396  std::vector<recob::OpHit> HitVector;
397  for(size_t i=0; i<NHits; i++)
398  HitVector.emplace_back(0,0,0,0,0,0,0,hit_pe,0);
399 
400  std::vector<int> HitsThisFlash(1,0);
401  std::vector< std::vector<int> > HitsPerFlash;
402 
403  std::vector<int> HitClaimedByFlash(NHits,-1);
404 
405  opdet::ClaimHits(HitVector,
406  HitsThisFlash,
408  HitsPerFlash,
409  HitClaimedByFlash);
410 
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);
415 }
std::array< float, 2 > HitVector(const recob::Hit &hit, const geo::GeometryCore *geo, const detinfo::DetectorPropertiesData &dprop)
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)
Definition: OpFlashAlg.cxx:227
constexpr float FlashThreshold
BOOST_AUTO_TEST_CASE ( ClaimHits_TwoHitsThisFlash_BelowThreshold  )

Definition at line 417 of file OpFlashAlg_test.cc.

418 {
419  size_t NHits = 2;
420 
421  //need this part to make a hit...
422  double hit_pe = 10;
423  std::vector<recob::OpHit> HitVector;
424  for(size_t i=0; i<NHits; i++)
425  HitVector.emplace_back(0,0,0,0,0,0,0,hit_pe,0);
426 
427  std::vector<int> HitsThisFlash;
428  HitsThisFlash.push_back(0); HitsThisFlash.push_back(1);
429  std::vector< std::vector<int> > HitsPerFlash;
430 
431  std::vector<int> HitClaimedByFlash(NHits,-1);
432 
433  opdet::ClaimHits(HitVector,
434  HitsThisFlash,
436  HitsPerFlash,
437  HitClaimedByFlash);
438 
439  BOOST_TEST( HitsPerFlash.size() == 0U);
440  BOOST_TEST( HitClaimedByFlash[0] == -1);
441  BOOST_TEST( HitClaimedByFlash[1] == -1);
442 }
std::array< float, 2 > HitVector(const recob::Hit &hit, const geo::GeometryCore *geo, const detinfo::DetectorPropertiesData &dprop)
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)
Definition: OpFlashAlg.cxx:227
constexpr float FlashThreshold
BOOST_AUTO_TEST_CASE ( ClaimHits_TwoHitsThisFlash_AboveThreshold  )

Definition at line 444 of file OpFlashAlg_test.cc.

445 {
446  size_t NHits = 2;
447 
448  //need this part to make a hit...
449  double hit_pe = 30;
450  std::vector<recob::OpHit> HitVector;
451  for(size_t i=0; i<NHits; i++)
452  HitVector.emplace_back(0,0,0,0,0,0,0,hit_pe,0);
453 
454  std::vector<int> HitsThisFlash;
455  HitsThisFlash.push_back(0); HitsThisFlash.push_back(1);
456  std::vector< std::vector<int> > HitsPerFlash;
457 
458  std::vector<int> HitClaimedByFlash(NHits,-1);
459 
460  opdet::ClaimHits(HitVector,
461  HitsThisFlash,
463  HitsPerFlash,
464  HitClaimedByFlash);
465 
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);
471 }
std::array< float, 2 > HitVector(const recob::Hit &hit, const geo::GeometryCore *geo, const detinfo::DetectorPropertiesData &dprop)
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)
Definition: OpFlashAlg.cxx:227
constexpr float FlashThreshold
BOOST_AUTO_TEST_CASE ( FindSeedHit_AllUsed  )

Definition at line 473 of file OpFlashAlg_test.cc.

474 {
475 
476  size_t NHits = 5;
477 
478  std::vector<int> HitsThisRefinedFlash;
479  double PEAccumulated=0, FlashMaxTime=0, FlashMinTime=0;
480 
481  double hit_pe = 20;
482  double peak_time = 0;
483  double width = 10;
484  std::vector<recob::OpHit> HitVector;
485  for(size_t i=0; i<NHits; i++){
486  HitVector.emplace_back(0,peak_time,0,0,width,0,0,hit_pe,0);
487  hit_pe+=10;
488  peak_time+=1;
489  }
490 
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);
494 
495  std::vector<bool> HitsUsed(NHits,true);
496 
497  opdet::FindSeedHit(HitsBySize,
498  HitsUsed,
499  HitVector,
500  HitsThisRefinedFlash,
501  PEAccumulated,
502  FlashMaxTime,
503  FlashMinTime);
504 
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 );
510 
511 }
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)
Definition: OpFlashAlg.cxx:301
std::size_t count(Cont const &cont)
BOOST_AUTO_TEST_CASE ( FindSeedHit_NoneUsed  )

Definition at line 513 of file OpFlashAlg_test.cc.

514 {
515 
516  size_t NHits = 5;
517 
518  std::vector<int> HitsThisRefinedFlash;
519  double PEAccumulated=0, FlashMaxTime=0, FlashMinTime=0;
520 
521  double hit_pe = 20;
522  double peak_time = 0;
523  double width = 10;
524  std::vector<recob::OpHit> HitVector;
525  for(size_t i=0; i<NHits; i++){
526  HitVector.emplace_back(0,peak_time,0,0,width,0,0,hit_pe,0);
527  hit_pe+=10;
528  peak_time+=1;
529  }
530 
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);
534 
535  std::vector<bool> HitsUsed(NHits,false);
536 
537  opdet::FindSeedHit(HitsBySize,
538  HitsUsed,
539  HitVector,
540  HitsThisRefinedFlash,
541  PEAccumulated,
542  FlashMaxTime,
543  FlashMinTime);
544 
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. );
551 
552 }
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)
Definition: OpFlashAlg.cxx:301
std::size_t count(Cont const &cont)
BOOST_AUTO_TEST_CASE ( FindSeedHit_FirstUsed  )

Definition at line 554 of file OpFlashAlg_test.cc.

555 {
556 
557  size_t NHits = 5;
558 
559  std::vector<int> HitsThisRefinedFlash;
560  double PEAccumulated=0, FlashMaxTime=0, FlashMinTime=0;
561 
562  double hit_pe = 20;
563  double peak_time = 0;
564  double width = 10;
565  std::vector<recob::OpHit> HitVector;
566  for(size_t i=0; i<NHits; i++){
567  HitVector.emplace_back(0,peak_time,0,0,width,0,0,hit_pe,0);
568  hit_pe+=10;
569  peak_time+=1;
570  }
571 
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);
575 
576  std::vector<bool> HitsUsed(NHits,false);
577  HitsUsed[NHits-1] = true;
578 
579  opdet::FindSeedHit(HitsBySize,
580  HitsUsed,
581  HitVector,
582  HitsThisRefinedFlash,
583  PEAccumulated,
584  FlashMaxTime,
585  FlashMinTime);
586 
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. );
594 
595 }
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)
Definition: OpFlashAlg.cxx:301
std::size_t count(Cont const &cont)
BOOST_AUTO_TEST_CASE ( AddHitToFlash_UsedHit  )

Definition at line 597 of file OpFlashAlg_test.cc.

598 {
599 
600  size_t NHits = 5;
601 
602  std::vector<int> HitsThisRefinedFlash;
603  double PEAccumulated=0, FlashMaxTime=0, FlashMinTime=0;
604 
605  double hit_pe = 20;
606  double peak_time = 0;
607  double width = 10;
608  std::vector<recob::OpHit> HitVector;
609  for(size_t i=0; i<NHits; i++){
610  HitVector.emplace_back(0,peak_time,0,0,width,0,0,hit_pe,0);
611  hit_pe+=10;
612  peak_time+=1;
613  }
614 
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);
619 
620  opdet::FindSeedHit(HitsBySize,
621  HitsUsed,
622  HitVector,
623  HitsThisRefinedFlash,
624  PEAccumulated,
625  FlashMaxTime,
626  FlashMinTime);
627 
628  int HitID = 4;
629  opdet::AddHitToFlash( HitID,
630  HitsUsed,
631  HitVector.at(HitID),
633  HitsThisRefinedFlash,
634  PEAccumulated,
635  FlashMaxTime,
636  FlashMinTime);
637 
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. );
644 
645 }
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)
Definition: OpFlashAlg.cxx:301
void AddHitToFlash(int const &HitID, std::vector< bool > &HitsUsed, recob::OpHit const &currentHit, double const WidthTolerance, std::vector< int > &HitsThisRefinedFlash, double &PEAccumulated, double &FlashMaxTime, double &FlashMinTime)
Definition: OpFlashAlg.cxx:331
constexpr double WidthTolerance
std::size_t count(Cont const &cont)
BOOST_AUTO_TEST_CASE ( AddHitToFlash_NewHit  )

Definition at line 647 of file OpFlashAlg_test.cc.

648 {
649 
650  size_t NHits = 5;
651 
652  std::vector<int> HitsThisRefinedFlash;
653  double PEAccumulated=0, FlashMaxTime=0, FlashMinTime=0;
654 
655  double hit_pe = 20;
656  double peak_time = 0;
657  double width = 10;
658  std::vector<recob::OpHit> HitVector;
659  for(size_t i=0; i<NHits; i++){
660  HitVector.emplace_back(0,peak_time,0,0,width,0,0,hit_pe,0);
661  hit_pe+=10;
662  peak_time+=1;
663  }
664 
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);
669 
670  opdet::FindSeedHit(HitsBySize,
671  HitsUsed,
672  HitVector,
673  HitsThisRefinedFlash,
674  PEAccumulated,
675  FlashMaxTime,
676  FlashMinTime);
677 
678  int HitID = 3;
679  opdet::AddHitToFlash( HitID,
680  HitsUsed,
681  HitVector.at(HitID),
683  HitsThisRefinedFlash,
684  PEAccumulated,
685  FlashMaxTime,
686  FlashMinTime);
687 
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. );
695 
696 }
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)
Definition: OpFlashAlg.cxx:301
void AddHitToFlash(int const &HitID, std::vector< bool > &HitsUsed, recob::OpHit const &currentHit, double const WidthTolerance, std::vector< int > &HitsThisRefinedFlash, double &PEAccumulated, double &FlashMaxTime, double &FlashMinTime)
Definition: OpFlashAlg.cxx:331
constexpr double WidthTolerance
std::size_t count(Cont const &cont)
BOOST_AUTO_TEST_CASE ( AddHitToFlash_OutsideWidth  )

Definition at line 698 of file OpFlashAlg_test.cc.

699 {
700 
701  size_t NHits = 5;
702 
703  std::vector<int> HitsThisRefinedFlash;
704  double PEAccumulated=0, FlashMaxTime=0, FlashMinTime=0;
705 
706  double hit_pe = 20;
707  double peak_time = 0;
708  double width = 0.1;
709  std::vector<recob::OpHit> HitVector;
710  for(size_t i=0; i<NHits; i++){
711  HitVector.emplace_back(0,peak_time,0,0,width,0,0,hit_pe,0);
712  hit_pe+=10;
713  peak_time+=1;
714  }
715 
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);
720 
721  opdet::FindSeedHit(HitsBySize,
722  HitsUsed,
723  HitVector,
724  HitsThisRefinedFlash,
725  PEAccumulated,
726  FlashMaxTime,
727  FlashMinTime);
728 
729  int HitID = 3;
730  opdet::AddHitToFlash( HitID,
731  HitsUsed,
732  HitVector.at(HitID),
734  HitsThisRefinedFlash,
735  PEAccumulated,
736  FlashMaxTime,
737  FlashMinTime);
738 
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 );
746 
747 }
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)
Definition: OpFlashAlg.cxx:301
void AddHitToFlash(int const &HitID, std::vector< bool > &HitsUsed, recob::OpHit const &currentHit, double const WidthTolerance, std::vector< int > &HitsThisRefinedFlash, double &PEAccumulated, double &FlashMaxTime, double &FlashMinTime)
Definition: OpFlashAlg.cxx:331
constexpr double WidthTolerance
std::size_t count(Cont const &cont)
BOOST_AUTO_TEST_CASE ( CheckAndStoreFlash_AboveThreshold  )

Definition at line 749 of file OpFlashAlg_test.cc.

750 {
751  std::vector< std::vector<int> > RefinedHitsPerFlash;
752 
753  std::vector<int> HitsThisRefinedFlash{0,1,2};
754  std::vector<bool> HitsUsed{true,true,true,false,false};
755  double PEAccumulated = 60;
756 
757  opdet::CheckAndStoreFlash( RefinedHitsPerFlash,
758  HitsThisRefinedFlash,
759  PEAccumulated,
761  HitsUsed );
762 
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);
769 
770 }
void CheckAndStoreFlash(std::vector< std::vector< int >> &RefinedHitsPerFlash, std::vector< int > const &HitsThisRefinedFlash, double const PEAccumulated, float const FlashThreshold, std::vector< bool > &HitsUsed)
Definition: OpFlashAlg.cxx:359
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
constexpr float FlashThreshold
std::size_t count(Cont const &cont)
BOOST_AUTO_TEST_CASE ( CheckAndStoreFlash_AboveThreshold_OneHit  )

Definition at line 772 of file OpFlashAlg_test.cc.

773 {
774  std::vector< std::vector<int> > RefinedHitsPerFlash;
775 
776  std::vector<int> HitsThisRefinedFlash{0};
777  std::vector<bool> HitsUsed{true,false,false,false,false};
778  double PEAccumulated = 60;
779 
780  opdet::CheckAndStoreFlash( RefinedHitsPerFlash,
781  HitsThisRefinedFlash,
782  PEAccumulated,
784  HitsUsed );
785 
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);
790 
791 }
void CheckAndStoreFlash(std::vector< std::vector< int >> &RefinedHitsPerFlash, std::vector< int > const &HitsThisRefinedFlash, double const PEAccumulated, float const FlashThreshold, std::vector< bool > &HitsUsed)
Definition: OpFlashAlg.cxx:359
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
constexpr float FlashThreshold
std::size_t count(Cont const &cont)
BOOST_AUTO_TEST_CASE ( CheckAndStoreFlash_BelowThreshold_OneHit  )

Definition at line 793 of file OpFlashAlg_test.cc.

794 {
795  std::vector< std::vector<int> > RefinedHitsPerFlash;
796 
797  std::vector<int> HitsThisRefinedFlash{0};
798  std::vector<bool> HitsUsed{true,false,false,false,false};
799  double PEAccumulated = 30;
800 
801  opdet::CheckAndStoreFlash( RefinedHitsPerFlash,
802  HitsThisRefinedFlash,
803  PEAccumulated,
805  HitsUsed );
806 
807  BOOST_TEST( RefinedHitsPerFlash.size() == 0U );
808  BOOST_TEST( std::count(HitsUsed.begin(),HitsUsed.end(),true) == 1);
809  BOOST_TEST( HitsUsed[0] == true);
810 
811 }
void CheckAndStoreFlash(std::vector< std::vector< int >> &RefinedHitsPerFlash, std::vector< int > const &HitsThisRefinedFlash, double const PEAccumulated, float const FlashThreshold, std::vector< bool > &HitsUsed)
Definition: OpFlashAlg.cxx:359
constexpr float FlashThreshold
std::size_t count(Cont const &cont)
BOOST_AUTO_TEST_CASE ( CheckAndStoreFlash_BelowThreshold_MultipleHits  )

Definition at line 813 of file OpFlashAlg_test.cc.

814 {
815  std::vector< std::vector<int> > RefinedHitsPerFlash;
816 
817  std::vector<int> HitsThisRefinedFlash{0,1,2};
818  std::vector<bool> HitsUsed{true,true,true,false,false};
819  double PEAccumulated = 30;
820 
821  opdet::CheckAndStoreFlash( RefinedHitsPerFlash,
822  HitsThisRefinedFlash,
823  PEAccumulated,
825  HitsUsed );
826 
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);
832 
833 }
void CheckAndStoreFlash(std::vector< std::vector< int >> &RefinedHitsPerFlash, std::vector< int > const &HitsThisRefinedFlash, double const PEAccumulated, float const FlashThreshold, std::vector< bool > &HitsUsed)
Definition: OpFlashAlg.cxx:359
constexpr float FlashThreshold
std::size_t count(Cont const &cont)
BOOST_AUTO_TEST_CASE ( AddHitContribution_AddFirstHit  )

Definition at line 835 of file OpFlashAlg_test.cc.

836 {
837  double MaxTime = -1e9, MinTime = 1e9;
838  double TotalPE=0, AveTime=0, AveAbsTime=0, FastToTotal=0;
839 
840  size_t NOpChannels = 5;
841  std::vector<double> PEs(NOpChannels,0);
842 
843  double hit_pe = 20;
844  double peak_time = 1;
845  double width = 5;
846  int op_channel = 0;
847  recob::OpHit currentHit(op_channel,peak_time,0,0,width,0,0,hit_pe,0);
848 
849  opdet::AddHitContribution( currentHit,
850  MaxTime,
851  MinTime,
852  AveTime,
853  FastToTotal,
854  AveAbsTime,
855  TotalPE,
856  PEs);
857 
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 );
866 }
void AddHitContribution(recob::OpHit const &currentHit, double &MaxTime, double &MinTime, double &AveTime, double &FastToTotal, double &AveAbsTime, double &TotalPE, std::vector< double > &PEs)
Definition: OpFlashAlg.cxx:456
BOOST_AUTO_TEST_CASE ( AddHitContribution_AddSecondHit  )

Definition at line 868 of file OpFlashAlg_test.cc.

869 {
870  double MaxTime = 1, MinTime = 1;
871  double TotalPE=20, AveTime=20, AveAbsTime=0, FastToTotal=0;
872 
873  size_t NOpChannels = 5;
874  std::vector<double> PEs(NOpChannels,0);
875  PEs.at(0)+=20;
876 
877  double hit_pe = 30;
878  double peak_time = 5;
879  double width = 5;
880  int op_channel = 2;
881  recob::OpHit currentHit(op_channel,peak_time,0,0,width,0,0,hit_pe,0);
882 
883  opdet::AddHitContribution( currentHit,
884  MaxTime,
885  MinTime,
886  AveTime,
887  FastToTotal,
888  AveAbsTime,
889  TotalPE,
890  PEs);
891 
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 );
901 }
void AddHitContribution(recob::OpHit const &currentHit, double &MaxTime, double &MinTime, double &AveTime, double &FastToTotal, double &AveAbsTime, double &TotalPE, std::vector< double > &PEs)
Definition: OpFlashAlg.cxx:456
BOOST_AUTO_TEST_CASE ( GetLikelihoodLateLight_BackwardsTime  )

Definition at line 904 of file OpFlashAlg_test.cc.

905 {
906 
907  double iPE = 100; double iTime = 0; double iWidth=0.5;
908  double jPE = 100; double jTime = -1; double jWidth=0.5;
909 
910  double result = opdet::GetLikelihoodLateLight(iPE, iTime, iWidth,
911  jPE, jTime, jWidth);
912 
913  BOOST_TEST( result == 1e6, tolerance);
914 }
auto const tolerance
double GetLikelihoodLateLight(double const iPE, double const iTime, double const iWidth, double const jPE, double const jTime, double const jWidth)
Definition: OpFlashAlg.cxx:605
BOOST_AUTO_TEST_CASE ( GetLikelihoodLateLight_EqualFlashes  )

Definition at line 916 of file OpFlashAlg_test.cc.

917 {
918 
919  double iPE = 100; double iTime = 0; double iWidth=0.5;
920  double jPE = 100; double jTime = 0; double jWidth=0.5;
921 
922  double result = opdet::GetLikelihoodLateLight(iPE, iTime, iWidth,
923  jPE, jTime, jWidth);
924 
925  BOOST_TEST( result == 0, tolerance);
926 }
auto const tolerance
double GetLikelihoodLateLight(double const iPE, double const iTime, double const iWidth, double const jPE, double const jTime, double const jWidth)
Definition: OpFlashAlg.cxx:605
BOOST_AUTO_TEST_CASE ( GetLikelihoodLateLight_LateFlash  )

Definition at line 928 of file OpFlashAlg_test.cc.

929 {
930 
931  double iPE = 100; double iTime = 0; double iWidth=0.5;
932  double jPE = 10; double jTime = 1.6; double jWidth=0.5;
933 
934  double result = opdet::GetLikelihoodLateLight(iPE, iTime, iWidth,
935  jPE, jTime, jWidth);
936 
937  double good_result = (jPE - std::exp(-1)*iPE)/(std::sqrt(std::exp(-1)*iPE));
938 
939  BOOST_TEST( result == good_result, tolerance);
940 }
auto const tolerance
double GetLikelihoodLateLight(double const iPE, double const iTime, double const iWidth, double const jPE, double const jTime, double const jWidth)
Definition: OpFlashAlg.cxx:605
BOOST_AUTO_TEST_CASE ( GetLikelihoodLateLight_VeryLateFlash  )

Definition at line 942 of file OpFlashAlg_test.cc.

943 {
944 
945  double iPE = 100; double iTime = 0; double iWidth=0.5;
946  double jPE = 10; double jTime = 16; double jWidth=0.5;
947 
948  double result = opdet::GetLikelihoodLateLight(iPE, iTime, iWidth,
949  jPE, jTime, jWidth);
950 
951  double good_result = (jPE - std::exp(-10)*iPE)/(std::sqrt(std::exp(-10)*iPE));
952 
953  BOOST_TEST( result == good_result, tolerance);
954 }
auto const tolerance
double GetLikelihoodLateLight(double const iPE, double const iTime, double const iWidth, double const jPE, double const jTime, double const jWidth)
Definition: OpFlashAlg.cxx:605
BOOST_AUTO_TEST_CASE ( GetLikelihoodLateLight_UnequalWidths  )

Definition at line 956 of file OpFlashAlg_test.cc.

957 {
958 
959  double iPE = 100; double iTime = 0; double iWidth=1;
960  double jPE = 10; double jTime = 1.6; double jWidth=0.5;
961 
962  double result = opdet::GetLikelihoodLateLight(iPE, iTime, iWidth,
963  jPE, jTime, jWidth);
964 
965  double good_result = (jPE - std::exp(-1)*iPE*0.5)/(std::sqrt(std::exp(-1)*iPE*0.5));
966 
967  BOOST_TEST( result == good_result, tolerance);
968 }
auto const tolerance
double GetLikelihoodLateLight(double const iPE, double const iTime, double const iWidth, double const jPE, double const jTime, double const jWidth)
Definition: OpFlashAlg.cxx:605
BOOST_AUTO_TEST_CASE ( MarkFlashesForRemoval_NoFlashes  )

Definition at line 970 of file OpFlashAlg_test.cc.

971 {
972  size_t NFlashes=5;
973  size_t BeginFlash=5; //that is, no new flashes to look at
974 
975  std::vector<recob::OpFlash> FlashVector(NFlashes);
976  std::vector<bool> MarkedForRemoval(NFlashes-BeginFlash,false);
977 
978  opdet::MarkFlashesForRemoval(FlashVector,
979  BeginFlash,
980  MarkedForRemoval);
981 
982  BOOST_TEST( MarkedForRemoval.size() == 0U );
983 
984 }
void MarkFlashesForRemoval(std::vector< recob::OpFlash > const &FlashVector, size_t const BeginFlash, std::vector< bool > &MarkedForRemoval)
Definition: OpFlashAlg.cxx:623
BOOST_AUTO_TEST_CASE ( MarkFlashesForRemoval_OneFlash  )

Definition at line 986 of file OpFlashAlg_test.cc.

987 {
988  size_t NFlashes=1;
989  size_t BeginFlash=0;
990 
991  std::vector<double> PEs(30,0);
992  PEs.at(0) = 100;
993  std::vector<double> WireCenters(3,0);
994  std::vector<double> WireWidths(3,0);
995 
996  std::vector<recob::OpFlash> FlashVector;
997  FlashVector.emplace_back(0, //time
998  0.5, //TimeWidth,
999  0, //AveAbsTime,
1000  0, //Frame,
1001  PEs,
1002  0, //InBeamFrame,
1003  0, //OnBeamTime,
1004  0, //FastToTotal,
1005  0, //meany,
1006  0, //widthy,
1007  0, //meanz,
1008  0, //widthz,
1009  WireCenters,
1010  WireWidths);
1011  std::vector<bool> MarkedForRemoval(NFlashes-BeginFlash,false);
1012 
1013  opdet::MarkFlashesForRemoval(FlashVector,
1014  BeginFlash,
1015  MarkedForRemoval);
1016 
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 );
1022 
1023 }
void MarkFlashesForRemoval(std::vector< recob::OpFlash > const &FlashVector, size_t const BeginFlash, std::vector< bool > &MarkedForRemoval)
Definition: OpFlashAlg.cxx:623
BOOST_AUTO_TEST_CASE ( MarkFlashesForRemoval_TwoIndieFlashes  )

Definition at line 1025 of file OpFlashAlg_test.cc.

1026 {
1027  size_t NFlashes=2;
1028  size_t BeginFlash=0;
1029 
1030  std::vector<double> PEs(30,0);
1031  PEs.at(0) = 100;
1032  std::vector<double> WireCenters(3,0);
1033  std::vector<double> WireWidths(3,0);
1034 
1035  std::vector<recob::OpFlash> FlashVector;
1036  FlashVector.emplace_back(0, //time
1037  0.5, //TimeWidth,
1038  0, //AveAbsTime,
1039  0, //Frame,
1040  PEs,
1041  0, //InBeamFrame,
1042  0, //OnBeamTime,
1043  0, //FastToTotal,
1044  0, //meany,
1045  0, //widthy,
1046  0, //meanz,
1047  0, //widthz,
1048  WireCenters,
1049  WireWidths);
1050  FlashVector.emplace_back(1e6, //time
1051  0.5, //TimeWidth,
1052  0, //AveAbsTime,
1053  0, //Frame,
1054  PEs,
1055  0, //InBeamFrame,
1056  0, //OnBeamTime,
1057  0, //FastToTotal,
1058  0, //meany,
1059  0, //widthy,
1060  0, //meanz,
1061  0, //widthz,
1062  WireCenters,
1063  WireWidths);
1064  std::vector<bool> MarkedForRemoval(NFlashes-BeginFlash,false);
1065 
1066  opdet::MarkFlashesForRemoval(FlashVector,
1067  BeginFlash,
1068  MarkedForRemoval);
1069 
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 );
1076 
1077 }
void MarkFlashesForRemoval(std::vector< recob::OpFlash > const &FlashVector, size_t const BeginFlash, std::vector< bool > &MarkedForRemoval)
Definition: OpFlashAlg.cxx:623
BOOST_AUTO_TEST_CASE ( MarkFlashesForRemoval_RemoveOneFlash  )

Definition at line 1079 of file OpFlashAlg_test.cc.

1080 {
1081  size_t NFlashes=3;
1082  size_t BeginFlash=0;
1083 
1084  std::vector<double> PEs(30,0);
1085  PEs.at(0) = 100;
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);
1090 
1091  std::vector<recob::OpFlash> FlashVector;
1092  FlashVector.emplace_back(0, //time
1093  0.5, //TimeWidth,
1094  0, //AveAbsTime,
1095  0, //Frame,
1096  PEs,
1097  0, //InBeamFrame,
1098  0, //OnBeamTime,
1099  0, //FastToTotal,
1100  0, //meany,
1101  0, //widthy,
1102  0, //meanz,
1103  0, //widthz,
1104  WireCenters,
1105  WireWidths);
1106  FlashVector.emplace_back(1.6, //time
1107  0.5, //TimeWidth,
1108  0, //AveAbsTime,
1109  0, //Frame,
1110  PEs_Small,
1111  0, //InBeamFrame,
1112  0, //OnBeamTime,
1113  0, //FastToTotal,
1114  0, //meany,
1115  0, //widthy,
1116  0, //meanz,
1117  0, //widthz,
1118  WireCenters,
1119  WireWidths);
1120  FlashVector.emplace_back(1e6, //time
1121  0.5, //TimeWidth,
1122  0, //AveAbsTime,
1123  0, //Frame,
1124  PEs,
1125  0, //InBeamFrame,
1126  0, //OnBeamTime,
1127  0, //FastToTotal,
1128  0, //meany,
1129  0, //widthy,
1130  0, //meanz,
1131  0, //widthz,
1132  WireCenters,
1133  WireWidths);
1134  std::vector<bool> MarkedForRemoval(NFlashes-BeginFlash,false);
1135 
1136  opdet::MarkFlashesForRemoval(FlashVector,
1137  BeginFlash,
1138  MarkedForRemoval);
1139 
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 );
1151 
1152 }
void MarkFlashesForRemoval(std::vector< recob::OpFlash > const &FlashVector, size_t const BeginFlash, std::vector< bool > &MarkedForRemoval)
Definition: OpFlashAlg.cxx:623
BOOST_AUTO_TEST_CASE ( MarkFlashesForRemoval_IgnoreFirstFlash  )

Definition at line 1154 of file OpFlashAlg_test.cc.

1155 {
1156  size_t NFlashes=4;
1157  size_t BeginFlash=1;
1158 
1159  std::vector<double> PEs(30,0);
1160  PEs.at(0) = 100;
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);
1165 
1166  std::vector<recob::OpFlash> FlashVector;
1167  FlashVector.emplace_back(-1e6, //time
1168  0.5, //TimeWidth,
1169  0, //AveAbsTime,
1170  0, //Frame,
1171  PEs,
1172  0, //InBeamFrame,
1173  0, //OnBeamTime,
1174  0, //FastToTotal,
1175  0, //meany,
1176  0, //widthy,
1177  0, //meanz,
1178  0, //widthz,
1179  WireCenters,
1180  WireWidths);
1181  FlashVector.emplace_back(0, //time
1182  0.5, //TimeWidth,
1183  0, //AveAbsTime,
1184  0, //Frame,
1185  PEs,
1186  0, //InBeamFrame,
1187  0, //OnBeamTime,
1188  0, //FastToTotal,
1189  0, //meany,
1190  0, //widthy,
1191  0, //meanz,
1192  0, //widthz,
1193  WireCenters,
1194  WireWidths);
1195  FlashVector.emplace_back(1.6, //time
1196  0.5, //TimeWidth,
1197  0, //AveAbsTime,
1198  0, //Frame,
1199  PEs_Small,
1200  0, //InBeamFrame,
1201  0, //OnBeamTime,
1202  0, //FastToTotal,
1203  0, //meany,
1204  0, //widthy,
1205  0, //meanz,
1206  0, //widthz,
1207  WireCenters,
1208  WireWidths);
1209  FlashVector.emplace_back(1e6, //time
1210  0.5, //TimeWidth,
1211  0, //AveAbsTime,
1212  0, //Frame,
1213  PEs,
1214  0, //InBeamFrame,
1215  0, //OnBeamTime,
1216  0, //FastToTotal,
1217  0, //meany,
1218  0, //widthy,
1219  0, //meanz,
1220  0, //widthz,
1221  WireCenters,
1222  WireWidths);
1223  std::vector<bool> MarkedForRemoval(NFlashes-BeginFlash,false);
1224 
1225  opdet::MarkFlashesForRemoval(FlashVector,
1226  BeginFlash,
1227  MarkedForRemoval);
1228 
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 );
1242 
1243 }
void MarkFlashesForRemoval(std::vector< recob::OpFlash > const &FlashVector, size_t const BeginFlash, std::vector< bool > &MarkedForRemoval)
Definition: OpFlashAlg.cxx:623
BOOST_AUTO_TEST_CASE ( RemoveFlashesFromVectors_IgnoreFirstFlash  )

Definition at line 1245 of file OpFlashAlg_test.cc.

1246 {
1247  size_t NFlashes=4;
1248  size_t BeginFlash=1;
1249 
1250  std::vector<double> PEs(30,0);
1251  PEs.at(0) = 100;
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);
1256 
1257  std::vector<recob::OpFlash> FlashVector;
1258  FlashVector.emplace_back(-1e6, //time
1259  0.5, //TimeWidth,
1260  0, //AveAbsTime,
1261  0, //Frame,
1262  PEs,
1263  0, //InBeamFrame,
1264  0, //OnBeamTime,
1265  0, //FastToTotal,
1266  0, //meany,
1267  0, //widthy,
1268  0, //meanz,
1269  0, //widthz,
1270  WireCenters,
1271  WireWidths);
1272  FlashVector.emplace_back(0, //time
1273  0.5, //TimeWidth,
1274  0, //AveAbsTime,
1275  0, //Frame,
1276  PEs,
1277  0, //InBeamFrame,
1278  0, //OnBeamTime,
1279  0, //FastToTotal,
1280  0, //meany,
1281  0, //widthy,
1282  0, //meanz,
1283  0, //widthz,
1284  WireCenters,
1285  WireWidths);
1286  FlashVector.emplace_back(1.6, //time
1287  0.5, //TimeWidth,
1288  0, //AveAbsTime,
1289  0, //Frame,
1290  PEs_Small,
1291  0, //InBeamFrame,
1292  0, //OnBeamTime,
1293  0, //FastToTotal,
1294  0, //meany,
1295  0, //widthy,
1296  0, //meanz,
1297  0, //widthz,
1298  WireCenters,
1299  WireWidths);
1300  FlashVector.emplace_back(1e6, //time
1301  0.5, //TimeWidth,
1302  0, //AveAbsTime,
1303  0, //Frame,
1304  PEs,
1305  0, //InBeamFrame,
1306  0, //OnBeamTime,
1307  0, //FastToTotal,
1308  0, //meany,
1309  0, //widthy,
1310  0, //meanz,
1311  0, //widthz,
1312  WireCenters,
1313  WireWidths);
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);
1319 
1320  opdet::RemoveFlashesFromVectors(MarkedForRemoval,
1321  FlashVector,
1322  BeginFlash,
1323  RefinedHitsPerFlash);
1324 
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 );
1332 
1333  BOOST_TEST( RefinedHitsPerFlash.size() == 2U );
1334  BOOST_TEST( RefinedHitsPerFlash[0][0] == 0 );
1335  BOOST_TEST( RefinedHitsPerFlash[1][0] == 2 );
1336 
1337 }
void RemoveFlashesFromVectors(std::vector< bool > const &MarkedForRemoval, std::vector< recob::OpFlash > &FlashVector, size_t const BeginFlash, std::vector< std::vector< int >> &RefinedHitsPerFlash)
Definition: OpFlashAlg.cxx:651
BOOST_AUTO_TEST_CASE ( RemoveFlashesFromVectors_NoFlashes  )

Definition at line 1339 of file OpFlashAlg_test.cc.

1340 {
1341  size_t NFlashes=5;
1342  size_t BeginFlash=5; //that is, no new flashes to look at
1343 
1344  std::vector<recob::OpFlash> FlashVector(NFlashes);
1345  std::vector<bool> MarkedForRemoval(NFlashes-BeginFlash,false);
1346  std::vector< std::vector<int> > RefinedHitsPerFlash(NFlashes-BeginFlash);
1347 
1348  opdet::RemoveFlashesFromVectors(MarkedForRemoval,
1349  FlashVector,
1350  BeginFlash,
1351  RefinedHitsPerFlash);
1352 
1353  BOOST_TEST( FlashVector.size() == NFlashes );
1354 
1355 }
void RemoveFlashesFromVectors(std::vector< bool > const &MarkedForRemoval, std::vector< recob::OpFlash > &FlashVector, size_t const BeginFlash, std::vector< std::vector< int >> &RefinedHitsPerFlash)
Definition: OpFlashAlg.cxx:651

Variable Documentation

constexpr float FlashThreshold = 50

Definition at line 8 of file OpFlashAlg_test.cc.

auto const tolerance = 1e-4% boost::test_tools::tolerance()

Definition at line 11 of file OpFlashAlg_test.cc.

constexpr double WidthTolerance = 0.5

Definition at line 9 of file OpFlashAlg_test.cc.