Belle II Software prerelease-11-00-00a
QEResultsExtractor Class Reference

class to extract results from qualityEstimation More...

#include <QEResultsExtractor.h>

Inheritance diagram for QEResultsExtractor:
Collaboration diagram for QEResultsExtractor:

Public Member Functions

 QEResultsExtractor (const std::string &method, std::vector< TrackingUtilities::Named< float * > > &variableSet, const std::string &prefix="")
 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< TrackingUtilities::Named< float * > > &variables)
 add a variable to the variable set
 

Protected Attributes

std::string m_prefix
 prefix that will be added before the variable names.
 
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< TrackingUtilities::Named< float * > > & variableSet,
const std::string & prefix = "" )
inline

Define names of variables that get extracted.

Definition at line 25 of file QEResultsExtractor.h.

26 :
27 VariableExtractor(), m_prefix(prefix + method)
28 {
29 addVariable(m_prefix + "_QI", variableSet);
30 addVariable(m_prefix + "_Chi2", variableSet);
31 addVariable(m_prefix + "_Pt", variableSet);
32 addVariable(m_prefix + "_PMag", variableSet);
33 addVariable(m_prefix + "_P_Mag", variableSet);
34 addVariable(m_prefix + "_P_Eta", variableSet);
35 addVariable(m_prefix + "_P_Phi", variableSet);
36 addVariable(m_prefix + "_P_X", variableSet);
37 addVariable(m_prefix + "_P_Y", variableSet);
38 addVariable(m_prefix + "_P_Z", variableSet);
39 }

Member Function Documentation

◆ addVariable()

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

add a variable to the variable set

Definition at line 30 of file VariableExtractor.h.

31 {
32 //todo: verify if it is faster to check explicitly or not
33 auto value = m_variables.emplace(identifier, NAN).first;
34 variables.emplace_back(identifier, &(value->second));
35 }

◆ extractVariables()

void extractVariables ( QualityEstimationResults const & values)
inline

extract the actual variables and write into a variable set

Definition at line 42 of file QEResultsExtractor.h.

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

Member Data Documentation

◆ m_prefix

std::string m_prefix
protected

prefix that will be added before the variable names.

Includes user-defined prefix and the name of estimation method.

Definition at line 76 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 38 of file VariableExtractor.h.


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