Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends

base::StreamProc Class Reference

#include <StreamProc.h>

Inheritance diagram for base::StreamProc:
Inheritance graph
[legend]
Collaboration diagram for base::StreamProc:
Collaboration graph
[legend]

Public Member Functions

virtual ~StreamProc ()
ProcMgrmgr () const
const std::string GetProcName () const
void SetTimeSorting (bool on)
bool IsTimeSorting () const
void SetTriggerWindow (double left, double right)
bool IsSynchronisationRequired () const
virtual bool AddNextBuffer (const Buffer &buf)
virtual bool ScanNewBuffers ()
virtual bool ScanNewBuffersTm ()
virtual void SkipAllData ()
virtual bool SkipBuffers (unsigned cnt)
virtual bool FirstBufferScan (const base::Buffer &buf)
virtual bool SecondBufferScan (const base::Buffer &buf)
unsigned numSyncs () const
SyncMarkergetSync (unsigned n)
SyncMarkerlastSync ()
bool eraseSyncAt (unsigned indx)
virtual bool CollectTriggers (GlobalTriggerMarksQueue &queue)
virtual bool DistributeTriggers (const GlobalTriggerMarksQueue &queue)
virtual bool ScanDataForNewTriggers ()
unsigned NumReadySubevents () const
virtual bool AppendSubevent (base::Event *evt)

Protected Types

typedef std::vector< base::BufferBuffersQueue
typedef std::vector
< base::SyncMarker
SyncMarksQueue
typedef std::vector
< base::LocalTriggerMarker
LocalTriggerMarksQueue

Protected Member Functions

 StreamProc (const char *name="", int indx=-1)
void SetSubPrefix (const char *subname="", int indx=-1, const char *subname2="", int indx2=-1)
H1handle MakeH1 (const char *name, const char *title, int nbins, double left, double right, const char *xtitle=0)
void FillH1 (H1handle h1, double x, double weight=1.)
H2handle MakeH2 (const char *name, const char *title, int nbins1, double left1, double right1, int nbins2, double left2, double right2, const char *options=0)
void FillH2 (H1handle h2, double x, double y, double weight=1.)
C1handle MakeC1 (const char *name, double left, double right, H1handle h1=0)
void ChangeC1 (C1handle c1, double left, double right)
int TestC1 (C1handle c1, double value, double *dist=0)
double GetC1Limit (C1handle c1, bool isleft=true)
void AddSyncMarker (SyncMarker &marker)
void AddTriggerMarker (LocalTriggerMarker &marker)
double local_time_dist (GlobalTime_t tm1, GlobalTime_t tm2)
GlobalTime_t LocalToGlobalTime (GlobalTime_t localtm, unsigned *lastindx=0)
virtual bool doTriggerSelection () const
virtual GlobalTime_t ProvidePotentialFlushTime (GlobalTime_t last_marker)
bool VerifyFlushTime (const base::GlobalTime_t &flush_time)
virtual double MaximumDisorderTm () const
unsigned TestHitTime (const base::GlobalTime_t &hittime, bool normal_hit)
virtual unsigned GetTriggerMultipl (unsigned indx)
virtual void SortDataInSubEvent (base::SubEvent *)

Protected Attributes

std::string fName
ProcMgrfMgr
 processor name, used for event naming
BuffersQueue fQueue
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
bool fIsSynchronisationRequired
 true if sync is required
SyncMarksQueue fSyncs
 list of sync markers
unsigned fSyncScanIndex
 sync scan index, use to adjust syncs over many processors
bool fSyncFlag
 boolean, used in sync adjustment procedure
LocalTriggerMarksQueue fLocalTrig
 list of local triggers
GlobalTriggerMarksQueue fGlobalTrig
 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
std::string fPrefix
 prefix, used for histogram names
std::string fSubPrefixD
 sub-prefix for histogram directory
std::string fSubPrefixN
 sub-prefix for histogram names
base::H1handle fTriggerTm
base::H1handle fMultipl
 histogram with time relative to the trigger
base::C1handle triggerWindow
 histogram of event multiplicity

Friends

class ProcMgr

Detailed Description

Definition at line 78 of file StreamProc.h.


Member Typedef Documentation

typedef std::vector<base::Buffer> base::StreamProc::BuffersQueue [protected]

Definition at line 83 of file StreamProc.h.

Definition at line 87 of file StreamProc.h.

typedef std::vector<base::SyncMarker> base::StreamProc::SyncMarksQueue [protected]

Definition at line 85 of file StreamProc.h.


Constructor & Destructor Documentation

base::StreamProc::StreamProc ( const char *  name = "",
int  indx = -1 
) [protected]

Make constructor protected - no way to create base class instance

Definition at line 41 of file StreamProc.cxx.

References base::ProcMgr::AddProc(), fMgr, fMultipl, fName, fPrefix, fTriggerTm, MakeC1(), MakeH1(), and triggerWindow.

base::StreamProc::~StreamProc (  )  [virtual]

Definition at line 73 of file StreamProc.cxx.

References fGlobalTrig, fLocalTrig, fQueue, and fSyncs.


Member Function Documentation

bool base::StreamProc::AddNextBuffer ( const Buffer buf  )  [virtual]

Provide next port of data to the processor

Definition at line 273 of file StreamProc.cxx.

References fQueue.

void base::StreamProc::AddSyncMarker ( base::SyncMarker marker  )  [protected]
void base::StreamProc::AddTriggerMarker ( LocalTriggerMarker marker  )  [protected]
bool base::StreamProc::AppendSubevent ( base::Event evt  )  [virtual]

Append data for first trigger to the main event

Definition at line 474 of file StreamProc.cxx.

References base::Event::AddSubEvent(), fGlobalTrig, fGlobalTrigScanIndex, FillH1(), fMultipl, GetProcName(), GetTriggerMultipl(), IsTimeSorting(), and SortDataInSubEvent().

void base::StreamProc::ChangeC1 ( C1handle  c1,
double  left,
double  right 
) [protected]

Definition at line 176 of file StreamProc.cxx.

References base::ProcMgr::ChangeC1(), and mgr().

Referenced by SetTriggerWindow().

bool base::StreamProc::CollectTriggers ( GlobalTriggerMarksQueue queue  )  [virtual]

Method to deliver detected triggers from processor to central manager

Definition at line 420 of file StreamProc.cxx.

References fLocalTrig, fQueueScanIndexTm, base::GlobalTriggerMarker::globaltm, and LocalToGlobalTime().

bool base::StreamProc::DistributeTriggers ( const GlobalTriggerMarksQueue queue  )  [virtual]

This is method to get back identified triggers from central manager

Definition at line 452 of file StreamProc.cxx.

References fGlobalTrig, GetC1Limit(), and triggerWindow.

virtual bool base::StreamProc::doTriggerSelection (  )  const [inline, protected, virtual]

Returns true when processor used to select trigger signal

Reimplemented in base::SysCoreProc, and get4::Processor.

Definition at line 149 of file StreamProc.h.

bool base::StreamProc::eraseSyncAt ( unsigned  indx  ) 

Removes sync at specified position

Definition at line 193 of file StreamProc.cxx.

References fSyncs, and fSyncScanIndex.

Referenced by base::ProcMgr::AnalyzeSyncMarkers().

void base::StreamProc::FillH1 ( H1handle  h1,
double  x,
double  weight = 1. 
) [protected]
void base::StreamProc::FillH2 ( H1handle  h2,
double  x,
double  y,
double  weight = 1. 
) [protected]

Definition at line 158 of file StreamProc.cxx.

References base::ProcMgr::FillH2(), and mgr().

Referenced by nx::Processor::FirstBufferScan().

virtual bool base::StreamProc::FirstBufferScan ( const base::Buffer buf  )  [inline, virtual]

Central method to scan new data in the queue This should include:

  • data indexing;
  • raw histogram filling;
  • search for special time markers;
  • multiplicity histogramming (if necessary)

Reimplemented in get4::Processor, and nx::Processor.

Definition at line 215 of file StreamProc.h.

Referenced by ScanNewBuffers().

double base::StreamProc::GetC1Limit ( C1handle  c1,
bool  isleft = true 
) [protected]

Definition at line 188 of file StreamProc.cxx.

