stream  0.10.0
stream analysis framework
Public Member Functions | Protected Member Functions | Protected Attributes | Friends
hadaq::HldProcessor Class Reference

HLD processor. More...

#include <hadaq/HldProcessor.h>

Inheritance diagram for hadaq::HldProcessor:
base::StreamProc base::Processor

Public Member Functions

 HldProcessor (bool auto_create=false, const char *after_func="")
 constructor More...
 
virtual ~HldProcessor ()
 destructor
 
uint32_t GetEventId () const
 Returns current event id.
 
uint32_t GetRunId () const
 Returns current run id.
 
unsigned NumberOfTDC () const
 Return number of TDCs in all TRBs.
 
TdcProcessorGetTDC (unsigned indx) const
 Get TDC by index.
 
TdcProcessorFindTDC (unsigned tdcid) const
 Find TDC by id.
 
unsigned NumberOfTRB () const
 Return number of TRBs.
 
TrbProcessorGetTRB (unsigned indx) const
 Get TRB by index.
 
TrbProcessorFindTRB (unsigned trbid) const
 Find TRB by id.
 
void ConfigureCalibration (const std::string &fileprefix, long period, unsigned trig=0xFFFF)
 Configure calibration modes. More...
 
void SetEventTypeSelect (unsigned evid)
 Set event type, only used in the analysis.
 
virtual void SetTriggerWindow (double left, double right)
 Set trigger window not only for itself, but for all subprocessors.
 
virtual void SetStoreKind (unsigned kind=1)
 Set store kind for all sub processors.
 
virtual bool FirstBufferScan (const base::Buffer &buf)
 Scan all messages, find reference signals. More...
 
void SetPrintRawData (bool on=true)
 Configure printing raw data in all sub-processors.
 
bool IsPrintRawData () const
 Returns true if print raw data configured.
 
void SetAutoCreate (bool on=true)
 Enable auto-create mode.
 
unsigned TransformEvent (void *src, unsigned len, void *tgt=0, unsigned tgtlen=0)
 Function to transform HLD event, used for TDC calibrations.
 
virtual void UserPreLoop ()
 Executing preliminary function before entering event loop.
 
hadaqs::RawEventGetLastEventHdr ()
 Return reference on last event header structure.
 
- 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
 
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...
 
virtual bool SecondBufferScan (const base::Buffer &)
 Second generic scan of buffer Here selection of data for region-of-interest should be performed.
 
- 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.
 
void SetStoreEnabled (bool on=true)
 Enable store - set store kind 1.
 
virtual void UserPostLoop ()
 post loop
 

Protected Member Functions

virtual bool doTriggerSelection () const
 Returns true when processor used to select trigger signal TRB3 not yet able to perform trigger selection.
 
void AddTrb (TrbProcessor *trb, unsigned id)
 Way to register trb processor. More...
 
virtual void CreateBranch (TTree *)
 Create branch in TTree to store provided data - hadaq::HldMessage.
 
virtual void Store (base::Event *ev)
 Call store event.
 
virtual void ResetStore ()
 Reset store.
 
void CreatePerTDCHisto ()
 Create summary histos where each bin corresponds to single TDC.
 
void DoHadesHistSummary ()
 Fill QA summary histograms.
 
void SetCrossProcess (bool on)
 Enable cross-processing of data Let produce time correlation between different TRBs.
 
- 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...
 
virtual double MaximumDisorderTm () const
 Time constant, defines how far disorder of messages can go.
 
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

TrbProcMap fMap
 map of trb processors
 
unsigned fEventTypeSelect
 selection for event type (lower 4 bits in event id)
 
bool fPrintRawData
 true when raw data should be printed
 
bool fAutoCreate
 when true, TRB/TDC processors will be created automatically
 
std::string fAfterFunc
 function called after new elements are created
 
std::string fCalibrName
 name of calibration for (auto)created components
 
long fCalibrPeriod
 how often calibration should be performed
 
unsigned fCalibrTriggerMask
 mask with enabled event ID, default all
 
base::H1handle fEvType
 HADAQ event type.
 
base::H1handle fEvSize
 HADAQ event size.
 
base::H1handle fSubevSize
 HADAQ sub-event size.
 
base::H1handle fHitsPerTDC
 HADAQ hits per TDC.
 
base::H1handle fErrPerTDC
 HADAQ errors per TDC.
 
base::H2handle fHitsPerTDCChannel
 HADAQ hits per TDC channel.
 
base::H2handle fErrPerTDCChannel
 HADAQ errors per TDC channel.
 
base::H2handle fCorrPerTDCChannel
 HADAQ corrections per TDC channel.
 
base::H2handle fQaFinePerTDCChannel
 HADAQ QA fine time per TDC channel.
 
base::H2handle fQaToTPerTDCChannel
 HADAQ QA ToT per TDC channel.
 
base::H2handle fQaEdgesPerTDCChannel
 HADAQ QA edges per TDC channel.
 
base::H2handle fQaErrorsPerTDCChannel
 HADAQ QA errors per TDC channel.
 
base::H1handle fQaSummary
 HADAQ QA summary histogram.
 
HldMessage fMsg
 used for TTree store
 
HldMessagepMsg
 used for TTree store
 
hadaqs::RawEvent fLastEvHdr
 ! copy of last event header (without data)
 
long fLastHadesTm
 ! last hades time
 
- 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
 

Friends

class TrbProcessor
 

Additional Inherited Members

- Public Types inherited from base::StreamProc
enum  SyncKind { sync_None , sync_Inter , sync_Left , sync_Right }
 kind of synchronization More...
 
- 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 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 }
 
- 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
 

Detailed Description

HLD processor.

Top-level processor of HLD events This is generic processor for HLD data Its only task - redistribute data over TRB processors

Constructor & Destructor Documentation

◆ HldProcessor()

hadaq::HldProcessor::HldProcessor ( bool  auto_create = false,
const char *  after_func = "" 
)

constructor

Parameters
auto_createenables automatic TRB and TDC creation based on setting, see hadaq::TrbProcessor::SetTDCRange and hadaq::TrbProcessor::SetHUBRange
after_funcfunction name which will be called after all TRBs and TDCs are created

Member Function Documentation

◆ AddTrb()

void hadaq::HldProcessor::AddTrb ( TrbProcessor trb,
unsigned  id 
)
protected

Way to register trb processor.

Adds TRB processor.

◆ ConfigureCalibration()

void hadaq::HldProcessor::ConfigureCalibration ( const std::string &  fileprefix,
long  period,
unsigned  trigmask = 0xFFFF 
)

Configure calibration modes.

Parameters
fileprefixis filename prefix for calibration files (empty string - no file I/O)
periodis hits count for autocalibration
  • 0 - only load calibration
  • -1 - accumulate data and store calibrations only at the end
  • -77 - accumulate data and produce liner calibrations only at the end
  • >0 - automatic calibration after N hits in each active channel if value ends with 77 like 10077 linear calibration will be calculated
trigmaskis trigger type mask used for calibration
  • (1 << 0xD) - special 0XD trigger with internal pulser, used also for TOT calibration
  • 0x3FFF - all kinds of trigger types will be used for calibration (excluding 0xE and 0xF)
  • 0x80000000 in mask enables usage of temperature correction

◆ FirstBufferScan()

bool hadaq::HldProcessor::FirstBufferScan ( const base::Buffer buf)
virtual

Scan all messages, find reference signals.

Perform scan of data in the buffer Central entry point for all analysis.

Reimplemented from base::StreamProc.


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