Belle II Software  release-05-02-19
SoftwareTriggerVariables.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Nils Braun *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <map>
13 #include <string>
14 #include <TObject.h>
15 
16 namespace Belle2 {
21  namespace SoftwareTrigger {
30  class SoftwareTriggerVariables : public TObject {
31  public:
33  void append(const std::string& identifier, const double& value)
34  {
35  m_results[identifier] = value;
36  }
37 
39  const std::map<std::string, double>& get() const
40  {
41  return m_results;
42  }
43 
45  double getVariable(std::string identifier) const
46  {
47  return m_results.at(identifier);
48  }
49 
51  bool has(std::string identifier) const
52  {
53  return m_results.count(identifier) > 0;
54  }
55 
57  void clear()
58  {
59  m_results.clear();
60  }
61 
62  private:
64  std::map<std::string, double> m_results;
65 
68  };
69  }
71 }
Belle2::SoftwareTrigger::SoftwareTriggerVariables::append
void append(const std::string &identifier, const double &value)
Append a new variable to the collection. Make sure not to override existing ones.
Definition: SoftwareTriggerVariables.h:41
Belle2::SoftwareTrigger::SoftwareTriggerVariables::clear
void clear()
Clear all results.
Definition: SoftwareTriggerVariables.h:65
Belle2::SoftwareTrigger::SoftwareTriggerVariables::get
const std::map< std::string, double > & get() const
Get the whole map of results for analysis.
Definition: SoftwareTriggerVariables.h:47
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::SoftwareTrigger::SoftwareTriggerVariables::m_results
std::map< std::string, double > m_results
Internal storage of the variables with names.
Definition: SoftwareTriggerVariables.h:72
Belle2::SoftwareTrigger::SoftwareTriggerVariables::ClassDef
ClassDef(SoftwareTriggerVariables, 1)
Making this class a ROOT class.
Belle2::SoftwareTrigger::SoftwareTriggerVariables::getVariable
double getVariable(std::string identifier) const
Get just one value from the map.
Definition: SoftwareTriggerVariables.h:53
Belle2::SoftwareTrigger::SoftwareTriggerVariables::has
bool has(std::string identifier) const
Returns true if indentifier is in the map of trigger variables.
Definition: SoftwareTriggerVariables.h:59
Belle2::SoftwareTrigger::SoftwareTriggerVariables
Storable object for the variables calculated in the SoftwareTriggerModule.
Definition: SoftwareTriggerVariables.h:38