REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
TRestTask Class Reference

Detailed Description

Wrapping REST macros into tasks.

REST macros are actually ROOT scripts written in C++. TRestTask wraps them and turns them into application mateadata class. This is done by calling method TInterpreter::LoadFile() and TInterpreter::ProcessLine(). Turning REST-macro-defined functions into classes means that we are able to run the macros from rml file, by adding a section under the section "TRestManager". Another way to launch TRestTask is through restManager executable. By directly typing "restManager TASKNAME [ARG]" in bash we can run the macros like executables. We also allow users to write TRestTask inherted class in REST macros. This can enable more functionalities.


RESTsoft - Software for Rare Event Searches with TPCs

History of developments:

2017-Nov: First concept and implementation of TRestTask Kaixiang Ni


Definition at line 27 of file TRestTask.h.

#include <TRestTask.h>

Inheritance diagram for TRestTask:
TRestMetadata

Public Member Functions

 ClassDefOverride (TRestTask, 1)
 
REST_TASKMODE GetMode () const
 
void InitFromConfigFile () override
 Starter method. Looks through the rml sections and set argument/datamenber value.
 
virtual void PrintArgumentHelp ()
 Default helper method both for TRestTask and any TRestTask-inherited class.
 
virtual void RunTask (TRestManager *)
 Run the task with command line.
 
void SetArgumentValue (std::vector< std::string > arg)
 Set argument directly with a list of string. More...
 
void SetMode (REST_TASKMODE mod)
 
 TRestTask ()
 TRestTask default constructor.
 

Static Public Member Functions

static TRestTaskGetTaskFromCommand (TString cmd)
 
static TRestTaskGetTaskFromMacro (TString Name)
 Static method to instantiate a TRestTask object with "MacroName". More...
 

Protected Member Functions

 TRestTask (TString TaskString, REST_TASKMODE mode=TASK_MACRO)
 TRestTask constructor with macro file name. More...
 

Protected Attributes

std::vector< std::string > fArgumentNames
 
std::vector< int > fArgumentTypes
 
std::vector< std::string > fArgumentValues
 
std::string fConstructedCommand = ""
 
std::string fInvokeMethod = ""
 
std::string fInvokeObject = ""
 
REST_TASKMODE fMode
 
unsigned int fNRequiredArgument
 

Constructor & Destructor Documentation

◆ TRestTask()

TRestTask::TRestTask ( TString  TaskString,
REST_TASKMODE  mode = TASK_MACRO 
)
protected

TRestTask constructor with macro file name.

The first method in the file is identified with its name and require arguments saved in the class. They will be used in forming the command line in the method TRestTask::InitTask()

Definition at line 65 of file TRestTask.cxx.

Member Function Documentation

◆ GetTaskFromMacro()

TRestTask * TRestTask::GetTaskFromMacro ( TString  taskName)
static

Static method to instantiate a TRestTask object with "MacroName".

REST macros are saved in the directory ./macros. They follow a naming logic, the naming style is like following: REST_[MacroName].hh

e.g. REST_ViewEvents.hh. Here we must add a prefix "REST_" with a macro name usually in verb form. When given the macro name, this method first calls TClass::GetClass() to find if there is a TRestTask-inherted class which has this name. If so, it returns the found class, if not, it finds a corresponding macro file and calls gInterpreter to load it, and then instantiates a TRestTask class wrapping this file.

Definition at line 269 of file TRestTask.cxx.

◆ SetArgumentValue()

void TRestTask::SetArgumentValue ( std::vector< std::string >  arg)

Set argument directly with a list of string.

Argument list will be overwritten by the input list. It will also set the data member value for derived class

Definition at line 151 of file TRestTask.cxx.


The documentation for this class was generated from the following files: