CFAlgoArray.cxx
Go to the documentation of this file.
1 #include "CFAlgoArray.h"
2 
3 namespace cmtool {
4 
5  //-------------------------------------------------------
7  //-------------------------------------------------------
8  {
10  _algo_array.clear();
11  }
12 
13  //----------------------------------------------------------------------------------------------
14  float CFAlgoArray::Float(const std::vector<const cluster::ClusterParamsAlg*> &clusters)
15  //----------------------------------------------------------------------------------------------
16  {
17 
18  std::vector<float> score_array;
19  score_array.reserve(_algo_array.size());
20 
21  for(auto const& algo : _algo_array) {
22 
23  float score = algo->Float(clusters);
24 
25  if(_mode != kSimpleAddition && score < 0)
26 
27  return score;
28 
29  score_array.push_back(score);
30 
31  }
32 
33  float score_result = 0;
34 
35  switch(_mode) {
36 
37  case kLastAlgo:
38 
39  score_result = (*score_array.rbegin());
40  break;
41 
42  case kSimpleAddition:
43  case kPositiveAddition:
44 
45  for(auto const& score : score_array) score_result += score;
46  break;
47 
48  case kMultiplication:
49 
50  for(auto const& score : score_array) score_result *= score;
51  break;
52 
53  }
54 
55  return score_result;
56  }
57 
58 }
CFAlgoArray()
Default constructor.
Definition: CFAlgoArray.cxx:6
virtual float Float(const std::vector< const cluster::ClusterParamsAlg * > &cluster)
Definition: CFAlgoArray.cxx:14
EvaluationMode_t _mode
evaluation mode
Definition: CFAlgoArray.h:115
Class def header for a class CFAlgoArray.
std::vector< CFloatAlgoBase * > _algo_array
vector of algorithms
Definition: CFAlgoArray.h:112
Definition: cfalgo.cc:3