LDMX Software
ClusterAlgoResult.cxx
2
4
5namespace ldmx {
6
8
9std::ostream& operator<<(std::ostream& o, const ClusterAlgoResult& c) {
10 return o << "ClusterAlgoResult { " << "name: " << c.name_ << " }";
11
12 for (int i = 0; i < c.variables_.GetSize(); ++i) {
13 o << "Element " << i << " : " << c.variables_[i];
14 }
15}
16
18 name_ = "";
19
20 for (int i = 0; i < variables_.GetSize(); ++i) {
21 variables_[i] = 0;
22 }
23}
24
25void ClusterAlgoResult::set(const TString& name, int nvar) {
26 name_ = name;
27
28 if (nvar > variables_.GetSize()) {
29 variables_.Set(nvar);
30 }
31}
32
33void ClusterAlgoResult::set(const TString& name, int nvar, int nweights) {
34 name_ = name;
35
36 if (nvar > variables_.GetSize()) {
37 variables_.Set(nvar);
38 }
39
40 if (nweights > weights_.GetSize()) {
41 weights_.Set(nweights);
42 }
43}
44
45void ClusterAlgoResult::setAlgoVar(int element, double value) {
46 if (element >= 0 && element < variables_.GetSize()) {
47 variables_[element] = value;
48 }
49}
50
51void ClusterAlgoResult::setWeight(int nCluster, double weight) {
52 if (nCluster >= 0 && nCluster < weights_.GetSize()) {
53 weights_[nCluster] = weight;
54 }
55}
56} // namespace ldmx
Class that holds details about the clustering algorithm as a whole.
Contains details about the clustering algorithm.
TString name_
Name of the clustering algorithm.
virtual ~ClusterAlgoResult()
Class destructor.
void setAlgoVar(int element, double value)
Set an algorithm variable.
void clear()
Reset the ClusterAlgoResult object.
void set(const TString &name, int nvar)
Set name and number of variables of cluster algo.
void setWeight(int nClusters, double weight)
Set a weight when number of clusters reached.