EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ActsExamples::Sequencer Class Reference

#include <acts/blob/sPHENIX/Examples/Framework/include/ActsExamples/Framework/Sequencer.hpp>

+ Collaboration diagram for ActsExamples::Sequencer:

Classes

struct  Config
 

Public Member Functions

 Sequencer (const Config &cfg)
 
void addService (std::shared_ptr< IService > service)
 
void addContextDecorator (std::shared_ptr< IContextDecorator > decorator)
 
void addReader (std::shared_ptr< IReader > reader)
 
void addAlgorithm (std::shared_ptr< IAlgorithm > algorithm)
 
void addWriter (std::shared_ptr< IWriter > writer)
 
int run ()
 

Private Member Functions

std::vector< std::string > listAlgorithmNames () const
 List of all configured algorithm names.
 
std::pair< size_t, size_t > determineEventsRange () const
 Determine range of (requested) events; [SIZE_MAX, SIZE_MAX) for error.
 
const Acts::Loggerlogger () const
 

Private Attributes

Config m_cfg
 
std::vector< std::shared_ptr
< IService > > 
m_services
 
std::vector< std::shared_ptr
< IContextDecorator > > 
m_decorators
 
std::vector< std::shared_ptr
< IReader > > 
m_readers
 
std::vector< std::shared_ptr
< IAlgorithm > > 
m_algorithms
 
std::vector< std::shared_ptr
< IWriter > > 
m_writers
 
std::unique_ptr< const
Acts::Logger
m_logger
 

Detailed Description

A simple algorithm sequencer for event processing.

This is the backbone of the framework. It reads events from file, runs the configured algorithms for each event, and writes selected data back to a file.

Definition at line 31 of file Sequencer.hpp.

View newest version in sPHENIX GitHub at line 31 of file Sequencer.hpp

Constructor & Destructor Documentation

ActsExamples::Sequencer::Sequencer ( const Config cfg)

Definition at line 25 of file Sequencer.cpp.

View newest version in sPHENIX GitHub at line 25 of file Sequencer.cpp

References m_cfg, and ActsExamples::Sequencer::Config::numThreads.

Member Function Documentation

void ActsExamples::Sequencer::addAlgorithm ( std::shared_ptr< IAlgorithm algorithm)

Append an algorithm to the sequence of algorithms.

Exceptions
std::invalid_argumentif the algorithm is NULL.

Definition at line 60 of file Sequencer.cpp.

View newest version in sPHENIX GitHub at line 60 of file Sequencer.cpp

References ACTS_INFO.

Referenced by main(), materialMappingExample(), propagationExample(), and runGeantinoRecording().

+ Here is the caller graph for this function:

void ActsExamples::Sequencer::addContextDecorator ( std::shared_ptr< IContextDecorator decorator)

Add a context decorator to the set of context decorators.

Exceptions
std::invalid_argumentif the decorator is NULL.

Definition at line 43 of file Sequencer.cpp.

View newest version in sPHENIX GitHub at line 43 of file Sequencer.cpp

References ACTS_INFO.

Referenced by main(), and propagationExample().

+ Here is the caller graph for this function:

void ActsExamples::Sequencer::addReader ( std::shared_ptr< IReader reader)

Add a reader to the set of readers.

Exceptions
std::invalid_argumentif the reader is NULL.

Definition at line 52 of file Sequencer.cpp.

View newest version in sPHENIX GitHub at line 52 of file Sequencer.cpp

References ACTS_INFO.

Referenced by main(), and materialMappingExample().

+ Here is the caller graph for this function:

void ActsExamples::Sequencer::addService ( std::shared_ptr< IService service)

Add a service to the set of services.

Exceptions
std::invalid_argumentif the service is NULL.

Definition at line 35 of file Sequencer.cpp.

View newest version in sPHENIX GitHub at line 35 of file Sequencer.cpp

References ACTS_INFO.

void ActsExamples::Sequencer::addWriter ( std::shared_ptr< IWriter writer)

Add a writer to the set of writers.

Exceptions
std::invalid_argumentif the writer is NULL.

Definition at line 69 of file Sequencer.cpp.

