stream  0.10.0
stream analysis framework
Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends
hadaq::TdcProcessor Class Reference

TDC processor. More...

#include <hadaq/TdcProcessor.h>

Inheritance diagram for hadaq::TdcProcessor:
hadaq::SubProcessor base::StreamProc base::Processor

Data Structures

struct  ChannelRec
 TDC channel record. More...
 

Public Types

enum  EErrors {
  errNoHeader , errChId , errEpoch , errFine ,
  err3ff , errCh0 , errMismatchDouble , errUncknHdr ,
  errDesignId , errMisc
}
 error codes More...
 
enum  EEdgesMasks { edge_Rising = 1 , edge_BothIndepend = 2 , edge_ForceRising = 3 , edge_CommonStatistic = 4 }
 edges mask More...
 
- Public Types inherited from base::StreamProc
enum  SyncKind { sync_None , sync_Inter , sync_Left , sync_Right }
 kind of synchronization More...
 

Public Member Functions

 TdcProcessor (TrbProcessor *trb, unsigned tdcid, unsigned numchannels=MaxNumTdcChannels, unsigned edge_mask=1, bool ver4=false)
 constructor More...
 
virtual ~TdcProcessor ()
 destructor
 
void SetSkipTdcMessages (unsigned cnt=0)
 Set number of TDC messages, which should be skipped from subevent before analyzing it.
 
void Set400Mhz (bool on=true)
 Configure 400 MHz mode.
 
void SetCustomMhz (float freq=400.)
 Set custom frequency.
 
void SetTotStatLimit (int minstat=100)
 Set minimal counts number for ToT calibration.
 
void SetTotRMSLimit (double rms=0.15)
 Set maximal allowed RMS for ToT histogram in ns.
 
unsigned NumChannels () const
 Returns number of TDC channels.
 
bool DoRisingEdge () const
 Returns true if processing rising edge.
 
bool DoFallingEdge () const
 Returns true if processing falling.
 
unsigned GetEdgeMask () const
 Returns value of edge mask.
 
double GetCalibrProgress () const
 Returns calibration progress.
 
std::string GetCalibrStatus () const
 Returns calibration status.
 
double GetCalibrQuality () const
 Returns calibration quality.
 
void AcknowledgeCalibrQuality (double lvl=1.)
 Acknowledge calibration quality.
 
std::vector< std::string > TakeCalibrLog ()
 Take all messages from calibration log.
 
int GetNumHist () const
 Get number of indexed histograms.
 
const char * GetHistName (int k) const
 Get histogram name by index.
 
base::H1handle GetHist (unsigned ch, int k=0)
 Get histogram by index and channel id.
 
void CreateHistograms (int *arr=0)
 Create basic histograms for specified channels. More...
 
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.
 
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, for instance 0x1 and 0xD First argument could be use to enable all triggers (0xFFFF, default) or none of the triggers (-1)
 
void SetCalibrTriggerMask (unsigned trigmask)
 Set calibration trigger mask directly, 1bit per each trigger type if bit 0x80000000 configured, calibration will use temperature correction.
 
void SetCalibrTempCoef (float coef)
 Set temperature coefficient, which is applied to calibration curves Typical value is about 0.0044.
 
void SetChannelTempShift (unsigned ch, float shift_per_grad)
 Set shift for the channel time stamp, which is added with temperature change.
 
void SetChannelTotShift (unsigned ch, float tot_shift)
 Set channel TOT shift in nano-seconds, typical value is around 30 ns.
 
void DisableCalibrationFor (unsigned firstch, unsigned lastch=0)
 Disable calibration for specified channels.
 
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. More...
 
void SetRefTmds (unsigned ch, unsigned refch, int npoints, double left, double right)
 Set reference signal for time extracted from v4 TMDS message. More...
 
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 SetRefChannel() command. More...
 
void CreateRateHisto (int np=1000, double xmin=0., double xmax=1e5)
 Create rate histogram to count hits per second (excluding channel 0)
 
void SetTotUpperLimit (double lmt=20)
 Configure upper limit for ToT.
 
double GetTotUpperLimit () const
 Get configured upper limit for ToT.
 
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 when reference channel 0 is used. More...
 
void SetEveryEpoch (bool on)
 If set, each hit must be supplied with epoch message.
 
bool IsEveryEpoch () const
 Return true if each hit must be supplied with epoch message.
 
void SetLinearCalibration (unsigned nch, unsigned finemin=30, unsigned finemax=500)
 Configure linear calibration for the channel.
 
void SetAutoCalibration (long cnt=100000)
 configure auto calibration
 
void UseExplicitCalibration ()
 Configure mode, when calibration should be start/stop explicitly.
 
int GetExplicitCalibrationMode ()
 Return explicit calibr mode, -1 - off, 0 - normal data processing, 1 - accumulating calibration.
 
void BeginCalibration (long cnt)
 Start mode, when all data will be used for calibrations.
 
void CompleteCalibration (bool dummy=false, const std::string &filename="", const std::string &subdir="")
 Complete calibration mode, create calibration and calibration files.
 
bool LoadCalibration (const std::string &fprefix)
 Load calibration from the file.
 
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 automatic calibration performed, otherwise only at the end.
 
void SetUseLinear (bool on=true)
 Enable linear calibrations.
 
bool IsUseLinear () const
 Returns true is linear calibrations are configured.
 
void SetLinearNumPoints (int cnt=2)
 Set number of points in linear calibrations.
 
int GetLinearNumPoints () const
 Return number of points in linear calibrations.
 
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, and 50ns - 80ns range
 
void ConfigureToTByHwType (unsigned hwtype)
 Configure 0xD trigger ToT based on hwtype.
 
void SetUseLastHit (bool on=true)
 When enabled, last hit time in the channel used for reference time calculations By default, first hit time is used Special case is reference to channel 0 - here all hits will be used.
 
bool IsUseLastHist () const
 Returns true if last hit used in reference histogram calculations.
 
const TdcMessageGetLastTdcHeader () const
 Return last TDC header, seen by the processor.
 
const TdcMessageGetLastTdcTrailer () const
 Return last TDC header, seen by the processor.
 
virtual void UserPostLoop ()
 execute posloop function - check if calibration should be performed
 
base::H1handle GetChannelRefHist (unsigned ch, bool=true)
 Get ref histogram for specified channel.
 
void ClearChannelRefHist (unsigned ch, bool rising=true)
 Clear ref histogram for specified channel.
 
void SetCh0Enabled (bool on=true)
 Enable/disable store of channel 0 in output event.
 
virtual bool FirstBufferScan (const base::Buffer &buf)
 Scan all messages, find reference signals if returned false, buffer has error and must be discarded.
 
virtual bool SecondBufferScan (const base::Buffer &buf)
 Scan buffer for selecting messages inside trigger window.
 
void IncCalibration (unsigned ch, bool rising, unsigned fine, unsigned value)
 For expert use - artificially set calibration statistic.
 
void ProduceCalibration (bool clear_stat=true, bool use_linear=false, bool dummy=false, bool preliminary=false)
 For expert use - produce calibration.
 
float GetCalibrTemp () const
 Access value of temperature during calibration. More...
 
void SetCalibrTemp (float v)
 Set temperature used for calibration.
 
void StoreCalibration (const std::string &fname, unsigned fileid=0)
 For expert use - store calibration in the file.
 
virtual void Store (base::Event *)
 Store event.
 
virtual void ResetStore ()
 reset store
 
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.
 
void EmulateTransform (int dummycnt)
 Emulate transformation.
 
void DoHadesHistAnalysis ()
 Special hades histograms creation.
 
void FillToTHistogram ()
 Fill ToT histogram.
 
- Public Member Functions inherited from hadaq::SubProcessor
virtual ~SubProcessor ()
 destructor
 
virtual void UserPreLoop ()
 pre loop
 
bool IsTDC () const
 is TDC
 
void SetPrintRawData (bool on=true)
 set print raw data
 
bool IsPrintRawData () const
 is print raw data
 
bool IsCrossProcess () const
 is cross process
 
HldProcessorGetHLD () const
 get HLD processor
 
- Public Member Functions inherited from base::StreamProc
virtual ~StreamProc ()
 destructor
 
void SetTimeSorting (bool on)
 Enable/disable time sorting of data in output event.
 
bool IsTimeSorting () const
 Is time sorting enabled.
 
void SetTriggerMargin (double margin=0.)
 Set minimal distance between two triggers.
 
void CreateTriggerHist (unsigned multipl=40, unsigned nbins=2500, double left=-1e-6, double right=4e-6)
 create histograms for triggers
 
virtual void SetTriggerWindow (double left, double right)
 Set window relative to some reference signal, which will be used as region-of-interest interval to select messages from the stream.
 
void SetRawScanOnly ()
 Method set raw-scan only mode for processor Processor will not be used for any data selection.
 
bool IsRawScanOnly () const
 Is only raw scan will be performed.
 
bool IsRawAnalysis () const
 Is raw analysis only.
 
bool IsTriggeredAnalysis () const
 Is triggered events analysis.
 
bool IsStreamAnalysis () const
 Is full stream analysis.
 
bool IsSynchronisationRequired () const
 Method indicate if any kind of time-synchronization technique should be applied for the processor. More...
 
unsigned minNumSyncRequired () const
 Returns minimal number of syncs required for time synchronisation.
 
virtual bool AddNextBuffer (const Buffer &buf)
 Provide next port of data to the processor. More...
 
virtual bool ScanNewBuffers ()
 Scanning all new buffers in the queue. More...
 
