166 jetStartP4 =
jet.jetP4();
168 const double E_det = jetStartP4.e();
169 const double pT_det = jetStartP4.pt();
170 const double eta_det = jetStartP4.eta();
171 const double mass_det = jetStartP4.mass();
173 if ( E_det < mass_det ) {
174 ATH_MSG_WARNING(
"JetPileupCorrection::calibrateImpl : Current jet has mass=" << mass_det/
m_GeV <<
" GeV, which is greater than it's energy=" << E_det/
m_GeV <<
" GeV?? Aborting." );
175 return StatusCode::FAILURE;
180 const double rho = jetEventInfo.
rho();
184 int NPV = jetEventInfo.
NPV();
185 float mu = jetEventInfo.
mu();
187 double pt_calib=
m_residual3DCorr->correctedPt(pT_det, eta_det, jetareaP4.Pt(), rho, mu, NPV ) ;
188 double scaleF = pt_calib < 0 ? 0.01*
m_GeV/pT_det : pt_calib/pT_det;
190 jet.setAttribute<
int>(
"PileupCorrected",
true);
192 jet.setJetP4( calibP4 );
195 ATH_MSG_VERBOSE(
" Applying area-subtraction calibration to jet " <<
jet.index() <<
" with pT = " << 0.001*
jet.pt() <<
" GeV");
199 jet.setAttribute<
int>(
"PileupCorrected",
true);
202 jet.setJetP4( calibP4 );
205 ATH_MSG_VERBOSE(
" Applying residual pileup calibration to jet " <<
jet.index() <<
" with pT = " << 0.001*
jet.pt() <<
" GeV");
207 const double NPV = jetEventInfo.
NPV();
208 const double mu = jetEventInfo.
mu();
209 const int nJet = jetEventInfo.
nJet();
213 double pT_offset = pT_det;
214 double pileup_SF = 1;
221 pT_offset =
m_doJetArea ? pT_det - rho*jetareaP4.pt() - offsetET : pT_det - offsetET;
224 pileup_SF = pT_offset >= 0 ? pT_offset / pT_det : 0.01*
m_GeV/pT_det;
228 static std::atomic<unsigned int> originWarnings = 0;
230 calibP4 = jetOriginP4*pileup_SF;
232 if ( originWarnings < 20 ) {
236 calibP4 = jetStartP4*pileup_SF;
239 calibP4 = jetStartP4*pileup_SF;
245 pT_offset =
m_doJetArea ? pT_det - rho*jetareaP4.pt() - offsetET : pT_det - offsetET;
246 double muSF = pT_offset >= 0 ? pT_offset / pT_det : 0.01*
m_GeV/pT_det;
251 static std::atomic<unsigned int> originWarnings = 0;
253 calibP4 = jetOriginP4*muSF;
255 if ( originWarnings < 20 ) {
259 calibP4 = jetStartP4*muSF;
262 calibP4 = jetStartP4*muSF;
267 double pT_afterMuCalib = calibP4.pt();
268 pT_offset = pT_afterMuCalib - offsetET;
269 double SF = pT_offset >= 0 ? pT_offset / pT_afterMuCalib : 0.01*
m_GeV/pT_afterMuCalib;
270 calibP4 = calibP4*SF;
277 jet.setAttribute<
int>(
"PileupCorrected",
true);
281 jet.setJetP4( calibP4 );
284 ATH_MSG_VERBOSE(
" Applying postive-only area-subtraction calibration to jet " <<
jet.index() <<
" with pT = " << 0.001*
jet.pt() <<
" GeV");
286 const double area_SF = (pT_det-rho*jetareaP4.pt()<=0 || E_det-rho*jetareaP4.e()<=0) ? 10/pT_det : (pT_det-rho*jetareaP4.pt())/pT_det;
290 static std::atomic<unsigned int> originWarnings = 0;
292 calibP4 = jetOriginP4*area_SF;
294 if ( originWarnings < 20 ) {
298 calibP4 = jetStartP4*area_SF;
300 }
else calibP4 = jetStartP4*area_SF;
305 jet.setAttribute<
int>(
"PileupCorrected",
true);
309 jet.setJetP4( calibP4 );
313 return StatusCode::SUCCESS;