Belle II Software  release-05-02-19
VariablesToHistogramModule.h
1 /**************************************************************************
2 * BASF2 (Belle Analysis Framework 2) *
3 * Copyright(C) 2013 - Belle II Collaboration *
4 * *
5 * Author: The Belle II Collaboration *
6 * Contributors: Thomas Keck *
7 * *
8 * This software is provided "as is" without any warranty. *
9 **************************************************************************/
10 
11 #pragma once
12 
13 #include <framework/core/Module.h>
14 #include <analysis/VariableManager/Manager.h>
15 #include <framework/datastore/StoreObjPtr.h>
16 #include <framework/pcore/RootMergeable.h>
17 
18 #include <TH1D.h>
19 #include <TFile.h>
20 
21 #include <string>
22 #include <vector>
23 
24 namespace Belle2 {
36  class VariablesToHistogramModule : public Module {
37  public:
40 
45  virtual void initialize() override;
47  virtual void event() override;
49  virtual void terminate() override;
50 
51  private:
53  std::string m_particleList;
55  std::vector<std::tuple<std::string, int, float, float>> m_variables;
57  std::vector<std::tuple<std::string, int, float, float, std::string, int, float, float>> m_variables_2d;
59  std::string m_fileName;
61  std::string m_directory;
62 
64  std::shared_ptr<TFile> m_file{nullptr};
66  std::vector<std::unique_ptr<StoreObjPtr<RootMergeable<TH1D>>>> m_hists;
68  std::vector<std::unique_ptr<StoreObjPtr<RootMergeable<TH2D>>>> m_2d_hists;
70  std::vector<Variable::Manager::FunctionPtr> m_functions;
72  std::vector<Variable::Manager::FunctionPtr> m_functions_2d_1;
74  std::vector<Variable::Manager::FunctionPtr> m_functions_2d_2;
75 
76  };
78 } // end namespace Belle2
Belle2::VariablesToHistogramModule::m_variables
std::vector< std::tuple< std::string, int, float, float > > m_variables
List of variables to save.
Definition: VariablesToHistogramModule.h:63
Belle2::VariablesToHistogramModule::initialize
virtual void initialize() override
Initialises the module.
Definition: VariablesToHistogramModule.cc:56
Belle2::VariablesToHistogramModule::m_fileName
std::string m_fileName
Name of ROOT file for output.
Definition: VariablesToHistogramModule.h:67
Belle2::VariablesToHistogramModule::m_variables_2d
std::vector< std::tuple< std::string, int, float, float, std::string, int, float, float > > m_variables_2d
List of pairs of variables to save.
Definition: VariablesToHistogramModule.h:65
Belle2::VariablesToHistogramModule::terminate
virtual void terminate() override
Write TTree to file, and close file if necessary.
Definition: VariablesToHistogramModule.cc:169
Belle2::VariablesToHistogramModule::m_2d_hists
std::vector< std::unique_ptr< StoreObjPtr< RootMergeable< TH2D > > > > m_2d_hists
The ROOT TH2Ds for output.
Definition: VariablesToHistogramModule.h:76
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::VariablesToHistogramModule::m_particleList
std::string m_particleList
Name of particle list with reconstructed particles.
Definition: VariablesToHistogramModule.h:61
Belle2::VariablesToHistogramModule::m_functions_2d_1
std::vector< Variable::Manager::FunctionPtr > m_functions_2d_1
List of function pointers corresponding to given variables.
Definition: VariablesToHistogramModule.h:80
Belle2::VariablesToHistogramModule::m_file
std::shared_ptr< TFile > m_file
ROOT file for output.
Definition: VariablesToHistogramModule.h:72
Belle2::VariablesToHistogramModule::VariablesToHistogramModule
VariablesToHistogramModule()
Constructor.
Definition: VariablesToHistogramModule.cc:30
Belle2::VariablesToHistogramModule::event
virtual void event() override
Method called for each event.
Definition: VariablesToHistogramModule.cc:132
Belle2::VariablesToHistogramModule::m_functions_2d_2
std::vector< Variable::Manager::FunctionPtr > m_functions_2d_2
List of function pointers corresponding to given variables.
Definition: VariablesToHistogramModule.h:82
Belle2::VariablesToHistogramModule::m_hists
std::vector< std::unique_ptr< StoreObjPtr< RootMergeable< TH1D > > > > m_hists
The ROOT TH1Ds for output.
Definition: VariablesToHistogramModule.h:74
Belle2::VariablesToHistogramModule::m_directory
std::string m_directory
Name of the Directory.
Definition: VariablesToHistogramModule.h:69
Belle2::VariablesToHistogramModule::m_functions
std::vector< Variable::Manager::FunctionPtr > m_functions
List of function pointers corresponding to given variables.
Definition: VariablesToHistogramModule.h:78