32 for(
const auto&
year: MCP::dataYearList)
52 return StatusCode::FAILURE;
55 if (
registry.registerSystematics(*
this) != StatusCode::SUCCESS)
58 return StatusCode::FAILURE;
61 return StatusCode::SUCCESS;
71 double corrIDpT =
mu.ID.calib_pt;
74 double corrMEpT =
mu.ME.calib_pt;
77 double corrDirectCBpT =
mu.CB.calib_pt;
89 double central(45.2),
width(15.5);
95 double sigmaID =
mu.expectedResID;
96 double sigmaME =
mu.expectedResME;
97 double denominator =
mu.CB.calib_pt * std::sqrt(sigmaID * sigmaID + sigmaME * sigmaME);
102 central += std::abs(0.5 *
res * central);
105 central -= std::abs(0.5 *
res * central);
112 double sigmas =
std::max(1.,(std::abs(
mu.CB.calib_pt - central) /
width));
119 double corrCBpT =
rho * corrDirectCBpT + (1 -
rho) * corrStatCombCBpT;
121 ATH_MSG_DEBUG(
"Saggita correction - corrDirectCBpT: " << corrDirectCBpT <<
" corrStatCombCBpT: " << corrStatCombCBpT <<
" rho " <<
rho<<
" corrCBPt: "<<corrCBpT);
124 mu.ID.calib_pt = corrIDpT;
125 mu.ME.calib_pt = corrMEpT;
127 else mu.CB.calib_pt = corrStatCombCBpT;
138 double originalPt =
pt;
141 ATH_MSG_DEBUG(
"CorrectForCharge - in pT: " << originalPt <<
" corrPt: " <<
pt <<
" applied saggita: " << corr);
150 double eta = trk.
eta;
170 std::vector<double> corrections;
179 corrections.push_back(corr);
191 ATH_MSG_ERROR(
"Sagitta correction is not applied to data, yet Eta dependant systematics are requested. This configuration is not supported");
206 corrections.push_back(corr);
218 corrections.push_back(corr);
228 if(
m_release.value().find(
"Recs2023") != std::string::npos) deltas = 1.2 * deltas;
229 else if(std::abs(eta)>1.05) deltas = 1.5 * deltas;
231 double corr = deltas *
scale;
234 corrections.push_back(corr);
248 double deltas = 0.00002;
249 if (eta > 2 || (eta > -2 && eta < -1.05)) {
251 corr += std::abs(450.0 - 45) / 100 * deltas;
253 corr += std::abs(
pT - 45) / 100 * deltas;
255 if (eta < -2 || (eta < 2 && eta> 1.5)) {
257 corr += std::abs(450.0 - 45) / 200 * deltas;
259 corr += std::abs(
pT - 45) / 200 * deltas;
262 if (
m_release.value().find(
"Recs2023") != std::string::npos) {
264 if (eta < 0 && eta> -0.5) corr += 2.1*deltas;
265 else if (eta < -1.05) corr += 1.1*deltas;
266 else if (eta > 0.5 ) corr += 0.8*deltas;
270 if (eta > -2 && eta < -1.05) corr = corr*2.5;
271 if (eta < -2) corr = corr*6;
272 if (eta > 1.5 && eta < 2) {
274 corr += std::abs(450.0 - 45) / 80 * deltas;
276 corr += std::abs(
pT - 45) / 80 * deltas;
278 if (eta > 1.05 && eta < 1.5) {
280 corr += std::abs(450.0 - 45) / 40 * deltas;
282 corr += std::abs(
pT - 45) / 40 * deltas;
289 corrections.push_back(corr*
scale);
300 corr *= (0.5 *
scale);
302 corrections.push_back(corr);
325 if(
mu.ID.calib_pt == 0)
return CBpT;
326 if(
mu.ME.calib_pt == 0)
return CBpT;
327 if(corrIDpT == 0)
return CBpT;
328 if(corrMEpT == 0)
return CBpT;
330 double chi2Nom = -999;
343 using TLV = ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<double>>;
344 TLV tlv{
mu.ID.calib_pt,
mu.ID.eta,
mu.ID.phi,
mu.ID.mass};
346 if(tlv.P() == 0) parsID[4] = 1e12;
347 else parsID[4] = 1.0 / (tlv.P() * 1
e3);
349 tlv.SetCoordinates(
mu.ME.calib_pt,
mu.ME.eta,
mu.ME.phi,
mu.ME.mass);
351 if(tlv.P() == 0) parsMS[4] = 1e12;
352 else parsMS[4] = 1.0 / (tlv.P() * 1
e3);
360 tlv.SetCoordinates(corrIDpT,
mu.ID.eta,
mu.ID.phi,
mu.ID.mass);
362 if(tlv.P() == 0) parsID[4] = 1e12;
363 else parsID[4] = 1.0 / (tlv.P() * 1
e3);
365 tlv.SetCoordinates(corrMEpT,
mu.ME.eta,
mu.ME.phi,
mu.ME.mass);
367 if(tlv.P() == 0) parsMS[4] = 1e12;
368 else parsMS[4] = 1.0 / (tlv.P() * 1
e3);
370 SysCorrCode =
applyStatCombination(parsID, covID, parsMS, covMS,
mu.CB.calib_charge, parsCBCorr, covCBCorr, chi2Nom);
374 double statCombPtNom =
std::sin(parsCBNom[3]) / std::abs(parsCBNom[4]);
375 double statCombPtCorr =
std::sin(parsCBCorr[3]) / std::abs(parsCBCorr[4]);
376 double corrCBpT = CBpT * (statCombPtCorr / statCombPtNom);
385 parsID[4] = std::abs(parsID[4]);
386 parsMS[4] = std::abs(parsMS[4]);
390 if (!matID.isInvertible()) {
398 if (!matMS.isInvertible()) {
405 Eigen::FullPivLU<
AmgSymMatrix(5)> matCB(weightID + weightMS);
406 if (!matCB.isInvertible()) {
410 covCB = matCB.inverse();
413 Eigen::FullPivLU<
AmgSymMatrix(5)> matSum(covID + covMS);
414 if (!matSum.isInvertible()) {
422 chi2 = diffPars.transpose() * invCovSum * diffPars;
425 parsCB = covCB * (weightID * parsID + weightMS * parsMS);
428 if (parsCB[2] >
M_PI)
429 parsCB[2] -= 2. *
M_PI;
430 else if (parsCB[2] < -
M_PI)
431 parsCB[2] += 2. *
M_PI;
440 return sys.find(systematic) !=
sys.end();
497 else if (!syst.
empty())
return StatusCode::FAILURE;
504 else if (!syst.
empty())
return StatusCode::FAILURE;
511 else if (!syst.
empty())
return StatusCode::FAILURE;
518 else if (!syst.
empty())
return StatusCode::FAILURE;
533 else if (!syst.
empty())
return StatusCode::FAILURE;
548 else if (!syst.
empty())
return StatusCode::FAILURE;
555 else if (!syst.
empty())
return StatusCode::FAILURE;
565 return StatusCode::SUCCESS;