46 virtual void beginRun(
art::Run const&
run)
override;
53 template <
typename Obj>
54 unsigned int testObject(Obj
const* pChStatus)
const;
68 const std::vector<unsigned int> SimpleChannelStatusTest::EmptyVect;
71 SimpleChannelStatusTest::SimpleChannelStatusTest
75 (pset.
get<std::vector<unsigned int>>(
"TestGoodChannels", EmptyVect))
77 (pset.
get<std::vector<unsigned int>>(
"TestNoisyChannels", EmptyVect))
79 (pset.
get<std::vector<unsigned int>>(
"TestBadChannels", EmptyVect))
83 log <<
"Channels known as good: " << KnownGoodChannels.size();
84 if (!KnownGoodChannels.empty()) {
86 for (
unsigned int chId: KnownGoodChannels) log <<
" " << chId;
90 log <<
"\nChannels known as noisy: " << KnownNoisyChannels.size();
91 if (!KnownNoisyChannels.empty()) {
93 for (
unsigned int chId: KnownNoisyChannels) log <<
" " << chId;
97 log <<
"\nChannels known as bad: " << KnownBadChannels.size();
98 if (!KnownBadChannels.empty()) {
100 for (
unsigned int chId: KnownBadChannels) log <<
" " << chId;
110 mf::LogInfo(
"SimpleChannelStatusTest") <<
"New run: " << run.
run();
116 <<
"\nTesting service interface...";
130 <<
"\nTesting base interface...";
133 nErrors = testObject(pChStatus);
136 << nErrors <<
" errors while testing ChannelStatusProvider!";
143 template <
typename Obj>
144 unsigned int SimpleChannelStatusTest::testObject(Obj
const* pChStatus)
const 153 auto BadChannels = pChStatus->BadChannels();
154 log <<
"\nChannels marked as bad: " << BadChannels.size();
155 if (!BadChannels.empty()) {
157 for (
unsigned int chId: BadChannels) log <<
" " << chId;
161 auto NoisyChannels = pChStatus->NoisyChannels();
162 log <<
"\nChannels marked as noisy: " << NoisyChannels.size();
163 if (!NoisyChannels.empty()) {
165 for (
unsigned int chId: NoisyChannels) log <<
" " << chId;
172 for (
const auto chId: KnownBadChannels) {
173 if (!pChStatus->IsBad(chId)) {
175 <<
"channel #" << chId <<
" is not bad as it should";
180 for (
const auto chId: KnownNoisyChannels) {
181 if (!pChStatus->IsNoisy(chId)) {
183 <<
"channel #" << chId <<
" is not noisy as it should";
188 for (
const auto chId: KnownGoodChannels) {
189 if (pChStatus->IsBad(chId)) {
191 <<
"channel #" << chId <<
" is bad, while it should not";
194 if (pChStatus->IsNoisy(chId)) {
196 <<
"channel #" << chId <<
" is noisy, while it should not";
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
static const std::vector< unsigned int > EmptyVect
for initializations
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
virtual void analyze(art::Event const &) override
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
std::vector< unsigned int > KnownGoodChannels
Tests an instanciation of the ChannelStatusService.
#define DEFINE_ART_MODULE(klass)
T get(std::string const &key) const
Class providing information about the quality of channels.
Filters for channels, events, etc.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::vector< unsigned int > KnownNoisyChannels
Interface for experiment-specific channel quality info provider.
std::vector< unsigned int > KnownBadChannels
ChannelStatusProvider const * GetProviderPtr() const
Returns a pointer to the service provider.
Interface for experiment-specific service for channel quality info.