All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 "WireCellAux/SimpleFrame.h"
#include "WireCellAux/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 74 of file RawFrameSource.cxx.

75 {
76  const int chid = rd.Channel();
77  const int tbin = 0;
78  const raw::RawDigit::ADCvector_t& adcv = rd.ADCs();
79 
80  short baseline = 0;
81  unsigned int nadcs = adcv.size();
82  if (nticks_want > 0) { // don't want natural input size
83  if (nticks_want > nadcs) {
84  baseline = Waveform::most_frequent(adcv);
85  }
86  nadcs = std::min(nadcs, nticks_want);
87  }
88  else {
89  nticks_want = nadcs;
90  }
91 
92  auto strace = new SimpleTrace(chid, tbin, nticks_want);
93  for (unsigned int itick=0; itick < nadcs; ++ itick) {
94  strace->charge()[itick] = adcv[itick];
95  }
96  for (unsigned int itick = nadcs; itick < nticks_want; ++itick) {
97  strace->charge()[itick] = baseline;
98  }
99  return strace;
100 }
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
BEGIN_PROLOG baseline
static double tdiff ( const art::Timestamp &  ts1,
const art::Timestamp &  ts2 
)
static

Definition at line 65 of file RawFrameSource.cxx.

66 {
67  TTimeStamp tts1(ts1.timeHigh(), ts1.timeLow());
68  TTimeStamp tts2(ts2.timeHigh(), ts2.timeLow());
69  return tts2.AsDouble() - tts1.AsDouble();
70 }
WIRECELL_FACTORY ( wclsRawFrameSource  ,
wcls::RawFrameSource  ,
wcls::IArtEventVisitor  ,
WireCell::IFrameSource   
)