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

This loop writes fragments to a root-file.

Definition at line 27 of file TFragWriteLoop.h.

Public Member Functions

 ~TFragWriteLoop () override
 
std::shared_ptr< ThreadsafeQueue< std::shared_ptr< const TBadFragment > > > & BadInputQueue ()
 
void ClearQueue () override
 
std::string EndStatus () override
 
size_t GetItemsCurrent () override
 
size_t GetItemsPopped () override
 
size_t GetItemsPushed () override
 
size_t GetRate () override
 
std::shared_ptr< ThreadsafeQueue< std::shared_ptr< const TFragment > > > & InputQueue ()
 
bool IsPaused ()
 
bool IsRunning ()
 
void Join ()
 
std::string Name () const
 
virtual void OnEnd ()
 
std::shared_ptr< ThreadsafeQueue< std::shared_ptr< const TFragment > > > & OutputQueue ()
 
void Pause ()
 
virtual std::string Progress ()
 
void Resume ()
 
std::shared_ptr< ThreadsafeQueue< std::shared_ptr< TEpicsFrag > > > & ScalerInputQueue ()
 
virtual std::string Status ()
 
void Stop ()
 
void Write ()
 

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 TFragWriteLoopGet (std::string name="", std::string fOutputFilename="")
 
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 Member Functions

bool Iteration () override
 

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

 TFragWriteLoop (std::string name, std::string fOutputFilename)
 
 ClassDefOverride (TFragWriteLoop, 0)
 
void WriteBadEvent (const std::shared_ptr< const TBadFragment > &event)
 
void WriteEvent (const std::shared_ptr< const TFragment > &event)
 
void WriteScaler (const std::shared_ptr< TEpicsFrag > &scaler)
 

Private Attributes

TBadFragmentfBadEventAddress
 
TTree * fBadEventTree
 
std::shared_ptr< ThreadsafeQueue< std::shared_ptr< const TBadFragment > > > fBadInputQueue
 
TFragmentfEventAddress
 
TTree * fEventTree
 
std::shared_ptr< ThreadsafeQueue< std::shared_ptr< const TFragment > > > fInputQueue
 
TFile * fOutputFile
 
std::shared_ptr< ThreadsafeQueue< std::shared_ptr< const TFragment > > > fOutputQueue
 
TEpicsFragfScalerAddress
 
std::shared_ptr< ThreadsafeQueue< std::shared_ptr< TEpicsFrag > > > fScalerInputQueue
 
TTree * fScalerTree
 

#include <TFragWriteLoop.h>

+ Inheritance diagram for TFragWriteLoop:
+ Collaboration diagram for TFragWriteLoop:

Constructor & Destructor Documentation

◆ ~TFragWriteLoop()

TFragWriteLoop::~TFragWriteLoop ( )
override

Definition at line 68 of file TFragWriteLoop.cxx.

References Write().

◆ TFragWriteLoop()

TFragWriteLoop::TFragWriteLoop ( std::string  name,
std::string  fOutputFilename 
)
private

Definition at line 38 of file TFragWriteLoop.cxx.

References fBadEventAddress, fBadEventTree, fEventAddress, fEventTree, fOutputFile, fScalerAddress, and fScalerTree.

Referenced by Get().

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.

◆ BadInputQueue()

std::shared_ptr<ThreadsafeQueue<std::shared_ptr<const TBadFragment> > >& TFragWriteLoop::BadInputQueue ( )
inline

Definition at line 35 of file TFragWriteLoop.h.

References fBadInputQueue.

Referenced by TGRSIint::SetupPipeline().

◆ ClassDefOverride()

TFragWriteLoop::ClassDefOverride ( TFragWriteLoop  ,
 
)
private

◆ ClearAllQueues()

void StoppableThread::ClearAllQueues ( )
staticinherited

Definition at line 166 of file StoppableThread.cxx.

References StoppableThread::fThreadMap.

Referenced by TGRSIInterruptHandler::Notify().

◆ ClearQueue()

void TFragWriteLoop::ClearQueue ( )
overridevirtual

Reimplemented from StoppableThread.

Definition at line 73 of file TFragWriteLoop.cxx.

References fInputQueue.

◆ 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 TFragWriteLoop::EndStatus ( )
overridevirtual

◆ Get() [1/2]

TFragWriteLoop * TFragWriteLoop::Get ( std::string  name = "",
std::string  fOutputFilename = "" 
)
static

Definition at line 22 of file TFragWriteLoop.cxx.

References StoppableThread::Get(), and TFragWriteLoop().

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.

◆ GetItemsCurrent()

size_t TFragWriteLoop::GetItemsCurrent ( )
inlineoverridevirtual

Implements StoppableThread.

Definition at line 48 of file TFragWriteLoop.h.

◆ GetItemsPopped()

size_t TFragWriteLoop::GetItemsPopped ( )
inlineoverridevirtual

Implements StoppableThread.

Definition at line 47 of file TFragWriteLoop.h.

References StoppableThread::fItemsPopped.

◆ GetItemsPushed()

size_t TFragWriteLoop::GetItemsPushed ( )
inlineoverridevirtual

Implements StoppableThread.

Definition at line 46 of file TFragWriteLoop.h.

References StoppableThread::fItemsPopped.

◆ GetNThreads()

int StoppableThread::GetNThreads ( )
staticinherited

Definition at line 21 of file StoppableThread.cxx.

References StoppableThread::fThreadMap.

Referenced by StoppableThread::Print().

◆ GetRate()

size_t TFragWriteLoop::GetRate ( )
inlineoverridevirtual

Implements StoppableThread.

Definition at line 49 of file TFragWriteLoop.h.

◆ InputQueue()

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

Definition at line 34 of file TFragWriteLoop.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 TFragWriteLoop::Iteration ( )
overrideprotectedvirtual

◆ 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().

◆ OutputQueue()

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

Definition at line 37 of file TFragWriteLoop.h.

References fOutputQueue.

◆ 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().

◆ ScalerInputQueue()

std::shared_ptr<ThreadsafeQueue<std::shared_ptr<TEpicsFrag> > >& TFragWriteLoop::ScalerInputQueue ( )
inline

Definition at line 36 of file TFragWriteLoop.h.

References fScalerInputQueue.

Referenced by TGRSIint::SetupPipeline().

◆ SendStop()

void StoppableThread::SendStop ( )
staticinherited

◆ 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

◆ Write()

◆ WriteBadEvent()

void TFragWriteLoop::WriteBadEvent ( const std::shared_ptr< const TBadFragment > &  event)
private

Definition at line 184 of file TFragWriteLoop.cxx.

References fBadEventAddress, fBadEventTree, and ttree_fill_mutex.

Referenced by Iteration().

◆ WriteEvent()

void TFragWriteLoop::WriteEvent ( const std::shared_ptr< const TFragment > &  event)
private

Definition at line 171 of file TFragWriteLoop.cxx.

References TDetectorHit::ClearTransients(), fEventAddress, fEventTree, and ttree_fill_mutex.

Referenced by Iteration().

◆ WriteScaler()

void TFragWriteLoop::WriteScaler ( const std::shared_ptr< TEpicsFrag > &  scaler)
private

Definition at line 193 of file TFragWriteLoop.cxx.

References fScalerAddress, fScalerTree, and ttree_fill_mutex.

Referenced by Iteration().

Member Data Documentation

◆ fBadEventAddress

TBadFragment* TFragWriteLoop::fBadEventAddress
private

Definition at line 71 of file TFragWriteLoop.h.

Referenced by TFragWriteLoop(), and WriteBadEvent().

◆ fBadEventTree

TTree* TFragWriteLoop::fBadEventTree
private

Definition at line 67 of file TFragWriteLoop.h.

Referenced by EndStatus(), TFragWriteLoop(), Write(), and WriteBadEvent().

◆ fBadInputQueue

std::shared_ptr<ThreadsafeQueue<std::shared_ptr<const TBadFragment> > > TFragWriteLoop::fBadInputQueue
private

Definition at line 76 of file TFragWriteLoop.h.

Referenced by BadInputQueue(), and Iteration().

◆ fEventAddress

TFragment* TFragWriteLoop::fEventAddress
private

Definition at line 70 of file TFragWriteLoop.h.

Referenced by TFragWriteLoop(), and WriteEvent().

◆ fEventTree

TTree* TFragWriteLoop::fEventTree
private

Definition at line 66 of file TFragWriteLoop.h.

Referenced by EndStatus(), TFragWriteLoop(), Write(), and WriteEvent().

◆ fInputQueue

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

Definition at line 75 of file TFragWriteLoop.h.

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

◆ fInputSize

◆ fItemsPopped

◆ fName

std::string StoppableThread::fName
protectedinherited

◆ fOutputFile

TFile* TFragWriteLoop::fOutputFile
private

Definition at line 64 of file TFragWriteLoop.h.

Referenced by TFragWriteLoop(), and Write().

◆ fOutputQueue

std::shared_ptr<ThreadsafeQueue<std::shared_ptr<const TFragment> > > TFragWriteLoop::fOutputQueue
private

Definition at line 78 of file TFragWriteLoop.h.

Referenced by OutputQueue().

◆ fScalerAddress

TEpicsFrag* TFragWriteLoop::fScalerAddress
private

Definition at line 72 of file TFragWriteLoop.h.

Referenced by TFragWriteLoop(), and WriteScaler().

◆ fScalerInputQueue

std::shared_ptr<ThreadsafeQueue<std::shared_ptr<TEpicsFrag> > > TFragWriteLoop::fScalerInputQueue
private

Definition at line 77 of file TFragWriteLoop.h.

Referenced by Iteration(), and ScalerInputQueue().

◆ fScalerTree

TTree* TFragWriteLoop::fScalerTree
private

Definition at line 68 of file TFragWriteLoop.h.

Referenced by TFragWriteLoop(), Write(), and WriteScaler().

◆ fStatusThread

std::thread StoppableThread::fStatusThread
staticinherited

◆ fStatusThreadOn

◆ fThreadMap