VDColdboxTDERawInput_source.cc
Go to the documentation of this file.
12 
13 #include "TMath.h"
14 
15 // DUNE includes
17 
20 
21 #include <exception>
22 #include <thread>
23 #include <mutex>
24 #include <regex>
25 #include <sstream>
26 #include <iterator>
27 #include <algorithm>
28 
29 
30 #define CHECKBYTEBIT(var, pos) ( (var) & (1<<pos) )
31 #define DCBITFLAG 0x0 // 0x0 LSB -> 0x7 MSB
32 #define GETDCFLAG(info) (CHECKBYTEBIT(info, DCBITFLAG)>0)
33 
34 //
35 // event data quality flag
36 // number of non instrumented cards for L1 builders
37 #define EVCARD0 0x5
38 #define EVDQFLAG(info) ( (info & 0x3F ) == EVCARD0 )
39 
40 using UIntVec = std::vector<unsigned>;
41 
42 //
43 //
44 //
45 namespace
46 {
47  // from VDColdboxHDF5Utils
48  void getMedianSigma(const raw::RawDigit::ADCvector_t &v_adc,
49  float &median,
50  float &sigma) {
51  size_t asiz = v_adc.size();
52  int imed=0;
53  if (asiz == 0) {
54  median = 0;
55  sigma = 0;
56  }
57  else {
58  // the RMS includes tails from bad samples and signals and may not be the best RMS calc.
59 
60  imed = TMath::Median(asiz,v_adc.data()) + 0.01; // add an offset to make sure the floor gets the right integer
61  median = imed;
62  sigma = TMath::RMS(asiz,v_adc.data());
63 
64  // add in a correction suggested by David Adams, May 6, 2019
65 
66  size_t s1 = 0;
67  size_t sm = 0;
68  for (size_t i = 0; i < asiz; ++i) {
69  if (v_adc.at(i) < imed) s1++;
70  if (v_adc.at(i) == imed) sm++;
71  }
72  if (sm > 0) {
73  float mcorr = (-0.5 + (0.5*(float) asiz - (float) s1)/ ((float) sm) );
74  //if (std::abs(mcorr)>1.0) std::cout << "mcorr: " << mcorr << std::endl;
75  median += mcorr;
76  }
77  }
78  }
79 
80  void unpackData( const char *buf, size_t nb, bool cflag,
81  unsigned nsa, adcbuf_t &data )
82  {
83  //data.clear();
84  if( !cflag ) // unpack the uncompressed data into RawDigit
85  {
86  data.push_back( raw::RawDigit::ADCvector_t(nsa) );
87  size_t sz = 0;
88  const BYTE* start = buf;
89  const BYTE* stop = start + nb;
90  while(start!=stop)
91  {
92  BYTE v1 = *start++;
93  BYTE v2 = *start++;
94  BYTE v3 = *start++;
95 
96  uint16_t tmp1 = ((v1 << 4) + ((v2 >> 4) & 0xf)) & 0xfff;
97  uint16_t tmp2 = (((v2 & 0xf) << 8 ) + (v3 & 0xff)) & 0xfff;
98 
99 
100  if( sz == nsa ){ data.push_back(raw::RawDigit::ADCvector_t(nsa)); sz = 0; }
101  data.back()[sz++] = (short)tmp1;
102 
103  if( sz == nsa ){ data.push_back(raw::RawDigit::ADCvector_t(nsa)); sz = 0; }
104  data.back()[sz++] = (short)tmp2;
105  }
106  }
107  else {
108  // should not happen ... The data are not compressed for VD coldbox
109  mf::LogError(__FUNCTION__)<<"The format for the compressed data is not defined";
110  }
111  }
112 
113  // get byte content for a given data type
114  // NOTE: cast assumes host byte order
115  template<typename T> T ConvertToValue(const void *in)
116  {
117  const T *ptr = static_cast<const T*>(in);
118  return *ptr;
119  }
120 
121 
122  // binary file format exception
123  class formatexception : public std::exception
124  {
125  virtual const char* what() const throw()
126  {
127  return "Bad file format";
128  }
129  };
130  static formatexception fex;
131 }
132 
133 
134 
135 //
136 namespace raw
137 {
138 
139  // ctor
140  VDColdboxTDERawInput::VDColdboxTDERawInput( fhicl::ParameterSet const &pset,
142  art::SourceHelper const &pm ) :
143  __sourceHelper( pm ),
144  __currentSubRunID(),
145  __eventCtr( 0 ),
146  __eventNum( 0 )
147  {
148  const std::string myname = "VDColdboxTDERawInput::ctor: ";
149 
150  __logLevel = pset.get<int>("LogLevel", 0);
151  __nsacro = pset.get<size_t>("SamplesPerChannel", 10000);
152  __start_tde_cru = pset.get<size_t>("StartTDEChCRU", 0);
153  __outlbl_digits = pset.get<std::string>("OutputLabelRawDigits", "daq");
154  __outlbl_rdtime = pset.get<std::string>("OutputLabelRDTime", "daq");
155  __outlbl_status = pset.get<std::string>("OutputLabelRDStatus", "daq");
156  __maxEvents = pset.get<int>("maxEvents", -1);
157  auto vecped_crps = pset.get<std::vector<UIntVec>>("InvertBaseline", std::vector<UIntVec>());
158  auto select_crps = pset.get<std::vector<unsigned>>("SelectCRPs", std::vector<unsigned>());
159 
160  std::map<unsigned, unsigned> invped_crps;
161  if( !vecped_crps.empty() ){
162  for( auto &v : vecped_crps ){
163  if( v.size() != 2 ){
164  if( __logLevel >= 1 )
165  mf::LogError(__FUNCTION__)<<"Bad vector size for pedestal inversion parameters";
166  continue;
167  }
168  // CRP ID = Pedestal inversion
169  invped_crps[ v[0] ] = v[1];
170  }
171  }
172 
173  if( __logLevel >= 1 )
174  {
175  std::cout << myname << " Configuration : " << std::endl;
176  std::cout << myname << " LogLevel : " << __logLevel << std::endl;
177  std::cout << myname << " SamplesPerChannel : " << __nsacro << std::endl;
178  std::cout << myname << " maxEvents : " << __maxEvents << std::endl;
179  std::cout << myname << " StartTDEChCRU : " << __start_tde_cru << std::endl;
180  std::cout << myname << " OutputLabelRawDigits : " << __outlbl_digits << std::endl;
181  std::cout << myname << " OutputLabelRDStatus : " << __outlbl_status << std::endl;
182  std::cout << myname << " OutputLabelRDtime : " << __outlbl_rdtime << std::endl;
183  std::cout << myname << " SelectCRPs : ";
184  if( select_crps.empty() ) std::cout<<"all"<<std::endl;
185  else
186  {
187  std::ostringstream vstr;
188  std::copy(select_crps.begin(), select_crps.end()-1,
189  std::ostream_iterator<unsigned>(vstr, ", "));
190  vstr << select_crps.back();
191  std::cout << vstr.str() << std::endl;
192  }
193  std::cout << myname << " InvertBaseline : ";
194  if( invped_crps.empty() ) std::cout<<"None"<<std::endl;
195  else {
196  for( auto const &m : invped_crps )
197  std::cout<< "[ "<<m.first<<", "<<m.second<<" ] ";
198  std::cout<<std::endl;
199  }
200  }
201 
202  __prodlbl_digits = __getProducerLabel( __outlbl_digits );
203  __prodlbl_rdtime = __getProducerLabel( __outlbl_rdtime );
204  __prodlbl_status = __getProducerLabel( __outlbl_status );
205 
206 
207 
208  //
209  helper.reconstitutes<std::vector<raw::RawDigit>, art::InEvent>(__outlbl_digits,
211  helper.reconstitutes<std::vector<raw::RDStatus>, art::InEvent>(__outlbl_status,
213  helper.reconstitutes<std::vector<raw::RDTimeStamp>, art::InEvent>(__outlbl_rdtime,
215 
216  //
217  // channel map order by CRP View
219 
220  // we grab all CRPs
221  auto crpidx = channelMap->get_crpidx();
222  for( auto c: crpidx )
223  {
224  // we take all channels in this CRP sorted by view and view channel
225  std::vector<dune::tde::ChannelId> chidx = channelMap->find_by_crp( c, true );
226 
227  // check if we want to keep only specific CRPs
228  bool keep = true;
229  if( !select_crps.empty() )
230  {
231  if( std::find( select_crps.begin(), select_crps.end(), c ) == select_crps.end() )
232  {
233  keep = false;
234  }
235  }
236  if( __logLevel >= 2 )
237  std::cout<<myname<<" CRP "<<c<<" selected "<<keep<<std::endl;
238 
239  // check if we need to invert baseline for the group of CRP channels
240  unsigned invped = 0;
241  if( !invped_crps.empty() ){
242  auto it = invped_crps.find( c );
243  if( it != invped_crps.end() ){
244  invped = it->second;
245  }
246  }
247  if( __logLevel >= 2 )
248  std::cout<<myname<<" CRP "<<c<<" baseline "<<invped<<std::endl;
249 
250 
251  //std::cout<<chidx.size()<<std::endl;
252  for( auto id: chidx )
253  {
254  // drop channels not connected to CRP
255  if( !id.exists() ) continue;
256  __daqch.push_back( id.seqn() );
257  __keepch.push_back( keep );
258  __invped.push_back( invped );
259  }
260  }
261 
262  if( __logLevel >= 1 ){
263  std::cout << myname << " Readout info : " << std::endl;
264  std::cout<<myname << " Number of CRPs from chmap : " << channelMap->ncrps() << std::endl;
265  std::cout<<myname << " Total channels expected : " << __daqch.size() << std::endl;
266  }
267  }
268 
269  //
271  {
272  __close();
273  }
274 
275  //
277  art::FileBlock* &fb )
278  {
279  __close();
280 
281  __eventCtr = 0;
282  __eventNum = 0;
283 
284  fb = new art::FileBlock(art::FileFormatVersion(1, "DPPD RawInput 2019"), name);
285 
286  //
287  __file.open( name.c_str(), std::ios::in | std::ios::binary | std::ios::ate);
288 
289  if( !__file.is_open() )
290  {
292  << "Error opening binary file " << name << std::endl;
293  }
294 
295  // get file size
296  __filesz = __file.tellg();
297 
298  // move to beginning
299  __file.seekg(0, std::ios::beg);
300 
301  // unpack event table
302  if( __unpack_evtable() == 0 )
303  {
304  __close();
306  << "File " << name << " does not have any events"<< std::endl;
307  }
308 
310  __file_seqno = __get_file_seqno( name );
311  }
312 
313 
314  //
316  art::SubRunPrincipal* const &inSR,
317  art::RunPrincipal* &outR,
318  art::SubRunPrincipal* &outSR,
319  art::EventPrincipal* &outE )
320  {
321  mf::LogInfo(__FUNCTION__)<<"Processing "<<__eventCtr<<" event record";
322  if( __eventCtr == __eventNum )
323  {
324  //ok we finished
325  mf::LogDebug(__FUNCTION__)<<"Finished reading "<<__eventNum<<" events";
326  return false;
327  }
328  if( (__maxEvents > 0 ) && ( (int)__eventCtr >= __maxEvents) ){
329  return false;
330  }
331 
332  // move to the next file position
333  if( __events[ __eventCtr ] != __file.tellg() )
334  __file.seekg( __events[ __eventCtr ], std::ios::beg );
335  size_t bsz = __evsz[ __eventCtr ];
336 
337  std::vector<BYTE> buf;
338  __readChunk( buf, bsz );
339 
340  // increment our event counter
341  __eventCtr++;
342 
343  DaqEvent event;
344  //bool ok =
345  __unpackEvent( buf, event );
346  // not sure what art wants me to do here if this was not ok ???
347 
348  art::RunNumber_t rn = event.runnum;
349  art::SubRunNumber_t srn = __file_seqno; // seq no from file name
350 
351  uint64_t sec = event.trigstamp.tv_sec;
352  uint64_t nsec = event.trigstamp.tv_nsec;
353 
354  // first 4 bytes are seconds and last four bytes are nsec
355  uint64_t tval = (sec << 32) + nsec;
356 
357  // here we are using event timestamp
358  // what happens if events in the future in same sub-run
359  // (different L2 builder) event have a lower timestamp
360  art::Timestamp tstamp( tval );
361 
362  bool doupdate;
363  if( (doupdate = (rn != __currentSubRunID.run())) )
364  {
365  outR = __sourceHelper.makeRunPrincipal(rn, tstamp);
366  doupdate = true;
367  }
368  if( (doupdate = (srn != __currentSubRunID.subRun())) )
369  {
370  outSR = __sourceHelper.makeSubRunPrincipal(rn, srn, tstamp);
371  }
372 
373  if( doupdate )
374  __currentSubRunID = art::SubRunID( rn, srn );
375 
376 
379  event.evnum, tstamp );
380 
381 
382  std::unique_ptr< std::vector<raw::RawDigit> > data ( new std::vector<raw::RawDigit> );
383  std::unique_ptr< std::vector<raw::RDTimeStamp> > rdtm ( new std::vector<raw::RDTimeStamp> );
384  std::unique_ptr< std::vector<raw::RDStatus> > stat ( new std::vector<raw::RDStatus> );
385 
386  // move data
387  data->reserve( event.crodata.size() );
388 
389  //
391  unsigned cru_ch = __start_tde_cru; // TDE channels should start at 0
392  for( size_t i=0;i<event.crodata.size();i++ )
393  {
394  if( i >= __daqch.size() ){ //skip not connected channels
395  continue;
396  }
397  unsigned daqch = __daqch[i];
398  raw::ChannelID_t ch = cru_ch;
399  cru_ch++;
400 
401  // raw digit
402 
403  if( __keepch[i] ){
404  unsigned invped = __invped[i];
405  if( invped > 0 ){
406  for( auto &e : event.crodata[daqch] ){
407  float v = (float)invped - e;
408  e = (short)(v);
409  }
410  }
411 
412  float median = 0., sigma = 0.;
413  getMedianSigma(event.crodata[daqch], median, sigma);
414  data->push_back( raw::RawDigit(ch, __nsacro,
415  std::move( event.crodata[daqch] ),
416  event.compression) );
417  data->back().SetPedestal( median, sigma );
418  }
419  else {
420  data->push_back( raw::RawDigit(ch, 0, dummy, event.compression) );
421  }
422  }
423  unsigned int statword = 0;
424  bool discarded = false;
425  bool kept = false;
426  if( !event.good ) // data missing from some units
427  {
428  discarded = false;
429  kept = true;
430  }
431  if( discarded ) statword |= 1;
432  if( kept ) statword |= 2;
433  stat->emplace_back( discarded, kept, statword );
434 
435  // assign some trigger flag ... see DataPrepModule
436  uint16_t rdtsflags = 0xd; // CRT for now
437  rdtm->emplace_back( raw::RDTimeStamp( tval, rdtsflags ) );
438 
442 
443  return true;
444  }
445 
446  //
447  // split output container name configuration into label and instance
449  {
450  std::string res = "";
451  size_t ipos = lbl.find(":");
452  if ( ipos != std::string::npos ) {
453  res = lbl.substr(ipos + 1);
454  lbl = lbl.substr(0, ipos);
455  }
456 
457  return res;
458  }
459 
460 
461 
462  //
463  ///
465  {
466  if(__file.is_open())
467  __file.close();
468 
469  __filesz = 0;
470  }
471 
472  //
473  // read a chunk of bytes from file
474  void VDColdboxTDERawInput::__readChunk( std::vector<BYTE> &bytes, size_t sz )
475  {
476  bytes.resize( sz );
477  __file.read( &bytes[0], sz );
478  if( !__file )
479  {
480  ssize_t nb = __file.gcount();
481  //mf::LogWarning(__FUNCTION__)
482  //<<"Could not read "<<sz<" bytes "<<" only "<<nb<<" were available"<<endl;
483  bytes.resize( nb );
484  // reset stream state from errors
485  __file.clear();
486  }
487  }
488 
489  //
490  // unpack the header with event table
492  {
493  unsigned rval = 0;
494  //__eventNum = 0;
495 
496  std::vector<BYTE> buf;
497  size_t msz = 2*sizeof(uint32_t);
498  __readChunk( buf, msz);
499  if( buf.size() != msz )
500  {
501  mf::LogError(__FUNCTION__)<<"Could not read number of events";
502  return 0;
503  }
504 
505 
506  // number of events in the file
507  __eventNum = ConvertToValue<uint32_t>(&buf[4]);
508  rval += buf.size();
509 
510  // file
511  if( __eventNum == 0 )
512  {
513  mf::LogError(__FUNCTION__)<<"File does not contain any events";
514  return 0;
515  }
516 
517  mf::LogInfo(__FUNCTION__)<<"Number of events in this file "<<__eventNum;
518 
519  size_t evtsz = __eventNum * 4 * sizeof(uint32_t);
520  if( evtsz + rval >= __filesz )
521  {
522  mf::LogError(__FUNCTION__)<<"Cannot find event table";
523  return 0;
524  }
525 
526  // read next chunk with event table info
527  __readChunk( buf, evtsz );
528  rval += buf.size();
529 
530  // unpack sizes of events in sequence
531  // we are only interested in the size here
532  __evsz.clear();
533  for( unsigned i=0;i<buf.size();i+=16 )
534  {
535  unsigned o = 0;
536  //uint32_t sn = ConvertToValue<uint32_t>(&buf[i+o]);
537 
538  o = 4;
539  uint32_t sz = ConvertToValue<uint32_t>(&buf[i+o]);
540  __evsz.push_back( sz );
541  }
542 
543  // generate table of positions of events in a file
544  __events.clear();
545 
546  // first event is at the current position
547  __events.push_back( __file.tellg() );
548  for(size_t i=0; i < __evsz.size()-1; i++)
549  {
550  __file.seekg( __evsz[i], std::ios::cur );
551  if( !__file )
552  {
553  mf::LogError(__FUNCTION__)<<"Event table does not match file size";
554  __file.clear();
555  __evsz.resize( __events.size() );
556  __eventNum = __events.size();
557  break;
558  }
559  __events.push_back( __file.tellg() );
560  }
561 
562  // return the number of bytes unpacked
563  return rval;
564  }
565 
566  //
567  // unpack event info from each l1evb fragment
568  unsigned VDColdboxTDERawInput::__unpack_eve_info( const char *buf, eveinfo_t &ei )
569  {
570  //
571  unsigned rval = 0;
572 
573  //
574  //memset(&ei, 0, sizeof(ei));
575  try
576  {
577  // check for delimiting words
578  BYTE k0 = buf[0];
579  BYTE k1 = buf[1];
580  static const unsigned evskey = 0xFF;
581  if( !( ((k0 & 0xFF) == evskey) && ((k1 & 0xFF) == evskey) ) )
582  {
583  mf::LogError(__FUNCTION__)<<"Event delimiting word could not be detected";
584  throw fex;
585  }
586  rval += 2;
587 
588  // decode run number
589  ei.runnum = ConvertToValue<uint32_t>( buf+rval );
590  rval += sizeof( ei.runnum );
591 
592  // run flags
593  ei.runflags = (uint8_t)buf[rval++];
594 
595  // this is actually written in host byte order
596  ei.ti = ConvertToValue<triginfo_t>( buf+rval );
597  rval += sizeof(ei.ti);
598 
599  // data quality flags
600  ei.evflag = (uint8_t)buf[rval++];
601 
602  // event number 4 bytes
603  ei.evnum = ConvertToValue<uint32_t>( buf+rval );
604  rval += sizeof( ei.evnum );
605 
606  // size of the lro data segment
607  ei.evszlro = ConvertToValue<uint32_t>( buf+rval );
608  rval += sizeof( ei.evszlro );
609 
610  // size of the cro data segment
611  ei.evszcro = ConvertToValue<uint32_t>( buf+rval );
612  rval += sizeof( ei.evszcro );
613  }
614  catch(std::exception &e)
615  {
616  rval = 0;
617  }
618 
619  return rval;
620  }
621 
622  //
623  //
624  bool VDColdboxTDERawInput::__unpackEvent( std::vector<BYTE> &buf, DaqEvent &event )
625  {
626  // fragments from each L1 builder
627  std::vector<fragment_t> frags;
628 
629  unsigned idx = 0;
630  for(;;)
631  {
632  fragment_t afrag;
633  if( idx >= buf.size() ) break;
634  unsigned rval = __unpack_eve_info( &buf[idx], afrag.ei );
635  if( rval == 0 ) return false;
636  idx += rval;
637  // set point to the binary data
638  afrag.bytes = &buf[idx];
639  size_t dsz = afrag.ei.evszcro + afrag.ei.evszlro;
640  idx += dsz;
641  idx += 1; // "Bruno byte"
642 
643  // some basic checks
644  if( frags.size() >= 1 )
645  {
646  if( frags[0].ei.runnum != afrag.ei.runnum )
647  {
648  mf::LogError(__FUNCTION__)<<"run numbers do not match among event fragments";
649  continue;
650  }
651  if( frags[0].ei.evnum != afrag.ei.evnum )
652  {
653  mf::LogError(__FUNCTION__)<<"event numbers do not match among event fragments";
654  mf::LogDebug(__FUNCTION__)<<"event number "<< frags[0].ei.evnum;
655  mf::LogDebug(__FUNCTION__)<<"event number "<< afrag.ei.evnum;
656  continue;
657  }
658  // check also timestamps???
659  }
660 
661  frags.push_back( afrag );
662  }
663 
664  //mf::LogDebug(__FUNCTION__)<<"number of fragments "<<frags.size()<<"\n";
665  //
666  std::mutex iomutex;
667  std::vector<std::thread> threads(frags.size() - 1);
668  unsigned nsa = __nsacro;
669  //unsigned invped = __invped;
670  for (unsigned i = 1; i<frags.size(); ++i)
671  {
672  auto afrag = frags.begin() + i;
673  threads[i-1] = std::thread([&iomutex, i, nsa, afrag] {
674  {
675  std::lock_guard<std::mutex> iolock(iomutex);
676  // make it look like we're using i so clang doesn't complain. This had been commented out
677  //msg_info << "Unpack thread #" << i << " is running\n";
678  if (i==100000) std::cout << "Unpack thread #" << i << " is running\n";
679  }
680  unpackData( afrag->bytes + afrag->ei.evszlro, afrag->ei.evszcro,
681  GETDCFLAG(afrag->ei.runflags), nsa, afrag->crodata);
682  });
683  }
684 
685  // unpack first fragment in the main thread
686  auto f0 = frags.begin();
687  event.good = EVDQFLAG( f0->ei.evflag );
688  event.runnum = f0->ei.runnum;
689  event.runflags = f0->ei.runflags;
690  //
691  event.evnum = f0->ei.evnum;
692  event.evflags.push_back( f0->ei.evflag );
693  //
694  event.trigtype = f0->ei.ti.type;
695  event.trignum = f0->ei.ti.num;
696  event.trigstamp = f0->ei.ti.ts;
697 
698  unpackData( f0->bytes + f0->ei.evszlro, f0->ei.evszcro, GETDCFLAG(f0->ei.runflags),
699  nsa, event.crodata );
700 
701  event.compression = raw::kNone;
702  // the compression should be set for all L1 event builders,
703  // since this depends on loaded AMC firmware
704  if( GETDCFLAG(f0->ei.runflags) )
705  event.compression = raw::kHuffman;
706 
707  // wait for other threads to complete
708  for (auto& t : threads) t.join();
709 
710  // merge with other fragments
711  for (auto it = frags.begin() + 1; it != frags.end(); ++it )
712  {
713  event.good = ( event.good && EVDQFLAG( it->ei.evflag ) );
714  event.evflags.push_back( it->ei.evflag );
715 
716  //
717  event.crodata.reserve(event.crodata.size() + it->crodata.size() );
718  std::move( std::begin( it->crodata ), std::end( it->crodata ),
719  std::back_inserter( event.crodata ));
720  it->crodata.clear();
721  }
722 
723  return true;
724  }
725 
726 
727  // assumed file name form <runno>_<seqno>_<L2evbID>.<extension>
728  // e.g., 198_129_cb.test
730  {
731  unsigned rval = 0;
732 
733  //std::cout << "input " << s << std::endl;
734  std::regex r("[[:digit:]]+_([[:digit:]]+)_[[:alnum:]]+\\.[[:alnum:]]+");
735  std::smatch m;
736 
737  if( !regex_search( s, m, r ) )
738  {
739  mf::LogWarning(__FUNCTION__) << "Unable to extract seqno from file name "<< s;
740  return rval;
741  }
742 
743  //
744  try
745  {
746  // str() is the entire match
747  rval = std::stoi( m.str(1) );
748  }
749  catch (const std::invalid_argument& ia)
750  {
751  rval = 0;
752  mf::LogWarning(__FUNCTION__) << "This should never happen";
753  }
754 
755  return rval;
756  }
757 }
758 
759 
760 ///
761 //
762 namespace raw {
764 }
765 
static QCString name
Definition: declinfo.cpp:673
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
Huffman Encoding.
Definition: RawTypes.h:10
unsigned __get_file_seqno(std::string s)
static constexpr double nb
Definition: Units.h:81
Collection of charge vs time digitized from a single readout channel.
Definition: RawDigit.h:69
std::string string
Definition: nybbler.cc:12
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
unsigned __unpack_eve_info(const char *buf, eveinfo_t &ei)
SubRunPrincipal * makeSubRunPrincipal(SubRunAuxiliary const &subRunAux) const
std::vector< short > ADCvector_t
Type representing a (compressed) vector of ADC counts.
Definition: RawDigit.h:73
std::vector< unsigned > UIntVec
std::vector< unsigned > __invped
Raw data description.
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
no compression
Definition: RawTypes.h:9
RunPrincipal * makeRunPrincipal(RunAuxiliary const &runAux) const
Definition: SourceHelper.cc:92
std::vector< uint32_t > __evsz
bool exists(std::string path)
TypeLabel const & reconstitutes(std::string const &modLabel, std::string const &instanceName={})
#define EVDQFLAG(info)
const double e
def move(depos, offset)
Definition: depos.py:107
RunNumber_t run() const
Definition: SubRunID.h:85
T get(std::string const &key) const
Definition: ParameterSet.h:271
char BYTE
Definition: dlardaq.h:39
bool readNext(art::RunPrincipal *const &inR, art::SubRunPrincipal *const &inSR, art::RunPrincipal *&outR, art::SubRunPrincipal *&outSR, art::EventPrincipal *&outE)
art::SourceHelper const & __sourceHelper
IDNumber_t< Level::SubRun > SubRunNumber_t
Definition: IDNumber.h:119
#define GETDCFLAG(info)
bool __unpackEvent(std::vector< BYTE > &buf, DaqEvent &event)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
void __readChunk(std::vector< BYTE > &bytes, size_t sz)
T ConvertToValue(const void *in)
Definition: dlardaq.h:110
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={})
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
std::vector< std::streampos > __events
std::vector< unsigned > __daqch
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
T copy(T const &v)
cet::LibraryManager dummy("noplugin")
EventPrincipal * makeEventPrincipal(EventAuxiliary const &eventAux, std::unique_ptr< History > &&history) const
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
SubRunNumber_t subRun() const
Definition: SubRunID.h:91
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
#define DEFINE_ART_INPUT_SOURCE(klass)
byte bytes
Alias for common language habits.
Definition: datasize.h:101
static formatexception fex
Definition: dlardaq.h:52
static QCString * s
Definition: config.cpp:1042
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
double median(sqlite3 *db, std::string const &table_name, std::string const &column_name)
Definition: statistics.cc:26
QTextStream & endl(QTextStream &s)
Event finding and building.
void readFile(std::string const &name, art::FileBlock *&fb)
std::string __getProducerLabel(std::string &lbl)
IDNumber_t< Level::Run > RunNumber_t
Definition: IDNumber.h:120