1 #define BOOST_TEST_MODULE ( HitAnaAlg_test )
2 #include "boost/test/unit_test.hpp"
17 std::string
const& HitModuleLabel)
45 BOOST_TEST( myHitAnaAlgTest.GetWireDataStruct().NHitModules == 0 );
46 BOOST_TEST( myHitAnaAlgTest.GetHitModuleLabels().size() == 0U );
47 BOOST_TEST( myHitAnaAlgTest.GetHitProcessingQueue().size() == 0U );
58 std::vector< std::vector<int> > AssocVector(nWires);
59 for(
size_t iter=0; iter<nWires; iter++)
60 AssocVector[iter].push_back(iter);
62 std::string HitModuleLabel =
"hit";
64 myHitAnaAlgTest.LoadHitAssocPair(HitVector,AssocVector,HitModuleLabel);
65 BOOST_TEST( myHitAnaAlgTest.GetHitModuleLabels().size() == 1U );
66 BOOST_TEST( myHitAnaAlgTest.GetHitProcessingQueue().size() == 1U );
76 std::vector<recob::Hit> HitVector1(nHits1);
77 std::vector<recob::Hit> HitVector2(nHits2);
79 std::vector< std::vector<int> > AssocVector1(nWires);
80 std::vector< std::vector<int> > AssocVector2(nWires);
81 for(
size_t iter=0; iter<nWires; iter++){
82 AssocVector1[iter].push_back(iter);
83 AssocVector2[iter].push_back(nWires-iter-1);
85 std::string HitModuleLabel1 =
"hit1";
86 std::string HitModuleLabel2 =
"hit2";
88 myHitAnaAlgTest.LoadHitAssocPair(HitVector1,AssocVector1,HitModuleLabel1);
89 myHitAnaAlgTest.LoadHitAssocPair(HitVector2,AssocVector2,HitModuleLabel2);
91 BOOST_TEST( myHitAnaAlgTest.GetHitModuleLabels().size() == 2U );
92 BOOST_TEST( myHitAnaAlgTest.GetHitModuleLabels()[0].compare(HitModuleLabel1) == 0 );
93 BOOST_TEST( myHitAnaAlgTest.GetHitModuleLabels()[1].compare(HitModuleLabel2) == 0 );
95 BOOST_TEST( myHitAnaAlgTest.GetHitProcessingQueue().size() == 2U );
96 BOOST_TEST( myHitAnaAlgTest.GetHitProcessingQueue()[0].second.size() == nWires );
97 BOOST_TEST( myHitAnaAlgTest.GetHitProcessingQueue()[0].second[0].size() == 1U );
98 BOOST_TEST( myHitAnaAlgTest.GetHitProcessingQueue()[0].second[0][0] == 0 );
99 BOOST_TEST( myHitAnaAlgTest.GetHitProcessingQueue()[1].second.size() == nWires );
100 BOOST_TEST( myHitAnaAlgTest.GetHitProcessingQueue()[1].second[0].size() == 1U );
101 BOOST_TEST( myHitAnaAlgTest.GetHitProcessingQueue()[1].second[0][0] == (int)(nWires-1) );
107 std::string str =
"test";
108 myHitAnaAlgTest.AddHitModuleLabel(str);
109 BOOST_TEST( myHitAnaAlgTest.GetHitModuleLabels().size() == 1U );
114 std::vector<recob::Hit>
HitVector(nHits);
116 std::vector< std::vector<int> > AssocVector(nWires);
117 for(
size_t iter=0; iter<nWires; iter++)
118 AssocVector[iter].push_back(iter);
120 std::string HitModuleLabel =
"hit";
122 BOOST_CHECK_THROW(myHitAnaAlgTest.LoadHitAssocPair(HitVector,AssocVector,HitModuleLabel),
hit::HitAnaAlgException);
131 std::vector<recob::Hit>
HitVector(nHits);
133 std::vector< std::vector<int> > AssocVector(nWires);
134 for(
size_t iter=0; iter<nWires; iter++)
135 AssocVector[iter].push_back(iter);
137 std::string HitModuleLabel =
"hit";
139 myHitAnaAlgTest.LoadHitAssocPair(HitVector,AssocVector,HitModuleLabel);
141 unsigned int event = 50;
142 unsigned int run =200;
144 myHitAnaAlgTest.InitWireData(event,run);
146 BOOST_TEST( myHitAnaAlgTest.GetWireDataStruct().event == event );
147 BOOST_TEST( myHitAnaAlgTest.GetWireDataStruct().run == run );
148 BOOST_TEST( myHitAnaAlgTest.GetWireDataStruct().NHitModules == 1 );
149 BOOST_TEST( myHitAnaAlgTest.GetWireDataStruct().HitModuleLabels.size() == 1U );
150 BOOST_TEST( myHitAnaAlgTest.GetWireDataStruct().HitModuleLabels[0] == HitModuleLabel );
156 unsigned int event = 50;
157 unsigned int run =200;
159 myHitAnaAlgTest.InitWireData(event,run);
161 BOOST_TEST( myHitAnaAlgTest.GetWireDataStruct().event == event );
162 BOOST_TEST( myHitAnaAlgTest.GetWireDataStruct().run == run );
163 BOOST_TEST( myHitAnaAlgTest.GetWireDataStruct().NHitModules == 0 );
164 BOOST_TEST( myHitAnaAlgTest.GetWireDataStruct().HitModuleLabels.size() == 0U );
170 unsigned int event = 50;
171 unsigned int run =200;
173 myHitAnaAlgTest.InitWireData(event,run);
174 myHitAnaAlgTest.ClearWireDataHitInfo();
176 BOOST_TEST( myHitAnaAlgTest.GetWireDataStruct().event == event );
177 BOOST_TEST( myHitAnaAlgTest.GetWireDataStruct().run == run );
178 BOOST_TEST( myHitAnaAlgTest.GetWireDataStruct().NHitModules == 0 );
179 BOOST_TEST( myHitAnaAlgTest.GetWireDataStruct().NHits.size() == 0U );
180 BOOST_TEST( myHitAnaAlgTest.GetWireDataStruct().Hits_IntegratedCharge.size() == 0U );
181 BOOST_TEST( myHitAnaAlgTest.GetWireDataStruct().Hits.size() == 0U );
190 std::vector<recob::Hit>
HitVector(nHits);
192 std::vector< std::vector<int> > AssocVector(nWires);
193 for(
size_t iter=0; iter<nWires; iter++)
194 AssocVector[iter].push_back(iter);
196 std::string HitModuleLabel =
"hit";
198 myHitAnaAlgTest.LoadHitAssocPair(HitVector,AssocVector,HitModuleLabel);
200 unsigned int event = 50;
201 unsigned int run =200;
203 myHitAnaAlgTest.InitWireData(event,run);
204 myHitAnaAlgTest.ClearWireDataHitInfo();
206 BOOST_TEST( myHitAnaAlgTest.GetWireDataStruct().event == event );
207 BOOST_TEST( myHitAnaAlgTest.GetWireDataStruct().run == run );
208 BOOST_TEST( myHitAnaAlgTest.GetWireDataStruct().NHitModules == 1 );
209 BOOST_TEST( myHitAnaAlgTest.GetWireDataStruct().NHits.size() == 1U );
210 BOOST_TEST( myHitAnaAlgTest.GetWireDataStruct().NHits[0] == 0 );
211 BOOST_TEST( myHitAnaAlgTest.GetWireDataStruct().Hits_IntegratedCharge.size() == 1U );
212 BOOST_TEST( myHitAnaAlgTest.GetWireDataStruct().Hits_IntegratedCharge[0] == 0 );
213 BOOST_TEST( myHitAnaAlgTest.GetWireDataStruct().Hits.size() == 1U );
217 BOOST_AUTO_TEST_SUITE_END()
std::vector< std::string > HitModuleLabels
void LoadHitAssocPair(std::vector< recob::Hit > const &HitVector, std::vector< std::vector< int > > const &AssocVector, std::string const &HitModuleLabel)
void LoadHitAssocPair(std::vector< recob::Hit > const &, std::vector< std::vector< int >> const &, std::string const &)
void AddHitModuleLabel(std::string str)
std::vector< HitAnaAlg::HitAssocPair > const & GetHitProcessingQueue() const
BOOST_FIXTURE_TEST_SUITE(GeometryIteratorsIcarus, IcarusGeometryIteratorTestFixture) BOOST_AUTO_TEST_CASE(AllTests)
void ClearWireDataHitInfo()
std::array< float, 2 > HitVector(const recob::Hit &hit, const geo::GeometryCore *geo, const detinfo::DetectorPropertiesData &dprop)
void InitWireData(unsigned int e, unsigned int r)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
hit::HitAnaAlgTest myHitAnaAlgTest
void ClearWireDataHitInfo()
std::vector< std::string > const & GetHitModuleLabels() const
void InitWireData(unsigned int, unsigned int)
WireROIInfo const & GetWireDataStruct() const
std::vector< HitAssocPair > HitProcessingQueue