virtual bool ScanNewBuffersTm ()
 With new calibration set (where possible) time of buffers. More...
 
virtual void SkipAllData ()
 Method to remove all buffers, all triggers and so on. More...
 
virtual bool SkipBuffers (unsigned cnt)
 Force processor to skip buffers from input. More...
 
unsigned numSyncs () const
 Returns total number of sync markers.
 
unsigned numReadySyncs () const
 Returns number of read sync markers.
 
SyncMarkergetSync (unsigned n)
 Returns sync marker.
 
unsigned findSyncWithId (unsigned syncid) const
 find sync marker
 
virtual bool CollectTriggers (GlobalMarksQueue &queue)
 Method to deliver detected triggers from processor to central manager. More...
 
virtual bool DistributeTriggers (const GlobalMarksQueue &queue)
 This is method to get back identified triggers from central manager. More...
 
virtual bool ScanDataForNewTriggers ()
 Here each processor should scan data again for new triggers Method made virtual while some subprocessors will do it in connection with others. More...
 
unsigned NumReadySubevents () const
 Returns number of already build events.
 
virtual bool AppendSubevent (base::Event *evt)
 Append data for first trigger to the main event. More...
 
- Public Member Functions inherited from base::Processor
virtual ~Processor ()
 destructor
 
ProcMgrmgr () const
 Return manager instance.
 
const char * GetName () const
 Get processor name.
 
unsigned GetID () const
 Get processor ID.
 
void SetHistFilling (int lvl=99)
 Set histogram filling level.
 
bool IsHistFilling () const
 Is histogram filling enabled.
 
int HistFillLevel () const
 Get histogram filling level.
 
unsigned GetStoreKind () const
 Get store kind.
 
bool IsStoreEnabled () const
 Is store enabled.
 
virtual void SetStoreKind (unsigned kind=1)
 Set store kind.
 
void SetStoreEnabled (bool on=true)
 Enable store - set store kind 1.
 

Static Public Member Functions

static void SetMaxBoardId (unsigned)
 obsolete, noop
 
static void SetDefaults (unsigned numfinebins=600, unsigned totrange=100, unsigned hist2dreduced=10)
 Set default values for TDC creation. More...
 
static void SetErrorMask (unsigned mask=0xffffffffU)
 Set errors mask which are printout, set 0 to disable errors printout See hadaq::TdcProcessor::EErrors to list of detected errors.
 
static void SetAllHistos (bool on=true)
 Automatically create histograms for all channels - even they not appear in data.
 
static void SetIgnoreCalibrMsgs (bool on=true)
 Configure to ignore all kind of calibration data stored in HLD file Let analysis HLD stored by HADES DAQ as it was not calibrated at all.
 
static void SetHadesMonitorInterval (int tm=-1)
 Configure interval in seconds for HADES monitoring histograms filling.
 
static int GetHadesMonitorInterval ()
 Return interval in seconds for HADES monitoring histograms filling.
 
static void SetUseDTrigForRef (bool on=true)
 Enable usage of 0xD trigger in ref histogram filling.
 
static void SetTriggerDWindow (double low=-25, double high=50)
 Configure window (in nanoseconds), where time stamps from 0xD trigger will be accepted for calibration.
 
static void SetToTCalibr (int minstat=100, double rms=0.15)
 Configure ToT calibration parameters. More...
 
static void SetDefaultLinearNumPoints (int cnt=2)
 Set default number of point in linear approximation.
 
static void SetUseAsDTrig (bool on=true)
 Use all data as 0xD trigger.
 
static void SetStoreCalibrTables (bool on=true)
 enable storage of calibration tables for V4 TDC
 
- Static Public Member Functions inherited from base::StreamProc
static void SetMarksQueueCapacity (unsigned sz)
 Set markers queue capacity.
 
static void SetBufsQueueCapacity (unsigned sz)
 Set buffers queue capacity.
 

Protected Member Functions

virtual bool doTriggerSelection () const
 Returns true when processor used to select trigger signal TDC not yet able to perform trigger selection.
 
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 the last buffer in the queue.
 
virtual double MaximumDisorderTm () const
 This is maximum disorder time for TDC messages TODO: derive this value from sub-items.
 
bool DoBufferScan (const base::Buffer &buf, bool isfirst)
 Scan all messages, find reference signals Major data analysis method.
 
bool DoBuffer4Scan (const base::Buffer &buf, bool isfirst)
 Scan all messages, find reference signals Major data analysis method.
 
double DoTestToT (int iCh)
 Test ToT.
 
double DoTestErrors (int iCh)
 Test errors in channel.
 
double DoTestEdges (int iCh)
 Test edges count.
 
double DoTestFineTimeH2 (int iCh, base::H2handle h)
 Test fine time.
 
double DoTestFineTime (double hRebin[], int nBinsRebin, int nEntries)
 Test fine time.
 
virtual void BeforeFill ()
 Reset different values before scan subevent.
 
