NAGASH 0.9.8
Next Generation Analysis System
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
NAGASH::Analysis Class Reference

Provide multi-thread interface to manipulate with Job. More...

#include "NAGASH/Analysis.h"

Public Member Functions

 Analysis ()
 Default constructor of the Analysis class.
 
 Analysis (Analysis &&ana)=delete
 
 Analysis (const Analysis &ana)=delete
 
 Analysis (const char *configfilename)
 Constructor of the Analysis class.
 
 Analysis (const ConfigTool &c)
 Constructor of the Analysis class.
 
 ~Analysis ()
 destructor of the Analysis class.
 
std::shared_ptr< ConfigToolConfigUser ()
 return the ConfigTool
 
void Join ()
 Join the threads in the thread pool.
 
std::shared_ptr< MSGToolMSGUser ()
 return the MSGTool
 
Analysisoperator= (Analysis &&ana)=delete
 
Analysisoperator= (const Analysis &ana)=delete
 
template<typename LE >
std::shared_ptr< ResultGroupProcessEventLoop (const char *filelist, bool dosave=true)
 Process the user defined event loop. This function will automatically call Join() after submit the event loop.
 
template<typename LE >
std::shared_ptr< ResultGroupProcessEventLoopMainThread (const char *filename, bool dosave=true)
 Single-thread mode of processing the user defined event loop. The event loop will be run in the main thread.
 
void SetThreadNumber (int num)
 Set the thread number of the thread pool. Can only be set once.
 
template<typename LE >
std::shared_ptr< ResultGroupSubmitEventLoop (const char *filelist, bool dosave=true)
 Submit the user defined event loop. This function will not automatically call Join() after submit the event loop. So user can submit multiple event loops.
 
template<typename J , typename... Args>
std::shared_ptr< ResultGroupSubmitJob (bool doSave, Args &&...args)
 Submit the user defined job. The Analysis will process the submitted jobs in multi-thread mode.
 
template<typename J , typename JS , typename... Args>
std::shared_ptr< ResultGroupSubmitJob (bool doSave, Args &&...args)
 Submit the user defined job. The Analysis will process the submitted jobs in multi-thread mode.
 

Protected Member Functions

std::shared_ptr< TimerTimerUser ()
 return the Timer
 

Protected Attributes

std::shared_ptr< ConfigToolconfig
 
std::vector< std::shared_ptr< ResultGroup > > ResultsToSave
 

Private Member Functions

void ConfigThreadPool ()
 Config the thread pool using the info from ConfigTool.
 
template<typename F , typename... Args>
void ThreadPoolEnqueue (F &&f, Args &&...args)
 General function to enqueue a function into the thread pool inside Analysis class.
 

Private Attributes

std::shared_ptr< MSGToolmsg
 
std::shared_ptr< ThreadPoolpool
 
std::vector< intSubmittedJobCount
 
int SubmittedJobs = 0
 
int ThreadNumber = 1
 
std::shared_ptr< Timertimer
 
std::vector< std::future< StatusCode > > vf
 

Detailed Description

Provide multi-thread interface to manipulate with Job.

Definition at line 234 of file Analysis.h.

Constructor & Destructor Documentation

◆ Analysis() [1/5]

Analysis::Analysis ( )

Default constructor of the Analysis class.

Definition at line 39 of file Analysis.cxx.

◆ Analysis() [2/5]

NAGASH::Analysis::Analysis ( const Analysis ana)
delete

◆ Analysis() [3/5]

NAGASH::Analysis::Analysis ( Analysis &&  ana)
delete

◆ Analysis() [4/5]

Analysis::Analysis ( const ConfigTool c)

Constructor of the Analysis class.

Parameters
cInput ConfigTool object.

Definition at line 18 of file Analysis.cxx.

◆ Analysis() [5/5]

Analysis::Analysis ( const char configfilename)

Constructor of the Analysis class.

Parameters
configfilenamepath to the configuration file.

Definition at line 29 of file Analysis.cxx.

◆ ~Analysis()

Analysis::~Analysis ( )

destructor of the Analysis class.

Definition at line 73 of file Analysis.cxx.

Member Function Documentation

◆ ConfigThreadPool()

void Analysis::ConfigThreadPool ( )
private

Config the thread pool using the info from ConfigTool.

Definition at line 49 of file Analysis.cxx.

◆ ConfigUser()

std::shared_ptr< ConfigTool > NAGASH::Analysis::ConfigUser ( )
inline

return the ConfigTool

Definition at line 287 of file Analysis.h.

◆ Join()

void Analysis::Join ( )

Join the threads in the thread pool.

Definition at line 97 of file Analysis.cxx.

◆ MSGUser()

std::shared_ptr< MSGTool > NAGASH::Analysis::MSGUser ( )
inline

return the MSGTool

Definition at line 289 of file Analysis.h.

◆ operator=() [1/2]

◆ operator=() [2/2]

◆ ProcessEventLoop()

template<typename LE >
std::shared_ptr< ResultGroup > NAGASH::Analysis::ProcessEventLoop ( const char filelist,
bool  dosave = true 
)

Process the user defined event loop. This function will automatically call Join() after submit the event loop.

Template Parameters
LEuser-define event loop class, must inherit from LoopEvent.
Parameters
[in]filelistInput file list.
[in]dosaveWhether save the result, i.e. automatically call ResultGroup::Write() after finish the event loop.
Returns
The ResultGroup of the event loop class defined by the user that stores the results after the entire event loop finished.