References base::ProcMgr::GetC1Limit(), and mgr().

Referenced by DistributeTriggers(), and ScanDataForNewTriggers().

const std::string base::StreamProc::GetProcName (  )  const [inline]

Definition at line 174 of file StreamProc.h.

References fName.

Referenced by AppendSubevent(), and nx::Processor::~Processor().

SyncMarker& base::StreamProc::getSync ( unsigned  n  )  [inline]

Definition at line 223 of file StreamProc.h.

References fSyncs.

Referenced by base::ProcMgr::AnalyzeSyncMarkers(), and LocalToGlobalTime().

virtual unsigned base::StreamProc::GetTriggerMultipl ( unsigned  indx  )  [inline, protected, virtual]

Reimplemented in get4::Processor, and nx::Processor.

Definition at line 163 of file StreamProc.h.

Referenced by AppendSubevent().

bool base::StreamProc::IsSynchronisationRequired (  )  const [inline]

Method indicate if any kind of time-synchronization technique should be applied for the processor. If true, sync messages must be produced by processor and will be used. If false, local time stamps could be immediately used (with any necessary conversion)

Definition at line 191 of file StreamProc.h.

References fIsSynchronisationRequired.

Referenced by AddSyncMarker(), base::ProcMgr::AnalyzeSyncMarkers(), and LocalToGlobalTime().

bool base::StreamProc::IsTimeSorting (  )  const [inline]

Definition at line 178 of file StreamProc.h.

References fTimeSorting.

Referenced by AppendSubevent().

SyncMarker& base::StreamProc::lastSync (  )  [inline]

Definition at line 224 of file StreamProc.h.

References fSyncs.

double base::StreamProc::local_time_dist ( GlobalTime_t  tm1,
GlobalTime_t  tm2 
) [inline, protected]

Definition at line 142 of file StreamProc.h.

Referenced by LocalToGlobalTime().

base::GlobalTime_t base::StreamProc::LocalToGlobalTime ( base::GlobalTime_t  localtm,
unsigned *  lastindx = 0 
) [protected]

Method converts local time (in ns representation) to global time TODO: One could introduce more precise method, which works with stamps

Definition at line 203 of file StreamProc.cxx.

References getSync(), base::SyncMarker::globaltm, IsSynchronisationRequired(), local_time_dist(), base::SyncMarker::localtm, and numSyncs().

Referenced by CollectTriggers(), ScanNewBuffersTm(), nx::Processor::SecondBufferScan(), and get4::Processor::SecondBufferScan().

base::C1handle base::StreamProc::MakeC1 ( const char *  name,
double  left,
double  right,
H1handle  h1 = 0 
) [protected]

Definition at line 164 of file StreamProc.cxx.

References fPrefix, fSubPrefixD, fSubPrefixN, base::ProcMgr::MakeC1(), and mgr().

Referenced by StreamProc().

base::H1handle base::StreamProc::MakeH1 ( const char *  name,
const char *  title,
int  nbins,
double  left,
double  right,
const char *  xtitle = 0 
) [protected]
base::H2handle base::StreamProc::MakeH2 ( const char *  name,
const char *  title,
int  nbins1,
double  left1,
double  right1,
int  nbins2,
double  left2,
double  right2,
const char *  options = 0 
) [protected]

Definition at line 142 of file StreamProc.cxx.

References fName, fPrefix, fSubPrefixD, fSubPrefixN, base::ProcMgr::MakeH2(), and mgr().

Referenced by nx::Processor::Processor().

virtual double base::StreamProc::MaximumDisorderTm (  )  const [inline, protected, virtual]

Time constant, defines how far disorder of messages can go

Reimplemented in get4::Processor, and nx::Processor.

Definition at line 158 of file StreamProc.h.

Referenced by ScanDataForNewTriggers(), and TestHitTime().

ProcMgr* base::StreamProc::mgr (  )  const [inline]
unsigned base::StreamProc::NumReadySubevents (  )  const [inline]

Returns number of already build events

Definition at line 238 of file StreamProc.h.

References fGlobalTrigScanIndex.

unsigned base::StreamProc::numSyncs (  )  const [inline]

Returns total number of sync markers

Definition at line 222 of file StreamProc.h.

References fSyncs.

Referenced by base::ProcMgr::AnalyzeSyncMarkers(), and LocalToGlobalTime().

base::GlobalTime_t base::StreamProc::ProvidePotentialFlushTime ( GlobalTime_t  last_marker  )  [protected, virtual]

Method should return time, which could be flushed from the processor

Definition at line 325 of file StreamProc.cxx.

References fQueue, and fQueueScanIndexTm.

bool base::StreamProc::ScanDataForNewTriggers (  )  [virtual]

Here each processor should scan data again for new triggers

Definition at line 571 of file StreamProc.cxx.

References fGlobalTrig, fGlobalTrigRightIndex, fGlobalTrigScanIndex, fQueue, fQueueScanIndexTm, GetC1Limit(), MaximumDisorderTm(), SecondBufferScan(), SkipBuffers(), and triggerWindow.

bool base::StreamProc::ScanNewBuffers (  )  [virtual]

Scanning all new buffers in the queue

Definition at line 280 of file StreamProc.cxx.

References FirstBufferScan(), fQueue, and fQueueScanIndex.

bool base::StreamProc::ScanNewBuffersTm (  )  [virtual]

With new calibration set (where possible) time of buffers

Definition at line 306 of file StreamProc.cxx.

References fQueue, fQueueScanIndexTm, fSyncs, fSyncScanIndex, and LocalToGlobalTime().

virtual bool base::StreamProc::SecondBufferScan ( const base::Buffer buf  )  [inline, virtual]

Second generic scan of buffer Here selection of data for region-of-interest should be performed

Reimplemented in get4::Processor, and nx::Processor.

Definition at line 219 of file StreamProc.h.

Referenced by ScanDataForNewTriggers().

void base::StreamProc::SetSubPrefix ( const char *  subname = "",
int  indx = -1,
const char *  subname2 = "",
int  indx2 = -1 
) [protected]

Set subprefix for histograms and conditions

Definition at line 84 of file StreamProc.cxx.

References fSubPrefixD, and fSubPrefixN.

Referenced by nx::Processor::Processor(), get4::Processor::Processor(), and get4::Processor::setRefChannel().

void base::StreamProc::SetTimeSorting ( bool  on  )  [inline]

Enable/disable time sorting of data in output event

Definition at line 177 of file StreamProc.h.

References fTimeSorting.

void base::StreamProc::SetTriggerWindow ( double  left,
double  right 
) [inline]

Definition at line 181 of file StreamProc.h.

References ChangeC1(), and triggerWindow.

void base::StreamProc::SkipAllData (  )  [virtual]

Method to remove all buffers, all triggers and so on

Definition at line 292 of file StreamProc.cxx.

References fGlobalTrig, fLocalTrig, fQueue, fQueueScanIndexTm, fSyncs, fSyncScanIndex, and SkipBuffers().

bool base::StreamProc::SkipBuffers ( unsigned  cnt  )  [virtual]

Force processor to skip buffers from input

Definition at line 372 of file StreamProc.cxx.

References fLocalTrig, fQueue, fQueueScanIndex, fQueueScanIndexTm, fSyncs, and fSyncScanIndex.

Referenced by ScanDataForNewTriggers(), and SkipAllData().

virtual void base::StreamProc::SortDataInSubEvent ( base::SubEvent  )  [inline, protected, virtual]

Reimplemented in get4::Processor, and nx::Processor.

Definition at line 165 of file StreamProc.h.

Referenced by AppendSubevent().

int base::StreamProc::TestC1 ( C1handle  c1,
double  value,
double *  dist = 0 
) [protected]

Definition at line 182 of file StreamProc.cxx.

References mgr(), and base::ProcMgr::TestC1().

unsigned base::StreamProc::TestHitTime ( const base::GlobalTime_t hittime,
bool  normal_hit 
) [protected]

Method decides to which trigger window belong hit

Definition at line 513 of file StreamProc.cxx.

References fGlobalTrig, fGlobalTrigRightIndex, fGlobalTrigScanIndex, FillH1(), fTriggerTm, and MaximumDisorderTm().

