Belle II Software development
QEResultsExtractor Class Reference

class to extract results from qualityEstimation More...

#include <QEResultsExtractor.h>

Inheritance diagram for QEResultsExtractor:
VariableExtractor

Public Member Functions

 QEResultsExtractor (const std::string &method, std::vector< Named< float * > > &variableSet)
 Define names of variables that get extracted.
 
void extractVariables (QualityEstimationResults const &values)
 extract the actual variables and write into a variable set
 

Protected Member Functions

void addVariable (const std::string &identifier, std::vector< Named< float * > > &variables)
 add a variable to the variable set
 

Protected Attributes

std::string m_method
 name of estimation method
 
std::unordered_map< std::string, float > m_variables
 unordered_map to associate float value with a string name
 

Detailed Description

class to extract results from qualityEstimation

Definition at line 21 of file QEResultsExtractor.h.

Constructor & Destructor Documentation

◆ QEResultsExtractor()

QEResultsExtractor ( const std::string &  method,
std::vector< Named< float * > > &  variableSet 
)
inline

Define names of variables that get extracted.

Definition at line 25 of file QEResultsExtractor.h.

25 :
26 VariableExtractor(), m_method(method)
27 {
28 addVariable(method + "_QI", variableSet);
29 addVariable(method + "_Chi2", variableSet);
30 addVariable(method + "_Pt", variableSet);
31 addVariable(method + "_PMag", variableSet);
32 addVariable(method + "_P_Mag", variableSet);
33 addVariable(method + "_P_Eta", variableSet);
34 addVariable(method + "_P_Phi", variableSet);
35 addVariable(method + "_P_X", variableSet);
36 addVariable(method + "_P_Y", variableSet);
37 addVariable(method + "_P_Z", variableSet);
38 }
std::string m_method
name of estimation method
void addVariable(const std::string &identifier, std::vector< Named< float * > > &variables)
add a variable to the variable set

Member Function Documentation

◆ addVariable()

void addVariable ( const std::string &  identifier,
std::vector< Named< float * > > &  variables 
)
inlineprotectedinherited

add a variable to the variable set

Definition at line 27 of file VariableExtractor.h.

28 {
29 //todo: verify if it is faster to check explicitly or not
30 auto value = m_variables.emplace(identifier, NAN).first;
31 variables.emplace_back(identifier, &(value->second));
32 }
std::unordered_map< std::string, float > m_variables
unordered_map to associate float value with a string name

◆ extractVariables()

void extractVariables ( QualityEstimationResults const &  values)
inline

extract the actual variables and write into a variable set

Definition at line 41 of file QEResultsExtractor.h.

42 {
43 m_variables.at(m_method + "_QI") = values.qualityIndicator;
44
45 float saneValue;
46 saneValue = values.chiSquared ? *(values.chiSquared) : -1;
47 m_variables.at(m_method + "_Chi2") = saneValue;
48 saneValue = values.pt ? *(values.pt) : -1;
49 m_variables.at(m_method + "_Pt") = saneValue;
50 saneValue = values.pmag ? *(values.pmag) : -1;
51 m_variables.at(m_method + "_PMag") = saneValue;
52
53
54 if (values.p) {
55 auto& vector = *(values.p);
56 m_variables.at(m_method + "_P_Mag") = vector.Mag();
57 m_variables.at(m_method + "_P_Eta") = vector.Eta();
58 m_variables.at(m_method + "_P_Phi") = vector.Phi();
59 m_variables.at(m_method + "_P_X") = vector.X();
60 m_variables.at(m_method + "_P_Y") = vector.Y();
61 m_variables.at(m_method + "_P_Z") = vector.Z();
62 } else {
63 m_variables.at(m_method + "_P_Mag") = -1;
64 m_variables.at(m_method + "_P_Eta") = -1;
65 m_variables.at(m_method + "_P_Phi") = -1;
66 m_variables.at(m_method + "_P_X") = -1;
67 m_variables.at(m_method + "_P_Y") = -1;
68 m_variables.at(m_method + "_P_Z") = -1;
69 }
70 }

Member Data Documentation

◆ m_method

std::string m_method
protected

name of estimation method

Definition at line 74 of file QEResultsExtractor.h.

◆ m_variables

std::unordered_map<std::string, float> m_variables
protectedinherited

unordered_map to associate float value with a string name

Definition at line 35 of file VariableExtractor.h.


The documentation for this class was generated from the following file: