1 #ifndef HADAQ_SPILLPROCESSOR_H
2 #define HADAQ_SPILLPROCESSOR_H
4 #include "base/StreamProc.h"
90 inline unsigned EpochDiff(
unsigned ep1,
unsigned ep2) {
return ep1 <= ep2 ? ep2 - ep1 : ep2 + 0x10000000 - ep1; }
93 inline unsigned Get1msBin(
unsigned ep1,
unsigned c1,
unsigned ep2,
unsigned c2)
95 unsigned ediff =
EpochDiff(ep1,ep2) * 2048 + c2 - c1;
96 return ediff / 200000;
101 void StartSpill(
unsigned epoch,
unsigned coarse = 0);
104 double CalcQuality(
unsigned firstbin,
unsigned len);
Memory management class.
Definition: Buffer.h:49
Abstract processor of data streams.
Definition: StreamProc.h:21
This is specialized process for spill structures
Definition: SpillProcessor.h:10
long fSumY
sum y
Definition: SpillProcessor.h:46
void SetMinSpillLength(double tm=0.1)
Set min spill length.
Definition: SpillProcessor.h:128
unsigned fTdcMin
minimal TDC id
Definition: SpillProcessor.h:78
unsigned fSpillStartEpoch
epoch value which assumed to be spill start, 0 - off
Definition: SpillProcessor.h:71
void StartSpill(unsigned epoch, unsigned coarse=0)
start spill
Definition: SpillProcessor.cxx:159
base::H1handle fTrendX
Beam X trending.
Definition: SpillProcessor.h:38
double fLastHaloX
last halo x
Definition: SpillProcessor.h:55
base::H1handle fTrendXSlow
Beam X with Quality histogram (with 40 ms binning)
Definition: SpillProcessor.h:20
base::H2handle fVetoPattern
2dim Veto detector Pattern
Definition: SpillProcessor.h:42
virtual bool FirstBufferScan(const base::Buffer &buf)
buffer scan
Definition: SpillProcessor.cxx:219
base::H1handle fTrendYHaloSlow
Quality histogram (with 40 ms binning)
Definition: SpillProcessor.h:27
long fCntX
cnt x
Definition: SpillProcessor.h:45
double fLastY
last y
Definition: SpillProcessor.h:54
double CalcQuality(unsigned firstbin, unsigned len)
calculate quality
Definition: SpillProcessor.cxx:200
long fCntHaloY
counter halo y
Definition: SpillProcessor.h:51
base::H1handle fHitsSpill
Hits in current spill (with 1 ms binning)
Definition: SpillProcessor.h:23
void SetChannelsLookup1(unsigned ch, unsigned lookup)
Set channel lookup 1.
Definition: SpillProcessor.h:133
unsigned fLastEpoch
last epoch
Definition: SpillProcessor.h:60
unsigned fChannelsLookup1[33]
first tdc
Definition: SpillProcessor.h:81
bool fAutoSpillDetect
true when spill will be detected automatically
Definition: SpillProcessor.h:63
base::H1handle fHitsLastSpill
Hits in last spill (with 1 ms binning)
Definition: SpillProcessor.h:24
long fSumX
sum x
Definition: SpillProcessor.h:44
unsigned fTdcMax
maximal TDC id
Definition: SpillProcessor.h:79
unsigned fLastSpillBin
last bin number filled in the histogram
Definition: SpillProcessor.h:62
long fCntY
cnt y
Definition: SpillProcessor.h:47
double fSpillOffLevel
number of hits in 40ms bin to detect spill off (at least N bins below limit)
Definition: SpillProcessor.h:68
int CompareHistBins(unsigned leftbin, unsigned rightbin)
returns -1 when leftbin<rightbin, taking into account overflow around 0x1000) +1 when leftbin>rightbi...
Definition: SpillProcessor.cxx:138
SpillProcessor()
constructor
Definition: SpillProcessor.cxx:27
double fLastX
last x
Definition: SpillProcessor.h:53
base::H1handle fEvSize
HADAQ event size.
Definition: SpillProcessor.h:14
bool fFirstEpoch
first epoch
Definition: SpillProcessor.h:65
double EpochTmDiff(unsigned ep1, unsigned ep2)
Return time difference between epochs in seconds.
Definition: SpillProcessor.cxx:151
unsigned fSpillMinCnt
minimal number of counts to detect spill
Definition: SpillProcessor.h:69
base::H1handle fTriggerFast
Quality histogram (with 20 us binning)
Definition: SpillProcessor.h:29
unsigned fLastSpillEpoch
last epoch used to calculate spill quality
Definition: SpillProcessor.h:61
base::H1handle fEvType
HADAQ event type.
Definition: SpillProcessor.h:13
void SetTriggerChannel(unsigned ch)
Set special channel with trigger info.
Definition: SpillProcessor.h:147
base::H1handle fSubevSize
HADAQ sub-event size.
Definition: SpillProcessor.h:15
double fMaxSpillLength
maximal spill time in seconds
Definition: SpillProcessor.h:76
unsigned fLastBinFast
last bin fast
Definition: SpillProcessor.h:58
long fSumHaloX
sum halo x
Definition: SpillProcessor.h:48
base::H1handle fHitsFast
Hits fast (with 20 us binning)
Definition: SpillProcessor.h:17
unsigned fLastBinSlow
last bin slow
Definition: SpillProcessor.h:59
base::H2handle fHaloPattern
2dim Halo detector Pattern
Definition: SpillProcessor.h:41
base::H1handle fLastSpill
Last SPILL histogram.
Definition: SpillProcessor.h:33
long fSumHaloY
sum halo y
Definition: SpillProcessor.h:50
base::H1handle fQualitySlow
Quality histogram (with 40 ms binning)
Definition: SpillProcessor.h:19
base::H1handle fBeamX
Accumulated X position.
Definition: SpillProcessor.h:35
unsigned EpochDiff(unsigned ep1, unsigned ep2)
Hard difference between epochs.
Definition: SpillProcessor.h:90
unsigned fChannelsLookup2[33]
second tdc
Definition: SpillProcessor.h:82
long fCntHaloX
counter halo x
Definition: SpillProcessor.h:49
base::H1handle fTrendXHaloSlow
Quality histogram (with 40 ms binning)
Definition: SpillProcessor.h:26
base::H1handle fSpill
Current SPILL histogram.
Definition: SpillProcessor.h:32
unsigned fChannelsLookup3[33]
third tdc
Definition: SpillProcessor.h:83
void SetChannelsLookup2(unsigned ch, unsigned lookup)
Set channel lookup 2.
Definition: SpillProcessor.h:135
double fMinSpillLength
minimal spill time in seconds
Definition: SpillProcessor.h:75
unsigned fSpillEndEpoch
epoch value when switch off spill
Definition: SpillProcessor.h:72
void SetTdcRange(unsigned min, unsigned max)
Set TDC range.
Definition: SpillProcessor.h:113
double fSpillOnLevel
number of hits in 40ms bin to detect spill on (at least N bins after each other over limit)
Definition: SpillProcessor.h:67
unsigned fCurrXYBin
bin where current XY is calculated
Definition: SpillProcessor.h:52
base::H1handle fTriggerSlow
Quality histogram (with 40 ms binning)
Definition: SpillProcessor.h:30
base::H1handle fHitsSlow
Hits slow (with 40 ms binning)
Definition: SpillProcessor.h:18
void SetSpillChannel(unsigned ch)
Set channel id on third TDC, which should detect spill-start signal.
Definition: SpillProcessor.h:140
base::H1handle fTrendYSlow
Quality histogram (with 40 ms binning)
Definition: SpillProcessor.h:21
void SetChannelsLookup3(unsigned ch, unsigned lookup)
Set channel lookup 3.
Definition: SpillProcessor.h:137
double fLastQSlowValue
last value of Q factor for slow histogram
Definition: SpillProcessor.h:85
base::H1handle fBeamY
Accumulated Y position.
Definition: SpillProcessor.h:36
double fLastHaloY
last halo y
Definition: SpillProcessor.h:56
base::H1handle fTrendY
Beam Y trending.
Definition: SpillProcessor.h:39
void SetMaxSpillLength(double tm=10)
Set max spill length.
Definition: SpillProcessor.h:130
unsigned fSpillStartCoarse
spill start coarse
Definition: SpillProcessor.h:73
void StopSpill(unsigned epoch)
stop spill
Definition: SpillProcessor.cxx:183
void SetSpillDetect(double lvl_on, double lvl_off, unsigned cnt=3)
Set spill detect.
Definition: SpillProcessor.h:120
unsigned Get1msBin(unsigned ep1, unsigned c1, unsigned ep2, unsigned c2)
Get 1ms bin.
Definition: SpillProcessor.h:93