stream  0.10.0
stream analysis framework
AdcProcessor.h
1 #ifndef HADAQ_ADCPROCESSOR_H
2 #define HADAQ_ADCPROCESSOR_H
3 
4 #include "hadaq/SubProcessor.h"
5 
6 #include "hadaq/AdcMessage.h"
7 #include "hadaq/AdcSubEvent.h"
8 #include <limits>
9 #include <iostream>
10 #include <vector>
11 
12 namespace hadaq {
13 
14 class TrbProcessor;
15 
21 class AdcProcessor : public SubProcessor {
22 
23  friend class TrbProcessor;
24 
25 protected:
26 
28  struct ChannelRec {
29  public:
30  ChannelRec() :
31  fHValues(0),
32  fHWaveform(0),
33  fHIntegral(0),
34  fHSamples(0),
35  fHCoarseTiming(0),
36  fHFineTiming(0)
37  {}
38  base::H1handle fHValues;
39  base::H2handle fHWaveform;
40  base::H1handle fHIntegral;
41  base::H2handle fHSamples;
42  base::H1handle fHCoarseTiming;
43  base::H1handle fHFineTiming;
44  };
45 
46  const double fSamplingPeriod;
47 
48  static std::vector<double> storage;
49 
50  base::H1handle fKinds;
51  base::H1handle fChannels;
52  std::vector<ChannelRec> fCh;
53 
54  std::vector<hadaq::AdcMessage> fStoreVect;
55  std::vector<hadaq::AdcMessage> *pStoreVect;
56 
57  virtual void CreateBranch(TTree*);
58 
59 public:
60 
61  AdcProcessor(TrbProcessor* trb, unsigned subid, unsigned numchannels = 48,
62  double samplingPeriod = 1000.0e-9/80);
63  virtual ~AdcProcessor();
64 
66  inline unsigned NumChannels() const { return fCh.size(); }
67 
70  virtual bool FirstBufferScan(const base::Buffer& buf);
71 
73  virtual bool SecondBufferScan(const base::Buffer& buf);
74 
75  virtual void Store(base::Event*);
76  virtual void ResetStore();
77 };
78 
79 }
80 
81 #endif
Memory management class.
Definition: Buffer.h:49
Event - collection of several subevents.
Definition: Event.h:17
This is specialized sub-processor for ADC addon.
Definition: AdcProcessor.h:21
const double fSamplingPeriod
ADC sampling period in seconds.
Definition: AdcProcessor.h:46
AdcProcessor(TrbProcessor *trb, unsigned subid, unsigned numchannels=48, double samplingPeriod=1000.0e-9/80)
constructor
Definition: AdcProcessor.cxx:21
virtual bool SecondBufferScan(const base::Buffer &buf)
Scan buffer for selecting messages inside trigger window.
Definition: AdcProcessor.cxx:67
virtual void CreateBranch(TTree *)
create branch
Definition: AdcProcessor.cxx:197
virtual bool FirstBufferScan(const base::Buffer &buf)
Scan all messages, find reference signals if returned false, buffer has error and must be discarded.
Definition: AdcProcessor.cxx:56
static std::vector< double > storage
storage
Definition: AdcProcessor.h:48
std::vector< ChannelRec > fCh
! histogram for individual channels
Definition: AdcProcessor.h:52
virtual ~AdcProcessor()
desructor
Definition: AdcProcessor.cxx:50
virtual void ResetStore()
reset store
Definition: AdcProcessor.cxx:223
virtual void Store(base::Event *)
store
Definition: AdcProcessor.cxx:206
base::H1handle fKinds
! kinds of messages
Definition: AdcProcessor.h:50
std::vector< hadaq::AdcMessage > * pStoreVect
! pointer on store vector
Definition: AdcProcessor.h:55
std::vector< hadaq::AdcMessage > fStoreVect
! dummy empty vector
Definition: AdcProcessor.h:54
base::H1handle fChannels
! histogram with messages per channel
Definition: AdcProcessor.h:51
unsigned NumChannels() const
number of channels
Definition: AdcProcessor.h:66
Abstract processor of HADAQ sub-sub-event.
Definition: SubProcessor.h:26
TRB processor.
Definition: TrbProcessor.h:46
Channel record.
Definition: AdcProcessor.h:28
base::H1handle fHCoarseTiming
! ADC samples since trigger detected
Definition: AdcProcessor.h:42
base::H2handle fHWaveform
! histogram of integrated raw waveform of channel (debug)
Definition: AdcProcessor.h:39
base::H1handle fHFineTiming
! histogram of timing of single channel to trigger
Definition: AdcProcessor.h:43
base::H1handle fHIntegral
! histogram of integrals from CFD feature extraction
Definition: AdcProcessor.h:40
base::H1handle fHValues
! histogram of values distribution in channel
Definition: AdcProcessor.h:38
base::H2handle fHSamples
! histogram of fine timings from CFD feature extraction
Definition: AdcProcessor.h:41