ATLAS Offline Software
Loading...
Searching...
No Matches
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
17class TAxis;
18
19namespace JetHelper {
20
23
24class 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; };
38 TH1& getHistogram() { return *m_hist; };
39
40 private:
42 Gaudi::Property< std::string > m_fileName { this, "inputfile", "JetUncertainties/CalibArea-08/rel21/Summer2019/R4_AllComponents.root", "File containing histograms" };
44 Gaudi::Property< std::string > m_histName { this, "histName", "Zjet_MuStat3_AntiKt4EMPFlow", "name of histrogram" };
45
46 protected:
47 std::unique_ptr<TH1> m_hist ATLAS_THREAD_SAFE {};
51 double enforceAxisRange(const TAxis& axis, const double inputValue) const;
53 double readFromHisto(const double X, const double Y=0, const double Z=0) const;
54 // Interpolation strategies
55 Gaudi::Property<std::string> m_interpStr {this, "InterpType", "Full", "Interpolation to run: Full/OnlyX/OnlyY/None"};
56 enum class InterpType
57 {
58 UNKNOWN=0, // Unknown/unset/etc
59 Full, // Full interpolation
60 None, // No interpolation
61 OnlyX, // Interpolate only in the x dimension
62 OnlyY, // Interpolate only in the y dimension
63 OnlyZ // Interpolate only in the z dimension
64 };
66
67};
68} // namespace JetHelper
69#endif
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Gaudi::Property< std::string > m_histName
name of the histogram
bool readHistoFromFile()
This function open the InputFile and assign the histogram to m_hist.
virtual ~HistoInputBase()
Destructor.
Gaudi::Property< std::string > m_interpStr
std::string getFileName() const
Return the name of the file that containt the histograms.
std::string getHistName() const
Return the name of the histogram.
std::unique_ptr< TH1 > m_hist ATLAS_THREAD_SAFE
Gaudi::Property< std::string > m_fileName
path to the file with histrograms
double readFromHisto(const double X, const double Y=0, const double Z=0) const
This function evaluate the histogram using the TH1::Interpolate.
HistoInputBase(const std::string &myname)
Constructor for standalone usage.
double enforceAxisRange(const TAxis &axis, const double inputValue) const
This function ensure that the histogram is NOT evaluated outside range.
TH1 & getHistogram()
Returns the underlying histogram.
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
class IJetCalibStep