virtual void AfterFill (SubProcMap *=0)
 Fill histograms after scan subevent.
 
long CheckChannelStat (unsigned ch)
 Return number of accumulated statistics for the channel.
 
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.
 
void CopyCalibration (const std::vector< float > &calibr, base::H1handle hcalibr, unsigned ch=0, base::H2handle h2calibr=0)
 Copy calibration.
 
bool CalibrateTot (unsigned ch, std::vector< uint32_t > &hist, float &tot_shift, float &tot_dev, float cut=0.)
 Calibrate ToT.
 
bool CheckPrintError ()
 Check if error should be printed.
 
bool CreateChannelHistograms (unsigned ch)
 create all histograms for the channel
 
double TestCanCalibrate (bool fillhist=false, std::string *status=nullptr)
 Check if automatic calibration can be performed - enough statistic is accumulated.
 
bool PerformAutoCalibrate ()
 Perform automatic calibration of channels.
 
void ClearChannelStat (unsigned ch)
 Clear channel statistic used for calibrations.
 
float ExtractCalibr (const std::vector< float > &func, unsigned bin)
 Extract calibration value.
 
float ExtractCalibrDirect (const std::vector< float > &func, unsigned bin)
 extract calibration value
 
void CreateV4CalibrTable (unsigned ch, uint32_t *table)
 Create V4 calibration table.
 
void SetTable (uint32_t *table, unsigned addr, uint32_t value)
 Set V4 table values.
 
void FindFMinMax (const std::vector< float > &func, int nbin, int &fmin, int &fmax)
 Find min and max values of fine counter in calibration.
 
virtual void CreateBranch (TTree *)
 Create TTree branch.
 
void AddError (unsigned code, const char *args,...)
 add new error
 
- Protected Member Functions inherited from hadaq::SubProcessor
 SubProcessor (TrbProcessor *trb, const char *nameprefix, unsigned subid)
 constructor
 
void SetNewDataFlag (bool on)
 Set new data flag, used by TrbProcessor.
 
bool IsNewDataFlag () const
 is new data flag, used by TrbProcessor
 
void AssignPerBrdHistos (TrbProcessor *trb, unsigned seqid)
 assign overview histograms
 
- Protected Member Functions inherited from base::StreamProc
 StreamProc (const char *name="", unsigned brdid=DummyBrdId, bool basehist=true)
 Make constructor protected - no way to create base class instance. More...
 
void SetSynchronisationKind (SyncKind kind=sync_Inter)
 Method indicate if any kind of time-synchronization technique should be applied for the processor. More...
 
void AddSyncMarker (SyncMarker &marker)
 add sync marker
 
bool AddTriggerMarker (LocalTimeMarker &marker, double tm_range=0.)
 Add new local trigger. More...
 
GlobalTime_t LocalToGlobalTime (GlobalTime_t localtm, unsigned *sync_index=0)
 Method converts local time (in ns representation) to global time. More...
 
bool IsSyncIndexWithInterpolation (unsigned indx) const
 Method return true when sync_index is means interpolation of time.
 
virtual GlobalTime_t ProvidePotentialFlushTime (GlobalTime_t last_marker)
 Method should return time, which could be flushed from the processor. More...
 
bool VerifyFlushTime (const base::GlobalTime_t &flush_time)
 Method must ensure that processor scanned such time and can really skip this data. More...
 
unsigned TestHitTime (const base::GlobalTime_t &hittime, bool normal_hit, bool can_close_event=true)
 Method decides to which trigger window belong hit normal_hit - indicates that time is belong to data, which than can be assigned to output can_close_event - when true, hit time can be used to decide that event is ready. More...
 
template<class EventClass , class MessageClass >
void AddMessage (unsigned indx, EventClass *ev, const MessageClass &msg)
 add new message to event
 
bool eraseSyncAt (unsigned indx)
 Removes sync at specified position. More...
 
bool eraseFirstSyncs (unsigned sync_num)
 Remove specified number of syncs. More...
 
- Protected Member Functions inherited from base::Processor
 Processor (const char *name="", unsigned brdid=DummyBrdId)
 Make constructor protected - no way to create base class instance. More...
 
void SetBoardId (unsigned id)
 Set board id.
 
void SetPathPrefix (const std::string &prefix)
 Set path prefix for histogramsid.
 
void SetSubPrefix (const char *subname="", int indx=-1, const char *subname2="", int indx2=-1)
 Set subprefix for histograms and conditions. More...
 
void SetSubPrefix2 (const char *subname="", int indx=-1, const char *subname2="", int indx2=-1)
 Set subprefix for histograms and conditions, index uses 2 symbols. More...
 
H1handle MakeH1 (const char *name, const char *title, int nbins, double left, double right, const char *xtitle=0)
 Adds processor prefix to histogram name and calls base::ProcMgr::MakeH1 method.
 
void FillH1 (H1handle h1, double x, double weight=1.)
 Fill 1-D histogram.
 
void FastFillH1 (H1handle h1, int x, double weight=1.)
 Fast fill 1-D histogram. More...
 
double GetH1Content (H1handle h1, int nbin)
 Get bin content of 1-D histogram.
 
void SetH1Content (H1handle h1, int nbin, double v=0.)
 Set bin content of 1-D histogram.
 
int GetH1NBins (H1handle h1)
 Get bins numbers for 1-D histogram.
 
void ClearH1 (H1handle h1)
 Clear 1-D histogram.
 
void CopyH1 (H1handle tgt, H1handle src)
 Copy 1-D histogram from src to tgt.
 
void SetH1Title (H1handle h1, const char *title)
 Set 1-D histogram title.
 
H2handle MakeH2 (const char *name, const char *title, int nbins1, double left1, double right1, int nbins2, double left2, double right2, const char *options=0)
 Adds processor prefix to histogram name and calls base::ProcMgr::MakeH2 method.
 
void FillH2 (H1handle h2, double x, double y, double weight=1.)
 Fill 2-D histogram.
 
void FastFillH2 (H1handle h2, int x, int y)
 Fast fill 2-D histogram. More...
 
void SetH2Content (H2handle h2, int nbin1, int nbin2, double v=0.)
 Set bin content of 2-D histogram.
 
double GetH2Content (H2handle h2, int bin1, int bin2)
 Get bin content of 2-D histogram.
 
bool GetH2NBins (H2handle h2, int &nBins1, int &nBins2)
 Get number of bins for 2-D histogram.
 
void ClearH2 (base::H2handle h2)
 Clear 2-D histogram.
 
void SetH2Title (H2handle h2, const char *title)
 Change title of 2-D histogram.
 
C1handle MakeC1 (const char *name, double left, double right, H1handle h1=0)
 Create condition.
 
void ChangeC1 (C1handle c1, double left, double right)
 Change condition limits.
 
int TestC1 (C1handle c1, double value, double *dist=0)
 Test condition.
 
double GetC1Limit (C1handle c1, bool isleft=true)
 Get condition limit.
 
virtual bool RegisterObject (TObject *tobj, const char *subfolder=0)
 Register object.
 

Protected Attributes

bool fVersion4 {false}
 if version4 TDC is analyzed
 
TdcIterator fIter1
 ! iterator for the first scan
 
TdcIterator fIter2
 ! iterator for the second scan
 
base::H1handle fChannels
 ! histogram with messages per channel
 
base::H1handle fHits
 ! histogram with hits per channel
 
base::H1handle fErrors
 ! histogram with errors per channel
 
base::H1handle fUndHits
 ! histogram with undetected hits per channel
 
base::H1handle fCorrHits
 ! histogram with corrected hits per channel
 
base::H1handle fMsgsKind
 ! messages kinds
 
base::H2handle fAllFine
 ! histogram of all fine counters
 
base::H2handle fAllCoarse
 ! histogram of all coarse counters
 
base::H2handle fRisingCalibr
 ! histogram with all rising calibrations
 
base::H2handle fFallingCalibr
 ! histogram all rising calibrations
 
base::H1handle fHitsRate
 ! histogram with data rate
 
base::H1handle fTotShifts
 ! histogram with all TOT shifts
 
base::H1handle fTempDistr
 ! temperature distribution
 
base::H2handle fhRaisingFineCalibr
 ! histogram of calibrated raising fine counter vs channel
 
base::H2handle fhTotVsChannel
 ! histogram of ToT vs channel
 
base::H1handle fhTotMoreCounter
 ! histogram of counter with ToT >20 ns per channel
 
base::H1handle fhTotMinusCounter
 ! histogram of counter with ToT < 0 ns per channel
 
unsigned fHldId
 ! sequence number of processor in HLD
 
base::H1handle * fHitsPerHld
 ! hits per TDC - from HLD
 
base::H1handle * fErrPerHld
 ! errors per TDC - from HLD
 
base::H2handle * fChHitsPerHld
 ! hits per TDC channel - from HLD
 
base::H2handle * fChErrPerHld
 ! errors per TDC channel - from HLD
 
base::H2handle * fChCorrPerHld
 ! corrections per TDC channel - from HLD
 
base::H2handle * fQaFinePerHld
 ! QA fine counter per TDC channel - from HLD
 
base::H2handle * fQaToTPerHld
 ! QA ToT per TDC channel - from HLD
 
base::H2handle * fQaEdgesPerHld
 ! QA Edges per TDC channel - from HLD
 
base::H2handle * fQaErrorsPerHld
 ! QA Errors per TDC channel - from HLD
 
unsigned fNumChannels
 ! number of channels
 
unsigned fNumFineBins
 ! number of fine-counter bins
 