Definition at line 300 of file Analysis.h.

◆ ProcessEventLoopMainThread()

template<typename LE >
std::shared_ptr< ResultGroup > NAGASH::Analysis::ProcessEventLoopMainThread ( const char filename,
bool  dosave = true 
)
inline

Single-thread mode of processing the user defined event loop. The event loop will be run in the main thread.

Template Parameters
LEuser-define event loop class, must inherit from LoopEvent.
Parameters
[in]filenameInput file name.
[in]dosaveWhether save the result, i.e. automatically call NAGASH::ResultGroup::Write() after finish the event loop.
Returns
The ResultGroup of the event loop class defined by the user that stores the results after the entire event loop finished.

Definition at line 392 of file Analysis.h.

◆ SetThreadNumber()

void Analysis::SetThreadNumber ( int  num)

Set the thread number of the thread pool. Can only be set once.

Parameters
numNumber of threads.

Definition at line 83 of file Analysis.cxx.

◆ SubmitEventLoop()

template<typename LE >
std::shared_ptr< ResultGroup > NAGASH::Analysis::SubmitEventLoop ( const char *  filelist,
bool  dosave = true 
)

Submit the user defined event loop. This function will not automatically call Join() after submit the event loop. So user can submit multiple event loops.

Template Parameters
LEuser-define event loop class, must inherit from LoopEvent.
Parameters
[in]filelistInput file list.
[in]dosaveWhether save the result, i.e. automatically call ResultGroup::Write() after finish the event loop.
Returns
The ResultGroup of the event loop class defined by the user that stores the results after the entire event loop finished.

Definition at line 316 of file Analysis.h.

◆ SubmitJob() [1/2]

template<typename J , typename... Args>
std::shared_ptr< ResultGroup > NAGASH::Analysis::SubmitJob ( bool  doSave,
Args &&...  args 
)
inline

Submit the user defined job. The Analysis will process the submitted jobs in multi-thread mode.

Template Parameters
Juser-defined job class, must inherit from Job.
...Argstypes of other arguments to be passed to the job class. Can be automatically deduced by the compiler.
Parameters
doSaveWhether save the result, i.e. automatically call ResultGroup::Write() after finish the job.
...argsother arguments to be passed to the job class, should be compatible with the definition of the Process function of the job class.
Returns
The ResultGroup of the job class defined by the user that stores the results after the job finished.

Definition at line 416 of file Analysis.h.

◆ SubmitJob() [2/2]

template<typename J , typename JS , typename... Args>
std::shared_ptr< ResultGroup > NAGASH::Analysis::SubmitJob ( bool  doSave,
Args &&...  args 
)

Submit the user defined job. The Analysis will process the submitted jobs in multi-thread mode.

Template Parameters
Juser-defined job class, must inherit from Job.
JSsometimes the Job::Process() function is a template function, this is the template type.
...Argstypes of other arguments to be passed to the job class. Can be automatically deduced by the compiler.
Parameters
doSaveWhether save the result, i.e. automatically call ResultGroup::Write() after finish the job.
...argsother arguments to be passed to the job class, should be compatible with the definition of the Process function of the job class.
Returns
The ResultGroup of the job class defined by the user that stores the results after the job finished.

Definition at line 455 of file Analysis.h.

◆ ThreadPoolEnqueue()

template<typename F , typename... Args>
void NAGASH::Analysis::ThreadPoolEnqueue ( F &&  f,
Args &&...  args 
)
private

General function to enqueue a function into the thread pool inside Analysis class.

Template Parameters
Fthe type of the function to be enqueued.
...Argsthe type of the arguments of the function.
Parameters
fthe function to be enqueued.
...argsthe arguments of the function.

Definition at line 488 of file Analysis.h.

◆ TimerUser()

std::shared_ptr< Timer > NAGASH::Analysis::TimerUser ( )
inlineprotected

return the Timer

Definition at line 288 of file Analysis.h.

Member Data Documentation

◆ config

std::shared_ptr<ConfigTool> NAGASH::Analysis::config
protected

Definition at line 269 of file Analysis.h.

◆ msg

std::shared_ptr<MSGTool> NAGASH::Analysis::msg
private

Definition at line 277 of file Analysis.h.

◆ pool

std::shared_ptr<ThreadPool> NAGASH::Analysis::pool
private

Definition at line 279 of file Analysis.h.

◆ ResultsToSave

std::vector<std::shared_ptr<ResultGroup> > NAGASH::Analysis::ResultsToSave
protected

Definition at line 270 of file Analysis.h.

◆ SubmittedJobCount

std::vector<int> NAGASH::Analysis::SubmittedJobCount
private

Definition at line 275 of file Analysis.h.

◆ SubmittedJobs

int NAGASH::Analysis::SubmittedJobs = 0
private

Definition at line 276 of file Analysis.h.

◆ ThreadNumber

int NAGASH::Analysis::ThreadNumber = 1
private

Definition at line 274 of file Analysis.h.

◆ timer

std::shared_ptr<Timer> NAGASH::Analysis::timer
private

Definition at line 278 of file Analysis.h.

◆ vf

std::vector<std::future<StatusCode> > NAGASH::Analysis::vf
private

Definition at line 280 of file Analysis.h.


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