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 39 of file TGRSIint.h.
Public Member Functions | |
~TGRSIint () override | |
void | DelayedProcessLine_Action () |
bool | HandleTermInput () override |
TRawFile * | OpenRawFile (const std::string &filename) |
TFile * | OpenRootFile (const std::string &filename, Option_t *opt="read") |
void | PrintHelp (bool) |
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 TGRSIint * | instance (int argc=0, char **argv=nullptr, void *options=nullptr, int numOptions=-1, bool noLogo=false, const char *appClassName="grsisort") |
Static Public Attributes | |
static TGRSIint * | fTGRSIint = 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 | DrawLogo () |
void | LoadExtraClasses () |
void | LoadGROOTGraphics () |
void | LoopUntilDone () |
void | SetupPipeline () |
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 |
#include <TGRSIint.h>
|
private |
Singleton constructor
Definition at line 64 of file TGRSIint.cxx.
References pygui.grut-view::argv, fGRSIEnv, TGRSIOptions::Get(), PrintLogo(), and TGRSIOptions::ShouldExit().
Referenced by instance().
|
override |
Default dtor.
Definition at line 190 of file TGRSIint.cxx.
|
private |
Applies options from TGRSIOptions. This include things such as batch sorting, reading material, and logo. Also includes the setup of what to do with mid and root files that are input.
Definition at line 91 of file TGRSIint.cxx.
References all_files_exist(), StoppableThread::AllThreadHeader(), TGRSIOptions::Batch(), TRunInfo::ClearDate(), TRunInfo::ClearFullVersion(), TRunInfo::ClearVersion(), TGRSIOptions::CloseAfterSort(), DRED, TGRSIOptions::Get(), TSingleton< TParserLibrary >::Get(), GRSI_GIT_COMMIT, GRSI_GIT_COMMIT_TIME, GRSI_RELEASE, TGRSIOptions::InputFiles(), TParserLibrary::Load(), LoadGROOTGraphics(), LoopUntilDone(), TGRSIOptions::MacroInputFiles(), OpenRawFile(), OpenRootFile(), TGRSIOptions::ParserLibrary(), TGRSIOptions::ReadingMaterial(), ReadTheNews(), RESET_COLOR, TGRSIOptions::RootInputFiles(), RunMacroFile(), TRunInfo::SetDate(), TRunInfo::SetFullVersion(), SetupPipeline(), TRunInfo::SetVersion(), StartGUI(), TGRSIOptions::StartGui(), and Terminate().
Referenced by instance().
|
private |
Definition at line 771 of file TGRSIint.cxx.
References anonymous_namespace{TGRSIint.cxx}::g__CommandFinished, anonymous_namespace{TGRSIint.cxx}::g__CommandResult, anonymous_namespace{TGRSIint.cxx}::g__CommandWaitingMutex, anonymous_namespace{TGRSIint.cxx}::g__LineToProcess, anonymous_namespace{TGRSIint.cxx}::g__NewResult, anonymous_namespace{TGRSIint.cxx}::g__ProcessingNeeded, and anonymous_namespace{TGRSIint.cxx}::g__ResultListMutex.
Referenced by ProcessLine().
void TGRSIint::DelayedProcessLine_Action | ( | ) |
Definition at line 788 of file TGRSIint.cxx.
References anonymous_namespace{TGRSIint.cxx}::g__CommandFinished, anonymous_namespace{TGRSIint.cxx}::g__CommandListMutex, anonymous_namespace{TGRSIint.cxx}::g__CommandResult, anonymous_namespace{TGRSIint.cxx}::g__LineToProcess, anonymous_namespace{TGRSIint.cxx}::g__NewResult, anonymous_namespace{TGRSIint.cxx}::g__ProcessingNeeded, anonymous_namespace{TGRSIint.cxx}::g__ResultListMutex, pygui.grut-view::message, and ProcessLine().
|
private |
Draws the logo. Can be suppressed with -l
Definition at line 698 of file TGRSIint.cxx.
References PopupLogo(), and WaitLogo().
Referenced by PrintLogo().
|
inlinestatic |
Definition at line 65 of file TGRSIint.h.
References fGRSIEnv.
|
override |
Handles terminal input via TRint
Definition at line 195 of file TGRSIint.cxx.
|
static |
Singleton constructor instance
Definition at line 54 of file TGRSIint.cxx.
References ApplyOptions(), pygui.grut-view::argv, fTGRSIint, and TGRSIint().
Referenced by main(), TGRSIInterruptHandler::Notify(), TFragHistLoop::OpenFile(), and TAnalysisHistLoop::OpenFile().
|
private |
|
private |
Loads root graphics in unless -b is used for batch mode.
Definition at line 705 of file TGRSIint.cxx.
Referenced by ApplyOptions().
|
private |
Outputs the thread status until all of the threads are complete.
Definition at line 167 of file TGRSIint.cxx.
References StoppableThread::AllThreadProgress(), StoppableThread::AllThreadStatus(), StoppableThread::AnyThreadRunning(), fAllowedToTerminate, and TGRSIOptions::Get().
Referenced by ApplyOptions(), and Terminate().
TRawFile * TGRSIint::OpenRawFile | ( | const std::string & | filename | ) |
Opens Raw input file and stores them in _raw if successfuly opened.
Definition at line 385 of file TGRSIint.cxx.
References BLUE, TParserLibrary::CreateRawFile(), file_exists(), fRawFiles, fRawFilesOpened, TSingleton< TParserLibrary >::Get(), ProcessLine(), and RESET_COLOR.
Referenced by ApplyOptions().
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 305 of file TGRSIint.cxx.
References AddFileToGUI(), BLUE, fRootFilesOpened, gAnalysis, gFragment, TRunInfo::ReadInfoFromFile(), and RESET_COLOR.
Referenced by ApplyOptions(), TFragHistLoop::OpenFile(), and TAnalysisHistLoop::OpenFile().
void TGRSIint::PrintHelp | ( | bool | ) |
Prints the help. Not sure this is used anymore.
Definition at line 716 of file TGRSIint.cxx.
References BG_WHITE, DRED, and RESET_COLOR.
|
override |
Prints the GRSISort logo to terminal
Definition at line 277 of file TGRSIint.cxx.
References DrawLogo(), GRSI_RELEASE, and ProgramName().
Referenced by TGRSIint().
|
override |
This takes over the native root command line. There are two main reasons for this
Definition at line 242 of file TGRSIint.cxx.
References DelayedProcessLine(), fIsTabComplete, and main_thread_id.
Referenced by DelayedProcessLine_Action(), OpenRawFile(), and 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 672 of file TGRSIint.cxx.
References file_exists(), and ProcessLine().
Referenced by ApplyOptions().
|
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 408 of file TGRSIint.cxx.
References TUnpackingLoop::AddGoodOutputQueue(), TFragmentChainLoop::AddOutputQueue(), TDetBuildingLoop::AddOutputQueue(), TGRSIOptions::AnalysisHistogramLib(), TGRSIOptions::AnalysisOptions(), TFragWriteLoop::BadInputQueue(), TUnpackingLoop::BadOutputQueue(), TDetectorInformation::BuildMode(), TAnalysisOptions::BuildWindow(), TGRSIOptions::CalInputFiles(), TGRSIOptions::CloseAfterSort(), StoppableThread::ColumnWidth(), DRED, TGRSIOptions::ExternalRunInfo(), file_exists(), fNewFragmentFile, TGRSIOptions::FragmentHistogramLib(), fRawFiles, gAnalysis, TFragHistLoop::Get(), TAnalysisHistLoop::Get(), TAnalysisWriteLoop::Get(), TFragWriteLoop::Get(), TGRSIOptions::Get(), TEventBuildingLoop::Get(), TUnpackingLoop::Get(), TFragmentChainLoop::Get(), TSingleton< TRunInfo >::Get(), TDataLoop::Get(), TDetBuildingLoop::Get(), TRunInfo::GetDetectorInformation(), GetRunNumber(), GetSubRunNumber(), gFragment, TGRSIOptions::InputFiles(), TFragHistLoop::InputQueue(), TAnalysisHistLoop::InputQueue(), TAnalysisWriteLoop::InputQueue(), TFragWriteLoop::InputQueue(), TEventBuildingLoop::InputQueue(), TUnpackingLoop::InputQueue(), TDetBuildingLoop::InputQueue(), TEventBuildingLoop::kDefault, TGRSIOptions::MakeAnalysisTree(), TGRSIOptions::MakeHistos(), TAnalysisWriteLoop::OutOfOrderQueue(), TEventBuildingLoop::OutOfOrderQueue(), TGRSIOptions::OutputAnalysisFile(), TGRSIOptions::OutputAnalysisHistogramFile(), TGRSIOptions::OutputFragmentFile(), TGRSIOptions::OutputFragmentHistogramFile(), TEventBuildingLoop::OutputQueue(), TDataLoop::OutputQueue(), TAnalysisOptions::Print(), TChannel::ReadCalFile(), TRunInfo::ReadInfoFile(), GValue::ReadValFile(), RESET_COLOR, StoppableThread::ResumeAll(), TFragWriteLoop::ScalerInputQueue(), TUnpackingLoop::ScalerOutputQueue(), TDetectorInformation::Set(), TFragHistLoop::SetOutputFilename(), TAnalysisHistLoop::SetOutputFilename(), TRunInfo::SetRunInfo(), TFragmentChainLoop::SetSelfStopping(), TDataLoop::SetSelfStopping(), TEventBuildingLoop::SetSortDepth(), TGRSIOptions::SortDepth(), TGRSIOptions::SortRaw(), StoppableThread::StatusWidth(), TGRSIOptions::ValInputFiles(), and TGRSIOptions::WriteFragmentTree().
Referenced by ApplyOptions().
|
override |
Tries to do a tab completion. Returns false if unsuccsessful
Definition at line 233 of file TGRSIint.cxx.
References fIsTabComplete.
|
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 201 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().
|
private |
Flag for shutting down GRSISort.
Definition at line 90 of file TGRSIint.h.
Referenced by LoopUntilDone(), and Terminate().
|
staticprivate |
|
private |
Flag for tab completion hook.
Definition at line 89 of file TGRSIint.h.
Referenced by ProcessLine(), and TabCompletionHook().
|
private |
Time of process.
Definition at line 83 of file TGRSIint.h.
|
private |
|
private |
List of Raw files opened.
Definition at line 95 of file TGRSIint.h.
Referenced by OpenRawFile(), and SetupPipeline().
|
private |
|
private |
Number of ROOT files opened.
Definition at line 91 of file TGRSIint.h.
Referenced by OpenRootFile().
|
static |
|
private |