GRSISort
Created by P.C. Bender
Developement Team: P.C. Bender, R. Dunlop, V. Bildstein
An extension of the ROOT analysis Framework
TEventBuildingLoop Class Reference

This loop builds events (vectors of fragments) based on timestamps and a build windows.

Definition at line 27 of file TEventBuildingLoop.h.

Public Types

enum  EBuildMode {
  EBuildMode::kDefault, EBuildMode::kTime, EBuildMode::kTimestamp, EBuildMode::kTriggerId,
  EBuildMode::kSkip
}
 

Public Member Functions

 ~TEventBuildingLoop () override
 
void ClearQueue () override
 
std::string EndStatus () override
 
unsigned long GetBuildWindow () const
 
size_t GetItemsCurrent () override
 
size_t GetItemsPopped () override
 
size_t GetItemsPushed () override
 
size_t GetRate () override
 
unsigned int GetSortDepth () const
 
std::shared_ptr< ThreadsafeQueue< std::shared_ptr< const TFragment > > > & InputQueue ()
 
bool IsPaused ()
 
bool IsRunning ()
 
bool Iteration () override
 
void Join ()
 
std::string Name () const
 
virtual void OnEnd ()
 
std::shared_ptr< ThreadsafeQueue< std::shared_ptr< const TFragment > > > & OutOfOrderQueue ()
 
std::shared_ptr< ThreadsafeQueue< std::vector< std::shared_ptr< const TFragment > > > > & OutputQueue ()
 
void Pause ()
 
virtual std::string Progress ()
 
void Resume ()
 
void SetBuildWindow (long val)
 
void SetSortDepth (int val)
 
virtual std::string Status ()
 
void Stop ()
 

Static Public Member Functions

static std::string AllThreadHeader ()
 
static std::string AllThreadProgress ()
 
static std::string AllThreadStatus ()
 
static bool AnyThreadRunning ()
 
static std::string AnyThreadStatus ()
 
static void ClearAllQueues ()
 
static void ColumnWidth (size_t val)
 
static size_t ColumnWidth ()
 
static TEventBuildingLoopGet (std::string name="", EBuildMode mode=EBuildMode::kTimestamp, long buildWindow=2000)
 
static StoppableThreadGet (const std::string &name)
 
static std::vector< StoppableThread * > GetAll ()
 
static int GetNThreads ()
 
static void join_status_thread ()
 
static void PauseAll ()
 
static void Print ()
 
static void ResumeAll ()
 
static void SendStop ()
 
static void start_status_thread ()
 
static void status_out ()
 
static void status_out_loop ()
 
static void StatusWidth (size_t val)
 
static size_t StatusWidth ()
 
static void stop_status_thread ()
 
static void StopAll ()
 

Static Public Attributes

static std::thread fStatusThread
 
static bool fStatusThreadOn = false
 

Protected Attributes

std::atomic_long fInputSize {0}
 
std::atomic_size_t fItemsPopped {0}
 
std::string fName
 

Static Protected Attributes

static std::map< std::string, StoppableThread * > fThreadMap
 

Private Member Functions

 TEventBuildingLoop (std::string name, EBuildMode mode, long buildWindow)
 
 TEventBuildingLoop (const TEventBuildingLoop &other)
 
bool CheckBuildCondition (const std::shared_ptr< const TFragment > &)
 
bool CheckTimeCondition (const std::shared_ptr< const TFragment > &)
 
bool CheckTimestampCondition (const std::shared_ptr< const TFragment > &)
 
bool CheckTriggerIdCondition (const std::shared_ptr< const TFragment > &)
 
 ClassDefOverride (TEventBuildingLoop, 0)
 
TEventBuildingLoopoperator= (const TEventBuildingLoop &other)
 

Private Attributes

EBuildMode fBuildMode
 
long fBuildWindow
 
std::shared_ptr< ThreadsafeQueue< std::shared_ptr< const TFragment > > > fInputQueue
 
std::vector< std::shared_ptr< const TFragment > > fNextEvent
 
std::multiset< std::shared_ptr< const TFragment >, std::function< bool(std::shared_ptr< const TFragment >, std::shared_ptr< const TFragment >)> > fOrdered
 
std::shared_ptr< ThreadsafeQueue< std::shared_ptr< const TFragment > > > fOutOfOrderQueue
 
std::shared_ptr< ThreadsafeQueue< std::vector< std::shared_ptr< const TFragment > > > > fOutputQueue
 
bool fPreviousSortingDepthError
 
bool fSkipInputSort
 
unsigned int fSortingDepth
 

#include <TEventBuildingLoop.h>

+ Inheritance diagram for TEventBuildingLoop:
+ Collaboration diagram for TEventBuildingLoop:

Member Enumeration Documentation

◆ EBuildMode

Enumerator
kDefault 
kTime 
kTimestamp 
kTriggerId 
kSkip 

Definition at line 29 of file TEventBuildingLoop.h.

Constructor & Destructor Documentation

◆ ~TEventBuildingLoop()

TEventBuildingLoop::~TEventBuildingLoop ( )
overridedefault

◆ TEventBuildingLoop() [1/2]

TEventBuildingLoop::TEventBuildingLoop ( std::string  name,
EBuildMode  mode,
long  buildWindow 
)
private

◆ TEventBuildingLoop() [2/2]

TEventBuildingLoop::TEventBuildingLoop ( const TEventBuildingLoop other)
private

Member Function Documentation

◆ AllThreadHeader()

std::string StoppableThread::AllThreadHeader ( )
staticinherited

◆ AllThreadProgress()

std::string StoppableThread::AllThreadProgress ( )
staticinherited

◆ AllThreadStatus()

std::string StoppableThread::AllThreadStatus ( )
staticinherited

◆ AnyThreadRunning()

bool StoppableThread::AnyThreadRunning ( )
staticinherited

◆ AnyThreadStatus()

std::string StoppableThread::AnyThreadStatus ( )
staticinherited

Definition at line 47 of file StoppableThread.cxx.

References StoppableThread::fThreadMap.

◆ CheckBuildCondition()

bool TEventBuildingLoop::CheckBuildCondition ( const std::shared_ptr< const TFragment > &  frag)
private

◆ CheckTimeCondition()

◆ CheckTimestampCondition()

◆ CheckTriggerIdCondition()

◆ ClassDefOverride()

TEventBuildingLoop::ClassDefOverride ( TEventBuildingLoop  ,
 
)
private

◆ ClearAllQueues()

void StoppableThread::ClearAllQueues ( )
staticinherited

Definition at line 166 of file StoppableThread.cxx.

References StoppableThread::fThreadMap.

Referenced by TGRSIInterruptHandler::Notify().

◆ ClearQueue()

void TEventBuildingLoop::ClearQueue ( )
overridevirtual

Reimplemented from StoppableThread.

Definition at line 66 of file TEventBuildingLoop.cxx.

References fInputQueue, and fOutputQueue.

◆ ColumnWidth() [1/2]

static void StoppableThread::ColumnWidth ( size_t  val)
inlinestaticinherited

Definition at line 75 of file StoppableThread.h.

References StoppableThread::fColumnWidth.

◆ ColumnWidth() [2/2]

static size_t StoppableThread::ColumnWidth ( )
inlinestaticinherited

Definition at line 77 of file StoppableThread.h.

References StoppableThread::fColumnWidth.

Referenced by TGRSIint::SetupPipeline().

◆ EndStatus()

std::string TEventBuildingLoop::EndStatus ( )
overridevirtual

Reimplemented from StoppableThread.

Definition at line 259 of file TEventBuildingLoop.cxx.

References fInputQueue, and StoppableThread::fItemsPopped.

◆ Get() [1/2]

static TEventBuildingLoop* TEventBuildingLoop::Get ( std::string  name = "",
EBuildMode  mode = EBuildMode::kTimestamp,
long  buildWindow = 2000 
)
static

Referenced by TGRSIint::SetupPipeline().

◆ Get() [2/2]

◆ GetAll()

std::vector< StoppableThread * > StoppableThread::GetAll ( )
staticinherited

Definition at line 315 of file StoppableThread.cxx.

References StoppableThread::fThreadMap.

◆ GetBuildWindow()

unsigned long TEventBuildingLoop::GetBuildWindow ( ) const
inline

Definition at line 53 of file TEventBuildingLoop.h.

References fBuildWindow.

◆ GetItemsCurrent()

size_t TEventBuildingLoop::GetItemsCurrent ( )
inlineoverridevirtual

Implements StoppableThread.

Definition at line 49 of file TEventBuildingLoop.h.

References fOutputQueue.

◆ GetItemsPopped()

size_t TEventBuildingLoop::GetItemsPopped ( )
inlineoverridevirtual

Implements StoppableThread.

Definition at line 48 of file TEventBuildingLoop.h.

References fOutputQueue.

◆ GetItemsPushed()

size_t TEventBuildingLoop::GetItemsPushed ( )
inlineoverridevirtual

Implements StoppableThread.

Definition at line 47 of file TEventBuildingLoop.h.

References fOutputQueue.

◆ GetNThreads()

int StoppableThread::GetNThreads ( )
staticinherited

Definition at line 21 of file StoppableThread.cxx.

References StoppableThread::fThreadMap.

Referenced by StoppableThread::Print().

◆ GetRate()

size_t TEventBuildingLoop::GetRate ( )
inlineoverridevirtual

Implements StoppableThread.

Definition at line 50 of file TEventBuildingLoop.h.

◆ GetSortDepth()

unsigned int TEventBuildingLoop::GetSortDepth ( ) const
inline

Definition at line 56 of file TEventBuildingLoop.h.

References fSortingDepth.

◆ InputQueue()

std::shared_ptr<ThreadsafeQueue<std::shared_ptr<const TFragment> > >& TEventBuildingLoop::InputQueue ( )
inline

Definition at line 35 of file TEventBuildingLoop.h.

References fInputQueue.

Referenced by TGRSIint::SetupPipeline().

◆ IsPaused()

bool StoppableThread::IsPaused ( )
inherited

Definition at line 224 of file StoppableThread.cxx.

References StoppableThread::fPaused.

◆ IsRunning()

bool StoppableThread::IsRunning ( )
inherited

Definition at line 219 of file StoppableThread.cxx.

References StoppableThread::fRunning.

Referenced by StoppableThread::status_out().

◆ Iteration()

bool TEventBuildingLoop::Iteration ( )
overridevirtual

◆ Join()

void StoppableThread::Join ( )
inherited

◆ join_status_thread()

void StoppableThread::join_status_thread ( )
staticinherited

◆ Name()

std::string StoppableThread::Name ( ) const
inlineinherited

◆ OnEnd()

virtual void StoppableThread::OnEnd ( )
inlinevirtualinherited

Reimplemented in TAnalysisWriteLoopClient, TFragmentChainLoop, TAnalysisWriteLoop, and TDataLoop.

Definition at line 54 of file StoppableThread.h.

Referenced by StoppableThread::Loop().

◆ operator=()

TEventBuildingLoop& TEventBuildingLoop::operator= ( const TEventBuildingLoop other)
private

◆ OutOfOrderQueue()

std::shared_ptr<ThreadsafeQueue<std::shared_ptr<const TFragment> > >& TEventBuildingLoop::OutOfOrderQueue ( )
inline

Definition at line 40 of file TEventBuildingLoop.h.

References fOutOfOrderQueue.

Referenced by TGRSIint::SetupPipeline().

◆ OutputQueue()

std::shared_ptr<ThreadsafeQueue<std::vector<std::shared_ptr<const TFragment> > > >& TEventBuildingLoop::OutputQueue ( )
inline

Definition at line 36 of file TEventBuildingLoop.h.

References fOutputQueue.

Referenced by TGRSIint::SetupPipeline().

◆ Pause()

void StoppableThread::Pause ( )
inherited

Definition at line 202 of file StoppableThread.cxx.

References StoppableThread::fPaused, and StoppableThread::fRunning.

◆ PauseAll()

void StoppableThread::PauseAll ( )
staticinherited

Definition at line 97 of file StoppableThread.cxx.

References StoppableThread::fThreadMap.

◆ Print()

void StoppableThread::Print ( )
staticinherited

◆ Progress()

std::string StoppableThread::Progress ( )
virtualinherited

◆ Resume()

void StoppableThread::Resume ( )
inherited

◆ ResumeAll()

void StoppableThread::ResumeAll ( )
staticinherited

Definition at line 104 of file StoppableThread.cxx.

References StoppableThread::fThreadMap.

Referenced by TGRSIint::SetupPipeline().

◆ SendStop()

void StoppableThread::SendStop ( )
staticinherited

◆ SetBuildWindow()

void TEventBuildingLoop::SetBuildWindow ( long  val)
inline

Definition at line 52 of file TEventBuildingLoop.h.

References fBuildWindow.

◆ SetSortDepth()

void TEventBuildingLoop::SetSortDepth ( int  val)
inline

Definition at line 55 of file TEventBuildingLoop.h.

References fSortingDepth.

Referenced by TGRSIint::SetupPipeline().

◆ start_status_thread()

void StoppableThread::start_status_thread ( )
staticinherited

◆ Status()

std::string StoppableThread::Status ( )
virtualinherited

◆ status_out()

◆ status_out_loop()

void StoppableThread::status_out_loop ( )
staticinherited

◆ StatusWidth() [1/2]

static void StoppableThread::StatusWidth ( size_t  val)
inlinestaticinherited

Definition at line 76 of file StoppableThread.h.

References StoppableThread::fStatusWidth.

◆ StatusWidth() [2/2]

static size_t StoppableThread::StatusWidth ( )
inlinestaticinherited

Definition at line 78 of file StoppableThread.h.

References StoppableThread::fStatusWidth.

Referenced by TGRSIint::SetupPipeline().

◆ Stop()

◆ stop_status_thread()

void StoppableThread::stop_status_thread ( )
staticinherited

◆ StopAll()

void StoppableThread::StopAll ( )
staticinherited

Member Data Documentation

◆ fBuildMode

EBuildMode TEventBuildingLoop::fBuildMode
private

Definition at line 76 of file TEventBuildingLoop.h.

Referenced by CheckBuildCondition(), and TEventBuildingLoop().

◆ fBuildWindow

long TEventBuildingLoop::fBuildWindow
private

◆ fInputQueue

std::shared_ptr<ThreadsafeQueue<std::shared_ptr<const TFragment> > > TEventBuildingLoop::fInputQueue
private

Definition at line 71 of file TEventBuildingLoop.h.

Referenced by ClearQueue(), EndStatus(), InputQueue(), and Iteration().

◆ fInputSize

◆ fItemsPopped

◆ fName

std::string StoppableThread::fName
protectedinherited

◆ fNextEvent

std::vector<std::shared_ptr<const TFragment> > TEventBuildingLoop::fNextEvent
private

◆ fOrdered

std::multiset<std::shared_ptr<const TFragment>, std::function<bool(std::shared_ptr<const TFragment>, std::shared_ptr<const TFragment>)> > TEventBuildingLoop::fOrdered
private

Definition at line 87 of file TEventBuildingLoop.h.

Referenced by Iteration(), and TEventBuildingLoop().

◆ fOutOfOrderQueue

std::shared_ptr<ThreadsafeQueue<std::shared_ptr<const TFragment> > > TEventBuildingLoop::fOutOfOrderQueue
private

◆ fOutputQueue

std::shared_ptr<ThreadsafeQueue<std::vector<std::shared_ptr<const TFragment> > > > TEventBuildingLoop::fOutputQueue
private

◆ fPreviousSortingDepthError

bool TEventBuildingLoop::fPreviousSortingDepthError
private

◆ fSkipInputSort

bool TEventBuildingLoop::fSkipInputSort
private

Definition at line 80 of file TEventBuildingLoop.h.

Referenced by Iteration(), and TEventBuildingLoop().

◆ fSortingDepth

unsigned int TEventBuildingLoop::fSortingDepth
private

◆ fStatusThread

std::thread StoppableThread::fStatusThread
staticinherited

◆ fStatusThreadOn

◆ fThreadMap