18 #define BOOST_TEST_MODULE ( simple_channel_status_test )
19 #include "boost/test/unit_test.hpp"
26 #include "fhiclcpp/ParameterSet.h"
27 #include "fhiclcpp/coding.h"
41 fhicl::detail::ps_sequence_t
encode(std::set<T>
const&
s) {
42 fhicl::detail::ps_sequence_t result;
43 result.reserve(s.size());
44 std::transform(s.begin(), s.end(), std::inserter(result, result.end()),
52 std::ostream& operator<< (std::ostream& out, std::set<T>
const&
s) {
54 typename std::set<T>::const_iterator
begin = s.cbegin(),
end = s.cend();
57 while (++begin !=
end) out <<
", " << *
begin;
77 const std::set<unsigned int> BadChannels,
86 std::unique_ptr<lariov::SimpleChannelStatus>
operator() ()
const
91 fhicl::ParameterSet cfg;
109 <<
"\nConfiguration:"
110 <<
"\n { " << config.to_string() <<
" }"
111 <<
"\nLoaded from configuration:"
112 <<
"\n - " << pStatus->
BadChannels().size() <<
" bad channels: "
114 <<
"\n - " << pStatus->
NoisyChannels().size() <<
" noisy channels: "
116 <<
"\n - largest channel ID: " << pStatus->
MaxChannel()
120 return std::unique_ptr<lariov::SimpleChannelStatus>(pStatus);
133 { 6, 8, 10, 11, 12, 13 }
136 BOOST_TEST_CHECKPOINT(
"Creating simple status");
137 std::unique_ptr<lariov::SimpleChannelStatus> StatusOwner
138 = statusCreator.CreateStatus();
143 BOOST_TEST(pSimpleStatus->
MaxChannel() == statusCreator.fMaxChannel);
171 std::set<raw::ChannelID_t> StatusBadChannels = pStatus->
BadChannels();
173 (StatusBadChannels.size() == statusCreator.fBadChannels.size());
174 BOOST_TEST(StatusBadChannels == statusCreator.fBadChannels);
177 std::set<raw::ChannelID_t> StatusNoisyChannels = pStatus->NoisyChannels();
179 (StatusNoisyChannels.size() == statusCreator.fNoisyChannels.size());
180 BOOST_TEST(StatusNoisyChannels == statusCreator.fNoisyChannels);
182 std::set<raw::ChannelID_t> GoodChannels;
189 && (channel <= statusCreator.fMaxPresentChannel);
190 const bool bBad = (statusCreator.fBadChannels.count(channel) > 0);
191 const bool bNoisy = (statusCreator.fNoisyChannels.count(channel) > 0);
192 const bool bGood = bPresent && !bBad && !bNoisy;
194 if (bGood) GoodChannels.insert(channel);
196 BOOST_TEST(pStatus->IsPresent(channel) == bPresent);
197 BOOST_TEST(pStatus->IsBad(channel) == bBad);
198 BOOST_TEST(pStatus->IsNoisy(channel) == bNoisy);
200 BOOST_TEST(pStatus->IsGood(channel) == bGood);
205 std::set<raw::ChannelID_t> StatusGoodChannels = pStatus->GoodChannels();
206 BOOST_TEST(StatusGoodChannels.size() == GoodChannels.size());
207 BOOST_TEST(StatusGoodChannels == GoodChannels);
raw::ChannelID_t MaxChannelPresent() const
Returns the ID of the largest present channel.
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
void Setup(raw::ChannelID_t MaxChannel, raw::ChannelID_t MaxGoodChannel)
Sets the service provider up.
virtual ChannelSet_t BadChannels() const override
Returns a copy of set of bad channel IDs for the current run.
::fhicl::detail::ps_atom_t encode(Interval< Args...> const &iv)
Encodes a quantity interval into a FHiCL parameter set atom.
raw::ChannelID_t MaxChannel() const
Returns the ID of the largest known channel.
virtual ChannelSet_t NoisyChannels() const override
Returns a copy of set of noisy channel IDs for the current run.
const raw::ChannelID_t fMaxPresentChannel
std::unique_ptr< lariov::SimpleChannelStatus > operator()() const
fhicl::ParameterSet CreateConfiguration() const
Channel quality provider with information from configuration file.
auto end(FixedBins< T, C > const &) noexcept
constexpr bool isValidChannelID(raw::ChannelID_t channel)
Class providing information about the quality of channels.
const std::set< unsigned int > fNoisyChannels
BEGIN_PROLOG NoisyChannels
auto begin(FixedBins< T, C > const &) noexcept
std::unique_ptr< lariov::SimpleChannelStatus > CreateStatus() const
then echo File list $list not found else cat $list while read file do echo $file sed s
StatusConfiguration(const raw::ChannelID_t MaxChannel, const raw::ChannelID_t MaxPresentChannel, const std::set< unsigned int > BadChannels, const std::set< unsigned int > NoisyChannels)
Class providing information about the quality of channels.
unsigned int ChannelID_t
Type representing the ID of a readout channel.
const raw::ChannelID_t fMaxChannel
BEGIN_PROLOG could also be cout
const std::set< unsigned int > fBadChannels
void test_simple_status()