View newest version in sPHENIX GitHub at line 69 of file Sequencer.cpp

References ACTS_INFO.

Referenced by main(), materialMappingExample(), materialValidationExample(), propagationExample(), and runGeantinoRecording().

+ Here is the caller graph for this function:

std::pair< std::size_t, std::size_t > ActsExamples::Sequencer::determineEventsRange ( ) const
private

Determine range of (requested) events; [SIZE_MAX, SIZE_MAX) for error.

Definition at line 112 of file Sequencer.cpp.

View newest version in sPHENIX GitHub at line 112 of file Sequencer.cpp

References ACTS_ERROR, ACTS_INFO, max, min, reader(), and Acts::UnitConstants::u.

+ Here is the call graph for this function:

std::vector< std::string > ActsExamples::Sequencer::listAlgorithmNames ( ) const
private

List of all configured algorithm names.

Definition at line 77 of file Sequencer.cpp.

View newest version in sPHENIX GitHub at line 77 of file Sequencer.cpp

References algorithm, eicpy.verify::names, and reader().

+ Here is the call graph for this function:

const Acts::Logger& ActsExamples::Sequencer::logger ( ) const
inlineprivate

Definition at line 111 of file Sequencer.hpp.

View newest version in sPHENIX GitHub at line 111 of file Sequencer.hpp

References m_logger.

int ActsExamples::Sequencer::run ( )

Run the event loop.

Returns
status code compatible with the main() return code
EXIT_SUCCESS when everying worked without problems
EXIT_FAILURE if something went wrong
Note
If the number of events to process is undefined, the sequencer will process events until the first reader signals the end-of-file. If given, it sets an upper bound.

This function is intended to be run as the last thing in the tool main function and its return value can be used directly as the program return value, i.e.

int main(int argc, char* argv[])
{
    Sequencer::Config cfg;
    ... // configure the sequencer
    Sequencer seq;
    ... // set up the algorithms
    return seq.run();
}

This will run the start-of-run hook for all configured services, run all configured readers, algorithms, and writers for each event, then invoke the end-of-run hook for all configured writers.

Decorate the context

Definition at line 228 of file Sequencer.cpp.

View newest version in sPHENIX GitHub at line 228 of file Sequencer.cpp

References ACTS_INFO, Acts::getDefaultLogger(), init(), eicpy.verify::names, SUCCESS, nlohmann::to_string(), and zero.

Referenced by main(), materialMappingExample(), materialValidationExample(), propagationExample(), and runGeantinoRecording().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

std::vector<std::shared_ptr<IAlgorithm> > ActsExamples::Sequencer::m_algorithms
private

Definition at line 107 of file Sequencer.hpp.

View newest version in sPHENIX GitHub at line 107 of file Sequencer.hpp

Config ActsExamples::Sequencer::m_cfg
private

Definition at line 103 of file Sequencer.hpp.

View newest version in sPHENIX GitHub at line 103 of file Sequencer.hpp

Referenced by Sequencer().

std::vector<std::shared_ptr<IContextDecorator> > ActsExamples::Sequencer::m_decorators
private

Definition at line 105 of file Sequencer.hpp.

View newest version in sPHENIX GitHub at line 105 of file Sequencer.hpp

std::unique_ptr<const Acts::Logger> ActsExamples::Sequencer::m_logger
private

Definition at line 109 of file Sequencer.hpp.

View newest version in sPHENIX GitHub at line 109 of file Sequencer.hpp

Referenced by logger().

std::vector<std::shared_ptr<IReader> > ActsExamples::Sequencer::m_readers
private

Definition at line 106 of file Sequencer.hpp.

View newest version in sPHENIX GitHub at line 106 of file Sequencer.hpp

std::vector<std::shared_ptr<IService> > ActsExamples::Sequencer::m_services
private

Definition at line 104 of file Sequencer.hpp.

View newest version in sPHENIX GitHub at line 104 of file Sequencer.hpp

std::vector<std::shared_ptr<IWriter> > ActsExamples::Sequencer::m_writers
private

Definition at line 108 of file Sequencer.hpp.

View newest version in sPHENIX GitHub at line 108 of file Sequencer.hpp


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