Referenced by nx::Processor::SecondBufferScan(), and get4::Processor::SecondBufferScan().

bool base::StreamProc::VerifyFlushTime ( const base::GlobalTime_t flush_time  )  [protected]

Method must ensure that processor scanned such time and can really skip this data

Definition at line 338 of file StreamProc.cxx.

References fQueue, and fQueueScanIndexTm.


Friends And Related Function Documentation

friend class ProcMgr [friend]

Definition at line 79 of file StreamProc.h.


Field Documentation

temporary value, used during second buffers scan

Definition at line 108 of file StreamProc.h.

Referenced by ScanDataForNewTriggers(), and TestHitTime().

index with first trigger which is not yet ready

Definition at line 107 of file StreamProc.h.

Referenced by AppendSubevent(), NumReadySubevents(), ScanDataForNewTriggers(), and TestHitTime().

true if sync is required

Definition at line 98 of file StreamProc.h.

Referenced by IsSynchronisationRequired(), and base::SysCoreProc::SetSyncSource().

list of local triggers

Definition at line 103 of file StreamProc.h.

Referenced by AddTriggerMarker(), CollectTriggers(), SkipAllData(), SkipBuffers(), and ~StreamProc().

processor name, used for event naming

Definition at line 91 of file StreamProc.h.

Referenced by mgr(), and StreamProc().

histogram with time relative to the trigger

Definition at line 117 of file StreamProc.h.

Referenced by AppendSubevent(), and StreamProc().

std::string base::StreamProc::fName [protected]

Definition at line 89 of file StreamProc.h.

Referenced by GetProcName(), MakeH1(), MakeH2(), and StreamProc().

std::string base::StreamProc::fPrefix [protected]

prefix, used for histogram names

Definition at line 112 of file StreamProc.h.

Referenced by MakeC1(), MakeH1(), MakeH2(), and StreamProc().

unsigned base::StreamProc::fQueueScanIndex [protected]

index of next buffer which should be scanned

Definition at line 95 of file StreamProc.h.

Referenced by AddSyncMarker(), AddTriggerMarker(), ScanNewBuffers(), and SkipBuffers().

index of buffer to scan and set correct times of the buffer head

Definition at line 96 of file StreamProc.h.

Referenced by CollectTriggers(), ProvidePotentialFlushTime(), ScanDataForNewTriggers(), ScanNewBuffersTm(), SkipAllData(), SkipBuffers(), and VerifyFlushTime().

std::string base::StreamProc::fSubPrefixD [protected]

sub-prefix for histogram directory

Definition at line 113 of file StreamProc.h.

Referenced by MakeC1(), MakeH1(), MakeH2(), and SetSubPrefix().

std::string base::StreamProc::fSubPrefixN [protected]

sub-prefix for histogram names

Definition at line 114 of file StreamProc.h.

Referenced by MakeC1(), MakeH1(), MakeH2(), and SetSubPrefix().

bool base::StreamProc::fSyncFlag [protected]

boolean, used in sync adjustment procedure

Definition at line 101 of file StreamProc.h.

Referenced by base::ProcMgr::AnalyzeSyncMarkers().

list of sync markers

Definition at line 99 of file StreamProc.h.

Referenced by AddSyncMarker(), eraseSyncAt(), getSync(), lastSync(), numSyncs(), ScanNewBuffersTm(), SkipAllData(), SkipBuffers(), and ~StreamProc().

unsigned base::StreamProc::fSyncScanIndex [protected]

sync scan index, use to adjust syncs over many processors

Definition at line 100 of file StreamProc.h.

Referenced by base::ProcMgr::AnalyzeSyncMarkers(), eraseSyncAt(), ScanNewBuffersTm(), SkipAllData(), and SkipBuffers().

defines if time sorting should be used for the messages

Definition at line 110 of file StreamProc.h.

Referenced by IsTimeSorting(), and SetTimeSorting().

Definition at line 116 of file StreamProc.h.

Referenced by StreamProc(), and TestHitTime().

histogram of event multiplicity

window used for data selection

Definition at line 119 of file StreamProc.h.

Referenced by DistributeTriggers(), ScanDataForNewTriggers(), SetTriggerWindow(), and StreamProc().


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