Belle II Software development
QEResultsExtractor.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <tracking/trackFindingVXD/variableExtractors/VariableExtractor.h>
12#include <tracking/trackFindingVXD/trackQualityEstimators/QualityEstimatorBase.h>
13
14
15namespace Belle2 {
22 public:
23
25 QEResultsExtractor(const std::string& method, std::vector<Named<float*>>& variableSet):
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 }
39
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 }
71
72 protected:
74 std::string m_method;
75 };
77}
A mixin class to attach a name to an object. Based on class with same name in CDC package.
Definition: Named.h:21
class to extract results from qualityEstimation
void extractVariables(QualityEstimationResults const &values)
extract the actual variables and write into a variable set
std::string m_method
name of estimation method
QEResultsExtractor(const std::string &method, std::vector< Named< float * > > &variableSet)
Define names of variables that get extracted.
class to extract individual variables
void addVariable(const std::string &identifier, std::vector< Named< float * > > &variables)
add a variable to the variable set
std::unordered_map< std::string, float > m_variables
unordered_map to associate float value with a string name
Abstract base class for different kinds of events.
Container for complete fit/estimation results.