std::vector< ChannelRecfCh
 ! full description for each channels
 
float fCalibrTemp
 ! temperature when calibration was performed
 
float fCalibrTempCoef
 ! coefficient to scale calibration curve (real value -1)
 
bool fCalibrUseTemp
 ! when true, use temperature adjustment for calibration
 
unsigned fCalibrTriggerMask
 ! mask with enabled for trigger events ids, default all
 
bool fToTdflt
 ! indicate if default setting used, which can be adjusted after seeing first event
 
double fToTvalue
 ! ToT of 0xd trigger
 
double fToThmin
 ! histogram min
 
double fToThmax
 ! histogram max
 
double fTotUpperLimit
 ! upper limit for ToT range check
 
int fTotStatLimit
 ! how much statistic required for ToT calibration
 
double fTotRMSLimit
 ! maximal RMS valus for complete calibration
 
long fCalibrAmount
 ! current accumulated calibr data
 
double fCalibrProgress
 ! current progress in calibration
 
std::string fCalibrStatus
 ! calibration status
 
double fCalibrQuality
 ! calibration quality:
 
float fTempCorrection
 ! correction for temperature sensor
 
float fCurrentTemp
 ! current measured temperature
 
unsigned fDesignId
 ! design ID, taken from status message
 
double fCalibrTempSum0
 ! sum0 used to check temperature during calibration
 
double fCalibrTempSum1
 ! sum1 used to check temperature during calibration
 
double fCalibrTempSum2
 ! sum2 used to check temperature during calibration
 
std::vector< hadaq::TdcMessageExtfDummyVect
 ! dummy empty vector
 
std::vector< hadaq::TdcMessageExt > * pStoreVect
 ! pointer on store vector
 
std::vector< hadaq::MessageFloatfDummyFloat
 ! vector with compact messages
 
std::vector< hadaq::MessageFloat > * pStoreFloat
 ! pointer on store vector
 
std::vector< hadaq::MessageDoublefDummyDouble
 ! vector with compact messages
 
std::vector< hadaq::MessageDouble > * pStoreDouble
 ! pointer on store vector
 
unsigned fEdgeMask
 EdgeMask defines how TDC calibration for falling edge is performed 0,1 - use only rising edge, falling edge is ignore 2 - falling edge enabled and fully independent from rising edge 3 - falling edge enabled and uses calibration from rising edge 4 - falling edge enabled and common statistic is used for calibration. More...
 
long fCalibrCounts
 ! indicates minimal number of counts in each channel required to produce calibration
 
bool fAutoCalibr
 ! when true, perform auto calibration
 
bool fAutoCalibrOnce
 ! when true, auto calibration will be executed once
 
int fAllCalibrMode
 ! use all data for calibrations, used with DABC -1 - disabled, 0 - off, 1 - on
 
int fAllTotMode
 ! ToT calibration mode -1 - disabled, 0 - accumulate stat for channels, 1 - accumulate stat for ToT
 
int fAllDTrigCnt
 ! number of 0xD triggers
 
std::string fWriteCalibr
 ! file which should be written at the end of data processing
 
bool fWriteEveryTime
 ! write calibration every time automatic calibration performed
 
bool fUseLinear
 ! create linear calibrations for the channel
 
int fLinearNumPoints
 ! number of linear points
 
bool fEveryEpoch
 ! if true, each hit must be supplied with epoch
 
bool fUseLastHit
 ! if true, last hit will be used in reference calculations
 
bool fUseNativeTrigger
 ! if true, TRB3 trigger is used as event time
 
bool fCompensateEpochReset
 ! if true, compensates epoch reset
 
unsigned fCompensateEpochCounter
 ! counter to compensate epoch reset
 
bool fCh0Enabled
 ! when true, channel 0 stored in output event
 
TdcMessage fLastTdcHeader
 ! copy of last TDC header
 
TdcMessage fLastTdcTrailer
 ! copy of last TDC trailer
 
long fRateCnt
 ! counter used for rate calculation
 
double fLastRateTm
 ! last ch0 time when rate was calculated
 
unsigned fSkipTdcMessages
 ! number of first messages, skipped from analysis
 
bool f400Mhz
 ! is 400Mhz mode (debug)
 
double fCustomMhz
 ! new design Mhz
 
std::vector< std::string > fCalibrLog
 ! error log messages during calibration
 
- Protected Attributes inherited from hadaq::SubProcessor
TrbProcessorfTrb
 ! pointer on TRB processor
 
unsigned fSeqeunceId
 ! sequence number of processor in TRB
 
bool fIsTDC
 ! indicate when it is TDC, to avoid dynamic_cast
 
base::H1handle * fMsgPerBrd
 ! messages per board - from TRB
 
base::H1handle * fErrPerBrd
 ! errors per board - from TRB
 
base::H1handle * fHitsPerBrd
 ! data hits per board - from TRB
 
