11 #include "art_root_io/TFileService.h" 15 #include "artdaq-core/Data/Fragment.hh" 16 #include "artdaq-core/Data/ContainerFragment.hh" 31 class FelixRawDecoder;
57 const artdaq::Fragment& frag,
58 RawDigits& raw_digits);
93 _h_nframes = file_srv->make<TH1D>(
"felix_NFrames",
"FELIX: Number of frames", 1000, 0, 1000);
101 <<
"-------------------- FELIX RawDecoder -------------------";
104 unsigned int n_felix_frags = 0;
112 try { cont_frags->size(); }
114 std::cout <<
"WARNING: Container FELIX data not found in event " << eventNumber <<
std::endl;
115 std::vector<raw::RawDigit> digits;
122 <<
"Run: " << evt.
run()
123 <<
", SubRun: " << evt.
subRun()
124 <<
", Event: " << evt.
event()
125 <<
" Container Fragments is NOT VALID";
128 for (
auto const& cont : *cont_frags)
130 artdaq::ContainerFragment cont_frag(cont);
131 for (
size_t ii = 0; ii < cont_frag.block_count(); ++ii)
138 if (
_process(*cont_frag[ii], raw_digits)) ++n_felix_frags;
149 try { frags->size(); }
151 std::cout <<
"WARNING: Raw FELIX data not found in event " << eventNumber <<
std::endl;
152 std::vector<raw::RawDigit> digits;
158 if(!frags.isValid()){
160 <<
"Run: " << evt.
run()
161 <<
", SubRun: " << evt.
subRun()
162 <<
", Event: " << evt.
event()
163 <<
" Fragments is NOT VALID";
166 for(
auto const& frag: *frags)
168 if (
_process(frag, raw_digits)) ++n_felix_frags;
173 <<
" Processed " << n_felix_frags
174 <<
" FELIX Fragments, " 178 evt.
put(std::make_unique<decltype(raw_digits)>(
std::move(raw_digits)),
184 const artdaq::Fragment& frag,
192 <<
" SequenceID = " << frag.sequenceID()
193 <<
" fragmentID = " << frag.fragmentID()
194 <<
" fragmentType = " << (unsigned)frag.type()
195 <<
" Timestamp = " << frag.timestamp();
201 uint8_t slot = felix.
slot_no(0);
204 std::cout<<
" Nframes = "<<n_frames<<
std::endl;
211 for(
unsigned ch = 0; ch < n_channels; ++ch) {
213 std::cout<<
"crate:slot:fiber = "<<crate<<
", "<<slot<<
", "<<fiber<<
std::endl;
215 for(
unsigned int nframe=0;nframe<waveform.size();nframe++){
216 if(ch==0 && nframe<100) {
217 if(nframe==0) std::cout<<
"Print the first 100 ADCs of Channel#1"<<
std::endl;
218 std::cout<<waveform.at(nframe)<<
" ";
221 v_adc.push_back(waveform.at(nframe));
223 int offlineChannel = -1;
227 raw_digits.push_back(raw_digit);
static constexpr size_t num_ch_per_frame
size_t total_frames() const
std::vector< uint16_t > _buffer
EventNumber_t event() const
Collection of charge vs time digitized from a single readout channel.
uint8_t slot_no(const unsigned &frame_ID=0) const
Handle< PROD > getHandle(SelectorBase const &) const
uint8_t crate_no(const unsigned &frame_ID=0) const
EDProducer(fhicl::ParameterSet const &pset)
static constexpr double fs
#define MF_LOG_ERROR(category)
std::vector< short > ADCvector_t
Type representing a (compressed) vector of ADC counts.
FelixRawDecoder(fhicl::ParameterSet const &p)
std::string _output_label
unsigned int GetOfflineNumberFromDetectorElements(unsigned int crate, unsigned int slot, unsigned int fiber, unsigned int fembchannel, FelixOrRCE frswitch)
#define DEFINE_ART_MODULE(klass)
struct dune::tde::crate crate
T get(std::string const &key) const
SubRunNumber_t subRun() const
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
bool _expect_container_fragments
#define MF_LOG_INFO(category)
void produce(art::Event &e) override
uint8_t fiber_no(const unsigned &frame_ID=0) const
adc_v get_ADCs_by_channel(const uint8_t channel_ID) const
bool _process(const artdaq::Fragment &frag, RawDigits &raw_digits)
IDNumber_t< Level::Event > EventNumber_t
void reconfigure(const fhicl::ParameterSet &pset)
FelixRawDecoder & operator=(FelixRawDecoder const &)=delete
std::vector< Fragment > Fragments
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)
std::vector< raw::RawDigit > RawDigits