ATLAS Offline Software
HistoInputBase.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef JETTOOLHELPERS_HISTOINPUTBASE_H
6 #define JETTOOLHELPERS_HISTOINPUTBASE_H
7 
8 
10 #include "AsgTools/AsgTool.h"
12 
13 #include "TH1.h" //unique_ptr member, and d'tor defined here
14 #include <string>
15 #include <memory>
16 
17 class TAxis;
18 
19 namespace JetHelper {
20 
23 
24 class HistoInputBase :public asg::AsgTool, virtual public IVarTool
25 {
27 
28  public:
30  HistoInputBase(const std::string& myname);
32  virtual ~HistoInputBase() {};
34  std::string getFileName() const { return m_fileName; };
36  std::string getHistName() const { return m_histName; };
37 
38  private:
40  Gaudi::Property< std::string > m_fileName { this, "inputfile", "JetUncertainties/CalibArea-08/rel21/Summer2019/R4_AllComponents.root", "File containing histograms" };
42  Gaudi::Property< std::string > m_histName { this, "histName", "Zjet_MuStat3_AntiKt4EMPFlow", "name of histrogram" };
43 
44  protected:
45  std::unique_ptr<TH1> m_hist ATLAS_THREAD_SAFE {};
49  double enforceAxisRange(const TAxis& axis, const double inputValue) const;
51  double readFromHisto(const double X, const double Y=0, const double Z=0) const;
52  // Interpolation strategies
53  Gaudi::Property<std::string> m_interpStr {this, "InterpType", "Full", "Interpolation to run: Full/OnlyX/OnlyY/None"};
54  enum class InterpType
55  {
56  UNKNOWN=0, // Unknown/unset/etc
57  Full, // Full interpolation
58  None, // No interpolation
59  OnlyX, // Interpolate only in the x dimension
60  OnlyY // Interpolate only in the y dimension
61  };
63 
64 };
65 } // namespace JetHelper
66 #endif
JetHelper::HistoInputBase::readHistoFromFile
bool readHistoFromFile()
This function open the InputFile and assign the histogram to m_hist.
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
PropertyWrapper.h
JetHelper::HistoInputBase::getFileName
std::string getFileName() const
Return the name of the file that containt the histograms.
Definition: HistoInputBase.h:34
JetHelper::HistoInputBase::m_histName
Gaudi::Property< std::string > m_histName
name of the histogram
Definition: HistoInputBase.h:42
yodamerge_tmp.axis
list axis
Definition: yodamerge_tmp.py:241
JetHelper
class IJetCalibStep
Definition: IInputVariable.h:18
IVarTool.h
JetHelper::HistoInputBase::m_interpStr
Gaudi::Property< std::string > m_interpStr
Definition: HistoInputBase.h:53
JetHelper::HistoInputBase
Class HistoInputBase This class implement common function used by HistoInput1D and HistoInput2D
Definition: HistoInputBase.h:25
JetHelper::HistoInputBase::InterpType::OnlyY
@ OnlyY
Monitored::X
@ X
Definition: HistogramFillerUtils.h:24
JetHelper::HistoInputBase::getHistName
std::string getHistName() const
Return the name of the histogram.
Definition: HistoInputBase.h:36
JetHelper::HistoInputBase::InterpType
InterpType
Definition: HistoInputBase.h:55
JetHelper::HistoInputBase::m_interpNum
InterpType m_interpNum
Definition: HistoInputBase.h:62
JetHelper::HistoInputBase::~HistoInputBase
virtual ~HistoInputBase()
Destructor.
Definition: HistoInputBase.h:32
JetHelper::IVarTool
Definition: IVarTool.h:23
JetHelper::HistoInputBase::InterpType::Full
@ Full
JetHelper::HistoInputBase::enforceAxisRange
double enforceAxisRange(const TAxis &axis, const double inputValue) const
This function ensure that the histogram is NOT evaluated outside range.
Monitored::Y
@ Y
Definition: HistogramFillerUtils.h:24
JetHelper::HistoInputBase::InterpType::None
@ None
JetHelper::HistoInputBase::InterpType::OnlyX
@ OnlyX
JetHelper::HistoInputBase::m_fileName
Gaudi::Property< std::string > m_fileName
path to the file with histrograms
Definition: HistoInputBase.h:40
ASG_TOOL_CLASS
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Definition: AsgToolMacros.h:68
JetHelper::HistoInputBase::ATLAS_THREAD_SAFE
std::unique_ptr< TH1 > m_hist ATLAS_THREAD_SAFE
Definition: HistoInputBase.h:45
JetHelper::HistoInputBase::readFromHisto
double readFromHisto(const double X, const double Y=0, const double Z=0) const
This function evaluate the histogram using the TH1::Interpolate.
JetHelper::HistoInputBase::InterpType::UNKNOWN
@ UNKNOWN
AsgTool.h
JetHelper::HistoInputBase::HistoInputBase
HistoInputBase(const std::string &myname)
Constructor for standalone usage.