ATLAS Offline Software
Loading...
Searching...
No Matches
FuncInput1D.h
Go to the documentation of this file.
1// Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3#ifndef JETTOOLHELPERS_FUNCINPUT1D_H
4#define JETTOOLHELPERS_FUNCINPUT1D_H
5
6// FuncInput1D
7//
8// Analogue of HistoInput1D that evaluates a TF1 instead of reading a
9// histogram bin. The TF1 is built from a formula string with fixed
10// parameters and range. The x value is provided by a VarTool and is
11// clamped to the function range before evaluation.
12
13#include "AsgTools/AsgTool.h"
15#include "AsgTools/ToolHandle.h"
16
19
20#include "xAODJet/Jet.h"
21
22#include "TFormula.h"
23
24#include <memory>
25#include <string>
26#include <vector>
27
28namespace JetHelper {
29
30 class FuncInput1D : public asg::AsgTool, virtual public IVarTool {
32
33 public:
34 FuncInput1D(const std::string& name);
35 virtual ~FuncInput1D() = default;
36
37 virtual StatusCode initialize() override;
38
40 virtual float getValue(const xAOD::Jet& jet, const JetContext& ctx) const override;
41
42 private:
43 // Tool providing x
44 ToolHandle<IVarTool> m_vartool {this, "varTool1", "VarTool", "InputVariable instance"};
45
46 // Function definition
47 Gaudi::Property<std::string> m_formula {this, "Formula", "", "TF1 formula in x and [0], [1], ..."};
48 Gaudi::Property<std::vector<double>> m_params {this, "Parameters", {}, "Function parameters"};
49 Gaudi::Property<double> m_xMin {this, "XMin", 0.0, "Lower edge of the function range"};
50 Gaudi::Property<double> m_xMax {this, "XMax", 1.0, "Upper edge of the function range"};
51
52 // Behaviour outside the range
53 Gaudi::Property<bool> m_clamp {this, "ClampToRange", true, "Clamp x to [XMin, XMax] (otherwise return OutOfRangeValue)"};
54 Gaudi::Property<float> m_outOfRangeValue {this, "OutOfRangeValue", 999.99, "Returned outside the range if ClampToRange is false"};
55
56 std::unique_ptr<const TFormula> m_func;
57 };
58
59} // namespace JetHelper
60
61#endif
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Gaudi::Property< float > m_outOfRangeValue
Definition FuncInput1D.h:54
Gaudi::Property< bool > m_clamp
Definition FuncInput1D.h:53
ToolHandle< IVarTool > m_vartool
Definition FuncInput1D.h:44
Gaudi::Property< std::vector< double > > m_params
Definition FuncInput1D.h:48
virtual float getValue(const xAOD::Jet &jet, const JetContext &ctx) const override
Evaluate the function at the value returned by the VarTool.
virtual ~FuncInput1D()=default
FuncInput1D(const std::string &name)
Gaudi::Property< double > m_xMin
Definition FuncInput1D.h:49
Gaudi::Property< double > m_xMax
Definition FuncInput1D.h:50
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
std::unique_ptr< const TFormula > m_func
Definition FuncInput1D.h:56
Gaudi::Property< std::string > m_formula
Definition FuncInput1D.h:47
Class JetContext Designed to read AOD information related to the event, N vertices,...
Definition JetContext.h:27
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
class IJetCalibStep
Jet_v1 Jet
Definition of the current "jet version".