27 ATH_MSG_FATAL(
"No jet smearing type was specified. Aborting.");
28 return StatusCode::FAILURE;
44 ATH_MSG_FATAL(
"Unrecognized jet smearing type: " <<
m_smearType <<
"--> the available options are 'pt', 'mass' or 'FourVec'");
45 return StatusCode::FAILURE;
53 return StatusCode::SUCCESS;
60 random =
new TRandom3();
63 random->SetSeed(seed);
84 double resolutionMC = 0;
86 return StatusCode::FAILURE;
88 double resolutionData = 0;
90 return StatusCode::FAILURE;
95 if (resolutionMC < resolutionData)
96 sigmaSmear = sqrt(resolutionData*resolutionData - resolutionMC*resolutionMC);
100 return StatusCode::SUCCESS;
106 return StatusCode::SUCCESS;
112 return StatusCode::SUCCESS;
116 ATH_MSG_DEBUG(
"Applying smearing calibration step to jet collection.");
120 for(
const auto jet: jets){
123 jet->setJetP4(jetStartP4);
125 double sigmaSmear = 0;
127 return StatusCode::FAILURE;
130 unsigned long seed =
static_cast<unsigned long>(1.e5*fabs(
jet->phi()));
132 if(seed == 0) seed = 45583453;
138 double smearingFactor = -1;
139 while (smearingFactor < 0)
140 smearingFactor = rng->Gaus(1.,sigmaSmear);
160 ATH_MSG_ERROR(
"Cannot smear the jet, the smearing type was not set");
161 return StatusCode::FAILURE;
166 jet->setJetP4(calibP4);
169 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.