BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
BmnEventCentrality.cxx
Go to the documentation of this file.
2
7
9 : TNamed(other)
11{
12 // Copy constructor: copies the class probability set
13}
14
16{
17 if (this != &other) {
18 TNamed::operator=(other);
19 fClassProbability = other.fClassProbability; // Copy the class probability set
20 }
21 return *this;
22}
23
25{
26 // Destructor: nothing to do as the set is cleaned up automatically
27}
28
30{
31 return GetClass(BmnCentralityClass::Method::FHCalHodo); // Delegate to the method-specific function
32}
33
35{
36 return GetProbability(BmnCentralityClass::Method::FHCalHodo); // Delegate to the method-specific function
37}
38
39const std::vector<float>& BmnEventCentrality::GetSoftCentrality() const
40{
41 return GetSoftCentrality(BmnCentralityClass::Method::FHCalHodo); // Delegate to the method-specific function
42}
43
45{
46 int candida = -1;
47 float proba = -1.0;
48 for (const auto& cls : fClassProbability) {
49 if (cls.GetMethod() == method) {
50 if (cls.GetProbability() > proba) {
51 proba = cls.GetProbability();
52 candida = cls.GetIndex();
53 }
54 }
55 }
56 return std::make_pair(candida, proba);
57}
58
60{
61 return GetClassProbabilityPair(method).first;
62}
63
68
70{
71 // Convert fClassProbability to a std::vector<float>
72 static std::vector<float> probabilities;
73 probabilities.clear();
74 for (const auto& cls : fClassProbability) {
75 probabilities.push_back(cls.GetProbability());
76 }
77 return probabilities;
78}
79
80void BmnEventCentrality::SetCentrality(int cluster_id, float probability, BmnCentralityClass::Method method)
81{
82 // Add or update the class probability for the specified method
83 fClassProbability.insert({cluster_id, probability, method});
84}
85
87{
88 fClassProbability.clear(); // Clear the class probability set
89}
const std::vector< float > & GetSoftCentrality() const
void SetCentrality(int cluster_id, float probability, BmnCentralityClass::Method method)
std::pair< int, float > GetClassProbabilityPair(BmnCentralityClass::Method method) const
BmnEventCentrality & operator=(const BmnEventCentrality &other)
std::set< BmnCentralityClass, Comparator > fClassProbability
TNamed & operator=(const TNamed &rhs)