Belle II Software light-2406-ragdoll
Map2Vector Class Reference

Helper class to make a vector of all possible combinations of int numbers contained in the input vectors (passed as values in a map). More...

#include <InclusiveBtagReconstructionModule.h>

Collaboration diagram for Map2Vector:

Public Member Functions

void convert (std::map< int, std::vector< int > > &input, std::vector< std::vector< int > > &output)
 Do the conversion using makeEntries().
 

Protected Member Functions

void makeEntries (std::map< int, std::vector< int > >::iterator positionOnTheMap, const std::map< int, std::vector< int > >::const_iterator &end, unsigned i, std::vector< std::vector< int > > &output)
 Recursively iterates over a map until the end is reached, then the output is ready.
 

Private Attributes

std::vector< int > m_combination
 Vector containing current combination of numbers (e.g.
 

Detailed Description

Helper class to make a vector of all possible combinations of int numbers contained in the input vectors (passed as values in a map).

In every resulting combination, there is only one number from each input vector.

It is used by InclusiveBtagReconstructionModule to combine Particle indices (in StoreArray) for different mdst sources (getMdstSource) to form std::vector of all combinations not sharing common mdst source.

Definition at line 75 of file InclusiveBtagReconstructionModule.h.

Member Function Documentation

◆ convert()

void convert ( std::map< int, std::vector< int > > &  input,
std::vector< std::vector< int > > &  output 
)

Do the conversion using makeEntries().

(e.g convert map<mdstSource, vector<arrayIndex>> to vector<vector<daughterArrayIndex>>)

Parameters
input- the input map
output- an empty vector to push back output combinations

Definition at line 163 of file InclusiveBtagReconstructionModule.cc.

164{
165 makeEntries(input.begin(), input.end(), 0, output);
166}
void makeEntries(std::map< int, std::vector< int > >::iterator positionOnTheMap, const std::map< int, std::vector< int > >::const_iterator &end, unsigned i, std::vector< std::vector< int > > &output)
Recursively iterates over a map until the end is reached, then the output is ready.

◆ makeEntries()

void makeEntries ( std::map< int, std::vector< int > >::iterator  positionOnTheMap,
const std::map< int, std::vector< int > >::const_iterator &  end,
unsigned  i,
std::vector< std::vector< int > > &  output 
)
protected

Recursively iterates over a map until the end is reached, then the output is ready.

Parameters
positionOnTheMap- current position on the input map
end- the end of the input map
i- current m_combination index
output- a vector to push back resulting combinations

Definition at line 168 of file InclusiveBtagReconstructionModule.cc.

171{
172 if (positionOnTheMap == end) {
173 output.push_back(m_combination);
174 } else {
175 std::vector<int>& v = positionOnTheMap->second;
176 ++positionOnTheMap;
177 for (int k : v) {
178 if (i < m_combination.size()) m_combination[i] = k;
179 else m_combination.push_back(k);
180 makeEntries(positionOnTheMap, end, i + 1, output);
181 }
182 }
183};
std::vector< int > m_combination
Vector containing current combination of numbers (e.g.

Member Data Documentation

◆ m_combination

std::vector<int> m_combination
private

Vector containing current combination of numbers (e.g.

arrayIndices of current Btag candidate's children)

Definition at line 102 of file InclusiveBtagReconstructionModule.h.


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