119 using dunedaq::detdataformats::wib::WIBFrame;
120 using dunedaq::detdataformats::wib::WIBHeader;
124 std::deque<std::string> det_types
127 for (
const auto & det : det_types)
129 if (det !=
"TPC")
continue;
132 std::cout <<
"HDColdboxDataInterface :" <<
"Detector type: " << det <<
std::endl;
135 std::deque<std::string> apaNames
140 std::cout <<
"HDColdboxDataInterface :" <<
"Size of apaNames: " << apaNames.size() <<
std::endl;
141 std::cout <<
"HDColdboxDataInterface :" <<
"apaNames[apano]: " << apaNames[apano-1] <<
std::endl;
147 for (
const auto &
t : linkNames)
149 hid_t dataset = H5Dopen(linkGroup,
t.data(), H5P_DEFAULT);
150 hsize_t ds_size = H5Dget_storage_size(dataset);
151 if (ds_size <=
sizeof(FragmentHeader))
continue;
153 std::vector<char> ds_data(ds_size);
154 H5Dread(dataset, H5T_STD_I8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, ds_data.data());
158 Fragment frag(&ds_data[0], Fragment::BufferAdoptionMode::kReadOnlyMode);
159 size_t n_frames = (ds_size -
sizeof(FragmentHeader))/
sizeof(WIBFrame);
162 std::cout <<
"HDColdboxDataInterface :" <<
"n_frames : " << n_frames <<
std::endl;
164 std::vector<raw::RawDigit::ADCvector_t> adc_vectors(256);
165 unsigned int slot = 0, fiber = 0;
167 for (
size_t i = 0; i < n_frames; ++i)
169 auto frame =
reinterpret_cast<WIBFrame*
>(
static_cast<uint8_t*
>(frag.get_data()) + i*
sizeof(WIBFrame));
172 std::cout <<
"HDColdboxDataInterface :" <<
"frame : " << frame <<
std::endl;
174 for (
size_t j = 0; j < adc_vectors.size(); ++j)
176 adc_vectors[j].push_back(frame->get_channel(j));
181 slot = frame->get_wib_header()->slot_no;
182 fiber = frame->get_wib_header()->fiber_no;
187 std::cout <<
"HDColdboxDataInterface :" <<
"slot, fiber: " << slot <<
", " << fiber <<
std::endl;
189 for (
size_t iChan = 0; iChan < 256; ++iChan)
194 std::cout <<
"HDColdboxDataInterface : " <<
"Channel: " << iChan <<
" N ticks: " << v_adc.size() <<
" Timestamp: " << frag.get_trigger_timestamp() <<
std::endl;
199 unsigned int fiberloc = 0;
211 MF_LOG_WARNING(
"_process_FELIX_AUX:") <<
" Fiber number " << (
int) fiber <<
" is expected to be 1 or 2 -- revisit logic";
215 unsigned int chloc = iChan;
226 std::cout <<
"HDColdboxDataInterface : " <<
"iChan : " << iChan <<
std::endl;
227 std::cout <<
"HDColdboxDataInterface : " <<
"offline_chan : " << offline_chan <<
std::endl;
229 if (offline_chan < 0)
continue;
230 if (offline_chan > maxchan)
continue;
232 timestamps.push_back(rd_ts);
234 float median = 0., sigma = 0.;
238 raw_digits.push_back(rd);
Collection of charge vs time digitized from a single readout channel.
std::vector< short > ADCvector_t
Type representing a (compressed) vector of ADC counts.
unsigned int fDefaultCrate
unsigned int GetOfflineNumberFromDetectorElements(unsigned int crate, unsigned int slot, unsigned int fiber, unsigned int fembchannel, FelixOrRCE frswitch)
void getMedianSigma(const raw::RawDigit::ADCvector_t &v_adc, float &median, float &sigma)
std::list< std::string > getMidLevelGroupNames(hid_t grp)
void SetPedestal(float ped, float sigma=1.)
Set pedestal and its RMS (the latter is 0 by default)
#define MF_LOG_WARNING(category)
hid_t getGroupFromPath(HDFFileInfoPtr &hdfFileInfoPtr, const std::string &path)
double median(sqlite3 *db, std::string const &table_name, std::string const &column_name)
QTextStream & endl(QTextStream &s)