Belle II Software development
FlipRecoTrackExtractor Class Reference

class to extract results from qualityEstimation More...

#include <FlipRecoTrackExtractor.h>

Inheritance diagram for FlipRecoTrackExtractor:
VariableExtractor

Public Member Functions

 FlipRecoTrackExtractor (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 27 of file FlipRecoTrackExtractor.h.

Constructor & Destructor Documentation

◆ FlipRecoTrackExtractor()

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

Define names of variables that get extracted.

Adding variables for 1st mva

Definition at line 31 of file FlipRecoTrackExtractor.h.

31 :
32 VariableExtractor(), m_prefix(prefix)
33 {
35 addVariable(prefix + "seed_pz_estimate", variableSet);
36 addVariable(prefix + "seed_pz_variance", variableSet);
37 addVariable(prefix + "seed_z_estimate", variableSet);
38 addVariable(prefix + "seed_tan_lambda_estimate", variableSet);
39 addVariable(prefix + "seed_pt_estimate", variableSet);
40 addVariable(prefix + "seed_x_estimate", variableSet);
41 addVariable(prefix + "seed_y_estimate", variableSet);
42 addVariable(prefix + "seed_py_variance", variableSet);
43 addVariable(prefix + "seed_d0_estimate", variableSet);
44 addVariable(prefix + "seed_omega_variance", variableSet);
45 addVariable(prefix + "svd_layer6_clsTime", variableSet);
46 addVariable(prefix + "seed_tan_lambda_variance", variableSet);
47 addVariable(prefix + "seed_z_variance", variableSet);
48 addVariable(prefix + "n_svd_hits", variableSet);
49 addVariable(prefix + "n_cdc_hits", variableSet);
50 addVariable(prefix + "svd_layer3_positionSigma", variableSet);
51 addVariable(prefix + "first_cdc_layer", variableSet);
52 addVariable(prefix + "last_cdc_layer", variableSet);
53 addVariable(prefix + "InOutArmTimeDifference", variableSet);
54 addVariable(prefix + "InOutArmTimeDifferenceError", variableSet);
55 addVariable(prefix + "inGoingArmTime", variableSet);
56 addVariable(prefix + "inGoingArmTimeError", variableSet);
57 addVariable(prefix + "outGoingArmTime", variableSet);
58 addVariable(prefix + "outGoingArmTimeError", variableSet);
59
60 }
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 63 of file FlipRecoTrackExtractor.h.

64 {
65 // Set all values to NaN to make sure that no values from previous recoTrack are used accidentally
67
68 const auto& cdcHitList = recoTrack.getSortedCDCHitList();
69 const RecoTrack* svdcdcRecoTrack = recoTrack.getRelated<RecoTrack>("SVDCDCRecoTracks");
70 // In case the CDC hit list is empty, or there is no svdcdcRecoTrack, set arbitrary default value and return
71 if (not svdcdcRecoTrack) {
72 return;
73 }
74
75 m_variables.at(m_prefix + "InOutArmTimeDifference") = static_cast<float>(recoTrack.getInOutArmTimeDifference());
76 m_variables.at(m_prefix + "InOutArmTimeDifferenceError") = static_cast<float>(recoTrack.getInOutArmTimeDifferenceError());
77 m_variables.at(m_prefix + "inGoingArmTime") = static_cast<float>(recoTrack.getIngoingArmTime());
78 m_variables.at(m_prefix + "inGoingArmTimeError") = static_cast<float>(recoTrack.getIngoingArmTimeError());
79 m_variables.at(m_prefix + "outGoingArmTime") = static_cast<float>(recoTrack.getOutgoingArmTime());
80 m_variables.at(m_prefix + "outGoingArmTimeError") = static_cast<float>(recoTrack.getOutgoingArmTimeError());
81
82 if (cdcHitList.size() > 0) {
83 m_variables.at(m_prefix + "first_cdc_layer") = static_cast<float>(cdcHitList.front()->getICLayer());
84 m_variables.at(m_prefix + "last_cdc_layer") = static_cast<float>(cdcHitList.back()->getICLayer());
85 }
86
87 m_variables.at(m_prefix + "n_svd_hits") = static_cast<float>(recoTrack.getNumberOfSVDHits());
88 m_variables.at(m_prefix + "n_cdc_hits") = static_cast<float>(recoTrack.getNumberOfCDCHits());
89
90 const auto& svdcdcRecoTrackCovariance = svdcdcRecoTrack->getSeedCovariance();
91 const auto& svdcdcRecoTrackMomentum = svdcdcRecoTrack->getMomentumSeed();
92 const auto& svdcdcRecoTrackPosition = svdcdcRecoTrack->getPositionSeed();
93 const float svdcdcRecoTrackChargeSign = svdcdcRecoTrack->getChargeSeed() > 0 ? 1.0f : -1.0f;
94 const float bFieldValue = static_cast<float>(BFieldManager::getFieldInTesla(svdcdcRecoTrackPosition).Z());
95 const uint16_t svdcdcNDF = 0xffff;
96 const auto& svdcdcFitResult = TrackFitResult(svdcdcRecoTrackPosition, svdcdcRecoTrackMomentum, svdcdcRecoTrackCovariance,
97 svdcdcRecoTrackChargeSign, Const::pion, 0, bFieldValue, 0, 0,
98 svdcdcNDF);
99
100 m_variables.at(m_prefix + "seed_pz_variance") = static_cast<float>(svdcdcRecoTrackCovariance(5, 5));
101 m_variables.at(m_prefix + "seed_pz_estimate") = static_cast<float>(svdcdcRecoTrackMomentum.Z());
102 m_variables.at(m_prefix + "seed_z_estimate") = static_cast<float>(svdcdcRecoTrackPosition.Z());
103 m_variables.at(m_prefix + "seed_tan_lambda_estimate") = static_cast<float>(svdcdcFitResult.getCotTheta());
104
105 m_variables.at(m_prefix + "seed_pt_estimate") = static_cast<float>(svdcdcRecoTrackMomentum.Rho());
106 m_variables.at(m_prefix + "seed_x_estimate") = static_cast<float>(svdcdcRecoTrackPosition.X());
107 m_variables.at(m_prefix + "seed_y_estimate") = static_cast<float>(svdcdcRecoTrackPosition.Y());
108 m_variables.at(m_prefix + "seed_py_variance") = static_cast<float>(svdcdcRecoTrackCovariance(4, 4));
109 m_variables.at(m_prefix + "seed_d0_estimate") = static_cast<float>(svdcdcFitResult.getD0());
110 m_variables.at(m_prefix + "seed_omega_variance") = static_cast<float>(svdcdcFitResult.getCov()[9]);
111 m_variables.at(m_prefix + "seed_tan_lambda_variance") = static_cast<float>(svdcdcFitResult.getCov()[14]);
112 m_variables.at(m_prefix + "seed_z_variance") = static_cast<float>(svdcdcRecoTrackCovariance(2, 2));
113
114 for (const auto* svdHit : recoTrack.getSVDHitList()) {
115 if (svdHit->getSensorID().getLayerNumber() == 3) {
116 m_variables.at(m_prefix + "svd_layer3_positionSigma") = static_cast<float>(svdHit->getPositionSigma());
117 }
118 if (svdHit->getSensorID().getLayerNumber() == 6) {
119 m_variables.at(m_prefix + "svd_layer6_clsTime") = static_cast<float>(svdHit->getClsTime());
120 }
121 }
122 }
static ROOT::Math::XYZVector getFieldInTesla(const ROOT::Math::XYZVector &pos)
return the magnetic field at a given position in Tesla.
Definition: BFieldManager.h:61
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 130 of file FlipRecoTrackExtractor.h.

131 {
132 m_variables.at(m_prefix + "InOutArmTimeDifference") = Const::floatNaN;
133 m_variables.at(m_prefix + "InOutArmTimeDifferenceError") = Const::floatNaN;
134 m_variables.at(m_prefix + "inGoingArmTime") = Const::floatNaN;
135 m_variables.at(m_prefix + "inGoingArmTimeError") = Const::floatNaN;
136 m_variables.at(m_prefix + "outGoingArmTime") = Const::floatNaN;
137 m_variables.at(m_prefix + "outGoingArmTimeError") = Const::floatNaN;
138 m_variables.at(m_prefix + "first_cdc_layer") = Const::floatNaN;
139 m_variables.at(m_prefix + "last_cdc_layer") = Const::floatNaN;
140 m_variables.at(m_prefix + "n_svd_hits") = Const::floatNaN;
141 m_variables.at(m_prefix + "n_cdc_hits") = Const::floatNaN;
142 m_variables.at(m_prefix + "seed_pz_variance") = Const::floatNaN;
143 m_variables.at(m_prefix + "seed_pz_estimate") = Const::floatNaN;
144 m_variables.at(m_prefix + "seed_z_estimate") = Const::floatNaN;
145 m_variables.at(m_prefix + "seed_tan_lambda_estimate") = Const::floatNaN;
146 m_variables.at(m_prefix + "seed_pt_estimate") = Const::floatNaN;
147 m_variables.at(m_prefix + "seed_x_estimate") = Const::floatNaN;
148 m_variables.at(m_prefix + "seed_y_estimate") = Const::floatNaN;
149 m_variables.at(m_prefix + "seed_py_variance") = Const::floatNaN;
150 m_variables.at(m_prefix + "seed_d0_estimate") = Const::floatNaN;
151 m_variables.at(m_prefix + "seed_omega_variance") = Const::floatNaN;
152 m_variables.at(m_prefix + "seed_tan_lambda_variance") = Const::floatNaN;
153 m_variables.at(m_prefix + "seed_z_variance") = Const::floatNaN;
154 m_variables.at(m_prefix + "svd_layer3_positionSigma") = Const::floatNaN;
155 m_variables.at(m_prefix + "svd_layer6_clsTime") = Const::floatNaN;
156 }
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 127 of file FlipRecoTrackExtractor.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: