33 std::vector<short> &adclist)
35 for(uint32_t i = 0; i < num_samples; i++)
37 adclist.emplace_back(adc->at(channel*num_samples + i));
44 size_t crate = LAr_chan / 320;
47 LAr_chan = 8*(LAr_chan/8+1)-LAr_chan%8 -1;
51 LAr_chan = 32*(LAr_chan/32+1)-LAr_chan%32 -1;
52 size_t card = 4 - ((LAr_chan / 32) % 5);
55 size_t shift = 31 - (LAr_chan % 32);
56 Chan311 = (2*card)*32 + shift;
60 size_t shift = 31 - (LAr_chan % 32);
61 Chan311 = (2*card + 1)*32 + shift;
66 size_t new_LAr_chan = LAr_chan - crate*320;
67 size_t card = ((new_LAr_chan / 32) % 5);
68 if(new_LAr_chan > 159)
70 size_t shift = new_LAr_chan % 32;
71 Chan311 = (2*card)*32 + shift;
75 size_t shift = new_LAr_chan % 32;
76 Chan311 = (2*card + 1)*32 + shift;
78 Chan311 = Chan311 + crate*320;
93 file.open(PedestalFileName);
97 <<
"failed to open input file " << PedestalFileName <<
"\n";
102 size_t ch, cryo,
crate, rawch;
104 file >> rawch >> cryo >> crate >> ch >> mean >>
rms;
105 PedMap.emplace_back(mean, rms);
126 std::vector<dlardaq::adc16_t> ADCvec311;
128 std::vector<dlardaq::adc16_t> *ADCvec311Pointer = &ADCvec311;
130 std::vector<short> adclist;
132 for(
size_t LAr_chan = 0; LAr_chan < (size_t)
nchannels; LAr_chan++)
137 short unsigned int nTickReadout =
nsamples;
147 digitList[LAr_chan] = rd;
194 DataDecode.
m_file.open(name.c_str(), std::ios_base::in | std::ios_base::binary);
198 <<
"failed to open input file " << name <<
"\n";
202 std::vector<dlardaq::BYTE> head_buf;
212 std::vector<dlardaq::BYTE> foot_buf;
227 <<
"File " <<name <<
" seems to have too many events: " <<
fNEvents <<
"\n";
241 mf::LogInfo(__FUNCTION__)<<
"All the files have been read in. Checking end of file..." <<
"\n";
245 if( ((uint8_t)file_length - (uint8_t)current_position) > (uint8_t)100 )
249 <<(file_length - current_position) <<
" bits left." <<
"\n";
251 mf::LogInfo(__FUNCTION__)<<
"Completed reading file and closing output file." <<
"\n";
259 std::unique_ptr< std::vector<raw::RawDigit> > tpc_raw_digits(
new std::vector<raw::RawDigit> );
268 std::uint64_t tthi = event_head.
trig_info.
ts.tv_sec;
269 std::uint64_t thilo = (tthi << 32) + event_head.
trig_info.
ts.tv_nsec;
275 int int_subrn = std::stoi(str_subrn);
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
enum raw::_compress Compress_t
Collection of charge vs time digitized from a single readout channel.
static const size_t FileFootSz
double rms(sqlite3 *db, std::string const &table_name, std::string const &column_name)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
SubRunPrincipal * makeSubRunPrincipal(SubRunAuxiliary const &subRunAux) const
ssize_t decode_runhead(const char *buf, runheader_t &rh)
void ReadPedestalFile(std::string PedestalFileName, std::vector< std::pair< double, double > > &PedMap)
static const size_t RunHeadSz
RunPrincipal * makeRunPrincipal(RunAuxiliary const &runAux) const
art framework interface to geometry description
TypeLabel const & reconstitutes(std::string const &modLabel, std::string const &instanceName={})
RunID const & runID() const
struct dune::tde::crate crate
T get(std::string const &key) const
IDNumber_t< Level::SubRun > SubRunNumber_t
size_t Get311Chan(size_t LAr_chan)
ssize_t decode_filefoot(const char *buf, footer_t &rf)
ssize_t GetEvent(size_t evnum, dlardaq::evheader_t &eh, std::vector< adc16_t > &adc)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::enable_if_t<!detail::range_sets_supported(P::branch_type)> put_product_in_principal(std::unique_ptr< T > &&product, P &principal, std::string const &module_label, std::string const &instance_name={})
void SetPedestal(float ped, float sigma=1.)
Set pedestal and its RMS (the latter is 0 by default)
Conversion of binary data to root files.
EventPrincipal * makeEventPrincipal(EventAuxiliary const &eventAux, std::unique_ptr< History > &&history) const
SubRunNumber_t subRun() const
void SplitAdc(const std::vector< dlardaq::adc16_t > *adc, size_t channel, uint32_t num_samples, std::vector< short > &adclist)
unsigned int ChannelID_t
Type representing the ID of a readout channel.
double mean(sqlite3 *db, std::string const &table_name, std::string const &column_name)
IDNumber_t< Level::Run > RunNumber_t