Belle II Software  release-08-01-10
VariablesToHistogramModule.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 <analysis/VariableManager/Manager.h>
12 
13 #include <framework/core/Module.h>
14 #include <framework/datastore/StoreObjPtr.h>
15 #include <framework/pcore/RootMergeable.h>
16 
17 #include <TH1D.h>
18 #include <TFile.h>
19 
20 #include <string>
21 #include <vector>
22 
23 namespace Belle2 {
36  public:
39 
44  virtual void initialize() override;
46  virtual void event() override;
48  virtual void terminate() override;
49 
50  private:
52  std::string m_particleList;
54  std::vector<std::tuple<std::string, int, float, float>> m_variables;
56  std::vector<std::tuple<std::string, int, float, float, std::string, int, float, float>> m_variables_2d;
58  std::string m_fileName;
60  std::string m_directory;
62  std::string m_fileNameSuffix;
63 
65  std::shared_ptr<TFile> m_file{nullptr};
67  std::vector<std::unique_ptr<StoreObjPtr<RootMergeable<TH1D>>>> m_hists;
69  std::vector<std::unique_ptr<StoreObjPtr<RootMergeable<TH2D>>>> m_2d_hists;
71  std::vector<Variable::Manager::FunctionPtr> m_functions;
73  std::vector<Variable::Manager::FunctionPtr> m_functions_2d_1;
75  std::vector<Variable::Manager::FunctionPtr> m_functions_2d_2;
76 
77  };
79 } // end namespace Belle2
Base class for Modules.
Definition: Module.h:72
Module to calculate variables specified by the user for a given ParticleList and save them into an Hi...
std::string m_directory
Name of the Directory.
virtual void initialize() override
Initialises the module.
std::vector< std::tuple< std::string, int, float, float > > m_variables
List of variables to save.
virtual void event() override
Method called for each event.
virtual void terminate() override
Write TTree to file, and close file if necessary.
std::vector< Variable::Manager::FunctionPtr > m_functions_2d_1
List of function pointers corresponding to given variables.
std::string m_fileName
Name of ROOT file for output.
std::vector< std::tuple< std::string, int, float, float, std::string, int, float, float > > m_variables_2d
List of pairs of variables to save.
std::vector< Variable::Manager::FunctionPtr > m_functions
List of function pointers corresponding to given variables.
std::string m_particleList
Name of particle list with reconstructed particles.
std::shared_ptr< TFile > m_file
ROOT file for output.
std::vector< Variable::Manager::FunctionPtr > m_functions_2d_2
List of function pointers corresponding to given variables.
std::vector< std::unique_ptr< StoreObjPtr< RootMergeable< TH2D > > > > m_2d_hists
The ROOT TH2Ds for output.
std::vector< std::unique_ptr< StoreObjPtr< RootMergeable< TH1D > > > > m_hists
The ROOT TH1Ds for output.
std::string m_fileNameSuffix
Suffix to be appended to the output file name.
Abstract base class for different kinds of events.