5#ifndef ANALYSISUTILS_ANALYSISCOMBINATION_H
6#define ANALYSISUTILS_ANALYSISCOMBINATION_H
69 template <
class CALLER,
class OUT,
class CRITERIA>
73 if (!ret)
return false;
76 if (criteria(caller, comb))
return true;
79 return goodOnes(caller, comb, criteria);
91 if (!ret)
return false;
94 unsigned int sIndex = 0;
95 std::vector<unsigned int>::const_iterator it =
m_index.begin();
96 std::vector<unsigned int>::const_iterator itE =
m_index.end();
105 for (
unsigned int i=sIndex; i<eIndex; ++i)
106 remain.push_back((*
m_coll)[i]);
109 if (it == itE)
break;
118 template <
class CALLER,
class OUT,
class CRITERIA>
121 bool ret =
get(comb, remain);
122 if (!ret)
return false;
125 if (criteria(caller, comb))
return true;
128 return goodOnes(caller, comb, remain, criteria);
158 for (
unsigned int i=0; i<nElement; ++i)
176 if (iElement < 0)
return false;
178 if (iElement+1 ==
static_cast<int>(
m_nElement))
bool get(OUT &comb, OUT &remain)
get a combination and the remaining elements
Combination(COLL *coll, const unsigned int nElement)
constructor
void reset()
reset internal indices
std::vector< unsigned int > m_index
indices of elements
bool setNewIndex(int iElement)
set new index recursively
bool goodOnes(CALLER *caller, OUT &comb, OUT &remain, CRITERIA criteria)
get a combination and the remaining elements.
bool m_first
flag to check if first
const unsigned int m_nElement
number of elements to be selected
bool get(OUT &comb)
get a combination.
bool goodOnes(CALLER *caller, OUT &comb, CRITERIA criteria)
get a combination which passes a selection criteria
utility class to select combination of elements in a collection