146 std::unique_ptr<std::vector<raw::OpDetWaveform>> product_collection(
new std::vector<raw::OpDetWaveform>());
151 art::Handle< std::vector<artdaq::Fragment> > rawFragHandle;
152 event.getByLabel(
_tag, rawFragHandle);
154 if (rawFragHandle.isValid()) {
156 std::cout <<
"######################################################################\n";
157 std::cout <<
"Run " <<
event.run() <<
", subrun " <<
event.subRun() << std::endl;
159 for (
size_t idx = 0; idx < rawFragHandle->size(); ++idx)
162 const auto& frag((*rawFragHandle)[idx]);
163 sbndaq::CAENV1730Fragment bb(frag);
164 auto const*
md = bb.Metadata();
165 sbndaq::CAENV1730Event
const* event_ptr = bb.Event();
166 sbndaq::CAENV1730EventHeader header = event_ptr->Header;
168 std::cout <<
"\tFragment ID: " << frag.fragmentID() <<
", type: " << frag.typeString() <<
", type: " << frag.type() <<
", boardID: " << header.boardID <<
", msk lo: " << header.channelMask_lo <<
", hi: " << header.channelMask_hi << std::endl;
169 std::cout <<
"\tFrom header, event counter is " << header.eventCounter <<
"\n";
170 std::cout <<
"\tFrom header, triggerTimeTag is " << header.triggerTimeTag <<
"\n";
171 std::vector< std::vector<uint16_t> > fWvfmsVec;
172 size_t nChannels =
md->nChannels;
173 std::cout <<
"\tFrom header , no of channel is " << nChannels <<
"\n";
175 uint32_t ev_size_quad_bytes = header.eventSize;
177 uint32_t evt_header_size_quad_bytes =
sizeof(sbndaq::CAENV1730EventHeader)/
sizeof(uint32_t);
178 uint32_t data_size_double_bytes = 2*(ev_size_quad_bytes - evt_header_size_quad_bytes);
179 uint32_t wfm_length = data_size_double_bytes/nChannels;
184 const uint16_t* data_begin =
reinterpret_cast<const uint16_t*
>(frag.dataBeginBytes()
185 +
sizeof(sbndaq::CAENV1730EventHeader));
187 const uint16_t* value_ptr = data_begin;
188 size_t ch_offset = 0;
192 for (
size_t i_ch=0; i_ch<nChannels; ++i_ch)
195 ch_offset = i_ch * wfm_length;
198 my_wf.resize(wfm_length);
201 for(
size_t i_t=0; i_t<wfm_length; ++i_t)
204 value_ptr = data_begin + ch_offset + i_t;
206 value = *(value_ptr);
213 product_collection->push_back(my_wf);
218 event.put(std::move(product_collection));
microsecond microseconds
Alias for common language habits.
second seconds
Alias for common language habits.
BEGIN_PROLOG could also be cout