Belle II Software  release-05-02-19
HistogramMapping.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2019 - 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 <framework/pcore/EvtMessage.h>
13 #include <TH1.h>
14 
15 #include <string>
16 #include <memory>
17 #include <map>
18 
19 namespace Belle2 {
32  class HistogramMapping {
33  public:
35  HistogramMapping& operator=(const HistogramMapping& rhs) = delete;
39  HistogramMapping(const HistogramMapping& rhs) = delete;
41  HistogramMapping(HistogramMapping&& rhs) = default;
43  HistogramMapping() = default;
45  explicit HistogramMapping(std::unique_ptr<Belle2::EvtMessage> msg);
46 
48  void operator+=(const HistogramMapping& rhs);
49 
51  void write() const;
53  void clear();
55  void printMe() const;
57  std::unique_ptr<Belle2::EvtMessage> toMessage() const;
59  bool empty() const;
60 
61  private:
63  std::map<std::string, std::unique_ptr<TH1>> m_histograms;
64  };
66 }
Belle2::HistogramMapping::m_histograms
std::map< std::string, std::unique_ptr< TH1 > > m_histograms
Internal storage of the histograms in the form name -> unique TH1 pointer.
Definition: HistogramMapping.h:71
Belle2::HistogramMapping::operator=
HistogramMapping & operator=(const HistogramMapping &rhs)=delete
As this is a heavy object, make sure to not copy.
Belle2::HistogramMapping::toMessage
std::unique_ptr< Belle2::EvtMessage > toMessage() const
Construct an EvtMessage by serializing the content of the internal histogram storage....
Definition: HistogramMapping.cc:90
Belle2::HistogramMapping::empty
bool empty() const
Check if there are no stored histograms.
Definition: HistogramMapping.cc:78
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::HistogramMapping::operator+=
void operator+=(const HistogramMapping &rhs)
Add another histogramm tree instance by merging all histograms with the same name.
Definition: HistogramMapping.cc:48
Belle2::HistogramMapping::write
void write() const
Write out all stored histograms in the currently selected ROOT gDirectory.
Definition: HistogramMapping.cc:65
Belle2::HistogramMapping::HistogramMapping
HistogramMapping()=default
Default constructor needed during summation.
Belle2::HistogramMapping::printMe
void printMe() const
Debug function to print out the content as into messages.
Definition: HistogramMapping.cc:83
Belle2::HistogramMapping::clear
void clear()
Clear all histograms in the internal map also deleting the pointers.
Definition: HistogramMapping.cc:73