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

#include <acts/blob/master/Examples/Framework/include/ACTFW/Framework/Sequencer.hpp>

+ Collaboration diagram for FW::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

FW::Sequencer::Sequencer ( const Config cfg)

Definition at line 24 of file Sequencer.cpp.

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

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

Member Function Documentation

void FW::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 59 of file Sequencer.cpp.

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

References ACTS_INFO.

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

+ Here is the caller graph for this function:

void FW::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 42 of file Sequencer.cpp.

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

References ACTS_INFO.

Referenced by main(), and propagationExample().

+ Here is the caller graph for this function:

void FW::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 51 of file Sequencer.cpp.

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

References ACTS_INFO.

Referenced by main(), and materialMappingExample().

+ Here is the caller graph for this function:

void FW::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 34 of file Sequencer.cpp.

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

References ACTS_INFO.

void FW::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 67 of file Sequencer.cpp.

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

References ACTS_INFO.

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

+ Here is the caller graph for this function:

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

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

Definition at line 109 of file Sequencer.cpp.

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

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

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

List of all configured algorithm names.

Definition at line 75 of file Sequencer.cpp.

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

References algorithm.

const Acts::Logger& FW::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 FW::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 226 of file Sequencer.cpp.

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

References ACTS_INFO, Acts::getDefaultLogger(), init(), r, SUCCESS, sw, nlohmann::to_string(), and zero.

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

+ 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> > FW::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 FW::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> > FW::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> FW::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> > FW::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> > FW::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> > FW::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: