8 #include "art/Framework/Core/EDAnalyzer.h"
9 #include "art/Framework/Core/ModuleMacros.h"
10 #include "art/Framework/Principal/Event.h"
11 #include "art/Framework/Principal/Handle.h"
12 #include "canvas/Utilities/Exception.h"
14 #include "artdaq-core-demo/Overlays/ToyFragment.hh"
15 #include "artdaq-core/Data/Fragment.hh"
17 #include "messagefacility/MessageLogger/MessageLogger.h"
57 virtual void analyze(art::Event
const& evt);
60 std::string raw_data_label_;
61 std::string frag_type_;
67 , raw_data_label_(pset.get<std::string>(
"raw_data_label"))
68 , frag_type_(pset.get<std::string>(
"frag_type")) {}
72 art::Handle<artdaq::Fragments> raw;
73 evt.getByLabel(raw_data_label_, frag_type_, raw);
77 for (
size_t idx = 0; idx < raw->size(); ++idx)
79 const auto& frag((*raw)[idx]);
84 auto adc_iter = bb.dataBeginADCs();
85 ToyFragment::adc_t expected_adc = 1;
87 for (; adc_iter != bb.dataEndADCs(); adc_iter++ , expected_adc++)
89 if (*adc_iter != expected_adc)
91 mf::LogError(
"CheckIntegrity") <<
"Error: in run " << evt.run() <<
", subrun " << evt.subRun() <<
92 ", event " << evt.event() <<
", seqID " << frag.sequenceID() <<
93 ", fragID " << frag.fragmentID() <<
": expected an ADC value of " << expected_adc <<
94 ", got " << *adc_iter;
99 mf::LogDebug(
"CheckIntegrity") <<
"In run " << evt.run() <<
", subrun " << evt.subRun() <<
100 ", event " << evt.event() <<
", everything is fine";
106 mf::LogError(
"CheckIntegrity") <<
"In run " << evt.run() <<
", subrun " << evt.subRun() <<
107 ", event " << evt.event() <<
", raw.isValid() returned false";
virtual void analyze(art::Event const &evt)
Analyze an event. Called by art for each event in run (based on command line options) ...
virtual ~CheckIntegrity()=default
Default destructor.
Demonstration art::EDAnalyzer which checks that all ToyFragment ADC counts are in the defined range...
CheckIntegrity(fhicl::ParameterSet const &pset)
CheckIntegrity Constructor.