18 #define BOOST_TEST_MODULE ( simple_channel_status_test ) 19 #include "boost/test/unit_test.hpp" 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) {
57 while (++begin !=
end) out <<
", " << *
begin;
77 const std::set<unsigned int> BadChannels,
78 const std::set<unsigned int> NoisyChannels
80 : fMaxChannel(MaxChannel)
81 , fMaxPresentChannel(MaxPresentChannel)
82 , fBadChannels(BadChannels)
83 , fNoisyChannels(NoisyChannels)
86 std::unique_ptr<lariov::SimpleChannelStatus> operator() ()
const 87 {
return CreateStatus(); }
94 cfg.
put(
"NoisyChannels", fNoisyChannels);
95 cfg.
put(
"BadChannels", fBadChannels);
106 pStatus->
Setup(fMaxChannel, fMaxPresentChannel);
109 <<
"\nConfiguration:" 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);
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
raw::ChannelID_t MaxChannelPresent() const
Returns the ID of the largest present channel.
void Setup(raw::ChannelID_t MaxChannel, raw::ChannelID_t MaxGoodChannel)
Sets the service provider up.
ps_atom_t encode(std::string const &)
raw::ChannelID_t MaxChannel() const
Returns the ID of the largest known channel.
const raw::ChannelID_t fMaxPresentChannel
fhicl::ParameterSet CreateConfiguration() const
std::vector< std::any > ps_sequence_t
virtual ChannelSet_t NoisyChannels() const override
Returns a copy of set of noisy channel IDs for the current run.
Channel quality provider with information from configuration file.
constexpr bool isValidChannelID(raw::ChannelID_t channel)
Class providing information about the quality of channels.
const std::set< unsigned int > fNoisyChannels
std::unique_ptr< lariov::SimpleChannelStatus > CreateStatus() const
virtual ChannelSet_t BadChannels() const override
Returns a copy of set of bad channel IDs for the current run.
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.
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
unsigned int ChannelID_t
Type representing the ID of a readout channel.
BOOST_AUTO_TEST_CASE(SimpleStatusTest)
void put(std::string const &key)
const raw::ChannelID_t fMaxChannel
QTextStream & endl(QTextStream &s)
const std::set< unsigned int > fBadChannels
std::string to_string() const
void test_simple_status()