GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TFragDiagnosticsLoop Class Reference

Detailed Description

This loop writes fragments to a root-file.

Definition at line 25 of file TFragDiagnosticsLoop.h.

Public Member Functions

 TFragDiagnosticsLoop (const TFragDiagnosticsLoop &)=delete
 
 TFragDiagnosticsLoop (TFragDiagnosticsLoop &&) noexcept=delete
 
 ~TFragDiagnosticsLoop ()
 
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 ()
 
TFragDiagnosticsLoopoperator= (const TFragDiagnosticsLoop &)=delete
 
TFragDiagnosticsLoopoperator= (TFragDiagnosticsLoop &&) noexcept=delete
 
void Pause ()
 
virtual std::string Progress ()
 
void Resume ()
 
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 size_t ColumnWidth ()
 
static void ColumnWidth (size_t val)
 
static StoppableThreadGet (const std::string &name)
 
static TFragDiagnosticsLoopGet (std::string name="", std::string fOutputFilename="")
 
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 size_t StatusWidth ()
 
static void StatusWidth (size_t val)
 
static void stop_status_thread ()
 
static void StopAll ()
 

Protected Member Functions

void IncrementItemsPopped ()
 
std::atomic_long & InputSize ()
 
void InputSize (int64_t val)
 
std::atomic_size_t & ItemsPopped ()
 
void ItemsPopped (size_t val)
 
bool Iteration () override
 

Private Member Functions

 TFragDiagnosticsLoop (std::string name, const std::string &fOutputFilename)
 
bool CreateHistograms ()
 
void Loop ()
 
void Process (const std::shared_ptr< const TFragment > &event)
 

Private Attributes

TH2D * fAccepted {nullptr}
 
std::map< unsigned int, std::array< int64_t, 2 > > fAcceptedChannelIds
 
uint64_t fAcceptedMax {0x1 << 14}
 
TBadFragmentfBadEventAddress {nullptr}
 
std::map< unsigned int, std::array< int64_t, 2 > > fChannelIds
 
TFragmentfEventAddress {nullptr}
 
std::atomic_bool fForceStop {false}
 
std::shared_ptr< ThreadsafeQueue< std::shared_ptr< const TFragment > > > fInputQueue
 
std::atomic_long fInputSize {0}
 
std::atomic_size_t fItemsPopped {0}
 
TH2D * fLostAcceptedIds {nullptr}
 
TH2D * fLostAcceptedIdsTime {nullptr}
 
TH2D * fLostChannelIds {nullptr}
 
TH2D * fLostChannelIdsTime {nullptr}
 
TH1D * fLostNetworkPackets {nullptr}
 
std::string fName
 
std::array< int, 2 > fNetworkPacketNumber {{0, 0}}
 
std::array< int64_t, 2 > fNetworkPacketTimeStamp {{0, 0}}
 
std::map< unsigned int, int > fNofRollovers
 
TFile * fOutputFile {nullptr}
 
std::atomic_bool fPaused {false}
 
std::condition_variable fPausedWait
 
std::mutex fPauseMutex
 
std::map< unsigned int, bool > fRolling
 
unsigned int fRollingThreshold {1000}
 
std::map< unsigned int, int > fRollnum
 
int fRollnumThreshold {20}
 
int fRunLength {0}
 
std::atomic_bool fRunning {false}
 
TEpicsFragfScalerAddress {nullptr}
 
std::thread fThread
 
std::map< unsigned int, std::array< int64_t, 2 > > fTimeStamps
 

Static Private Attributes

static size_t fColumnWidth = 20
 
static std::thread fStatusThread
 
static bool fStatusThreadOn = false
 
static size_t fStatusWidth = 80
 
static std::map< std::string, StoppableThread * > fThreadMap
 
+ Inheritance diagram for TFragDiagnosticsLoop:
+ Collaboration diagram for TFragDiagnosticsLoop:

Constructor & Destructor Documentation

◆ TFragDiagnosticsLoop() [1/3]

TFragDiagnosticsLoop::TFragDiagnosticsLoop ( const TFragDiagnosticsLoop & )
delete

Referenced by Get().

◆ TFragDiagnosticsLoop() [2/3]

TFragDiagnosticsLoop::TFragDiagnosticsLoop ( TFragDiagnosticsLoop && )
deletenoexcept

◆ ~TFragDiagnosticsLoop()

TFragDiagnosticsLoop::~TFragDiagnosticsLoop ( )

Definition at line 56 of file TFragDiagnosticsLoop.cxx.

References Write().

◆ TFragDiagnosticsLoop() [3/3]

TFragDiagnosticsLoop::TFragDiagnosticsLoop ( std::string name,
const std::string & fOutputFilename )
private

Definition at line 39 of file TFragDiagnosticsLoop.cxx.

References fOutputFile.

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.

◆ ClearAllQueues()

void StoppableThread::ClearAllQueues ( )
staticinherited

Definition at line 166 of file StoppableThread.cxx.

References StoppableThread::fThreadMap.

Referenced by TGRSIInterruptHandler::Notify().

◆ ClearQueue()

void TFragDiagnosticsLoop::ClearQueue ( )
overridevirtual

Reimplemented from StoppableThread.

Definition at line 61 of file TFragDiagnosticsLoop.cxx.

References fInputQueue.

◆ ColumnWidth() [1/2]

static size_t StoppableThread::ColumnWidth ( )
inlinestaticinherited

Definition at line 81 of file StoppableThread.h.

References StoppableThread::fColumnWidth.

Referenced by TGRSIint::SetupPipeline().

◆ ColumnWidth() [2/2]

static void StoppableThread::ColumnWidth ( size_t val)
inlinestaticinherited

Definition at line 79 of file StoppableThread.h.

References StoppableThread::fColumnWidth.

◆ CreateHistograms()

◆ EndStatus()

std::string TFragDiagnosticsLoop::EndStatus ( )
overridevirtual

◆ Get() [1/2]

◆ Get() [2/2]

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

Definition at line 23 of file TFragDiagnosticsLoop.cxx.

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

Referenced by TGRSIint::SetupPipeline().

◆ GetAll()

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

Definition at line 315 of file StoppableThread.cxx.

References StoppableThread::fThreadMap.

◆ GetItemsCurrent()

size_t TFragDiagnosticsLoop::GetItemsCurrent ( )
inlineoverridevirtual

Implements StoppableThread.

Definition at line 47 of file TFragDiagnosticsLoop.h.

◆ GetItemsPopped()

size_t TFragDiagnosticsLoop::GetItemsPopped ( )
inlineoverridevirtual

Implements StoppableThread.

Definition at line 46 of file TFragDiagnosticsLoop.h.

References StoppableThread::ItemsPopped().

◆ GetItemsPushed()

size_t TFragDiagnosticsLoop::GetItemsPushed ( )
inlineoverridevirtual

Implements StoppableThread.

Definition at line 45 of file TFragDiagnosticsLoop.h.

References StoppableThread::ItemsPopped().

◆ GetNThreads()

int StoppableThread::GetNThreads ( )
staticinherited

Definition at line 21 of file StoppableThread.cxx.

References StoppableThread::fThreadMap.

Referenced by StoppableThread::Print().

◆ GetRate()

size_t TFragDiagnosticsLoop::GetRate ( )
inlineoverridevirtual

Implements StoppableThread.

Definition at line 48 of file TFragDiagnosticsLoop.h.

◆ IncrementItemsPopped()

◆ InputQueue()

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

Definition at line 36 of file TFragDiagnosticsLoop.h.

References fInputQueue.

Referenced by TGRSIint::SetupPipeline().

◆ InputSize() [1/2]

◆ InputSize() [2/2]

void StoppableThread::InputSize ( int64_t val)
inlineprotectedinherited

Definition at line 93 of file StoppableThread.h.

References StoppableThread::fInputSize.

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

◆ ItemsPopped() [1/2]

◆ ItemsPopped() [2/2]

void StoppableThread::ItemsPopped ( size_t val)
inlineprotectedinherited

Definition at line 92 of file StoppableThread.h.

References StoppableThread::fItemsPopped.

◆ Iteration()

bool TFragDiagnosticsLoop::Iteration ( )
overrideprotectedvirtual

◆ Join()

void StoppableThread::Join ( )
inherited

◆ join_status_thread()

void StoppableThread::join_status_thread ( )
staticinherited

◆ Loop()

◆ Name()

◆ OnEnd()

virtual void StoppableThread::OnEnd ( )
inlinevirtualinherited

Reimplemented in TAnalysisWriteLoop, TDataLoop, and TFragmentChainLoop.

Definition at line 58 of file StoppableThread.h.

Referenced by StoppableThread::Loop().

◆ operator=() [1/2]

TFragDiagnosticsLoop & TFragDiagnosticsLoop::operator= ( const TFragDiagnosticsLoop & )
delete

◆ operator=() [2/2]

TFragDiagnosticsLoop & TFragDiagnosticsLoop::operator= ( TFragDiagnosticsLoop && )
deletenoexcept

◆ 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

◆ Process()

◆ 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

Definition at line 135 of file StoppableThread.cxx.

References StoppableThread::fThreadMap.

Referenced by StoppableThread::StopAll(), and TGRSIint::Terminate().

◆ 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 size_t StoppableThread::StatusWidth ( )
inlinestaticinherited

Definition at line 82 of file StoppableThread.h.

References StoppableThread::fStatusWidth.

Referenced by TGRSIint::SetupPipeline().

◆ StatusWidth() [2/2]

static void StoppableThread::StatusWidth ( size_t val)
inlinestaticinherited

Definition at line 80 of file StoppableThread.h.

References StoppableThread::fStatusWidth.

◆ Stop()

◆ stop_status_thread()

void StoppableThread::stop_status_thread ( )
staticinherited

◆ StopAll()

void StoppableThread::StopAll ( )
staticinherited

◆ Write()

Member Data Documentation

◆ fAccepted

TH2D* TFragDiagnosticsLoop::fAccepted {nullptr}
private

Definition at line 87 of file TFragDiagnosticsLoop.h.

Referenced by CreateHistograms(), Process(), and Write().

◆ fAcceptedChannelIds

std::map<unsigned int, std::array<int64_t, 2> > TFragDiagnosticsLoop::fAcceptedChannelIds
private

Definition at line 78 of file TFragDiagnosticsLoop.h.

Referenced by Process().

◆ fAcceptedMax

uint64_t TFragDiagnosticsLoop::fAcceptedMax {0x1 << 14}
private

Definition at line 69 of file TFragDiagnosticsLoop.h.

Referenced by Process().

◆ fBadEventAddress

TBadFragment* TFragDiagnosticsLoop::fBadEventAddress {nullptr}
private

Definition at line 65 of file TFragDiagnosticsLoop.h.

◆ fChannelIds

std::map<unsigned int, std::array<int64_t, 2> > TFragDiagnosticsLoop::fChannelIds
private

Definition at line 77 of file TFragDiagnosticsLoop.h.

Referenced by Process().

◆ fColumnWidth

◆ fEventAddress

TFragment* TFragDiagnosticsLoop::fEventAddress {nullptr}
private

Definition at line 64 of file TFragDiagnosticsLoop.h.

◆ fForceStop

std::atomic_bool StoppableThread::fForceStop {false}
privateinherited

Definition at line 119 of file StoppableThread.h.

◆ fInputQueue

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

Definition at line 95 of file TFragDiagnosticsLoop.h.

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

◆ fInputSize

std::atomic_long StoppableThread::fInputSize {0}
privateinherited

number of items in the input (queue), only updated within Iteration(), so not always fully up-to-date (signed to hold error from queue::pop)

Definition at line 101 of file StoppableThread.h.

Referenced by StoppableThread::InputSize(), StoppableThread::InputSize(), StoppableThread::Progress(), and StoppableThread::Status().

◆ fItemsPopped

std::atomic_size_t StoppableThread::fItemsPopped {0}
privateinherited

◆ fLostAcceptedIds

TH2D* TFragDiagnosticsLoop::fLostAcceptedIds {nullptr}
private

Definition at line 90 of file TFragDiagnosticsLoop.h.

Referenced by CreateHistograms(), Process(), and Write().

◆ fLostAcceptedIdsTime

TH2D* TFragDiagnosticsLoop::fLostAcceptedIdsTime {nullptr}
private

Definition at line 92 of file TFragDiagnosticsLoop.h.

Referenced by CreateHistograms(), Process(), and Write().

◆ fLostChannelIds

TH2D* TFragDiagnosticsLoop::fLostChannelIds {nullptr}
private

Definition at line 89 of file TFragDiagnosticsLoop.h.

Referenced by CreateHistograms(), Process(), and Write().

◆ fLostChannelIdsTime

TH2D* TFragDiagnosticsLoop::fLostChannelIdsTime {nullptr}
private

Definition at line 91 of file TFragDiagnosticsLoop.h.

Referenced by CreateHistograms(), Process(), and Write().

◆ fLostNetworkPackets

TH1D* TFragDiagnosticsLoop::fLostNetworkPackets {nullptr}
private

Definition at line 88 of file TFragDiagnosticsLoop.h.

Referenced by CreateHistograms(), Process(), and Write().

◆ fName

std::string StoppableThread::fName
privateinherited

◆ fNetworkPacketNumber

std::array<int, 2> TFragDiagnosticsLoop::fNetworkPacketNumber {{0, 0}}
private

Definition at line 80 of file TFragDiagnosticsLoop.h.

Referenced by Process().

◆ fNetworkPacketTimeStamp

std::array<int64_t, 2> TFragDiagnosticsLoop::fNetworkPacketTimeStamp {{0, 0}}
private

Definition at line 81 of file TFragDiagnosticsLoop.h.

Referenced by Process().

◆ fNofRollovers

std::map<unsigned int, int> TFragDiagnosticsLoop::fNofRollovers
private

Definition at line 70 of file TFragDiagnosticsLoop.h.

Referenced by Process().

◆ fOutputFile

TFile* TFragDiagnosticsLoop::fOutputFile {nullptr}
private

Definition at line 62 of file TFragDiagnosticsLoop.h.

Referenced by TFragDiagnosticsLoop(), CreateHistograms(), and Write().

◆ fPaused

std::atomic_bool StoppableThread::fPaused {false}
privateinherited

◆ fPausedWait

std::condition_variable StoppableThread::fPausedWait
privateinherited

◆ fPauseMutex

std::mutex StoppableThread::fPauseMutex
privateinherited

◆ fRolling

std::map<unsigned int, bool> TFragDiagnosticsLoop::fRolling
private

Definition at line 71 of file TFragDiagnosticsLoop.h.

Referenced by Process().

◆ fRollingThreshold

unsigned int TFragDiagnosticsLoop::fRollingThreshold {1000}
private

Definition at line 73 of file TFragDiagnosticsLoop.h.

Referenced by Process().

◆ fRollnum

std::map<unsigned int, int> TFragDiagnosticsLoop::fRollnum
private

Definition at line 72 of file TFragDiagnosticsLoop.h.

Referenced by Process().

◆ fRollnumThreshold

int TFragDiagnosticsLoop::fRollnumThreshold {20}
private

Definition at line 74 of file TFragDiagnosticsLoop.h.

Referenced by Process().

◆ fRunLength

int TFragDiagnosticsLoop::fRunLength {0}
private

Definition at line 84 of file TFragDiagnosticsLoop.h.

Referenced by CreateHistograms(), and Write().

◆ fRunning

std::atomic_bool StoppableThread::fRunning {false}
privateinherited

◆ fScalerAddress

TEpicsFrag* TFragDiagnosticsLoop::fScalerAddress {nullptr}
private

Definition at line 66 of file TFragDiagnosticsLoop.h.

◆ fStatusThread

std::thread StoppableThread::fStatusThread
staticprivateinherited

◆ fStatusThreadOn

◆ fStatusWidth

◆ fThread

std::thread StoppableThread::fThread
privateinherited

Definition at line 117 of file StoppableThread.h.

Referenced by StoppableThread::StoppableThread(), and StoppableThread::Join().

◆ fThreadMap

◆ fTimeStamps

std::map<unsigned int, std::array<int64_t, 2> > TFragDiagnosticsLoop::fTimeStamps
private

Definition at line 79 of file TFragDiagnosticsLoop.h.

Referenced by Process().