| The Gaudi Framework v29r1 (5cd95fa2)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
DataFlowManager Class Reference

The DataFlowManager takes care of keeping track of the dependencies of the algorithms in terms of dataObjects. More...

`#include <GaudiHive/src/DataFlowManager.h>`

Collaboration diagram for DataFlowManager:
[legend]

## Public Types
typedef boost::dynamic_bitset | dependency_bitset
| Type holding the dependencies for one single algorithm. More...
typedef std::vector< DataObjIDColl > | algosDependenciesCollection

## Public Member Functions
| DataFlowManager (const std::list< IAlgorithm * > &)
| Constructor. More...
| DataFlowManager (algosDependenciesCollection algoDependencies)
| Constructor (transitional, will be deprecated once handles are in place) More...
bool | canAlgorithmRun (unsigned int iAlgo)
| Needed data products are available. More...
void | updateDataObjectsCatalog (const DataObjIDColl &newProducts)
| Update the catalog of available products in the slot. More...
void | reset ()
| Reset to default values. More...
DataObjIDColl | content () const
| Get the content of the catalog. More...
DataObjIDColl | dataDependencies (unsigned int iAlgo) const
| Get the dependencies of a single algo;. More...

## Private Types
typedef DataObjID | productName_t
| Track the products, assigning an index to them. Static since the same for all events. More...

## Private Member Functions
long int | productName2index (const productName_t &productName)
| Simple helper method to convert the product name into an index. More...
DataObjID & | index2productName (const unsigned int i)
| Simple helper method to convert an index to a product name. More...

## Private Attributes
DataObjIDColl | m_fc
dependency_bitset | m_dataObjectsCatalog
| Catalog of the products in the whiteboard. More...

## Static Private Attributes
static std::vector< dependency_bitset > | m_algosRequirements
| Requirements of algos. Static since the same for all events. More...
static std::vector< DataObjID > | m_productName_vec
| Track the products, assigning an index to them. Static since the same for all events. More...
static std::unordered_map< productName_t, long int, DataObjID_Hasher > | m_productName_index_map

## Detailed Description

The DataFlowManager takes care of keeping track of the dependencies of the algorithms in terms of dataObjects.

One instance of the DataFlowManager is responsible for one event.

Author
  Danilo Piparo, Benedikt Hegner

Version
  1.0

Definition at line 28 of file DataFlowManager.h.

## Member Typedef Documentation

typedef std::vector<DataObjIDColl> DataFlowManager::algosDependenciesCollection

Definition at line 35 of file DataFlowManager.h.

typedef boost::dynamic_bitset DataFlowManager::dependency_bitset

Type holding the dependencies for one single algorithm.

Definition at line 33 of file DataFlowManager.h.

typedef DataObjID DataFlowManager::productName_t
| private

Track the products, assigning an index to them. Static since the same for all events.

Definition at line 67 of file DataFlowManager.h.

## Constructor & Destructor Documentation

DataFlowManager::DataFlowManager | ( | const std::list< IAlgorithm * > & |  | ) |
| inline

Constructor.

Definition at line 37 of file DataFlowManager.h.

37 : m_dataObjectsCatalog( 0 ){};
DataFlowManager::m_dataObjectsCatalog
dependency_bitset m_dataObjectsCatalog
Catalog of the products in the whiteboard.
Definition: DataFlowManager.h:61

DataFlowManager::DataFlowManager | ( | algosDependenciesCollection | algoDependencies | ) |

Constructor (transitional, will be deprecated once handles are in place)

If this is the first instance, the constructor fills the requirements of all algorithms and indexes the data products.

Definition at line 13 of file DataFlowManager.cpp.

