ATLAS Offline Software
HistoHelperRoot.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef JETTAGTOOLS_HISTOHELPERROOT_H
6 #define JETTAGTOOLS_HISTOHELPERROOT_H
7 
8 /******************************************************
9  @class HistoHelper
10 ********************************************************/
11 
12 #include <string>
13 #include <map>
14 #include <vector>
15 
17 #include "GaudiKernel/LockedHandle.h"
19 
20 class ITHistSvc;
21 class TH1;
22 class TH2;
23 class TH3;
24 
25 
26 namespace Analysis
27 {
28 
36 {
37 
38  public:
39 
41  HistoHelperRoot(ITHistSvc*);
43 
44  std::string baseName(const std::string& fullHistoName); // removes the path and return the histogram name
45  void bookHisto(const std::string& histoName, const std::string& histoTitle, unsigned int bins, double minx, double maxx);
46  void bookHisto(const std::string& histoName, const std::string& histoTitle, unsigned int bins, double* edge);
47  void bookHisto(const std::string& histoName, const std::string& histoTitle, unsigned int binsx, double minx, double maxx, unsigned int binsy, double miny, double maxy);
48  void bookHisto(const std::string& histoName, const std::string& histoTitle, unsigned int binsx, double* edgex, unsigned int binsy, double* edgey);
49  void bookHisto(const std::string& histoName, const std::string& histoTitle, unsigned int binsx, double minx, double maxx, unsigned int binsy, double miny, double maxy, unsigned int binsz, double minz, double maxz);
50  void fillHisto(const std::string& histoName, double ) const;
51  void fillHistoWithWeight(const std::string& histoName, double ,double) const;
52  void fillHisto(const std::string& histoName, double, double ) const;
53  void fillHisto(const std::string& histoName, double, double, double) const;
54 
56  TH1* getHisto1D ATLAS_NOT_THREAD_SAFE (const std::string& histoName);
57  TH2* getHisto2D ATLAS_NOT_THREAD_SAFE (const std::string& histoName);
58  TH3* getHisto3D ATLAS_NOT_THREAD_SAFE (const std::string& histoName);
60 
61  // Interpolating
62  static double Interpol1d(double, TH1*);
63  static double Interpol2d(double, double, TH2*);
64  static double Interpol3d(double, double, double, TH3*);
65  // Smoothing (ASH)
66  static void smoothASH2D(TH2*, int m1=3, int m2=3, bool debug=false);
67  static void smoothASH3D(TH3*, int m1=3, int m2=3, int m3=2, bool debug=false);
68 
69  //changing directory
70  //void setHistoDir(std::string name) {m_histoDir = name;};
72  void print();
73 
74  private:
75 
76  ITHistSvc* m_histoSvc;
77  std::map<std::string, LockedHandle<TH1>> m_histoMap1D;
78  std::map<std::string, LockedHandle<TH2>> m_histoMap2D;
79  std::map<std::string, LockedHandle<TH3>> m_histoMap3D;
80  std::map<std::string, HistoLimits> m_histoLimitsMap1D;
81  std::map<std::string, HistoLimits> m_histoLimitsMap2D;
82  std::map<std::string, HistoLimits> m_histoLimitsMap3D;
84 };
85 
86 }
87 #endif
88 
python.SystemOfUnits.m2
int m2
Definition: SystemOfUnits.py:92
Analysis::HistoHelperRoot::Interpol1d
static double Interpol1d(double, TH1 *)
Definition: HistoHelperRoot.cxx:545
python.App.bins
bins
Definition: App.py:410
Analysis::HistoHelperRoot::smoothASH3D
static void smoothASH3D(TH3 *, int m1=3, int m2=3, int m3=2, bool debug=false)
Definition: HistoHelperRoot.cxx:324
Analysis::HistoHelperRoot
Helper class for histograming.
Definition: HistoHelperRoot.h:36
Analysis::HistoHelperRoot::ATLAS_NOT_THREAD_SAFE
TH2 *getHisto2D ATLAS_NOT_THREAD_SAFE(const std::string &histoName)
Analysis::HistoHelperRoot::~HistoHelperRoot
~HistoHelperRoot()
Definition: HistoHelperRoot.cxx:34
Analysis::HistoHelperRoot::smoothASH2D
static void smoothASH2D(TH2 *, int m1=3, int m2=3, bool debug=false)
Definition: HistoHelperRoot.cxx:190
Analysis::HistoHelperRoot::setCheckOverflows
void setCheckOverflows(bool b)
Definition: HistoHelperRoot.h:71
Analysis::HistoHelperRoot::ATLAS_NOT_THREAD_SAFE
TH3 *getHisto3D ATLAS_NOT_THREAD_SAFE(const std::string &histoName)
Analysis::HistoHelperRoot::print
void print()
Definition: HistoHelperRoot.cxx:178
Analysis::HistoHelperRoot::Interpol2d
static double Interpol2d(double, double, TH2 *)
Definition: HistoHelperRoot.cxx:569
Analysis::HistoHelperRoot::m_histoLimitsMap1D
std::map< std::string, HistoLimits > m_histoLimitsMap1D
Definition: HistoHelperRoot.h:80
python.changerun.m1
m1
Definition: changerun.py:32
Analysis::HistoHelperRoot::fillHistoWithWeight
void fillHistoWithWeight(const std::string &histoName, double, double) const
Definition: HistoHelperRoot.cxx:117
Analysis::HistoHelperRoot::bookHisto
void bookHisto(const std::string &histoName, const std::string &histoTitle, unsigned int bins, double minx, double maxx)
Definition: HistoHelperRoot.cxx:55
TH3
Definition: rootspy.cxx:440
Analysis::HistoHelperRoot::HistoHelperRoot
HistoHelperRoot(ITHistSvc *)
Constructor with histoSvc only.
Definition: HistoHelperRoot.cxx:28
Analysis::HistoHelperRoot::ATLAS_NOT_THREAD_SAFE
TH1 *getHisto1D ATLAS_NOT_THREAD_SAFE(const std::string &histoName)
Histogram accessors (not thread-safe because exposed bare pointer)
TH2
Definition: rootspy.cxx:373
HistoLimits.h
Analysis::HistoHelperRoot::Interpol3d
static double Interpol3d(double, double, double, TH3 *)
Definition: HistoHelperRoot.cxx:615
Analysis
The namespace of all packages in PhysicsAnalysis/JetTagging.
Definition: BTaggingCnvAlg.h:20
Analysis::HistoHelperRoot::baseName
std::string baseName(const std::string &fullHistoName)
Definition: HistoHelperRoot.cxx:36
debug
const bool debug
Definition: MakeUncertaintyPlots.cxx:53
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
Analysis::HistoHelperRoot::m_histoSvc
ITHistSvc * m_histoSvc
Definition: HistoHelperRoot.h:76
Analysis::HistoHelperRoot::m_checkOverflows
bool m_checkOverflows
Definition: HistoHelperRoot.h:83
Analysis::HistoHelperRoot::m_histoLimitsMap3D
std::map< std::string, HistoLimits > m_histoLimitsMap3D
Definition: HistoHelperRoot.h:82
Analysis::HistoHelperRoot::m_histoLimitsMap2D
std::map< std::string, HistoLimits > m_histoLimitsMap2D
Definition: HistoHelperRoot.h:81
Analysis::HistoHelperRoot::m_histoMap1D
std::map< std::string, LockedHandle< TH1 > > m_histoMap1D
Definition: HistoHelperRoot.h:77
TH1
Definition: rootspy.cxx:268
Analysis::HistoHelperRoot::fillHisto
void fillHisto(const std::string &histoName, double) const
Definition: HistoHelperRoot.cxx:103
checker_macros.h
Define macros for attributes used to control the static checker.
Analysis::HistoHelperRoot::m_histoMap2D
std::map< std::string, LockedHandle< TH2 > > m_histoMap2D
Definition: HistoHelperRoot.h:78
Analysis::HistoHelperRoot::m_histoMap3D
std::map< std::string, LockedHandle< TH3 > > m_histoMap3D
Definition: HistoHelperRoot.h:79
python.SystemOfUnits.m3
int m3
Definition: SystemOfUnits.py:93