LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
CFAlgoArray.cxx
Go to the documentation of this file.
1 #ifndef RECOTOOL_CFALGOARRAY_CXX
2 #define RECOTOOL_CFALGOARRAY_CXX
3 
4 #include "CFAlgoArray.h"
5 
6 namespace cmtool {
7 
8  //-------------------------------------------------------
10  //-------------------------------------------------------
11  {
13  _algo_array.clear();
14  }
15 
16  //----------------------------------------------------------------------------------------------
17  float CFAlgoArray::Float(const std::vector<const cluster::ClusterParamsAlg*> &clusters)
18  //----------------------------------------------------------------------------------------------
19  {
20 
21  std::vector<float> score_array;
22  score_array.reserve(_algo_array.size());
23 
24  for(auto const& algo : _algo_array) {
25 
26  float score = algo->Float(clusters);
27 
28  if(_mode != kSimpleAddition && score < 0)
29 
30  return score;
31 
32  score_array.push_back(score);
33 
34  }
35 
36  float score_result = 0;
37 
38  switch(_mode) {
39 
40  case kLastAlgo:
41 
42  score_result = (*score_array.rbegin());
43  break;
44 
45  case kSimpleAddition:
46  case kPositiveAddition:
47 
48  for(auto const& score : score_array) score_result += score;
49  break;
50 
51  case kMultiplication:
52 
53  for(auto const& score : score_array) score_result *= score;
54  break;
55 
56  }
57 
58  return score_result;
59  }
60 
61 }
62 #endif
CFAlgoArray()
Default constructor.
Definition: CFAlgoArray.cxx:9
virtual float Float(const std::vector< const cluster::ClusterParamsAlg * > &cluster)
Definition: CFAlgoArray.cxx:17
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