Belle II Software  release-08-02-06
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 #include <vector>
11 #include <string>
12 #include <tracking/trackFindingVXD/utilities/Named.h>
13 #include <unordered_map>
14 
15 
16 namespace Belle2 {
23  public:
24 
25  protected:
27  void addVariable(const std::string& identifier, std::vector<Named<float*>>& variables)
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  }
33 
35  std::unordered_map<std::string, float> m_variables;
36  };
38 }
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< Named< float * >> &variables)
add a variable to the variable set
Abstract base class for different kinds of events.