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

Detailed Description

TGRSIint is a class that acts as an interpreter for GRSISort. The idea is that TGRSIint will read in cal, info, mid and root files and open them appropriately (order) and do the correct thing with them. It also applies the command line options. Finally, TGRSIint allows us to take over the interpreter to do some GRSI things.

Definition at line 43 of file TGRSIint.h.

Public Member Functions

 TGRSIint (const TGRSIint &)=delete
 
 TGRSIint (TGRSIint &&) noexcept=delete
 
 ~TGRSIint ()=default
 
void DelayedProcessLine_Action ()
 
bool HandleTermInput () override
 
TRawFileOpenRawFile (const std::string &filename)
 
TFile * OpenRootFile (const std::string &filename, Option_t *opt="read")
 
TGRSIintoperator= (const TGRSIint &)=delete
 
TGRSIintoperator= (TGRSIint &&) noexcept=delete
 
void PrintLogo (bool) override
 
Long_t ProcessLine (const char *line, Bool_t sync=kFALSE, Int_t *error=nullptr) override
 
void RunMacroFile (const std::string &filename)
 
int TabCompletionHook (char *, int *, std::ostream &) override
 
void Terminate (Int_t status=0) override
 

Static Public Member Functions

static TEnv * GetEnv ()
 
static TGRSIintinstance (int argc=0, char **argv=nullptr, void *options=nullptr, int numOptions=-1, bool noLogo=false, const char *appClassName="grsisort")
 
static void PrintHelp (bool)
 

Static Public Attributes

static TGRSIintfTGRSIint = nullptr
 

Private Member Functions

 TGRSIint (int argc, char **argv, void *options=nullptr, int numOptions=0, bool noLogo=false, const char *appClassName="grsisort")
 
void ApplyOptions ()
 
Long_t DelayedProcessLine (std::string command)
 
void LoadExtraClasses ()
 
void LoopUntilDone ()
 
void SetupPipeline ()
 

Static Private Member Functions

static void DrawLogo ()
 
static void LoadGROOTGraphics ()
 

Private Attributes

bool fAllowedToTerminate
 
bool fIsTabComplete
 
TTimer * fKeepAliveTimer
 
std::string fNewFragmentFile
 
std::vector< TRawFile * > fRawFiles
 
int fRawFilesOpened
 
int fRootFilesOpened
 
std::thread::id main_thread_id
 

Static Private Attributes

static TEnv * fGRSIEnv = nullptr
 
+ Inheritance diagram for TGRSIint:
+ Collaboration diagram for TGRSIint:

Constructor & Destructor Documentation

◆ TGRSIint() [1/3]

TGRSIint::TGRSIint ( int argc,
char ** argv,
void * options = nullptr,
int numOptions = 0,
bool noLogo = false,
const char * appClassName = "grsisort" )
private

Singleton constructor

Definition at line 63 of file TGRSIint.cxx.

References fGRSIEnv, TGRSIOptions::Get(), PrintLogo(), and TGRSIOptions::ShouldExit().

Referenced by instance().

◆ TGRSIint() [2/3]

TGRSIint::TGRSIint ( const TGRSIint & )
delete

◆ TGRSIint() [3/3]

TGRSIint::TGRSIint ( TGRSIint && )
deletenoexcept

◆ ~TGRSIint()

TGRSIint::~TGRSIint ( )
default

Member Function Documentation

◆ ApplyOptions()

◆ DelayedProcessLine()

Long_t TGRSIint::DelayedProcessLine ( std::string command)
private

Definition at line 773 of file TGRSIint.cxx.

Referenced by ProcessLine().

◆ DelayedProcessLine_Action()

void TGRSIint::DelayedProcessLine_Action ( )

Definition at line 790 of file TGRSIint.cxx.

References ProcessLine().

◆ DrawLogo()

void TGRSIint::DrawLogo ( )
staticprivate

Draws the logo. Can be suppressed with -l

Definition at line 697 of file TGRSIint.cxx.

References PopupLogo(), and WaitLogo().

Referenced by PrintLogo().

◆ GetEnv()

static TEnv * TGRSIint::GetEnv ( )
inlinestatic

Definition at line 72 of file TGRSIint.h.

References fGRSIEnv.

◆ HandleTermInput()

bool TGRSIint::HandleTermInput ( )
override

Handles terminal input via TRint

Definition at line 187 of file TGRSIint.cxx.

◆ instance()

TGRSIint * TGRSIint::instance ( int argc = 0,
char ** argv = nullptr,
void * options = nullptr,
int numOptions = -1,
bool noLogo = false,
const char * appClassName = "grsisort" )
static

Singleton constructor instance

Definition at line 53 of file TGRSIint.cxx.

References TGRSIint(), ApplyOptions(), and fTGRSIint.

Referenced by main(), TGRSIInterruptHandler::Notify(), TAnalysisHistLoop::OpenFile(), and TFragHistLoop::OpenFile().

◆ LoadExtraClasses()

void TGRSIint::LoadExtraClasses ( )
private

◆ LoadGROOTGraphics()

void TGRSIint::LoadGROOTGraphics ( )
staticprivate

Loads root graphics in unless -b is used for batch mode.

Definition at line 704 of file TGRSIint.cxx.

Referenced by ApplyOptions().

◆ LoopUntilDone()

void TGRSIint::LoopUntilDone ( )
private

Outputs the thread status until all of the threads are complete.

Definition at line 164 of file TGRSIint.cxx.

References StoppableThread::AllThreadProgress(), StoppableThread::AllThreadStatus(), StoppableThread::AnyThreadRunning(), fAllowedToTerminate, and TGRSIOptions::Get().

Referenced by ApplyOptions(), and Terminate().

◆ OpenRawFile()

TRawFile * TGRSIint::OpenRawFile ( const std::string & filename)

Opens Raw input file and stores them in _raw if successfuly opened.

Definition at line 371 of file TGRSIint.cxx.

References BLUE, TParserLibrary::CreateRawFile(), FileExists(), fRawFiles, fRawFilesOpened, TSingleton< TParserLibrary >::Get(), ProcessLine(), and RESET_COLOR.

Referenced by ApplyOptions().

◆ OpenRootFile()

TFile * TGRSIint::OpenRootFile ( const std::string & filename,
Option_t * opt = "read" )

Opens root files provided on the command line. Also tells you where these files are stored (ie _file0). If these files are analysis or fragment trees, they are automatically chained into chains called gFragment and gAnalysis. Once this is complete, the TChannels, GValues and RunInfo are also read in.

Definition at line 299 of file TGRSIint.cxx.

References AddFileToGUI(), BLUE, fRootFilesOpened, gAnalysis, gFragment, TRunInfo::ReadInfoFromFile(), and RESET_COLOR.

Referenced by ApplyOptions(), TAnalysisHistLoop::OpenFile(), and TFragHistLoop::OpenFile().

◆ operator=() [1/2]

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

◆ operator=() [2/2]

TGRSIint & TGRSIint::operator= ( TGRSIint && )
deletenoexcept

◆ PrintHelp()

void TGRSIint::PrintHelp ( bool print)
static

Prints the help. Not sure this is used anymore.

Definition at line 715 of file TGRSIint.cxx.

References BG_WHITE, DRED, and RESET_COLOR.

◆ PrintLogo()

void TGRSIint::PrintLogo ( bool print)
override

Prints the GRSISort logo to terminal

Definition at line 271 of file TGRSIint.cxx.

References DrawLogo(), and ProgramName().

Referenced by TGRSIint().

◆ ProcessLine()

Long_t TGRSIint::ProcessLine ( const char * line,
Bool_t sync = kFALSE,
Int_t * error = nullptr )
override

This takes over the native root command line. There are two main reasons for this

  1. To keep the command line thread-safe.
  2. To block TCanvas from opening, and to instead use our GCanvas.

Definition at line 234 of file TGRSIint.cxx.

References DelayedProcessLine(), fIsTabComplete, and main_thread_id.

Referenced by DelayedProcessLine_Action(), OpenRawFile(), and RunMacroFile().

◆ RunMacroFile()

void TGRSIint::RunMacroFile ( const std::string & filename)

Runs a macro file. This happens when a .C file is provided on the command line

Definition at line 671 of file TGRSIint.cxx.

References FileExists(), and ProcessLine().

Referenced by ApplyOptions().

◆ SetupPipeline()

void TGRSIint::SetupPipeline ( )
private

Finds all of the files input as well as flags provided and makes all of the decisions about what to sort and what order to open everything up in. This also creates the output files. Starts the threads and gets the sorting going. This is really the brains of the command line sorting routine.

Definition at line 399 of file TGRSIint.cxx.

References TUnpackingLoop::AddGoodOutputQueue(), TDetBuildingLoop::AddOutputQueue(), TFragmentChainLoop::AddOutputQueue(), TGRSIOptions::AnalysisHistogramLib(), TGRSIOptions::AnalysisOptions(), TFragWriteLoop::BadInputQueue(), TUnpackingLoop::BadOutputQueue(), TDetectorInformation::BuildMode(), TGRSIOptions::CalInputFiles(), TGRSIOptions::CloseAfterSort(), StoppableThread::ColumnWidth(), DRED, TGRSIOptions::ExternalRunInfo(), FileExists(), fNewFragmentFile, TGRSIOptions::FragmentHistogramLib(), fRawFiles, gAnalysis, TAnalysisHistLoop::Get(), TAnalysisWriteLoop::Get(), TDataLoop::Get(), TDetBuildingLoop::Get(), TEventBuildingLoop::Get(), TFragHistLoop::Get(), TFragmentChainLoop::Get(), TFragWriteLoop::Get(), TGRSIOptions::Get(), TUnpackingLoop::Get(), TRunInfo::GetDetectorInformation(), GetRunNumber(), GetSubRunNumber(), gFragment, TGRSIOptions::InputFiles(), TAnalysisHistLoop::InputQueue(), TDetBuildingLoop::InputQueue(), TEventBuildingLoop::InputQueue(), TFragHistLoop::InputQueue(), TFragWriteLoop::InputQueue(), TUnpackingLoop::InputQueue(), TEventBuildingLoop::kDefault, TGRSIOptions::MakeAnalysisTree(), TGRSIOptions::MakeHistos(), TEventBuildingLoop::OutOfOrderQueue(), TGRSIOptions::OutputAnalysisFile(), TGRSIOptions::OutputAnalysisHistogramFile(), TGRSIOptions::OutputFragmentFile(), TGRSIOptions::OutputFragmentHistogramFile(), TDataLoop::OutputQueue(), TEventBuildingLoop::OutputQueue(), TAnalysisOptions::Print(), TChannel::ReadCalFile(), TRunInfo::ReadInfoFile(), GValue::ReadValFile(), RESET_COLOR, StoppableThread::ResumeAll(), TFragWriteLoop::ScalerInputQueue(), TUnpackingLoop::ScalerOutputQueue(), TDetectorInformation::Set(), TAnalysisHistLoop::SetOutputFilename(), TFragHistLoop::SetOutputFilename(), TRunInfo::SetRunInfo(), TDataLoop::SetSelfStopping(), TFragmentChainLoop::SetSelfStopping(), TEventBuildingLoop::SetSortDepth(), TGRSIOptions::SortDepth(), TGRSIOptions::SortRaw(), StoppableThread::StatusWidth(), TGRSIOptions::UseRnTuple(), TGRSIOptions::ValInputFiles(), and TGRSIOptions::WriteFragmentTree().

Referenced by ApplyOptions().

◆ TabCompletionHook()

Int_t TGRSIint::TabCompletionHook ( char * buf,
int * pLoc,
std::ostream & out )
override

Tries to do a tab completion. Returns false if unsuccsessful

Definition at line 225 of file TGRSIint.cxx.

References fIsTabComplete.

◆ Terminate()

void TGRSIint::Terminate ( Int_t status = 0)
override

Kills all of the threads if the process is allowed to terminate. This sends an error to TSortingDiagnostics if an analysis tree is being created

Definition at line 193 of file TGRSIint.cxx.

References fAllowedToTerminate, TGRSIOptions::Get(), TSingleton< TSortingDiagnostics >::Get(), LoopUntilDone(), TSortingDiagnostics::Print(), StoppableThread::SendStop(), and StoppableThread::StopAll().

Referenced by ApplyOptions(), and TGRSIInterruptHandler::Notify().

Member Data Documentation

◆ fAllowedToTerminate

bool TGRSIint::fAllowedToTerminate
private

Flag for shutting down GRSISort.

Definition at line 94 of file TGRSIint.h.

Referenced by LoopUntilDone(), and Terminate().

◆ fGRSIEnv

TEnv * TGRSIint::fGRSIEnv = nullptr
staticprivate

GRSI environment.

Definition at line 48 of file TGRSIint.h.

Referenced by TGRSIint(), and GetEnv().

◆ fIsTabComplete

bool TGRSIint::fIsTabComplete
private

Flag for tab completion hook.

Definition at line 93 of file TGRSIint.h.

Referenced by ProcessLine(), and TabCompletionHook().

◆ fKeepAliveTimer

TTimer* TGRSIint::fKeepAliveTimer
private

Time of process.

Definition at line 88 of file TGRSIint.h.

◆ fNewFragmentFile

std::string TGRSIint::fNewFragmentFile
private

New fragment file name.

Definition at line 97 of file TGRSIint.h.

Referenced by SetupPipeline().

◆ fRawFiles

std::vector<TRawFile*> TGRSIint::fRawFiles
private

List of Raw files opened.

Definition at line 99 of file TGRSIint.h.

Referenced by OpenRawFile(), and SetupPipeline().

◆ fRawFilesOpened

int TGRSIint::fRawFilesOpened
private

Number of Raw Files opened.

Definition at line 96 of file TGRSIint.h.

Referenced by OpenRawFile().

◆ fRootFilesOpened

int TGRSIint::fRootFilesOpened
private

Number of ROOT files opened.

Definition at line 95 of file TGRSIint.h.

Referenced by OpenRootFile().

◆ fTGRSIint

TGRSIint * TGRSIint::fTGRSIint = nullptr
static

Static pointer (singleton)

Definition at line 51 of file TGRSIint.h.

Referenced by instance().

◆ main_thread_id

std::thread::id TGRSIint::main_thread_id
private

Main sorting thread id.

Definition at line 90 of file TGRSIint.h.

Referenced by ProcessLine().