base::H2handle * fCalHitsPerBrd
 ! calibration hits per board - from TRB
 
base::H2handle * fToTPerBrd
 ! ToT per board - from TRB
 
bool fNewDataFlag
 ! flag used by TRB processor to indicate if new data was added
 
bool fPrintRawData
 ! if true, raw data will be printed
 
bool fCrossProcess
 ! if true, AfterFill will be called by Trb processor
 
- Protected Attributes inherited from base::StreamProc
BuffersQueue fQueue
 ! buffers queue
 
unsigned fQueueScanIndex
 index of next buffer which should be scanned
 
unsigned fQueueScanIndexTm
 index of buffer to scan and set correct times of the buffer head
 
AnalysisKind fAnalysisKind
 defines that processor is doing
 
SyncKind fSynchronisationKind
 kind of synchronization
 
SyncMarksQueue fSyncs
 list of sync markers
 
unsigned fSyncScanIndex
 sync scan index, indicate number of syncs which can really be used for synchronization
 
bool fSyncFlag
 boolean, used in sync adjustment procedure
 
LocalMarkersQueue fLocalMarks
 queue with local markers
 
double fTriggerAcceptMaring
 time margin (in local time) to accept new trigger
 
GlobalTime_t fLastLocalTriggerTm
 time of last local trigger
 
GlobalMarksQueue fGlobalMarks
 list of global triggers in work
 
unsigned fGlobalTrigScanIndex
 index with first trigger which is not yet ready
 
unsigned fGlobalTrigRightIndex
 temporary value, used during second buffers scan
 
bool fTimeSorting
 defines if time sorting should be used for the messages
 
base::H1handle fTriggerTm
 ! histogram with time relative to the trigger
 
base::H1handle fMultipl
 ! histogram of event multiplicity
 
base::C1handle fTriggerWindow
 window used for data selection
 
- Protected Attributes inherited from base::Processor
std::string fName
 processor name, used for event naming
 
unsigned fID
 identifier, used mostly for debugging
 
ProcMgrfMgr
 direct pointer on manager
 
std::string fPathPrefix
 histogram path prefix, used for histogram folder name
 
std::string fPrefix
 prefix, used for histogram names
 
std::string fSubPrefixD
 sub-prefix for histogram directory
 
std::string fSubPrefixN
 sub-prefix for histogram names
 
int fHistFilling
 level of histogram filling
 
unsigned fStoreKind
 if >0, store will be enabled for processor
 
bool fIntHistFormat
 if true, internal histogram format is used
 

Static Protected Attributes

static unsigned gNumFineBins = FineCounterBins
 ! default value for number of bins in histograms for fine bins
 
static unsigned gTotRange = 100
 ! default range for TOT histogram
 
static unsigned gHist2dReduce = 10
 ! reduce factor for points in 2D histogram
 
static unsigned gErrorMask = 0xffffffffU
 ! mask for errors to display
 
static bool gAllHistos = false
 ! when true, all histos for all channels created simultaneously
 
static double gTrigDWindowLow = 0
 ! low limit of time stamps for 0xD trigger used for calibration
 
static double gTrigDWindowHigh = 0
 ! high limit of time stamps for 0xD trigger used for calibration
 
static bool gUseDTrigForRef = false
 ! when true, use special triggers for ref calculations
 
static bool gUseAsDTrig = false
 ! when true, all events are analyzed as 0xD trigger
 
static int gHadesMonitorInterval = -111
 ! how often special HADES monitoring procedure called
 
static int gTotStatLimit = 100
 ! how much statistic required for ToT calibration
 
static double gTotRMSLimit = 0.15
 ! allowed RMS value
 
static int gDefaultLinearNumPoints = 2
 ! number of points when linear calibration is used
 
static bool gIgnoreCalibrMsgs = false
 ! ignore calibration messages
 
static bool gStoreCalibrTables = false
 ! when enabled, store calibration tables for v4 TDC
 
- Static Protected Attributes inherited from base::StreamProc
static unsigned fMarksQueueCapacity = 10000
 maximum number of items in the marksers queue
 
static unsigned fBufsQueueCapacity = 100
 maximum number of items in the queue
 

Friends

class TrbProcessor
 

Additional Inherited Members

- Protected Types inherited from base::StreamProc
typedef RecordsQueue< base::Buffer, false > BuffersQueue
 buffers queue
 
typedef RecordsQueue< base::SyncMarker, false > SyncMarksQueue
 sync markers queue
 
- Protected Types inherited from base::Processor
enum  { DummyBrdId = 0xffffffff }
 

Detailed Description

TDC processor.

This is specialized sub-processor for FPGA-TDC. Normally it should be used together with TrbProcessor, which the only can provide data Following levels of histograms filling are working

Member Enumeration Documentation

◆ EEdgesMasks

edges mask

Enumerator
edge_Rising 

process only rising edge

edge_BothIndepend 

process rising and falling endges independent

edge_ForceRising 

use rising edge calibration for falling

edge_CommonStatistic 

accumulate common statistic for both

◆ EErrors

error codes

Enumerator
errNoHeader 

no header found

errChId 

wrong channel id

errEpoch 

wrong/missing epoch

errFine 

bad fine counter

err3ff 

0x3ff error

errCh0 

nissig channel 0

errUncknHdr 

uncknown header

errDesignId 

mismatch in design id

errMisc 

all other errors

Constructor & Destructor Documentation

◆ TdcProcessor()

hadaq::TdcProcessor::TdcProcessor ( TrbProcessor trb,
unsigned  tdcid,
unsigned  numchannels = MaxNumTdcChannels,
unsigned  edge_mask = 1,
bool  ver4 = false 
)

constructor

Parameters
trb- instance of hadaq::TrbProcessor
tdcid- TDC id
numchannels- number of channels
edge_mask- edges mask, see hadaq::TdcProcessor::EEdgesMasks
ver4- is TDC V4 should be expected

<! sequence number of processor in HLD

<! errors per TDC channel - from HLD

<! corrections per TDC channel - from HLD

<! QA fine counter per TDC channel - from HLD

<! QA ToT per TDC channel - from HLD

<! QA Edges per TDC channel - from HLD

<! QA Errors per TDC channel - from HLD

Member Function Documentation

◆ CreateHistograms()

void hadaq::TdcProcessor::CreateHistograms ( int *  arr = 0)

Create basic histograms for specified channels.

If array not specified, histograms for all channels are created. In array last element must be 0 or out of channel range. Call should be like: int channels[] = {33, 34, 35, 36, 0}; tdc->CreateHistograms( channels );

◆ EnableRefCondPrint()

bool hadaq::TdcProcessor::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 when reference channel 0 is used.

One could set maximum number of events to print In any case one should first set reference channel

◆ GetCalibrTemp()

float hadaq::TdcProcessor::GetCalibrTemp ( ) const
inline

Access value of temperature during calibration.

Used to adjust all kind of calibrations afterwards

◆ SetDefaults()

void hadaq::TdcProcessor::SetDefaults ( unsigned  numfinebins = 600,
unsigned  totrange = 100,
unsigned  hist2dreduced = 10 
)
static

Set default values for TDC creation.

Parameters
numfinebins- maximal value of fine counter bins, used for all histograms and calibrations, default 600
totrange- time in ns for ToT histograms, default 100
hist2dreduced- reducing factor on some 2D histograms, default 10 - means one bin instead 10 ns of ToT

◆ SetDoubleRefChannel()

bool hadaq::TdcProcessor::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 SetRefChannel() command.

If ch2 > 1000, than channel from other TDC can be used. tdcid = (ch2 - 1000) / 1000

◆ SetRefChannel()

void hadaq::TdcProcessor::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.

Parameters
chchannel for which reference histogram will be created
refchspecifies number of reference channel
reftdcspecifies tdc id, used for ref channel. default (0xffff) same TDC will be used
npointsnumber of points in ref histogram
leftleft limit of histogram
rightright limit of histogram
twodimif extra two dimensional histograms should be created If redtdc contains 0x70000 (like 0x7c010), than direct difference without channel 0 will be calculated To be able use other TDCs, one should enable TTrbProcessor::SetCrossProcess(true); If left-right range are specified, ref histograms are created. If twodim==true, 2-D histogram which will accumulate correlation between time difference to ref channel and:
  • fine_counter (shift 0 ns)
  • fine_counter of ref channel (shift -1 ns)
  • coarse_counter/4 (shift -2 ns)

◆ SetRefTmds()

void hadaq::TdcProcessor::SetRefTmds ( unsigned  ch,
unsigned  refch,
int  npoints,
double  left,
double  right 
)

Set reference signal for time extracted from v4 TMDS message.

Parameters
chconfigured channel
refchreference channel
npointsnumber of points in ref histogram
leftleft limit of histogram
rightright limit of histogram

◆ SetToTCalibr()

void hadaq::TdcProcessor::SetToTCalibr ( int  minstat = 100,
double  rms = 0.15 
)
static

Configure ToT calibration parameters.

Parameters
minstat- minimal number of counts to make ToT calibration, default 100
rms- maximal allowed RMS for ToT histogram in ns, default 0.15

Field Documentation

◆ fEdgeMask

unsigned hadaq::TdcProcessor::fEdgeMask
protected

EdgeMask defines how TDC calibration for falling edge is performed 0,1 - use only rising edge, falling edge is ignore 2 - falling edge enabled and fully independent from rising edge 3 - falling edge enabled and uses calibration from rising edge 4 - falling edge enabled and common statistic is used for calibration.

! which channels to analyze, analyzes trailing edges when more than 1


The documentation for this class was generated from the following files: