ATLAS Offline Software
SmearingCalibStep.h
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // SmearingCalibStep.h
8 // Header file for class SmearingCalibStep
9 // Author: Ben Hodkinson <ben.hodkinson@cern.ch>
11 
12 #ifndef JETCALIBTOOLS_SMEARINGCALIBSTEP_H
13 #define JETCALIBTOOLS_SMEARINGCALIBSTEP_H
14 
15 #include "AsgTools/AsgTool.h"
16 #include "AsgTools/AsgToolMacros.h"
17 #include "AsgTools/ToolHandle.h"
19 
21 
25 
26 #include "TRandom3.h"
27 #include "boost/thread/tss.hpp"
28 
30  : public asg::AsgTool,
31  virtual public IJetCalibStep {
32 
34 
35  public:
36  SmearingCalibStep(const std::string& name = "SmearingCalibStep");
37 
38  virtual StatusCode initialize() override;
39  virtual StatusCode calibrate(xAOD::JetContainer&) const override;
40 
41  virtual StatusCode getNominalResolutionData(const xAOD::Jet& jet, const JetHelper::JetContext& jc, double& resolution) const override;
42  virtual StatusCode getNominalResolutionMC(const xAOD::Jet& jet, const JetHelper::JetContext& jc, double& resolution) const override;
43 
44  private:
45  Gaudi::Property<std::string> m_jetStartScale {this, "JSCStartingScale", "JetGSCScaleMomentum", "Starting jet scale"};
46  Gaudi::Property<std::string> m_jetOutScale {this, "JSCOutScale", "JetSmearedMomentum", "Ending jet scale"};
47  Gaudi::Property<std::string> m_smearType {this, "SmearType", "", "How to smear: pt, eta or FourVec"};
48 
49  // TODO: Old smearing step had different interpolation options -> not added to JetToolHelpers yet?
50 
51  ToolHandle<JetHelper::IVarTool> m_histToolMC {this, "HistoReaderMC", "HistoInput2D", "Instance of HistoInput1D or HistoInput2D for reading histogram for MC"};
52  ToolHandle<JetHelper::IVarTool> m_histToolData {this, "HistoReaderData", "HistoInput2D", "Instance of HistoInput1D or HistoInput2D for reading histogram for data"};
53 
54  // Helper methods
55  StatusCode getSigmaSmear(xAOD::Jet& jet, const JetHelper::JetContext & jc, double& sigmaSmear) const;
57  TRandom3* getTLSRandomGen(unsigned long seed) const;
58 
59  // Private enums
60  enum class SmearType
61  {
62  UNKNOWN=0, // Unknown/unset/etc
63  Pt, // pT smearing (JpTR)
64  Mass, // Mass smearing (JMR)
65  FourVec // Four-vector smearing (JER)
66  };
68 
69  mutable boost::thread_specific_ptr<TRandom3> m_rand_tls; // thread-specific random number generator
70 };
71 
72 #endif
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
PropertyWrapper.h
SmearingCalibStep::SmearType::Mass
@ Mass
SmearingCalibStep::getSigmaSmear
StatusCode getSigmaSmear(xAOD::Jet &jet, const JetHelper::JetContext &jc, double &sigmaSmear) const
Definition: SmearingCalibStep.cxx:68
JetHelper::JetContext
Class JetContext Designed to read AOD information related to the event, N vertices,...
Definition: JetContext.h:24
SmearingCalibStep::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: SmearingCalibStep.cxx:19
SmearingCalibStep::getNominalResolutionMC
virtual StatusCode getNominalResolutionMC(const xAOD::Jet &jet, const JetHelper::JetContext &jc, double &resolution) const override
Definition: SmearingCalibStep.cxx:110
SmearingCalibStep::SmearType::UNKNOWN
@ UNKNOWN
IVarTool.h
Dedxcorrection::resolution
double resolution[nGasTypes][nParametersResolution]
Definition: TRT_ToT_Corrections.h:46
IJetCalibStep.h
SmearingCalibStep::m_histToolData
ToolHandle< JetHelper::IVarTool > m_histToolData
Definition: SmearingCalibStep.h:52
SmearingCalibStep::m_smearTypeClass
SmearType m_smearTypeClass
Definition: SmearingCalibStep.h:67
SmearingCalibStep::m_jetStartScale
Gaudi::Property< std::string > m_jetStartScale
Definition: SmearingCalibStep.h:45
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
SmearingCalibStep::getNominalResolutionData
virtual StatusCode getNominalResolutionData(const xAOD::Jet &jet, const JetHelper::JetContext &jc, double &resolution) const override
Definition: SmearingCalibStep.cxx:104
SmearingCalibStep::SmearType::Pt
@ Pt
SmearingCalibStep::m_rand_tls
boost::thread_specific_ptr< TRandom3 > m_rand_tls
Definition: SmearingCalibStep.h:69
SmearingCalibStep::getTLSRandomGen
TRandom3 * getTLSRandomGen(unsigned long seed) const
Definition: SmearingCalibStep.cxx:57
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
SmearingCalibStep
Definition: SmearingCalibStep.h:31
IJetCalibTool.h
SmearingCalibStep::m_histToolMC
ToolHandle< JetHelper::IVarTool > m_histToolMC
Definition: SmearingCalibStep.h:51
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
SmearingCalibStep::calibrate
virtual StatusCode calibrate(xAOD::JetContainer &) const override
Apply calibration to a jet container.
Definition: SmearingCalibStep.cxx:116
SmearingCalibStep::getNominalResolution
StatusCode getNominalResolution(const xAOD::Jet &jet, JetHelper::JetContext jc, double &resolution) const
EventInfo.h
IJetCalibStep
Definition: IJetCalibStep.h:27
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
ASG_TOOL_CLASS
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Definition: AsgToolMacros.h:68
SmearingCalibStep::SmearType::FourVec
@ FourVec
AsgToolMacros.h
SmearingCalibStep::m_smearType
Gaudi::Property< std::string > m_smearType
Definition: SmearingCalibStep.h:47
ToolHandle.h
AsgTool.h
SmearingCalibStep::m_jetOutScale
Gaudi::Property< std::string > m_jetOutScale
Definition: SmearingCalibStep.h:46
SmearingCalibStep::SmearingCalibStep
SmearingCalibStep(const std::string &name="SmearingCalibStep")
Definition: SmearingCalibStep.cxx:15
SmearingCalibStep::SmearType
SmearType
Definition: SmearingCalibStep.h:61