Functions
RawFrameSource.cxx File Reference
#include "RawFrameSource.h"
#include "art/Framework/Principal/Handle.h"
#include "lardataobj/RawData/RawDigit.h"
#include "art/Framework/Principal/Event.h"
#include "art/Framework/Principal/Run.h"
#include "TTimeStamp.h"
#include "WireCellIface/SimpleFrame.h"
#include "WireCellIface/SimpleTrace.h"
#include "WireCellUtil/NamedFactory.h"

Go to the source code of this file.

Functions

 WIRECELL_FACTORY (wclsRawFrameSource, wcls::RawFrameSource, wcls::IArtEventVisitor, WireCell::IFrameSource) using namespace wcls
 
static double tdiff (const art::Timestamp &ts1, const art::Timestamp &ts2)
 
static SimpleTrace * make_trace (const raw::RawDigit &rd, unsigned int nticks_want)
 

Function Documentation

static SimpleTrace* make_trace ( const raw::RawDigit rd,
unsigned int  nticks_want 
)
static

Definition at line 72 of file RawFrameSource.cxx.

73 {
74  const int chid = rd.Channel();
75  const int tbin = 0;
76  const raw::RawDigit::ADCvector_t& adcv = rd.ADCs();
77 
78  short baseline = 0;
79  unsigned int nadcs = adcv.size();
80  if (nticks_want > 0) { // don't want natural input size
81  if (nticks_want > nadcs) {
82  baseline = Waveform::most_frequent(adcv);
83  }
84  nadcs = std::min(nadcs, nticks_want);
85  }
86  else {
87  nticks_want = nadcs;
88  }
89 
90  auto strace = new SimpleTrace(chid, tbin, nticks_want);
91  for (unsigned int itick=0; itick < nadcs; ++ itick) {
92  strace->charge()[itick] = adcv[itick];
93  }
94  for (unsigned int itick = nadcs; itick < nticks_want; ++itick) {
95  strace->charge()[itick] = baseline;
96  }
97  return strace;
98 }
const ADCvector_t & ADCs() const
Reference to the compressed ADC count vector.
Definition: RawDigit.h:210
ChannelID_t Channel() const
DAQ channel this raw data was read from.
Definition: RawDigit.h:212
std::vector< short > ADCvector_t
Type representing a (compressed) vector of ADC counts.
Definition: RawDigit.h:73
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
static double tdiff ( const art::Timestamp ts1,
const art::Timestamp ts2 
)
static

Definition at line 63 of file RawFrameSource.cxx.

64 {
65  TTimeStamp tts1(ts1.timeHigh(), ts1.timeLow());
66  TTimeStamp tts2(ts2.timeHigh(), ts2.timeLow());
67  return tts2.AsDouble() - tts1.AsDouble();
68 }
constexpr std::uint32_t timeLow() const
Definition: Timestamp.h:29
constexpr std::uint32_t timeHigh() const
Definition: Timestamp.h:34
WIRECELL_FACTORY ( wclsRawFrameSource  ,
wcls::RawFrameSource  ,
wcls::IArtEventVisitor  ,
WireCell::IFrameSource   
)