14 {
15
16 // Count how many products are actually requested
17 unsigned int nProducts( 0 );
18 for ( auto& thisAlgoDependencies : algosDependencies ) {
19 nProducts += thisAlgoDependencies.size();
20 }
21 m_dataObjectsCatalog.resize( nProducts );
22
23 // If it's not the first instance, nothing to do here
24 if ( m_algosRequirements.size() == 0 ) {
25 // This is the first instance, compile the requirements
26 m_algosRequirements.resize( algosDependencies.size(), dependency_bitset( nProducts ) );
27
28 // Fill the requirements
29 unsigned int algoIndex = 0;
30 long int productIndex = 0;
31 for ( auto& thisAlgoDependencies : algosDependencies ) {
32 // Make a local alias for better readability
33 auto& dependency_bits = m_algosRequirements[algoIndex];
34 for ( auto& product : thisAlgoDependencies ) {
35 auto ret_val = m_productName_index_map.insert( std::pair<DataObjID, long int>( product, productIndex ) );
36 // insert successful means product wasn't known before. So increment counter
37 if ( ret_val.second == true ) ++productIndex;
38 // in any case the return value holds the proper product index
39 dependency_bits[ret_val.first->second] = true;
40 } // end loop on products on which the algo depends
41 algoIndex++;
42 } // end loop on algorithms
43
44 // Now the vector of products
45 m_productName_vec.resize( m_productName_index_map.size() );
46 for ( auto& name_idx : m_productName_index_map ) m_productName_vec[name_idx.second] = name_idx.first;
47 }
48 }
DataFlowManager::dependency_bitset
boost::dynamic_bitset dependency_bitset
Type holding the dependencies for one single algorithm.
Definition: DataFlowManager.h:33
DataFlowManager::m_productName_vec
static std::vector< DataObjID > m_productName_vec
Track the products, assigning an index to them. Static since the same for all events.
Definition: DataFlowManager.h:65
DataFlowManager::m_productName_index_map
static std::unordered_map< productName_t, long int, DataObjID_Hasher > m_productName_index_map
Definition: DataFlowManager.h:69
DataFlowManager::m_algosRequirements
static std::vector< dependency_bitset > m_algosRequirements
Requirements of algos. Static since the same for all events.
Definition: DataFlowManager.h:63
std::vector::resize
T resize(T...args)
std::pair
std::vector::size
T size(T...args)
DataFlowManager::m_dataObjectsCatalog
dependency_bitset m_dataObjectsCatalog
Catalog of the products in the whiteboard.
Definition: DataFlowManager.h:61

## Member Function Documentation

bool DataFlowManager::canAlgorithmRun | ( | unsigned int | iAlgo | ) |

Needed data products are available.

This method is called to know if the algorithm can run according to what data objects are in the event.

Definition at line 56 of file DataFlowManager.cpp.

57 {
58 const dependency_bitset& thisAlgoRequirements = m_algosRequirements[iAlgo];
59 return thisAlgoRequirements.is_subset_of( m_dataObjectsCatalog );
60 }
DataFlowManager::dependency_bitset
boost::dynamic_bitset dependency_bitset
Type holding the dependencies for one single algorithm.
Definition: DataFlowManager.h:33
DataFlowManager::m_algosRequirements
static std::vector< dependency_bitset > m_algosRequirements
Requirements of algos. Static since the same for all events.
Definition: DataFlowManager.h:63
DataFlowManager::m_dataObjectsCatalog
dependency_bitset m_dataObjectsCatalog
Catalog of the products in the whiteboard.
Definition: DataFlowManager.h:61

DataObjIDColl DataFlowManager::content | ( |  | ) | const

Get the content of the catalog.

Get the content (inefficient, only for debug in case of crashes)

Definition at line 86 of file DataFlowManager.cpp.

87 {
88 DataObjIDColl products;
89 for ( const auto& p : m_fc ) {
90 products.insert( p );
91 }
92 return products;
93 }
DataFlowManager::m_fc
DataObjIDColl m_fc
Definition: DataFlowManager.h:58
std::unordered_set< DataObjID, DataObjID_Hasher >
std::unordered_set::insert
T insert(T...args)

DataObjIDColl DataFlowManager::dataDependencies | ( | unsigned int | iAlgo | ) | const

Get the dependencies of a single algo;.

Get the data dependencies (inefficient, only for debug in case of crashes)

Definition at line 97 of file DataFlowManager.cpp.

98 {
99 // with move semantics this is ~fine
100 DataObjIDColl deps;
101 for ( unsigned int i = 0; i < m_productName_vec.size(); ++i ) {
102 if ( m_algosRequirements[iAlgo][i] ) deps.insert( m_productName_vec[i] );
103 }
104 return deps;
105 }
DataFlowManager::m_productName_vec
static std::vector< DataObjID > m_productName_vec
Track the products, assigning an index to them. Static since the same for all events.
Definition: DataFlowManager.h:65
DataFlowManager::m_algosRequirements
static std::vector< dependency_bitset > m_algosRequirements
Requirements of algos. Static since the same for all events.
Definition: DataFlowManager.h:63
std::unordered_set< DataObjID, DataObjID_Hasher >
std::unordered_set::insert
T insert(T...args)
std::vector::size
T size(T...args)

DataObjID& DataFlowManager::index2productName | ( | const unsigned int | i | ) |
| inline private

Simple helper method to convert an index to a product name.

Definition at line 76 of file DataFlowManager.h.

76 { return m_productName_vec[i]; };
DataFlowManager::m_productName_vec
static std::vector< DataObjID > m_productName_vec
Track the products, assigning an index to them. Static since the same for all events.
Definition: DataFlowManager.h:65

long int DataFlowManager::productName2index | ( | const productName_t & | productName | ) |
| inline private

Simple helper method to convert the product name into an index.

Definition at line 71 of file DataFlowManager.h.

72 {
73 return m_productName_index_map.count( productName ) > 0 ? m_productName_index_map[productName] : -1;
74 };
DataFlowManager::m_productName_index_map
static std::unordered_map< productName_t, long int, DataObjID_Hasher > m_productName_index_map
Definition: DataFlowManager.h:69

void DataFlowManager::reset | ( |  | ) |

Reset to default values.

Reset the slot for a new event.

Definition at line 77 of file DataFlowManager.cpp.

78 {
79 m_dataObjectsCatalog.reset();
80 m_fc.clear();
81 }
DataFlowManager::m_fc
DataObjIDColl m_fc
Definition: DataFlowManager.h:58
std::unordered_set::clear
T clear(T...args)
DataFlowManager::m_dataObjectsCatalog
dependency_bitset m_dataObjectsCatalog
Catalog of the products in the whiteboard.
Definition: DataFlowManager.h:61

void DataFlowManager::updateDataObjectsCatalog | ( | const DataObjIDColl & | newProducts | ) |

Update the catalog of available products in the slot.

Definition at line 65 of file DataFlowManager.cpp.

66 {
67 for ( const auto& new_product : newProducts ) {
68 m_fc.insert( new_product );
69 const int index = productName2index( new_product );
70 if ( index >= 0 ) m_dataObjectsCatalog[index] = true;
71 }
72 }
DataFlowManager::m_fc
DataObjIDColl m_fc
Definition: DataFlowManager.h:58
DataFlowManager::productName2index
long int productName2index(const productName_t &productName)
Simple helper method to convert the product name into an index.
Definition: DataFlowManager.h:71
std::unordered_set::insert
T insert(T...args)
DataFlowManager::m_dataObjectsCatalog
dependency_bitset m_dataObjectsCatalog
Catalog of the products in the whiteboard.
Definition: DataFlowManager.h:61

## Member Data Documentation

std::vector< DataFlowManager::dependency_bitset > DataFlowManager::m_algosRequirements
| static private

Requirements of algos. Static since the same for all events.

Definition at line 63 of file DataFlowManager.h.

dependency_bitset DataFlowManager::m_dataObjectsCatalog
| private

Catalog of the products in the whiteboard.

Definition at line 61 of file DataFlowManager.h.

DataObjIDColl DataFlowManager::m_fc
| private

Definition at line 58 of file DataFlowManager.h.

std::unordered_map< DataObjID, long int, DataObjID_Hasher > DataFlowManager::m_productName_index_map
| static private

Definition at line 69 of file DataFlowManager.h.

std::vector< DataObjID > DataFlowManager::m_productName_vec
| static private

Track the products, assigning an index to them. Static since the same for all events.

Definition at line 65 of file DataFlowManager.h.

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

- GaudiHive/src/DataFlowManager.h
- GaudiHive/src/DataFlowManager.cpp