28 ATH_MSG_FATAL(
"No jet smearing type was specified. Aborting.");
29 return StatusCode::FAILURE;
45 ATH_MSG_FATAL(
"Unrecognized jet smearing type: " <<
m_smearType <<
"--> the available options are 'pt', 'mass' or 'FourVec'");
46 return StatusCode::FAILURE;
54 return StatusCode::SUCCESS;
61 random =
new TRandom3();
64 random->SetSeed(seed);
85 double resolutionMC = 0;
87 return StatusCode::FAILURE;
89 double resolutionData = 0;
91 return StatusCode::FAILURE;
96 if (resolutionMC < resolutionData)
97 sigmaSmear = sqrt(resolutionData*resolutionData - resolutionMC*resolutionMC);
101 return StatusCode::SUCCESS;
107 return StatusCode::SUCCESS;
113 return StatusCode::SUCCESS;
117 ATH_MSG_DEBUG(
"Applying smearing calibration step to jet collection.");
121 for(
const auto jet: jets){
124 jet->setJetP4(jetStartP4);
126 double sigmaSmear = 0;
128 return StatusCode::FAILURE;
131 unsigned long seed =
static_cast<unsigned long>(1.e5*fabs(
jet->phi()));
133 if(seed == 0) seed = 45583453;
139 double smearingFactor = -1;
140 while (smearingFactor < 0)
141 smearingFactor = rng->Gaus(1.,sigmaSmear);
161 ATH_MSG_ERROR(
"Cannot smear the jet, the smearing type was not set");
162 return StatusCode::FAILURE;
167 jet->setJetP4(calibP4);
170 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
Class JetContext Designed to read AOD information related to the event, N vertices,...
ToolHandle< JetHelper::IVarTool > m_histToolMC
virtual StatusCode getNominalResolutionData(const xAOD::Jet &jet, const JetHelper::JetContext &jc, double &resolution) const override
SmearType m_smearTypeClass
TRandom3 * getTLSRandomGen(unsigned long seed) const
Gaudi::Property< std::string > m_jetOutScale
ToolHandle< JetHelper::IVarTool > m_histToolData
SmearingCalibStep(const std::string &name="SmearingCalibStep")
Gaudi::Property< std::string > m_smearType
virtual StatusCode calibrate(xAOD::JetContainer &) const override
Apply calibration to a jet container.
virtual StatusCode getNominalResolutionMC(const xAOD::Jet &jet, const JetHelper::JetContext &jc, double &resolution) const override
Gaudi::Property< std::string > m_jetInScale
boost::thread_specific_ptr< TRandom3 > m_rand_tls
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
StatusCode getSigmaSmear(xAOD::Jet &jet, const JetHelper::JetContext &jc, double &sigmaSmear) const
Jet_v1 Jet
Definition of the current "jet version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.