Belle II Software development
VariableExtractor.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/trackingUtilities/utilities/Named.h>
12
13#include <vector>
14#include <string>
15#include <unordered_map>
16#include <cmath>
17
18
19namespace Belle2 {
26 public:
27
28 protected:
30 void addVariable(const std::string& identifier, std::vector<TrackingUtilities::Named<float*>>& variables)
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 }
36
38 std::unordered_map<std::string, float> m_variables;
39 };
40
41}
A mixin class to attach a name to an object.
Definition Named.h:23
class to extract individual variables
std::unordered_map< std::string, float > m_variables
unordered_map to associate float value with a string name
void addVariable(const std::string &identifier, std::vector< TrackingUtilities::Named< float * > > &variables)
add a variable to the variable set
Abstract base class for different kinds of events.