Belle II Software development
EventInfoExtractor Class Reference

class to extract results from qualityEstimation More...

#include <EventInfoExtractor.h>

Inheritance diagram for EventInfoExtractor:
VariableExtractor

Public Member Functions

 EventInfoExtractor (std::vector< Named< float * > > &variableSet)
 Define names of variables that get extracted.
 
void extractVariables (const StoreArray< RecoTrack > &recoTracks, const RecoTrack &thisRecoTrack)
 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::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 24 of file EventInfoExtractor.h.

Constructor & Destructor Documentation

◆ EventInfoExtractor()

EventInfoExtractor ( std::vector< Named< float * > > &  variableSet)
inlineexplicit

Define names of variables that get extracted.

Definition at line 28 of file EventInfoExtractor.h.

28 :
29 VariableExtractor()
30 {
31 addVariable("__experiment__", variableSet);
32 addVariable("__run__", variableSet);
33 addVariable("__event__", variableSet);
34 addVariable("N_RecoTracks", variableSet);
35 addVariable("N_PXDRecoTracks", variableSet);
36 addVariable("N_SVDRecoTracks", variableSet);
37 addVariable("N_CDCRecoTracks", variableSet);
38 addVariable("N_diff_PXD_SVD_RecoTracks", variableSet);
39 addVariable("N_diff_SVD_CDC_RecoTracks", variableSet);
40 addVariable("RTs_Min_Mom_diff_Mag", variableSet);
41 addVariable("RTs_Min_Mom_diff_Pt", variableSet);
42 addVariable("RTs_Min_Pos_diff_Theta", variableSet);
43 addVariable("RTs_Min_Pos_diff_Phi", variableSet);
44 }
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 ( const StoreArray< RecoTrack > &  recoTracks,
const RecoTrack thisRecoTrack 
)
inline

extract the actual variables and write into a variable set

Definition at line 47 of file EventInfoExtractor.h.

48 {
49 m_variables.at("N_RecoTracks") = recoTracks.getEntries();
50
51 int n_pxdRecoTracks = 0;
52 int n_svdRecoTracks = 0;
53 int n_cdcRecoTracks = 0;
54 float min_mom_diff_mag = std::numeric_limits<float>::max();
55 float min_mom_diff_Pt = std::numeric_limits<float>::max();
56 float min_pos_diff_Theta = std::numeric_limits<float>::max();
57 float min_pos_diff_Phi = std::numeric_limits<float>::max();
58
59 for (const RecoTrack& recoTrack : recoTracks) {
60 if (recoTrack.hasPXDHits())
61 n_pxdRecoTracks++;
62 if (recoTrack.hasSVDHits())
63 n_svdRecoTracks++;
64 if (recoTrack.hasCDCHits())
65 n_cdcRecoTracks++;
66
67 if (recoTrack.getArrayIndex() == thisRecoTrack.getArrayIndex())
68 continue;
69
70 float mom_diff_mag = fabs(recoTrack.getMomentumSeed().R() - thisRecoTrack.getMomentumSeed().R());
71 if (mom_diff_mag < min_mom_diff_mag) {
72 min_mom_diff_mag = mom_diff_mag;
73 }
74 float mom_diff_Pt = fabs(recoTrack.getMomentumSeed().Rho() - thisRecoTrack.getMomentumSeed().Rho());
75 if (mom_diff_Pt < min_mom_diff_Pt) {
76 min_mom_diff_Pt = mom_diff_Pt;
77 }
78 float pos_diff_Theta = fabs(recoTrack.getPositionSeed().Theta() - thisRecoTrack.getPositionSeed().Theta());
79 if (pos_diff_Theta < min_pos_diff_Theta) {
80 min_pos_diff_Theta = pos_diff_Theta;
81 }
82 float pos_diff_Phi = fabs(recoTrack.getPositionSeed().Phi() - thisRecoTrack.getPositionSeed().Phi());
83 if (pos_diff_Phi < min_pos_diff_Phi) {
84 min_pos_diff_Phi = pos_diff_Phi;
85 }
86 }
87
88 StoreObjPtr<EventMetaData> m_eventMetaData;
89
90 m_variables.at("__experiment__") = m_eventMetaData->getExperiment();
91 m_variables.at("__run__") = m_eventMetaData->getRun();
92 m_variables.at("__event__") = m_eventMetaData->getEvent();
93 m_variables.at("N_PXDRecoTracks") = n_pxdRecoTracks;
94 m_variables.at("N_SVDRecoTracks") = n_svdRecoTracks;
95 m_variables.at("N_CDCRecoTracks") = n_cdcRecoTracks;
96 m_variables.at("N_diff_PXD_SVD_RecoTracks") = n_svdRecoTracks - n_pxdRecoTracks;
97 m_variables.at("N_diff_SVD_CDC_RecoTracks") = n_cdcRecoTracks - n_svdRecoTracks;
98 m_variables.at("RTs_Min_Mom_diff_Mag") = min_mom_diff_mag;
99 m_variables.at("RTs_Min_Mom_diff_Pt") = min_mom_diff_Pt;
100 m_variables.at("RTs_Min_Pos_diff_Theta") = min_pos_diff_Theta;
101 m_variables.at("RTs_Min_Pos_diff_Phi") = min_pos_diff_Phi;
102 }
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:216

Member Data Documentation

◆ 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: