1 #ifndef HADAQ_TDCPROCESSOR_H
2 #define HADAQ_TDCPROCESSOR_H
4 #include "hadaq/SubProcessor.h"
6 #include "hadaq/TdcMessage.h"
7 #include "hadaq/TdcIterator.h"
8 #include "hadaq/TdcSubEvent.h"
16 enum { FineCounterBins = 600, TotBins = 3000, ToTvalue = 20, ToThmin = 15, ToThmax = 60 };
162 for (
unsigned n=0;n<numfine;n++)
177 else if (coarse_unit > 0.01)
186 for (
int n=0;n<5;++n)
203 for (
unsigned n=0;n<TotBins;n++)
252 std::vector<ChannelRec>
fCh;
367 double DoTestFineTime(
double hRebin[],
int nBinsRebin,
int nEntries);
374 double CalibrateChannel(
unsigned nch,
bool rising,
const std::vector<uint32_t> &statistic, std::vector<float> &calibr,
bool use_linear =
false,
bool preliminary =
false);
375 void CopyCalibration(
const std::vector<float> &calibr, base::H1handle hcalibr,
unsigned ch = 0, base::H2handle h2calibr = 0);
377 bool CalibrateTot(
unsigned ch, std::vector<uint32_t> &hist,
float &tot_shift,
float &tot_dev,
float cut = 0.);
383 double TestCanCalibrate(
bool fillhist =
false, std::string *status =
nullptr);
389 float ExtractCalibr(
const std::vector<float> &func,
unsigned bin);
394 if (func.size() > 100)
return func[bin];
398 if (bin <= func[1])
return func[2];
399 int pnt = func.size() - 2;
400 if (bin >= func[pnt])
return func[pnt+1];
403 int segm = std::ceil((bin - func[1]) / (func[pnt] - func[1]) * (func[0] - 1));
407 return func[pnt-1] + (bin - func[pnt-2]) / (func[pnt] - func[pnt-2]) * (func[pnt+1] - func[pnt-1]);
411 void SetTable(uint32_t *table,
unsigned addr, uint32_t value);
413 void FindFMinMax(
const std::vector<float> &func,
int nbin,
int &fmin,
int &fmax);
417 void AddError(
unsigned code,
const char *args, ...);
443 TdcProcessor(
TrbProcessor* trb,
unsigned tdcid,
unsigned numchannels = MaxNumTdcChannels,
unsigned edge_mask = 1,
bool ver4 =
false);
448 static void SetDefaults(
unsigned numfinebins = 600,
unsigned totrange = 100,
unsigned hist2dreduced = 10);
463 static void SetToTCalibr(
int minstat = 100,
double rms = 0.15);
510 std::vector<std::string> res;
522 case 0:
return "RisingFine";
523 case 1:
return "RisingCoarse";
524 case 2:
return "RisingRef";
525 case 3:
return "FallingFine";
526 case 4:
return "FallingCoarse";
527 case 5:
return "Tot";
528 case 6:
return "RisingMult";
529 case 7:
return "FallingMult";
530 case 8:
return "RisingTmdsRef";
536 base::H1handle
GetHist(
unsigned ch,
int k = 0)
540 case 0:
return fCh[ch].fRisingFine;
542 case 2:
return fCh[ch].fRisingRef;
543 case 3:
return fCh[ch].fFallingFine;
545 case 5:
return fCh[ch].fTot;
546 case 6:
return fCh[ch].fRisingMult;
547 case 7:
return fCh[ch].fFallingMult;
548 case 8:
return fCh[ch].fRisingTmdsRef;
557 base::H2handle *hChHits, base::H2handle *hChErrs,
558 base::H2handle *hChCorr,
559 base::H2handle *hQaFine, base::H2handle *hQaToT,
560 base::H2handle *hQaEdges, base::H2handle *hQaErrors)
578 void SetCalibrTrigger(
int typ1 = 0xFFFF,
unsigned typ2 = 0,
unsigned typ3 = 0,
unsigned typ4 = 0)
607 if (ch <
fCh.size())
fCh[ch].time_shift_per_grad = shift_per_grad;
613 if (ch <
fCh.size())
fCh[ch].tot_shift = tot_shift;
618 void SetRefChannel(
unsigned ch,
unsigned refch,
unsigned reftdc = 0xffff,
int npoints = 5000,
double left = -10.,
double right = 10.,
bool twodim =
false);
621 void SetRefTmds(
unsigned ch,
unsigned refch,
int npoints,
double left,
double right);
624 int npx = 200,
double xmin = -10.,
double xmax = 10.,
625 int npy = 200,
double ymin = -10.,
double ymax = 10.);
627 void CreateRateHisto(
int np = 1000,
double xmin = 0.,
double xmax = 1e5);
635 bool EnableRefCondPrint(
unsigned ch,
double left = -10,
double right = 10,
int numprint = 0);
655 void CompleteCalibration(
bool dummy =
false,
const std::string &filename =
"",
const std::string &subdir =
"");
679 void SetToTRange(
double tot_0xd,
double hmin,
double hmax);
701 {
return ch <
fCh.size() ?
fCh[ch].fRisingRef : 0; }
723 void IncCalibration(
unsigned ch,
bool rising,
unsigned fine,
unsigned value);
725 void ProduceCalibration(
bool clear_stat =
true,
bool use_linear =
false,
bool dummy =
false,
bool preliminary =
false);
Memory management class.
Definition: Buffer.h:49
Event - collection of several subevents.
Definition: Event.h:17
void ClearH1(H1handle h1)
Clear 1-D histogram.
Definition: base/Processor.h:132
Abstract processor of HADAQ sub-sub-event.
Definition: SubProcessor.h:26
TDC iterator.
Definition: TdcIterator.h:16
TDC processor.
Definition: TdcProcessor.h:32
double fCalibrTempSum1
! sum1 used to check temperature during calibration
Definition: TdcProcessor.h:280
void SetCalibrTemp(float v)
Set temperature used for calibration.
Definition: TdcProcessor.h:732
virtual void ResetStore()
reset store
Definition: TdcProcessor.cxx:3859
unsigned fNumFineBins
! number of fine-counter bins
Definition: TdcProcessor.h:251
void CreateRateHisto(int np=1000, double xmin=0., double xmax=1e5)
Create rate histogram to count hits per second (excluding channel 0)
Definition: TdcProcessor.cxx:680
bool fUseLastHit
! if true, last hit will be used in reference calculations
Definition: TdcProcessor.h:312
double fToThmin
! histogram min
Definition: TdcProcessor.h:260
EEdgesMasks
edges mask
Definition: TdcProcessor.h:436
@ edge_Rising
process only rising edge
Definition: TdcProcessor.h:437
@ edge_CommonStatistic
accumulate common statistic for both
Definition: TdcProcessor.h:440
@ edge_ForceRising
use rising edge calibration for falling
Definition: TdcProcessor.h:439
@ edge_BothIndepend
process rising and falling endges independent
Definition: TdcProcessor.h:438
static void SetDefaultLinearNumPoints(int cnt=2)
Set default number of point in linear approximation.
Definition: TdcProcessor.cxx:113
virtual ~TdcProcessor()
destructor
Definition: TdcProcessor.cxx:318
base::H1handle fChannels
! histogram with messages per channel
Definition: TdcProcessor.h:220
float fTempCorrection
! correction for temperature sensor
Definition: TdcProcessor.h:276
std::vector< hadaq::MessageFloat > fDummyFloat
! vector with compact messages
Definition: TdcProcessor.h:286
bool fCalibrUseTemp
! when true, use temperature adjustment for calibration
Definition: TdcProcessor.h:255
TdcMessage fLastTdcTrailer
! copy of last TDC trailer
Definition: TdcProcessor.h:323
bool DoRisingEdge() const
Returns true if processing rising edge.
Definition: TdcProcessor.h:486
bool f400Mhz
! is 400Mhz mode (debug)
Definition: TdcProcessor.h:329
static void SetStoreCalibrTables(bool on=true)
enable storage of calibration tables for V4 TDC
Definition: TdcProcessor.cxx:153
void CreateV4CalibrTable(unsigned ch, uint32_t *table)
Create V4 calibration table.
Definition: TdcProcessor.cxx:3603
virtual bool doTriggerSelection() const
Returns true when processor used to select trigger signal TDC not yet able to perform trigger selecti...
Definition: TdcProcessor.h:336
double TestCanCalibrate(bool fillhist=false, std::string *status=nullptr)
Check if automatic calibration can be performed - enough statistic is accumulated.
Definition: TdcProcessor.cxx:866
base::H2handle * fChHitsPerHld
! hits per TDC channel - from HLD
Definition: TdcProcessor.h:242
bool fCompensateEpochReset
! if true, compensates epoch reset
Definition: TdcProcessor.h:316
float GetCalibrTemp() const
Access value of temperature during calibration.
Definition: TdcProcessor.h:729
static unsigned gHist2dReduce
! reduce factor for points in 2D histogram
Definition: TdcProcessor.h:340
unsigned fDesignId
! design ID, taken from status message
Definition: TdcProcessor.h:278
base::H2handle fhTotVsChannel
! histogram of ToT vs channel
Definition: TdcProcessor.h:235
bool SetDoubleRefChannel(unsigned ch1, unsigned ch2, int npx=200, double xmin=-10., double xmax=10., int npy=200, double ymin=-10., double ymax=10.)
Configure double-reference histogram Required that for both channels references are specified via Set...
Definition: TdcProcessor.cxx:613
long fCalibrCounts
! indicates minimal number of counts in each channel required to produce calibration
Definition: TdcProcessor.h:298
double fTotRMSLimit
! maximal RMS valus for complete calibration
Definition: TdcProcessor.h:264
std::vector< hadaq::MessageFloat > * pStoreFloat
! pointer on store vector
Definition: TdcProcessor.h:287
static void SetAllHistos(bool on=true)
Automatically create histograms for all channels - even they not appear in data.
Definition: TdcProcessor.cxx:76
unsigned fSkipTdcMessages
! number of first messages, skipped from analysis
Definition: TdcProcessor.h:328
TdcIterator fIter2
! iterator for the second scan
Definition: TdcProcessor.h:218
static bool gUseDTrigForRef
! when true, use special triggers for ref calculations
Definition: TdcProcessor.h:345
double CalibrateChannel(unsigned nch, bool rising, const std::vector< uint32_t > &statistic, std::vector< float > &calibr, bool use_linear=false, bool preliminary=false)
Calibrate channel.
Definition: TdcProcessor.cxx:3001
double DoTestFineTime(double hRebin[], int nBinsRebin, int nEntries)
Test fine time.
Definition: TdcProcessor.cxx:2922
virtual bool SecondBufferScan(const base::Buffer &buf)
Scan buffer for selecting messages inside trigger window.
Definition: TdcProcessor.h:718
std::string GetCalibrStatus() const
Returns calibration status.
Definition: TdcProcessor.h:495
base::H1handle fhTotMoreCounter
! histogram of counter with ToT >20 ns per channel
Definition: TdcProcessor.h:236
unsigned fHldId
! sequence number of processor in HLD
Definition: TdcProcessor.h:239
static unsigned gErrorMask
! mask for errors to display
Definition: TdcProcessor.h:341
bool LoadCalibration(const std::string &fprefix)
Load calibration from the file.
Definition: TdcProcessor.cxx:3668
void SetToTRange(double tot_0xd, double hmin, double hmax)
set real ToT value for 0xD trigger and min/max for histogram accumulation default is 30ns,...
Definition: TdcProcessor.cxx:437
int GetNumHist() const
Get number of indexed histograms.
Definition: TdcProcessor.h:516
void SetAutoCalibration(long cnt=100000)
configure auto calibration
Definition: TdcProcessor.h:645
bool DoFallingEdge() const
Returns true if processing falling.
Definition: TdcProcessor.h:488
unsigned TransformTdcData(hadaqs::RawSubevent *sub, uint32_t *rawdata, unsigned indx, unsigned datalen, hadaqs::RawSubevent *tgt=0, unsigned tgtindx=0)
Method transform TDC data, if output specified, use it otherwise change original data.
Definition: TdcProcessor.cxx:1008
static void SetTriggerDWindow(double low=-25, double high=50)
Configure window (in nanoseconds), where time stamps from 0xD trigger will be accepted for calibratio...
Definition: TdcProcessor.cxx:93
bool fWriteEveryTime
! write calibration every time automatic calibration performed
Definition: TdcProcessor.h:306
void CreateHistograms(int *arr=0)
Create basic histograms for specified channels.
Definition: TdcProcessor.cxx:487
unsigned fCalibrTriggerMask
! mask with enabled for trigger events ids, default all
Definition: TdcProcessor.h:256
std::vector< hadaq::MessageDouble > fDummyDouble
! vector with compact messages
Definition: TdcProcessor.h:289
base::H1handle fTempDistr
! temperature distribution
Definition: TdcProcessor.h:232
virtual void Store(base::Event *)
Store event.
Definition: TdcProcessor.cxx:3826
virtual bool FirstBufferScan(const base::Buffer &buf)
Scan all messages, find reference signals if returned false, buffer has error and must be discarded.
Definition: TdcProcessor.h:712
base::H2handle * fQaErrorsPerHld
! QA Errors per TDC channel - from HLD
Definition: TdcProcessor.h:248
void FillToTHistogram()
Fill ToT histogram.
Definition: TdcProcessor.cxx:3405
base::H2handle fRisingCalibr
! histogram with all rising calibrations
Definition: TdcProcessor.h:228
void UseExplicitCalibration()
Configure mode, when calibration should be start/stop explicitly.
Definition: TdcProcessor.h:648
void SetCalibrTriggerMask(unsigned trigmask)
Set calibration trigger mask directly, 1bit per each trigger type if bit 0x80000000 configured,...
Definition: TdcProcessor.h:591
void ClearChannelStat(unsigned ch)
Clear channel statistic used for calibrations.
Definition: TdcProcessor.cxx:3418
double DoTestToT(int iCh)
Test ToT.
Definition: TdcProcessor.cxx:2807
static void SetUseDTrigForRef(bool on=true)
Enable usage of 0xD trigger in ref histogram filling.
Definition: TdcProcessor.cxx:121
void DoHadesHistAnalysis()
Special hades histograms creation.
Definition: TdcProcessor.cxx:2789
double DoTestEdges(int iCh)
Test edges count.
Definition: TdcProcessor.cxx:2868
static void SetUseAsDTrig(bool on=true)
Use all data as 0xD trigger.
Definition: TdcProcessor.cxx:129
bool DoBuffer4Scan(const base::Buffer &buf, bool isfirst)
Scan all messages, find reference signals Major data analysis method.
Definition: TdcProcessor.cxx:2196
TdcIterator fIter1
! iterator for the first scan
Definition: TdcProcessor.h:217
void SetLinearCalibration(unsigned nch, unsigned finemin=30, unsigned finemax=500)
Configure linear calibration for the channel.
Definition: TdcProcessor.cxx:2992
unsigned fEdgeMask
EdgeMask defines how TDC calibration for falling edge is performed 0,1 - use only rising edge,...
Definition: TdcProcessor.h:297
bool IsUseLastHist() const
Returns true if last hit used in reference histogram calculations.
Definition: TdcProcessor.h:689
static int GetHadesMonitorInterval()
Return interval in seconds for HADES monitoring histograms filling.
Definition: TdcProcessor.cxx:145
void FindFMinMax(const std::vector< float > &func, int nbin, int &fmin, int &fmax)
Find min and max values of fine counter in calibration.
Definition: TdcProcessor.cxx:961
static bool gUseAsDTrig
! when true, all events are analyzed as 0xD trigger
Definition: TdcProcessor.h:346
bool CheckPrintError()
Check if error should be printed.
Definition: TdcProcessor.cxx:353
void SetUseLinear(bool on=true)
Enable linear calibrations.
Definition: TdcProcessor.h:669
void AcknowledgeCalibrQuality(double lvl=1.)
Acknowledge calibration quality.
Definition: TdcProcessor.h:499
float ExtractCalibrDirect(const std::vector< float > &func, unsigned bin)
extract calibration value
Definition: TdcProcessor.h:392
long CheckChannelStat(unsigned ch)
Return number of accumulated statistics for the channel.
Definition: TdcProcessor.cxx:845
const TdcMessage & GetLastTdcTrailer() const
Return last TDC header, seen by the processor.
Definition: TdcProcessor.h:695
base::H1handle fhTotMinusCounter
! histogram of counter with ToT < 0 ns per channel
Definition: TdcProcessor.h:237
void SetChannelTempShift(unsigned ch, float shift_per_grad)
Set shift for the channel time stamp, which is added with temperature change.
Definition: TdcProcessor.h:605
void IncCalibration(unsigned ch, bool rising, unsigned fine, unsigned value)
For expert use - artificially set calibration statistic.
Definition: TdcProcessor.cxx:3785
static unsigned gTotRange
! default range for TOT histogram
Definition: TdcProcessor.h:339
base::H2handle * fQaFinePerHld
! QA fine counter per TDC channel - from HLD
Definition: TdcProcessor.h:245
void SetTotStatLimit(int minstat=100)
Set minimal counts number for ToT calibration.
Definition: TdcProcessor.h:479
static int gDefaultLinearNumPoints
! number of points when linear calibration is used
Definition: TdcProcessor.h:350
static unsigned gNumFineBins
! default value for number of bins in histograms for fine bins
Definition: TdcProcessor.h:338
unsigned GetEdgeMask() const
Returns value of edge mask.
Definition: TdcProcessor.h:490
double fCustomMhz
! new design Mhz
Definition: TdcProcessor.h:330
base::H1handle GetHist(unsigned ch, int k=0)
Get histogram by index and channel id.
Definition: TdcProcessor.h:536
std::vector< ChannelRec > fCh
! full description for each channels
Definition: TdcProcessor.h:252
double DoTestFineTimeH2(int iCh, base::H2handle h)
Test fine time.
Definition: TdcProcessor.cxx:2899
unsigned NumChannels() const
Returns number of TDC channels.
Definition: TdcProcessor.h:484
std::vector< hadaq::MessageDouble > * pStoreDouble
! pointer on store vector
Definition: TdcProcessor.h:290
int fLinearNumPoints
! number of linear points
Definition: TdcProcessor.h:308
void SetSkipTdcMessages(unsigned cnt=0)
Set number of TDC messages, which should be skipped from subevent before analyzing it.
Definition: TdcProcessor.h:472
int fAllCalibrMode
! use all data for calibrations, used with DABC -1 - disabled, 0 - off, 1 - on
Definition: TdcProcessor.h:301
static double gTrigDWindowHigh
! high limit of time stamps for 0xD trigger used for calibration
Definition: TdcProcessor.h:344
base::H1handle fTotShifts
! histogram with all TOT shifts
Definition: TdcProcessor.h:231
int fAllTotMode
! ToT calibration mode -1 - disabled, 0 - accumulate stat for channels, 1 - accumulate stat for ToT
Definition: TdcProcessor.h:302
void SetEveryEpoch(bool on)
If set, each hit must be supplied with epoch message.
Definition: TdcProcessor.h:638
void AddError(unsigned code, const char *args,...)
add new error
Definition: TdcProcessor.cxx:361
unsigned fCompensateEpochCounter
! counter to compensate epoch reset
Definition: TdcProcessor.h:318
void SetTotRMSLimit(double rms=0.15)
Set maximal allowed RMS for ToT histogram in ns.
Definition: TdcProcessor.h:481
int GetLinearNumPoints() const
Return number of points in linear calibrations.
Definition: TdcProcessor.h:677
static bool gAllHistos
! when true, all histos for all channels created simultaneously
Definition: TdcProcessor.h:342
double fLastRateTm
! last ch0 time when rate was calculated
Definition: TdcProcessor.h:326
int fAllDTrigCnt
! number of 0xD triggers
Definition: TdcProcessor.h:303
base::H2handle * fChErrPerHld
! errors per TDC channel - from HLD
Definition: TdcProcessor.h:243
bool fToTdflt
! indicate if default setting used, which can be adjusted after seeing first event
Definition: TdcProcessor.h:258
float fCalibrTemp
! temperature when calibration was performed
Definition: TdcProcessor.h:253
std::vector< std::string > fCalibrLog
! error log messages during calibration
Definition: TdcProcessor.h:332
static void SetToTCalibr(int minstat=100, double rms=0.15)
Configure ToT calibration parameters.
Definition: TdcProcessor.cxx:104
bool IsEveryEpoch() const
Return true if each hit must be supplied with epoch message.
Definition: TdcProcessor.h:640
void DisableCalibrationFor(unsigned firstch, unsigned lastch=0)
Disable calibration for specified channels.
Definition: TdcProcessor.cxx:425
void SetCh0Enabled(bool on=true)
Enable/disable store of channel 0 in output event.
Definition: TdcProcessor.h:708
bool fAutoCalibrOnce
! when true, auto calibration will be executed once
Definition: TdcProcessor.h:300
base::H2handle fAllCoarse
! histogram of all coarse counters
Definition: TdcProcessor.h:227
void Set400Mhz(bool on=true)
Configure 400 MHz mode.
Definition: TdcProcessor.cxx:329
base::H1handle * fHitsPerHld
! hits per TDC - from HLD
Definition: TdcProcessor.h:240
double fCalibrTempSum0
! sum0 used to check temperature during calibration
Definition: TdcProcessor.h:279
const char * GetHistName(int k) const
Get histogram name by index.
Definition: TdcProcessor.h:519
bool fVersion4
if version4 TDC is analyzed
Definition: TdcProcessor.h:215
long fRateCnt
! counter used for rate calculation
Definition: TdcProcessor.h:325
bool fCh0Enabled
! when true, channel 0 stored in output event
Definition: TdcProcessor.h:320
static void SetDefaults(unsigned numfinebins=600, unsigned totrange=100, unsigned hist2dreduced=10)
Set default values for TDC creation.
Definition: TdcProcessor.cxx:57
std::vector< hadaq::TdcMessageExt > * pStoreVect
! pointer on store vector
Definition: TdcProcessor.h:284
static void SetHadesMonitorInterval(int tm=-1)
Configure interval in seconds for HADES monitoring histograms filling.
Definition: TdcProcessor.cxx:137
int fTotStatLimit
! how much statistic required for ToT calibration
Definition: TdcProcessor.h:263
static int gTotStatLimit
! how much statistic required for ToT calibration
Definition: TdcProcessor.h:348
void BeginCalibration(long cnt)
Start mode, when all data will be used for calibrations.
Definition: TdcProcessor.cxx:921
void SetCustomMhz(float freq=400.)
Set custom frequency.
Definition: TdcProcessor.cxx:341
bool fUseLinear
! create linear calibrations for the channel
Definition: TdcProcessor.h:307
double GetCalibrQuality() const
Returns calibration quality.
Definition: TdcProcessor.h:497
double fCalibrProgress
! current progress in calibration
Definition: TdcProcessor.h:267
void SetCalibrTempCoef(float coef)
Set temperature coefficient, which is applied to calibration curves Typical value is about 0....
Definition: TdcProcessor.h:599
static bool gStoreCalibrTables
! when enabled, store calibration tables for v4 TDC
Definition: TdcProcessor.h:352
void SetTotUpperLimit(double lmt=20)
Configure upper limit for ToT.
Definition: TdcProcessor.h:630
float ExtractCalibr(const std::vector< float > &func, unsigned bin)
Extract calibration value.
Definition: TdcProcessor.cxx:981
base::H1handle GetChannelRefHist(unsigned ch, bool=true)
Get ref histogram for specified channel.
Definition: TdcProcessor.h:700
TdcMessage fLastTdcHeader
! copy of last TDC header
Definition: TdcProcessor.h:322
bool EnableRefCondPrint(unsigned ch, double left=-10, double right=10, int numprint=0)
Enable print of TDC data when time difference to ref channel belong to specified interval Work ONLY w...
Definition: TdcProcessor.cxx:692
const TdcMessage & GetLastTdcHeader() const
Return last TDC header, seen by the processor.
Definition: TdcProcessor.h:692
void SetTable(uint32_t *table, unsigned addr, uint32_t value)
Set V4 table values.
Definition: TdcProcessor.cxx:3533
bool fAutoCalibr
! when true, perform auto calibration
Definition: TdcProcessor.h:299
std::vector< std::string > TakeCalibrLog()
Take all messages from calibration log.
Definition: TdcProcessor.h:508
void ProduceCalibration(bool clear_stat=true, bool use_linear=false, bool dummy=false, bool preliminary=false)
For expert use - produce calibration.
Definition: TdcProcessor.cxx:3266
bool CalibrateTot(unsigned ch, std::vector< uint32_t > &hist, float &tot_shift, float &tot_dev, float cut=0.)
Calibrate ToT.
Definition: TdcProcessor.cxx:3171
void SetRefChannel(unsigned ch, unsigned refch, unsigned reftdc=0xffff, int npoints=5000, double left=-10., double right=10., bool twodim=false)
Set reference signal for the TDC channel ch.
Definition: TdcProcessor.cxx:516
void CopyCalibration(const std::vector< float > &calibr, base::H1handle hcalibr, unsigned ch=0, base::H2handle h2calibr=0)
Copy calibration.
Definition: TdcProcessor.cxx:3253
float fCurrentTemp
! current measured temperature
Definition: TdcProcessor.h:277
base::H2handle fAllFine
! histogram of all fine counters
Definition: TdcProcessor.h:226
double DoTestErrors(int iCh)
Test errors in channel.
Definition: TdcProcessor.cxx:2838
static void SetErrorMask(unsigned mask=0xffffffffU)
Set errors mask which are printout, set 0 to disable errors printout See hadaq::TdcProcessor::EErrors...
Definition: TdcProcessor.cxx:68
std::vector< hadaq::TdcMessageExt > fDummyVect
! dummy empty vector
Definition: TdcProcessor.h:283
static bool gIgnoreCalibrMsgs
! ignore calibration messages
Definition: TdcProcessor.h:351
std::string fWriteCalibr
! file which should be written at the end of data processing
Definition: TdcProcessor.h:305
void SetRefTmds(unsigned ch, unsigned refch, int npoints, double left, double right)
Set reference signal for time extracted from v4 TMDS message.
Definition: TdcProcessor.cxx:577
virtual void BeforeFill()
Reset different values before scan subevent.
Definition: TdcProcessor.cxx:720
void SetWriteCalibration(const std::string &fprefix, bool every_time=false, bool use_linear=false)
When specified, calibration will be written to the file If every_time == true, write every time when ...
Definition: TdcProcessor.h:661
double fCalibrQuality
! calibration quality:
Definition: TdcProcessor.h:269
static void SetIgnoreCalibrMsgs(bool on=true)
Configure to ignore all kind of calibration data stored in HLD file Let analysis HLD stored by HADES ...
Definition: TdcProcessor.cxx:85
virtual void AfterFill(SubProcMap *=0)
Fill histograms after scan subevent.
Definition: TdcProcessor.cxx:735
void SetCalibrTrigger(int typ1=0xFFFF, unsigned typ2=0, unsigned typ3=0, unsigned typ4=0)
Set calibration trigger type(s) One could specify up-to 4 different trigger types,...
Definition: TdcProcessor.h:578
static double gTotRMSLimit
! allowed RMS value
Definition: TdcProcessor.h:349
static int gHadesMonitorInterval
! how often special HADES monitoring procedure called
Definition: TdcProcessor.h:347
base::H1handle fHits
! histogram with hits per channel
Definition: TdcProcessor.h:221
double GetCalibrProgress() const
Returns calibration progress.
Definition: TdcProcessor.h:493
void EmulateTransform(int dummycnt)
Emulate transformation.
Definition: TdcProcessor.cxx:1322
base::H2handle * fQaToTPerHld
! QA ToT per TDC channel - from HLD
Definition: TdcProcessor.h:246
void StoreCalibration(const std::string &fname, unsigned fileid=0)
For expert use - store calibration in the file.
Definition: TdcProcessor.cxx:3433
float fCalibrTempCoef
! coefficient to scale calibration curve (real value -1)
Definition: TdcProcessor.h:254
void ClearChannelRefHist(unsigned ch, bool rising=true)
Clear ref histogram for specified channel.
Definition: TdcProcessor.h:704
unsigned fNumChannels
! number of channels
Definition: TdcProcessor.h:250
bool PerformAutoCalibrate()
Perform automatic calibration of channels.
Definition: TdcProcessor.cxx:905
base::H2handle * fChCorrPerHld
! corrections per TDC channel - from HLD
Definition: TdcProcessor.h:244
void SetChannelTotShift(unsigned ch, float tot_shift)
Set channel TOT shift in nano-seconds, typical value is around 30 ns.
Definition: TdcProcessor.h:611
virtual double MaximumDisorderTm() const
This is maximum disorder time for TDC messages TODO: derive this value from sub-items.
Definition: TdcProcessor.h:358
double fToTvalue
! ToT of 0xd trigger
Definition: TdcProcessor.h:259
base::H1handle fMsgsKind
! messages kinds
Definition: TdcProcessor.h:225
bool fEveryEpoch
! if true, each hit must be supplied with epoch
Definition: TdcProcessor.h:310
base::H1handle * fErrPerHld
! errors per TDC - from HLD
Definition: TdcProcessor.h:241
static double gTrigDWindowLow
! low limit of time stamps for 0xD trigger used for calibration
Definition: TdcProcessor.h:343
base::H2handle * fQaEdgesPerHld
! QA Edges per TDC channel - from HLD
Definition: TdcProcessor.h:247
long fCalibrAmount
! current accumulated calibr data
Definition: TdcProcessor.h:266
void SetLinearNumPoints(int cnt=2)
Set number of points in linear calibrations.
Definition: TdcProcessor.h:675
double fCalibrTempSum2
! sum2 used to check temperature during calibration
Definition: TdcProcessor.h:281
bool IsUseLinear() const
Returns true is linear calibrations are configured.
Definition: TdcProcessor.h:672
virtual void CreateBranch(TTree *)
Create TTree branch.
Definition: TdcProcessor.cxx:3803
std::string fCalibrStatus
! calibration status
Definition: TdcProcessor.h:268
virtual void AppendTrbSync(uint32_t syncid)
Method will be called by TRB processor if SYNC message was found One should change 4 first bytes in t...
Definition: TdcProcessor.cxx:2979
bool fUseNativeTrigger
! if true, TRB3 trigger is used as event time
Definition: TdcProcessor.h:314
base::H2handle fhRaisingFineCalibr
! histogram of calibrated raising fine counter vs channel
Definition: TdcProcessor.h:234
int GetExplicitCalibrationMode()
Return explicit calibr mode, -1 - off, 0 - normal data processing, 1 - accumulating calibration.
Definition: TdcProcessor.h:651
static void SetMaxBoardId(unsigned)
obsolete, noop
Definition: TdcProcessor.cxx:47
void CompleteCalibration(bool dummy=false, const std::string &filename="", const std::string &subdir="")
Complete calibration mode, create calibration and calibration files.
Definition: TdcProcessor.cxx:943
void SetUseLastHit(bool on=true)
When enabled, last hit time in the channel used for reference time calculations By default,...
Definition: TdcProcessor.h:686
void ConfigureToTByHwType(unsigned hwtype)
Configure 0xD trigger ToT based on hwtype.
Definition: TdcProcessor.cxx:448
base::H2handle fFallingCalibr
! histogram all rising calibrations
Definition: TdcProcessor.h:229
base::H1handle fHitsRate
! histogram with data rate
Definition: TdcProcessor.h:230
EErrors
error codes
Definition: TdcProcessor.h:422
@ err3ff
0x3ff error
Definition: TdcProcessor.h:427
@ errFine
bad fine counter
Definition: TdcProcessor.h:426
@ errDesignId
mismatch in design id
Definition: TdcProcessor.h:431
@ errEpoch
wrong/missing epoch
Definition: TdcProcessor.h:425
@ errUncknHdr
uncknown header
Definition: TdcProcessor.h:430
@ errMisc
all other errors
Definition: TdcProcessor.h:432
@ errNoHeader
no header found
Definition: TdcProcessor.h:423
@ errCh0
nissig channel 0
Definition: TdcProcessor.h:428
@ errChId
wrong channel id
Definition: TdcProcessor.h:424
double GetTotUpperLimit() const
Get configured upper limit for ToT.
Definition: TdcProcessor.h:633
void AssignPerHldHistos(unsigned id, base::H1handle *hHits, base::H1handle *hErrs, base::H2handle *hChHits, base::H2handle *hChErrs, base::H2handle *hChCorr, base::H2handle *hQaFine, base::H2handle *hQaToT, base::H2handle *hQaEdges, base::H2handle *hQaErrors)
Assign per HLD histos.
Definition: TdcProcessor.h:556
double fTotUpperLimit
! upper limit for ToT range check
Definition: TdcProcessor.h:262
bool DoBufferScan(const base::Buffer &buf, bool isfirst)
Scan all messages, find reference signals Major data analysis method.
Definition: TdcProcessor.cxx:1594
virtual void UserPostLoop()
execute posloop function - check if calibration should be performed
Definition: TdcProcessor.cxx:472
base::H1handle fCorrHits
! histogram with corrected hits per channel
Definition: TdcProcessor.h:224
base::H1handle fUndHits
! histogram with undetected hits per channel
Definition: TdcProcessor.h:223
base::H1handle fErrors
! histogram with errors per channel
Definition: TdcProcessor.h:222
bool CreateChannelHistograms(unsigned ch)
create all histograms for the channel
Definition: TdcProcessor.cxx:392
double fToThmax
! histogram max
Definition: TdcProcessor.h:261
TdcProcessor(TrbProcessor *trb, unsigned tdcid, unsigned numchannels=MaxNumTdcChannels, unsigned edge_mask=1, bool ver4=false)
constructor
Definition: TdcProcessor.cxx:166
TRB processor.
Definition: TrbProcessor.h:46
TDC message.
Definition: TdcMessage.h:70
static unsigned GetFineMaxValue()
get pre-configured max fine counter
Definition: TdcMessage.h:303
static unsigned GetFineMinValue()
get pre-configured min fine counter
Definition: TdcMessage.h:301
static double CoarseUnit()
default coarse unit for 200 MHz
Definition: TdcMessage.h:280
TDC channel record.
Definition: TdcProcessor.h:39
double rising_last_tm
! last leading edge time
Definition: TdcProcessor.h:66
base::H2handle fRisingRef2D
! histogram
Definition: TdcProcessor.h:54
float time_shift_per_grad
! delay in channel (ns/C), caused by temperature change
Definition: TdcProcessor.h:85
base::H1handle fTot0D
! TOT from 0xD trigger (used for shift calibration)
Definition: TdcProcessor.h:61
long calibr_stat_falling
! accumulated statistic during last calibration
Definition: TdcProcessor.h:91
ChannelRec()
constructor
Definition: TdcProcessor.h:94
float last_tot
! last tot
Definition: TdcProcessor.h:80
base::H2handle fRisingDoubleRef
! correlation with diff time from other channel
Definition: TdcProcessor.h:56
double rising_tmds
! first detected rising time from TMDS
Definition: TdcProcessor.h:69
bool docalibr
! if false, simple calibration will be used
Definition: TdcProcessor.h:46
int falling_cnt
! number of falling hits in last event
Definition: TdcProcessor.h:64
base::C1handle fRisingRefCond
! condition to print raw events
Definition: TdcProcessor.h:52
void ReleaseToTHist()
Release memory for ToT histogram
Definition: TdcProcessor.h:208
unsigned doublerefch
! double reference channel
Definition: TdcProcessor.h:43
base::H1handle fFallingMult
! number of hits per event
Definition: TdcProcessor.h:59
std::vector< uint32_t > rising_stat
! rising stat
Definition: TdcProcessor.h:76
base::H1handle fFallingCalibr
! histogram of channel calibration function
Definition: TdcProcessor.h:62
bool hascalibr
! indicate if channel has valid calibration (not simple linear)
Definition: TdcProcessor.h:47
unsigned refch
! reference channel for specified
Definition: TdcProcessor.h:40
std::vector< uint32_t > falling_stat
! falling stat
Definition: TdcProcessor.h:78
bool refabs
! if true, absolute difference (without channel 0) will be used
Definition: TdcProcessor.h:42
long all_rising_stat
! all rising stat
Definition: TdcProcessor.h:74
base::H1handle fRisingMult
! number of hits per event
Definition: TdcProcessor.h:50
unsigned refch_tmds
! reference channel for TMDS messages
Definition: TdcProcessor.h:45
float tot_dev
! tot shift deviation after calibration
Definition: TdcProcessor.h:84
void CreateCalibr(unsigned numfine, double coarse_unit=-1.)
create calibration structures
Definition: TdcProcessor.h:151
std::vector< float > rising_calibr
! rising calibr
Definition: TdcProcessor.h:77
base::H1handle fFallingFine
! histogram of all fine counters
Definition: TdcProcessor.h:58
unsigned reftdc
! tdc of reference channel
Definition: TdcProcessor.h:41
base::H1handle fRisingRef
! histogram of time diff to ref channel
Definition: TdcProcessor.h:51
double rising_hit_tm
! leading edge time, used in correlation analysis. can be first or last time
Definition: TdcProcessor.h:65
unsigned doublereftdc
! tdc of double reference channel
Definition: TdcProcessor.h:44
float tot_shift
! calibrated tot shift
Definition: TdcProcessor.h:83
void CreateToTHist()
Create ToT histogram
Definition: TdcProcessor.h:200
long tot0d_cnt
! counter of tot0d statistic for calibration
Definition: TdcProcessor.h:81
float calibr_quality_falling
! quality of last calibration 0. is nothing
Definition: TdcProcessor.h:89
long calibr_stat_rising
! accumulated statistic during last calibration
Definition: TdcProcessor.h:90
base::H1handle fRisingRefRef
! difference of two ref times, connected with double ref
Definition: TdcProcessor.h:55
base::H1handle fRisingCalibr
! histogram of channel calibration function
Definition: TdcProcessor.h:53
bool check_calibr
! flag used to indicate that calibration was checked
Definition: TdcProcessor.h:48
float calibr_quality_rising
! quality of last calibration 0. is nothing
Definition: TdcProcessor.h:88
std::vector< uint32_t > tot0d_hist
! histogram used for TOT calibration, allocated only when required
Definition: TdcProcessor.h:82
float trig0d_coef
! scaling coefficient, applied when build calibration from 0xD trigger (reserved)
Definition: TdcProcessor.h:86
base::H1handle fRisingFine
! histogram of all fine counters
Definition: TdcProcessor.h:49
long all_falling_stat
! all falling stat
Definition: TdcProcessor.h:75
unsigned rising_fine
! rising fine
Definition: TdcProcessor.h:71
bool rising_new_value
! used to calculate TOT and avoid errors after single leading and double trailing edge
Definition: TdcProcessor.h:67
base::H1handle fTot
! histogram of time-over-threshold measurement
Definition: TdcProcessor.h:60
void SetLinearCalibr(unsigned finemin, unsigned finemax, double coarse_unit=-1)
Assign linear calibration.
Definition: TdcProcessor.h:169
base::H1handle fRisingTmdsRef
! histogram of time diff to ref channel for TMDS message
Definition: TdcProcessor.h:57
unsigned rising_coarse
! rising coarse
Definition: TdcProcessor.h:70
void ReleaseCalibr()
Release memory used by calibration structures.
Definition: TdcProcessor.h:191
void FillCalibr(unsigned numfine, double coarse_unit=-1.)
Initialize claibration with default values.
Definition: TdcProcessor.h:160
unsigned last_falling_fine
! last falling fine
Definition: TdcProcessor.h:73
double rising_ref_tm
! rising ref time
Definition: TdcProcessor.h:68
std::vector< float > falling_calibr
! falling calibr
Definition: TdcProcessor.h:79
int rising_cond_prnt
! rising condition print
Definition: TdcProcessor.h:87
int rising_cnt
! number of rising hits in last event
Definition: TdcProcessor.h:63
unsigned last_rising_fine
! last rising fine
Definition: TdcProcessor.h:72
Raw hades subevent.
Definition: definess.h:408