160 {
163
166 jetStartP4 = jet.
jetP4();
167
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();
172
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;
176 }
177
180 const double rho = jetEventInfo.
rho();
182
184 int NPV = jetEventInfo.
NPV();
185 float mu = jetEventInfo.
mu();
186
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;
193
195 ATH_MSG_VERBOSE(
" Applying area-subtraction calibration to jet " << jet.
index() <<
" with pT = " << 0.001*jet.
pt() <<
" GeV");
196
198
200
203
205 ATH_MSG_VERBOSE(
" Applying residual pileup calibration to jet " << jet.
index() <<
" with pT = " << 0.001*jet.
pt() <<
" GeV");
206
207 const double NPV = jetEventInfo.
NPV();
208 const double mu = jetEventInfo.
mu();
209 const int nJet = jetEventInfo.
nJet();
210
211
212 double offsetET = 0;
213 double pT_offset = pT_det;
214 double pileup_SF = 1;
215
219
220
221 pT_offset =
m_doJetArea ? pT_det -
rho*jetareaP4.pt() - offsetET : pT_det - offsetET;
222
223
224 pileup_SF = pT_offset >= 0 ? pT_offset / pT_det : 0.01*
m_GeV/pT_det;
225
228 static std::atomic<unsigned int> originWarnings = 0;
230 calibP4 = jetOriginP4*pileup_SF;
231 else {
232 if ( originWarnings < 20 ) {
234 ++originWarnings;
235 }
236 calibP4 = jetStartP4*pileup_SF;
237 }
238 } else {
239 calibP4 = jetStartP4*pileup_SF;
240 }
241 } else {
242
243
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;
247
248
251 static std::atomic<unsigned int> originWarnings = 0;
253 calibP4 = jetOriginP4*muSF;
254 else {
255 if ( originWarnings < 20 ) {
257 ++originWarnings;
258 }
259 calibP4 = jetStartP4*muSF;
260 }
261 } else {
262 calibP4 = jetStartP4*muSF;
263 }
264
265
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;
271
272 }
273
274
276
278
279
282
283 } else {
284 ATH_MSG_VERBOSE(
" Applying postive-only area-subtraction calibration to jet " << jet.
index() <<
" with pT = " << 0.001*jet.
pt() <<
" GeV");
285
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;
293 else {
294 if ( originWarnings < 20 ) {
296 ++originWarnings;
297 }
298 calibP4 = jetStartP4*area_SF;
299 }
300 } else calibP4 = jetStartP4*area_SF;
301
302
304
306
307
310 }
311
313 return StatusCode::SUCCESS;
314}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
virtual StatusCode setStartP4(xAOD::Jet &jet) const
std::unique_ptr< PUCorrection::PU3DCorrectionHelper > m_residual3DCorr
bool m_doSequentialResidual
size_t index() const
Return the index of this element within its container.
void setAttribute(const std::string &name, const T &v)
void setJetP4(const JetFourMom_t &p4)
virtual double pt() const
The transverse momentum ( ) of the particle.
bool getAttribute(AttributeID type, T &value) const
Retrieve attribute moment by enum.
JetFourMom_t jetP4() const
The full 4-momentum of the particle : internal jet type.
const float SF[NF]
Cross sections for Fluor.
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.