Belle II Software development
FlipRecoTrackExtractor2nd Class Reference

class to extract results from qualityEstimation More...

#include <Flip2ndRecoTrackExtractor.h>

Inheritance diagram for FlipRecoTrackExtractor2nd:
VariableExtractor

Public Member Functions

 FlipRecoTrackExtractor2nd (std::vector< Named< float * > > &variableSet, const std::string &prefix="")
 Define names of variables that get extracted.
 
void extractVariables (RecoTrack &recoTrack)
 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_prefix
 prefix for RecoTrack extracted variables
 
std::unordered_map< std::string, float > m_variables
 unordered_map to associate float value with a string name
 

Private Member Functions

void setDefaultValues ()
 Set all variables to default error value.
 

Detailed Description

class to extract results from qualityEstimation

Definition at line 26 of file Flip2ndRecoTrackExtractor.h.

Constructor & Destructor Documentation

◆ FlipRecoTrackExtractor2nd()

FlipRecoTrackExtractor2nd ( std::vector< Named< float * > > &  variableSet,
const std::string &  prefix = "" 
)
inlineexplicit

Define names of variables that get extracted.

Definition at line 30 of file Flip2ndRecoTrackExtractor.h.

30 :
31 VariableExtractor(), m_prefix(prefix)
32 {
33 addVariable(prefix + "flipped_pz_estimate", variableSet);
34 addVariable(prefix + "tan_lambda_estimate", variableSet);
35 addVariable(prefix + "d0_variance", variableSet);
36 addVariable(prefix + "z_estimate", variableSet);
37 addVariable(prefix + "px_variance", variableSet);
38 addVariable(prefix + "p_value", variableSet);
39 addVariable(prefix + "pt_estimate", variableSet);
40 addVariable(prefix + "y_estimate", variableSet);
41 addVariable(prefix + "d0_estimate", variableSet);
42 addVariable(prefix + "x_estimate", variableSet);
43 addVariable(prefix + "pz_variance", variableSet);
44 addVariable(prefix + "omega_estimate", variableSet);
45 addVariable(prefix + "px_estimate", variableSet);
46 addVariable(prefix + "flipped_z_estimate", variableSet);
47 addVariable(prefix + "py_estimate", variableSet);
48 addVariable(prefix + "outGoingArmTime", variableSet);
49 addVariable(prefix + "quality_flip_indicator", variableSet);
50 addVariable(prefix + "inGoingArmTime", variableSet);
51 }
std::string m_prefix
prefix for RecoTrack extracted variables
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 ( RecoTrack recoTrack)
inline

extract the actual variables and write into a variable set

Definition at line 53 of file Flip2ndRecoTrackExtractor.h.

54 {
55 // Set all values to NaN to make sure that no values from previous recoTrack are used accidentally
57
58 const Track* track = recoTrack.getRelated<Track>("Tracks");
59 const RecoTrack* flippedRecoTrack = recoTrack.getRelatedFrom<RecoTrack>("RecoTracks_flipped");
60 if (not track or not flippedRecoTrack) {
61 // Don't have track or flippedRecoTrack -> return
62 return;
63 }
64 const Track* flippedTrack = flippedRecoTrack->getRelatedFrom<Track>("Tracks_flipped");
65 if (not flippedTrack) {
66 // Don't have flippedTrack -> return
67 return;
68 }
69 const TrackFitResult* trackFitResult = track->getTrackFitResultWithClosestMass(Const::pion);
70 const TrackFitResult* flippedTrackFitResult =
71 flippedTrack->getTrackFitResultWithClosestMassByName(Const::pion, "TrackFitResults_flipped");
72 if (not trackFitResult or not flippedTrackFitResult) {
73 // Don't have trackFitResult or flippedTrackFitResult -> return
74 return;
75 }
76
77 const auto& unflippedCovariance = trackFitResult->getCovariance6();
78 const auto& unflippedMomentum = trackFitResult->getMomentum();
79 const auto& unflippedPosition = trackFitResult->getPosition();
80
81 const auto& flippedMomentum = flippedTrackFitResult->getMomentum();
82 const auto& flippedPosition = flippedTrackFitResult->getPosition();
83
84 m_variables.at(m_prefix + "flipped_pz_estimate") = static_cast<float>(flippedMomentum.Z());
85 m_variables.at(m_prefix + "tan_lambda_estimate") = static_cast<float>(trackFitResult->getCotTheta());
86 m_variables.at(m_prefix + "d0_variance") = static_cast<float>(trackFitResult->getCov()[0]);
87 m_variables.at(m_prefix + "z_estimate") = static_cast<float>(unflippedPosition.Z());
88 m_variables.at(m_prefix + "px_variance") = static_cast<float>(unflippedCovariance(3, 3));
89 m_variables.at(m_prefix + "p_value") = static_cast<float>(trackFitResult->getPValue());
90 m_variables.at(m_prefix + "pt_estimate") = static_cast<float>(unflippedMomentum.Rho());
91 m_variables.at(m_prefix + "y_estimate") = static_cast<float>(unflippedPosition.Y());
92 m_variables.at(m_prefix + "d0_estimate") = static_cast<float>(trackFitResult->getD0());
93 m_variables.at(m_prefix + "x_estimate") = static_cast<float>(unflippedPosition.X());
94 m_variables.at(m_prefix + "pz_variance") = static_cast<float>(unflippedCovariance(5, 5));
95 m_variables.at(m_prefix + "omega_estimate") = static_cast<float>(trackFitResult->getOmega());
96 m_variables.at(m_prefix + "quality_flip_indicator") = static_cast<float>(recoTrack.getFlipQualityIndicator());
97 m_variables.at(m_prefix + "px_estimate") = static_cast<float>(unflippedMomentum.X());
98 m_variables.at(m_prefix + "flipped_z_estimate") = static_cast<float>(flippedPosition.Z());
99 m_variables.at(m_prefix + "py_estimate") = static_cast<float>(unflippedMomentum.Y());
100 m_variables.at(m_prefix + "inGoingArmTime") = static_cast<float>(recoTrack.getIngoingArmTime());
101 m_variables.at(m_prefix + "outGoingArmTime") = static_cast<float>(recoTrack.getOutgoingArmTime());
102 }
static const ChargedStable pion
charged pion particle
Definition: Const.h:661
void setDefaultValues()
Set all variables to default error value.

◆ setDefaultValues()

void setDefaultValues ( )
inlineprivate

Set all variables to default error value.

Definition at line 109 of file Flip2ndRecoTrackExtractor.h.

110 {
111 m_variables.at(m_prefix + "flipped_pz_estimate") = Const::floatNaN;
112 m_variables.at(m_prefix + "tan_lambda_estimate") = Const::floatNaN;
113 m_variables.at(m_prefix + "d0_variance") = Const::floatNaN;
114 m_variables.at(m_prefix + "z_estimate") = Const::floatNaN;
115 m_variables.at(m_prefix + "px_variance") = Const::floatNaN;
116 m_variables.at(m_prefix + "p_value") = Const::floatNaN;
117 m_variables.at(m_prefix + "pt_estimate") = Const::floatNaN;
118 m_variables.at(m_prefix + "y_estimate") = Const::floatNaN;
119 m_variables.at(m_prefix + "d0_estimate") = Const::floatNaN;
120 m_variables.at(m_prefix + "x_estimate") = Const::floatNaN;
121 m_variables.at(m_prefix + "pz_variance") = Const::floatNaN;
122 m_variables.at(m_prefix + "omega_estimate") = Const::floatNaN;
123 m_variables.at(m_prefix + "px_estimate") = Const::floatNaN;
124 m_variables.at(m_prefix + "flipped_z_estimate") = Const::floatNaN;
125 m_variables.at(m_prefix + "py_estimate") = Const::floatNaN;
126 m_variables.at(m_prefix + "outGoingArmTime") = Const::floatNaN;
127 m_variables.at(m_prefix + "quality_flip_indicator") = Const::floatNaN;
128 m_variables.at(m_prefix + "inGoingArmTime") = Const::floatNaN;
129 }
static const float floatNaN
quiet_NaN
Definition: Const.h:704

Member Data Documentation

◆ m_prefix

std::string m_prefix
protected

prefix for RecoTrack extracted variables

Definition at line 106 of file Flip2ndRecoTrackExtractor.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: