ATLAS Offline Software
Loading...
Searching...
No Matches
JetSmearingCorrection.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 JETCALIBTOOLS_JETSMEARINGCORRECTION_H
6#define JETCALIBTOOLS_JETSMEARINGCORRECTION_H
7
8
10
11#include <memory>
12#include <vector>
13
14#include "boost/thread/tss.hpp"
15
16#include "TRandom3.h"
17#include "TEnv.h"
18#include "TH1.h"
19#include "TH2.h"
20#include "TFile.h"
21
23 : virtual public JetCalibrationStep
24{
25
26 public:
28 JetSmearingCorrection(const std::string& name, TEnv* config, TString jetAlgo, TString calibAreaTag, bool dev);
30
31 virtual StatusCode initialize() override;
32 virtual StatusCode calibrate(xAOD::Jet& jet, JetEventInfo&) const override;
33
34 virtual StatusCode getNominalResolutionData(const xAOD::Jet& jet, double& resolution) const override;
35 virtual StatusCode getNominalResolutionMC( const xAOD::Jet& jet, double& resolution) const override;
36
37 private:
38 // Helper methods
39 StatusCode getSigmaSmear(xAOD::Jet& jet, double& sigmaSmear) const;
40 StatusCode getNominalResolution(const xAOD::Jet& jet, const TH1* histo, const std::vector< std::unique_ptr<TH1> >& projections, double& resolution) const;
41 StatusCode readHisto(double& returnValue, const TH1* histo, double x) const;
42 StatusCode readHisto(double& returnValue, const TH1* histo, const std::vector< std::unique_ptr<TH1> >& projections, double x, double y) const;
43 StatusCode cacheProjections(TH1* fullHistogram, std::vector< std::unique_ptr<TH1> >& cacheLocation, const std::string& type);
44 TRandom3* getTLSRandomGen(unsigned long seed) const;
45
46 // Private enums
47 enum class SmearType
48 {
49 UNKNOWN=0, // Unknown/unset/etc
50 Pt, // pT smearing (JpTR)
51 Mass, // Mass smearing (JMR)
52 FourVec // Four-vector smearing (JER)
53 };
54 enum class HistType
55 {
56 UNKNOWN=0, // Unknown/unset/etc
57 Pt, // 1D histogram, binned in pT
58 PtEta, // 2D histogram, binned in x=pT y=eta
59 PtAbsEta // 2D histogram, binned in x=pT y=|eta|
60 };
61 enum class InterpType
62 {
63 UNKNOWN=0, // Unknown/unset/etc
64 Full, // Full interpolation
65 None, // No interpolation
66 OnlyX, // Interpolate only in the x dimension
67 OnlyY // Interpolate only in the y dimension
68 };
69
70 // Class variables from constructor
71 TEnv* m_config;
72 const TString m_jetAlgo;
73 const TString m_calibAreaTag;
74 const bool m_dev;
75 mutable boost::thread_specific_ptr<TRandom3> m_rand_tls; // thread-specific random number generator
76
77 // Class variables read in from the config file
82 std::unique_ptr<TH1> m_smearResolutionMC;
83 std::unique_ptr<TH1> m_smearResolutionData;
84
85 // Variables to cache projections in case of 1-D interpolaton in 2-D or 3-D histograms
86 std::vector< std::unique_ptr<TH1> > m_cachedProjResMC;
87 std::vector< std::unique_ptr<TH1> > m_cachedProjResData;
88};
89
90
91#endif
92
#define y
#define x
JetCalibrationStep(const char *name="JetCalibrationStep")
StatusCode getSigmaSmear(xAOD::Jet &jet, double &sigmaSmear) const
StatusCode readHisto(double &returnValue, const TH1 *histo, double x) const
boost::thread_specific_ptr< TRandom3 > m_rand_tls
StatusCode cacheProjections(TH1 *fullHistogram, std::vector< std::unique_ptr< TH1 > > &cacheLocation, const std::string &type)
std::vector< std::unique_ptr< TH1 > > m_cachedProjResData
virtual StatusCode initialize() override
StatusCode getNominalResolution(const xAOD::Jet &jet, const TH1 *histo, const std::vector< std::unique_ptr< TH1 > > &projections, double &resolution) const
std::unique_ptr< TH1 > m_smearResolutionMC
TRandom3 * getTLSRandomGen(unsigned long seed) const
virtual StatusCode getNominalResolutionMC(const xAOD::Jet &jet, double &resolution) const override
std::vector< std::unique_ptr< TH1 > > m_cachedProjResMC
virtual ~JetSmearingCorrection()
virtual StatusCode calibrate(xAOD::Jet &jet, JetEventInfo &) const override
virtual StatusCode getNominalResolutionData(const xAOD::Jet &jet, double &resolution) const override
std::unique_ptr< TH1 > m_smearResolutionData
Jet_v1 Jet
Definition of the current "jet version".